In the Google Play doc, it is written "To verify a purchase, the app passes the purchase token and other details up to your backend servers, which verifies them directly with Google Play using the Google Play Developer API."
My question is : do I really need my own server to implement InApp subscriptions in my Android app ?
Is there a way to implement subscriptions without my own server ? (using only the Google Play Inapp Billing API directly from my app)
Thanks !
We always strive to work with our developer community to help keep their apps on Play while they make any needed changes. In 2020, we clarified the language of our Payments policy to make it more clear that all apps must use Play's billing system for the purchase of in-app digital goods and services.
In-app Billing is a Google Play service that provides checkout processing for in-app purchases. To use the service, your application sends a billing request for a specific in-app product.
On an Android device: Open the Google Play app. At the top right, tap the profile icon. Tap Payments & subscriptions Subscriptions.
Supported in versions 4.0 and higher of the Google Play Billing Library, Google Play allows customers to purchase more than one of the same in-app product in one transaction by specifying a quantity from the purchase cart. Your app is expected to handle multi-quantity purchases and grant entitlement based on the specified purchase quantity.
The first step to integrate with Google Play's billing system is to add the library to your app and initialize a connection. Note: If you've followed the Getting ready guide, then you've already added the necessary dependencies and can move on to the next section.
Note: Acknowledgement is not required when using a version of the Google Play Billing Library prior to 2.0. The process to grant entitlement and acknowledge the purchase depends on whether the purchase is a non-consumable, a consumable, or a subscription.
Answer to my own question : NO NEED to have its own server to implement inapp subscriptions. An own server simply allows to add a level of security but I don't really care about security in my specific case (no problem if 1% of people bypass the inapp process).
An own server allows to perform some additional level of checking with the 'boolean verifyDeveloperPayload(Purchase p)' method. Simply return 'true' in all cases as it is set by default in the Google example.
To implemeent subscriptions simply call :
mHelper.launchSubscriptionPurchaseFlow(this, SKU_PREMIUM, RC_REQUEST, mPurchaseFinishedListener);
instead of :
mHelper.launchPurchaseFlow(this, SKU_PREMIUM, RC_REQUEST, mPurchaseFinishedListener, payload);
Crete a subscription item in the dev console.
And that is it !
EDIT SEPTEMBER 2020: I don't know is it is still true with the V3 of the API... Indeed, the doc mentions that the app must manage the account 'hold status' but I don't know if a server and using RTDN/PubSub is now required.
EDIT OCTOBER 2020:
Confirmed that no server is required even with API V3. See here
Few years later...
Google is still highly recommending using a back-end server for billing.
But they acknowledged that many developers needed a serverless solution and they created this issue.
After a few months they offered a sample of a Serverless Android app here.
There is a Java version for Java fans too in the same repo here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With