Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin

Overview

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 {
        jcenter()
    }
    
    dependencies {
        compile 'org.sufficientlysecure:donations:2.6'
    }
    
  2. Instantiate the fragment where you want to use it. Check out the example app for this: DonationsActivity.java
  3. Don't forget to pass through results in onActivityResult() back to the fragment as shown in DonationsActivity.java.
  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 BuildConfig.java.
  2. Add <uses-permission android:name="android.permission.INTERNET" /> to product flavors that use Flattr
  3. Add <uses-permission android:name="com.android.vending.BILLING" /> to product flavors that use Google Play In-app billing

Screenshots

Product Flavor: Google Product Flavor: Fdroid
Screenshot Screenshot

Translations

Help translating on Transifex.

Build Example App with Gradle

  1. Have Android SDK "tools", "platform-tools", and "build-tools" directories in your PATH (http://developer.android.com/sdk/index.html)
  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

Changelog

2.6

  • Force Intent chooser for PayPal
  • Min SDK 14

2.5

  • Sync translations

2.4

  • Fix NPE without billing service

2.3

  • Publish to JCenter

2.2

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

2.1

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

2.0

  • Now uses Gradle Build System (http://tools.android.com/tech-docs/new-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!)

Contribute

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

Comments
  • IAB helper not set up exception

    IAB helper not set up exception

    Occasionally I get the following exception while using the library:

    java.lang.IllegalStateException: IAB helper is not set up. Can't perform operation: launchPurchaseFlow at org.sufficientlysecure.donations.google.util.IabHelper.checkSetupDone(IabHelper.java:781) at org.sufficientlysecure.donations.google.util.IabHelper.launchPurchaseFlow(IabHelper.java:371) at org.sufficientlysecure.donations.DonationsFragment.donateGoogleOnClick(DonationsFragment.java:345) at org.sufficientlysecure.donations.DonationsFragment$1.onClick(DonationsFragment.java:218) at android.view.View.performClick(View.java:4439) at android.widget.Button.performClick(Button.java:148) at android.view.View$PerformClick.run(View.java:18395) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5319) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method)

    opened by aeroperf 7
  • Link error when using PayPal app

    Link error when using PayPal app

    Hi, it seems that with the PayPal official app installed, when prompted to choose a "browser", if you click on it, the PayPal app redirects anyway to the browser but the page gets a 404 error. Instead, if you choose a browser in the app chooser, the link works and one can log in and make the donation.

    bug 
    opened by dentex 6
  • Add support for bitcoin

    Add support for bitcoin

    This seems like a good addition to the donations lib. If you think so too, feel free to test and add it (I added it to a different project myself, but may have accidentally forgot to copy some part).

    opened by oleg-codaio 4
  • unmanaged vs managed in-app product

    unmanaged vs managed in-app product

    Hi,

    the readme of this library states that one should create unmanaged products in the developer console. However, i read that since billing v3 only managed products are available? Is this a bug in the readme or am i missing something?

    thanks matthias

    opened by mx1up 3
  • Update donations__thanks_dialog as per @xicciodj

    Update donations__thanks_dialog as per @xicciodj

    Sorry for not following translation project but transifex link seems to be down.

    Related: https://github.com/Mygod/VPNHotspot/pull/137#pullrequestreview-336562467 https://github.com/Mygod/VPNHotspot/pull/137/commits/10e88ffc40a2ef226b40f6ab2744c3dcdf8812e9

    opened by Mygod 2
  • IABHelper not setup

    IABHelper not setup

    Recently I commented in the issue #15 because this error is happening again.

    I managed to solve it by doing this trick, but the latest version of the lib was not managing it: (as the code is a bit longer, I will add a PasteBin for better visualization):

    --> https://pastebin.com/Wda6FwPz

    opened by Javinator9889 2
  • Attempt to read from field 'java.lang.String org.sufficientlysecure.donations.google.util.Purchase.mItemType' on a null object reference

    Attempt to read from field 'java.lang.String org.sufficientlysecure.donations.google.util.Purchase.mItemType' on a null object reference

    Fatal Exception: java.lang.NullPointerException Attempt to read from field 'java.lang.String org.sufficientlysecure.donations.google.util.Purchase.mItemType' on a null object reference raw org.sufficientlysecure.donations.google.util.IabHelper.consume (IabHelper.java) org.sufficientlysecure.donations.google.util.IabHelper$3.run (IabHelper.java) java.lang.Thread.run (Thread.java:818)

    opened by conzorz 2
  • libnl-3-android issues

    libnl-3-android issues

    @dschuermann Sorry to post msg at this project, It is because the libnl-3-android project(https://github.com/dschuermann/libnl-3-android) do not have issues module.

    I have a project https://github.com/imlinhao/android-iw-libnl3/issues/1 that depends on the libnl-3-android project, but because of the version update of ubuntu and android ndk, there be some problems of the project.

    I want to know whether you have some blogs of how to porting libnl to android, or maybe update the libnl-3-android project using the newly libnl and newly compile tool like ubuntu 14.04 and android ndk 10c.

    Thank you very much, and you can contact me at [email protected].

    opened by imlinhao 2
  • is paypal donation still functionable?

    is paypal donation still functionable?

    Hi,

    I downloaded the App FasterGPS and have a look on donation page. However, there is not more paypal donation, only google play? I wonder why. thanks!

    opened by evolapp 2
  • Make donations__google_android_market_promt_array configurable

    Make donations__google_android_market_promt_array configurable

    donations__google_android_market_promt_array should be configurable as donations__google_catalog so it should not be the donations__google_android_market_promt_array in lib resources but a string-array name d donations__google_catalog_labels in donations__config.xml then:

            // choose donation amount
            mGoogleSpinner = (Spinner) getActivity().findViewById(
                    R.id.donations__google_android_market_spinner);
            int nameResourceID = getActivity().getResources().getIdentifier("donations__google_catalog_labels", "array",
                getActivity().getApplicationInfo().packageName);
    
            ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),
                nameResourceID,
                    android.R.layout.simple_spinner_item);
    
    opened by anegrin 2
  • Can we use this library and upload the app to playstore?

    Can we use this library and upload the app to playstore?

    Hi, I just want to make sure before I used this library for donation purpose inside my app since I've read reddit and stackoverflow threads talking about their app got rejected/banned because having donation button which not used google IAP. Thanks

    opened by muhrahmatullah 1
  • Not supported by Google anymore

    Not supported by Google anymore

    I've just tried to release a new version of my app, but Google changed something that requires a new billing API since the first of November 2021: https://android-developers.googleblog.com/2020/06/meet-google-play-billing-library.html

    Can you update your library to support this new billing api?

    opened by TheNetStriker 0
  • Paypal fix or way around

    Paypal fix or way around

    I used to have a paypal option in my apps, reading the google support information they say that web cannot open a Paypal link a WebBrowser requesting for donations because can be used for tricking user to donate an amount they don't agree with. So, after some days trying I figured a way around.

    Easy instead of launching Paypal Fragment to manage Paypal just command your app to open the phone default WebBrowser in your paypal.me link. I'll leave an example below.

    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://paypal.me/juanjshb"));
    startActivity(browserIntent);
    

    Hope it help. It works for me

    opened by juanjhb1894 0
  • String resource donations__description not breaking correctly

    String resource donations__description not breaking correctly

    In some languages the string resource donations__description doesn't break correctly caused by backslash escape of the "\n" control character. Example: image

    opened by soenkegissel 0
  • Illegal state exception

    Illegal state exception

    First crash log : java.lang.IllegalStateException: at android.support.v4.app.Fragment.requireContext (Fragment.java:611) at android.support.v4.app.Fragment.getResources (Fragment.java:675) at android.support.v4.app.Fragment.getString (Fragment.java:697) at org.sufficientlysecure.donations.DonationsFragment$2.onIabSetupFinished (DonationsFragment.java:243) at org.sufficientlysecure.donations.google.util.IabHelper$1.onServiceConnected (IabHelper.java:230) at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:1101) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1118) at android.os.Handler.handleCallback (Handler.java:733) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:136) at android.app.ActivityThread.main (ActivityThread.java:5590) at java.lang.reflect.Method.invokeNative (Native Method) at java.lang.reflect.Method.invoke (Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1280) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1096) at dalvik.system.NativeStart.main (Native Method)

    Second crash log :

    java.lang.IllegalStateException: at org.sufficientlysecure.donations.google.util.IabHelper.checkSetupDone (IabHelper.java:784) at org.sufficientlysecure.donations.google.util.IabHelper.launchPurchaseFlow (IabHelper.java:374) at org.sufficientlysecure.donations.DonationsFragment.donateGoogleOnClick (DonationsFragment.java:332) at org.sufficientlysecure.donations.DonationsFragment$1.onClick (DonationsFragment.java:220) at android.view.View.performClick (View.java:4508) at android.view.View$PerformClick.run (View.java:18675) at android.os.Handler.handleCallback (Handler.java:733) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:136) at android.app.ActivityThread.main (ActivityThread.java:5590) at java.lang.reflect.Method.invokeNative (Native Method) at java.lang.reflect.Method.invoke (Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1280) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1096) at dalvik.system.NativeStart.main (Native Method)

    opened by darkmat13r 3
  • Strip the exclamation mark from buttons

    Strip the exclamation mark from buttons

    For politeness the exclamation mark should be removed from the button in all translations. No one want's to be talked to in imperative. "DONATE!" they will not.

    opened by soenkegissel 0
