Free apps are great for the users; they get more downloads etc. If a customer really likes your app, he or she might even pay for it, but if it's neither a free, nor a trial app and if there are no additional features to purchase, there are no options to give you a financial suport.
But you can easily use in-app purchases to offer a 'donate' option to your customer.
This sample will show you how to take a ready-made UserControl to equip your apps with a 'donate' button.

Building the Sample

The sample contains the TCD.Commerce source code, containig the UserControl, as well as a sample application. Both projects have a dependency on the TCD.Controls NuGet package.
Please note that the control does not work in development properly, but only when it's actually released.
However, you can see how it works in my Charmap App.


In the TCD.Commerce library, I created a UserControl that can be used as a AppBar button. It automatically offers in-app products with 'donation' in ther ID to be bought by the user:
It also handles exceptions that can occur during the procedure. Those exceptions include default texts that are already definded in the DonationButton class, but can also be modified by setting the properties starting with STR_*.
Declaring the DonationButton in XAML is very easy:
<commerce:DonationButton x:Name="donationButton" STR_EmailReportDeveloperEmail="" STR_EmailReportSubject="[YOUR APP NAME] Error" DonationSpotted="DonationButton_DonationSpotted" />
With the XAML declaration above all you need to do in the C# code is to thank the user for the donation:
private void DonationButton_DonationSpotted(object sender, EventArgs e) 
            thanksBlock.Visibility = Visibility.Visible; 
Optionally you can customize all the texts that can occur...
IMPORTANT: Pay attention to the wording of the 'NoInternet' and 'NoStoreResponse' texts - if they look like an error too much, you might fail the certification because of requirement 3.2.
            donationButton.STR_ButtonLabel = LocalizedStrings.GetString("STR_ButtonLabel"); 
            donationButton.STR_CloseButton = LocalizedStrings.GetString("STR_CloseButton"); 
            donationButton.STR_EmailReportBody = LocalizedStrings.GetString("STR_EmailReportBody"); 
            donationButton.STR_EmailReportButton = LocalizedStrings.GetString("STR_EmailReportButton"); 
            donationButton.STR_NoInternetContent = LocalizedStrings.GetString("STR_NoInternetContent");
 When you submit your app to the store you will have to add in-app producs accordingly. For example:
Have fun =)  

Source Code Files

More Information

TCD.Commerce is available as a NuGet package too:
I also blegged about this: