Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android/Google Play: do I really need my OWN server to manage inapp billing subscriptions?

Tags:

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 !

like image 296
Regis_AG Avatar asked Jun 02 '15 17:06

Regis_AG


People also ask

Is Google Play billing mandatory?

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.

What is Inapp billing?

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.

How do I add a subscription to my Google Play account?

On an Android device: Open the Google Play app. At the top right, tap the profile icon. Tap Payments & subscriptions Subscriptions.

How does Google Play billing library support multi-quantity purchases?

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.

How do I integrate with Google Play billing system?

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.

Is acknowledgement required when using Google Play billing library?

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.


2 Answers

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

like image 177
Regis_AG Avatar answered Nov 19 '22 07:11

Regis_AG


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.

like image 27
walox Avatar answered Nov 19 '22 08:11

walox