Owner
Sufficiently Secure
Strengthening your freedom on Android
Sufficiently Secure
Accept PayPal and credit cards in your Android app

Important: PayPal Mobile SDKs are Deprecated. The APIs powering them will remain operational long enough for merchants to migrate, but the SDKs themse

PayPal 802 Dec 22, 2022
One merchant integration point for all of PayPal's services

android-sdk [WIP] One merchant integration point for all of PayPal's services Static Analysis Tools Detekt This project uses Detekt for Kotlin code an

PayPal 23 Dec 20, 2022
Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum.

ReactiveLocation library for Android Small library that wraps Google Play Services API in brilliant RxJava Observables reducing boilerplate to minimum

MichaƂ Charmas 2.1k Dec 4, 2022
A clustering library for the Google Maps Android API v2

DEPRECATED Don't use this. The Maps v3 SDK handles markers. That with a few other cool utilities make this library obsolete! Clusterkraf A clustering

Ticketmaster Mobile Studio 258 Nov 28, 2022
Its measurement app made using kotlin with sceneform sdk by google

ARCORE MEASUREMENT This app is build using sceneform sdk for android using kotlin language It helps you measure the distance between multiple points i

Kashif Mehmood 39 Dec 9, 2022
Android Weather Library: android weather lib to develop weather based app fast and easily

