Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if user cancels Google Play subscription?

Tags:

About to build a subscription product into our Android app, but a little unclear on the best way to know about canceled subscriptions. The only way we are planning on letting the user cancel is for them to go to Google Play Store and explicitly cancel, but in this case, our backend won't be notified.

The Google Play Developer API docs explicitly say you must not query the API for the status of all subscriptions so how are we supposed to know which users have cancelled their subscription?

Any help much appreciated!

like image 595
Karim Varela Avatar asked Jun 04 '16 23:06

Karim Varela


People also ask

What happens if you cancel subscription Google Play?

If you have a subscription with an app and the app gets removed from Google Play, your future subscription will be canceled. Your past subscriptions will not be refunded.

Why does my subscription not show up on Google Play?

If you can't find your subscriptions, check that you're signed in to the correct account. Make sure to sign in to the Google Account that has your subscriptions. Learn how to add an account or switch accounts. The email you used with the subscription app may be different than your Google Account.


2 Answers

According to In-App Subscription documentation there is no mechanism to detect when the user cancels the subscription. Since it is not canceled immediately. Instead it waits for the end of the cycle for the subscription to expire.

Excerpt from document (source)

When the user cancels a subscription, Google Play does not offer a refund for the current billing cycle. Instead, it allows the user to have access to the canceled subscription until the end of the current billing cycle, at which time it terminates the subscription. For example, if a user purchases a monthly subscription and cancels it on the 15th day of the cycle, Google Play will consider the subscription valid until the end of the 30th day (or other day, depending on the month)

The app won't receive any kind of notification when user cancels the subscription.

The behavior of subscription is whenever you query the inventory in the app SKU will be returned if subscription is valid. When the subscription expires the SKU won't be returned when you query the inventory.

According to the documentation in this link

It is okay to run a batch query whenever subscription is nearing the end

Excerpt from document (source):

Query for subscription status only at expiration — Once your server has retrieved the expiration date of subscription tokens, it should not query the Google Play servers for the subscription status again until the subscription is reaching or has passed the expiration date. Typically, your servers would run a batch query each day to check the status of expiring subscriptions, then update the database

The following server api lets you query the subscription status:

https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource-representations

The variables autoRenewing and cancelReason will let you know if the subscription has been canceled.

By using the above API you would be able to implement a system wherein the subscription nearing expiration can be queried for status and then determine whether they are canceled or not.

Full details for subscription cancellation can be found at this link.

Note:
Documentation states that you should continue to provide the content as long as the user has valid subscription. If you are planning to deny access to the content if someone canceled the subscription will go against the Google Policy

Excerpt from document (source)

Important: In all cases, you must continue to offer the content that your subscribers have purchased through their subscriptions, as long any user is able to access it. That is, you must not remove any content while any user still has an active subscription to it, even if that subscription will terminate at the end of the current billing cycle.

like image 192
Anirudha Agashe Avatar answered Oct 12 '22 14:10

Anirudha Agashe


It looks like it's now possible to receive server-side notifications about subscriptions changes (renewal, cancellation...):

The In-app Billing API provides server push notifications that give developers the capability to monitor state changes for Play-managed subscriptions.

See this page for more details: https://developer.android.com/google/play/billing/billing_subscriptions.html#realtime-notifications

like image 25
guillaume-tgl Avatar answered Oct 12 '22 13:10

guillaume-tgl