Am I doing these steps correctly to verify a subscription to a user’s subscription in an application?

I am making an Android app that sells a monthly subscription in the app. Before diving into it too much, can you say how it should be done correctly? I am using the Android developer API for Google Play.

When you first start the application, send the following to sendBillingRequest ():

  • CHECK_BILLING_SUPPORTED. If not, don't worry about creating a buy user interface.
  • RESTORE_TRANSACTIONS. If there were transactions, save the user's purchase token.

When a user makes a purchase:

  • Save the purchase token.
  • Submit a GET request using the purchase token in the Google Play Developer API to verify your subscription.
    • If the subscription is valid, save the expiration date of the subscription and the initiation date. Provide access to acquired data.
    • If the subscription is not valid, delete the purchase token. Do not provide access to acquired data and draw a “not acquired” version of the user interface.

Every time the application launches, check if you have a saved purchase token.

If the purchase token does not exist:

  • Do not provide access to acquired data and draw a "not acquired" version of the user interface.

If a purchase token exists, check the expiration date and initiation time:

  • If (expired) or (initiation was more than a month ago)
    • Send a GET request using the purchase token in the Google Play Developer API to confirm your subscription.
    • If the purchase is valid, update the saved expiration dates and initiation dates. Provide access to acquired data.
    • If the purchase is not valid, delete the saved purchase token and expiration and initiation data. Do not grant access or draw a “not purchased” version of the user interface.
  • Else
    • Provide access to acquired data.
+7
source share
1 answer

Yes I.

I successfully completed billing in the application this way.

+2
source

All Articles