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

2

29

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 !

Ignatia answered 2/6, 2015 at 17:28 Comment(4)
Short answer: yes, you need a backend server.Holden
Sorry but it seems that you are wrong. See my answer to my own question.Ignatia
I wouldn't say I'm wrong, since security is a big thing... Which apparently does not apply to youHolden
#16067680Juarez
I
30

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

Ignatia answered 4/6, 2015 at 6:52 Comment(2)
Thanks for the follow up on v3 API. I had a doubt in this approach, can we restore purchases by not using a backend? Say when user installs the same app but on another device?Precocity
@Precocity Yes, purchases can be restored without backend.Ignatia
B
8

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.

Bloodshed answered 29/5, 2021 at 10:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.