Visit GitHub RepoPurchases

Android Donations Lib

Android Donations Lib supports donations by Google Play Store, Flattr, PayPal, and Bitcoin.

It is used in projects, such as OpenKeychain, AdAway, FasterGPS, and NTPSync.

NOTE: Google mailed me to remove PayPal donation capability when publishing on Google Play! Thus, you should build "product flavors" defined by the example: One version with Google Play donation capability and one with Paypal, Flattr, and Bitcoin!

How to use

  1. Add dependency to your build.gradle:
    repositories {
    dependencies {
        compile 'org.sufficientlysecure:donations:2.6'
  2. Instantiate the fragment where you want to use it. Check out the example app for this:
  3. Don't forget to pass through results in onActivityResult() back to the fragment as shown in
  4. When publishing the app you must create managed in-app products for your app in the Google Play Store that matches the ones you defined in private static final String[] GOOGLE_CATALOG

Build flavors

  1. Keep in mind that Google forbits other payment methods besides Google Play. Thus, in the example, two build flavors are used. Check out ExampleApp/build.gradle. The build script adds DONATIONS_GOOGLE to the auto generated
  2. Add <uses-permission android:name="android.permission.INTERNET" /> to product flavors that use Flattr
  3. Add <uses-permission android:name="" /> to product flavors that use Google Play In-app billing


Product Flavor: Google Product Flavor: Fdroid
Screenshot Screenshot


Help translating on Transifex.

Build Example App with Gradle

  1. Have Android SDK "tools", "platform-tools", and "build-tools" directories in your PATH (
  2. Export ANDROID_HOME pointing to your Android SDK
  3. Download Android Support Repository, and Google Repository using Android SDK Manager
  4. Execute ./gradlew build

Add the lib to your project



  • Force Intent chooser for PayPal
  • Min SDK 14


  • Sync translations


  • Fix NPE without billing service


  • Publish to JCenter


  • Updated build files
  • Added bitcoin support (thanks to Oleg Vaskevich)


  • Permissions are now defined per product flavor, they were removed from library's AndroidManifest


  • Now uses Gradle Build System (
  • No xml configuration needed anymore!
  • Fragment can be instantiated and used in any Activity.
  • You can build "product flavors" defined by the ExampleApp: One version with Google Play Donation capability and one with Paypal and Flattr! (Google mailed me to remove PayPal donation capability when publishing on Google Play!)


Fork Android Donations Lib and do a pull request. I will merge your changes back into the main project.

Join India's largest learning revolution
Free Video Tutorials
Learn Programming
Learning is a journey, let's learn together

MindOrks Newsletter
100,000+ Subscribers
A free weekly newsletter that comes with the latest Android articles, open source projects, events and hot discussions.

Subscribe Now

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer