Cancellation of User Subscription in Google In App Purchases - android

I want non auto renewable subscriptions in Google In app purchases. According to Google Docs, In App subscriptions are auto renewable which means they will be renewed after that specified time. I want non auto renewable subscriptions. So What I will do is canceling user subscription from my system. According to Google docs, If user subscription is canceled, it will remains valid until its expiration time. I have two options
Cancel user subscription when he subscribed as this subscription will remain valid until its expiry time.
Setup a scheduler which will cancel user subscription before it is renewed.
According to docs, there is parameter in response cancelReason which can be either 0,1 or 2
The reason why a subscription was cancelled or is not auto-renewing.
Possible values are
0: User cancelled the subscription
1: Subscription was cancelled by the system, for example because of a billing problem
2: Subscription was replaced with a new subscription
I want to ask, if I cancel subscription (which will be considered as subscription canceled by system) when user just subscribed, will it be valid until its expiry time? As there is no such description in Google API Docs. As for method 2 of cancellation, I had to setup a scheduler on the system which is lengthy task.

The whole point of a subscription is that it renews.
If you want to take a payment for a specific time period but do not want it to renew then just use in-app purchasing.
Have your users buy an in-app product and have that product "expire" after a set time period. You can query from the system the purchase date etc. then just use the in-app "consume" method after that time has passed.

Related

Should a purchase be acknowledge again subscription renewal?

I'm implementing google in-app billing on my app. Normally, when a subscription reaches expire time, it will be automatically renewed. A new purchase is made (with the purchase token remain the same)
So, should my app acknowledge this new purchase or can I safely ignore it?
after rereading the google play in app billing documentation (https://developer.android.com/google/play/billing/billing_library_releases_notes#2_0_acknowledge)
"For subscriptions, you must acknowledge any purchase that has a new purchase token. This means that all initial purchases, plan changes, and re-signups need to be acknowledged, but you do not need to acknowledge subsequent renewals. To determine if a purchase needs acknowledgment, you can check the acknowledgement field in the purchase."
so basically, if the subscription is renewed, i don't have to acknowledge it.
i share the answer here for anyone interested in the same topic.
You simply periodically call billingClient.queryPurchases() if you use the billing libray, or mService.getPurchases() if using the AIDL
If the user has renewed the subscription, it will return that the user owns the item, if he decides not to renew it, after the grace period, if any, it will return that he does not own the item.

In App Purchase( How user Subscribe to Single product at a time)

I have created the product list of 3 product of type SUBSCRIPTIONS.
Required
When the user subscribe to another product, if their is any the Subscription of
previous product it automatically get cancelled,
and user get subscribe to newly selected product.
Problem
The user get subscription of 2 products at a time which is wrong.
I have search it, but found the solution that user manually need to
Unsubscribe the product in Play Store Account --> Subscription
setting. is there is any another way to Unsubscribe previuos Product
if user subscribe new Product of type subscription.
Subscription Upgrade/Downgrade
With the In-app Billing API, users can upgrade or downgrade a subscription during its active period. When the user does this, the active subscription is canceled and a new subscription is created. The unused balance of the old subscription is applied on a pro-rated basis to the new subscription. The first billing period for the new subscription begins after that balance is used up.
Subscription Cancellation
Users can view the status of all of their subscriptions and cancel them if necessary from the My Apps screen in the Play Store app. Currently, the In-app Billing API does not provide support for programmatically canceling subscriptions from inside the purchasing app.
In addition to client-side API calls, you can use the server-side API for cancelling a subscription programattically. This call cancels a user's subscription purchase but remains valid until its expiration time.
https://developer.android.com/google/play/billing/billing_subscriptions.html
please read the 6th point, user wont be charged 2nd time as per android Documentation, read below.
Users can upgrade or downgrade a subscription in the middle of a
subscription period. The old subscription's cost is pro-rated, and the
unused portion is applied to the replacement subscription.

Android In-App Subscription PurchaseState is always 0

In my android app using in-app subscription monthly plan. I have purchased a subscription product with test account. After one hour I cancelled it manually from my phone.
After I query using inventory.getPurchase(monthlyplan), I always get purchase state is 0.
I waited more than one day; still getting response of purchase state is 0. Can any one help me on this?
You may want to check this document - Subscription Cancellation:
Users can view the status of all of their subscriptions and cancel them if necessary from the My Apps screen in the Play Store app. Currently, the In-app Billing API does not provide support for programatically canceling subscriptions from inside the purchasing app.
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).
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. Alternatively, you can use the refund and revoke API to revoke each subscriber's subscription (one by one) and refund their subscription payments. Removing content that any subscriber is entitled to access will result in penalties. Please see the policies document for more information.
There are some good insights regarding the following (also found in the same document):
App uninstallation
Refunding and revoking subscriptions
Here is a related SO question that also talk about cancelling subscription in-app.

How to determine if user cancels Google Play subscription?

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!
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.
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

auto-renew subscription in-app billing google play

This is my first time to deal with in-app billing in android, I want to know If I want to use monthly subscription to my application, is the option of auto-renew subscription in on by default, or user should do something in his/her google wallet account to allow auto-renew subscription in my app
Thanks.
Yes, it is recurring by default. When user buys subscription, it automatically recurs based on an interval you specify in Developer Console, and User can cancel at any time.
The docs say:
After users have purchased subscriptions, they can view the
subscriptions and cancel them from the My Apps screen in the Play
Store app or from the app's product details page in the Play Store
app.
Additionally,
Billing continues indefinitely at the interval and price specified for
the subscription. At each subscription renewal, Google Play charges
the user account automatically, then notifies the user of the charges
afterward by email. For monthly and annual subscriptions, billing
cycles will always match subscription cycles, based on the purchase
date.
See:
http://developer.android.com/google/play/billing/billing_subscriptions.html
http://developer.android.com/google/play/billing/billing_subscriptions.html#cancellation

Categories

Resources