WeatherLib Android weather lib is an android weather aggregator. The lib helps you getting weather data from the most importat weather provider. It su

Surviving with android (by Francesco Azzola) 641 Dec 23, 2022
Library for Android In-App Billing (Version 3+)

Checkout (Android In-App Billing Library) Description Checkout is an implementation of Android In-App Billing API (v3+). Its main goal is to make inte

Sergey Solovyev 1k Nov 26, 2022
Android library project for providing multiple image selection from the device.

PolyPicker Android library project for selecting/capturing multiple images from the device. Result Caution! Eclipse library project structure has been

JW 407 Dec 27, 2022
Android library that provides for multiple image selection.

#MultipleImageSelect An android library that allows selection of multiple images from gallery. It shows an initial album (buckets) chooser and then im

Darshan Dorai 299 Nov 14, 2022
this is the demo of billing new library v3

Billing library v3 demo android This is the demo of billing new library v3 for android native IMPORTANT 1- you must have login to google play store to

Muhammad Sikandar 3 Dec 6, 2021
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

LandscapeVideoCamera Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to

Jeroen Mols 1.2k Dec 29, 2022
SocialAuth repository which contains socialauth android version and samples

SocialAuth Android is an Android version of popular SocialAuth Java library. Now you do not need to integrate multiple SDKs if you want to integrate y

3Pillar Global Open Source 318 Dec 30, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

LandscapeVideoCamera Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to

Jeroen Mols 1.2k Nov 22, 2022
A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK

Vision Sample (Android) A sample project of implementing Liveness Detection and Identity OCR on Android app using Kredibel Vision SDK. You can checkou

null 10 Nov 27, 2022
Offerwall for Android games and apps monetization.

Monlix Android SDK Monlix offerwall for Android Integration In the top level build.gradle file, add the following For Gradle < 7 allprojects { repo

Monlix 2 Jun 11, 2022
Qiscus provide everything you need to power up your app with chats. And it's now made simple.

Introduction Qiscus Chat SDK (Software Development Kit) is a product provided by Qiscus that enables you to embed an in-app chat/chat feature in your

Qiscus - Multichannel Conversational Platform 197 Dec 27, 2022
This SDK can be used to identify a user via passport or ID Card prove identity of user via Biometry comparing selfie and photo from chip of ID Doc

Verdi Mobile SDK This SDK can be used to identify a user via passport or Id Card. In this repository, you can find the library itself and the Sample a

null 5 Jan 3, 2022