Sinto Ileaf
Sinto Ileaf

Reputation: 11

Inapp purchase automatic subscription / subscription cancellation callbacks

In my android application user membership plan is upgraded using inapp subscription on monthly basis. There are 2 membership status corresponding to each user 'free' & 'premium'. If user subscribes on monthly basis, the membership status will become premium. But after 1 month the membership status goes to free.

How can we get auto subscription status from play store so that I could pass this status to the backend to upgrade the user membership status to premium.

Is there any callbacks from google play store to app or direct to the backend server to get the subscription status?

Upvotes: 1

Views: 260

Answers (1)

Marc Greenstock
Marc Greenstock

Reputation: 11668

Is there any callbacks from google play store to app or direct to the backend server to get the subscription status?

No, you have to query the purchaseToken yourself using the Google Play Developer API from within your own web-server.

Upon receiving the purchaseToken on your server you should make a request to the Google Play Developer API to retrieve the expiryTimeMillis.

You should then queue a task to run again at the given expiryTimeMillis to retrieve the latest expiry date and so on until the expiryTimeMillis appears in the past indicating that the subscription has not been renewed.

If you're specifically looking for a service with webhook integration that you don't need to build yourself, I suggest checking out https://mbaasy.com. It's in beta at the moment but if you register I can get you in the beta program soon. Disclaimer: I'm the founder of mbaasy.

Upvotes: 1

Related Questions