2

I have an android app that has subscriptions, the problem is user can directly re subscribe to expired subscription from the play store instead of the app. so i can't have the user details in the backend when this happens. also tried disabling the re subscribe option but that re subscribe button is still appear on the play store. Anyone know how to handle this scenario?

Praveen Kumar
  • 67
  • 1
  • 5
  • in Google Cloud Console, there has an option to give API end point, when user subscribe or resubscribe to the plan, then Google play store sends the response to that end point – DeePanShu Sep 23 '21 at 06:27
  • Thanks for replying, yes, i created pub/sub topic to get the response from the play store when user subscribe, cancel, re-subscribe, all are working fine and am getting response, the but after a particular subscription got expired it is nowhere linked to that user, so when he re-subscribed i still got the response from the play store but with new order id and purchase token, so am not able to identify which user made the purchase by comparing with database users list. is there any to identify the user who made re-subscribe to expired subscription. – Praveen Kumar Sep 23 '21 at 06:42
  • can there is not details of emailAddress or profileId?? – DeePanShu Sep 23 '21 at 06:51
  • Sorry for late reply, this is the response i got from the subscription message, {"version":"1.0","packageName":"xyz","subscriptionNotification":{"notificationType":4,"purchaseToken":"cmnl.AO-J1OwFZMBPMjtuGqxq_PSBugL_fnmMNzNkOPKKSXhArQXxVwKQYnVb-c7ke9RCddXr2KJSpJsceWefFapaXjNnVpZpI9T0aOHy1kXsNU-xxCv4Y","subscriptionId":"product3","version":"1.0"},"eventTimeMillis":"1632316080676"} and i pass the purchase token to GoogleReceiptVerify() – Praveen Kumar Sep 23 '21 at 09:23
  • where is the response?? – DeePanShu Sep 23 '21 at 09:26
  • in response i got {"payload":{"purchaseType":0,"paymentState":1,"priceAmountMicros":"1300000000","countryCode":"IN","kind":"androidpublisher#subscriptionPurchase","priceCurrencyCode":"JPY","developerPayload":"","expiryTimeMillis":"1632316497150","autoRenewing":true,"startTimeMillis":"1632316079572","orderId":"GPA.3311-1511-0000-83580","acknowledgementState":0},"errorMessage":null,"isSuccessful":true}, – Praveen Kumar Sep 23 '21 at 09:27
  • so everytime when user subscribed from the app i got the message and pass that token to reciept verify method, then i got order id throught that i will find the user in database and update the status. oderid will be store to db by the android app developer. – Praveen Kumar Sep 23 '21 at 09:30
  • you have to store orderId to your backend also for crosscheck, otherwise I think it is impossible to track if you are not getting emailAddress and profileId – DeePanShu Sep 23 '21 at 09:34
  • yes, am storing the orderid, but when same user did resubscription from playstore for expired one it is getting subscribed and i will get the message & response as well but new order id and purchase token, with new order id or purchase token am not able to match the user. – Praveen Kumar Sep 23 '21 at 09:37
  • Explore this link: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/acknowledge and https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get – DeePanShu Sep 23 '21 at 09:54

0 Answers0