How to get Android In-App Subscription auto renewal details? - android

I'm working an app that will have an in-app subscription purchases on Weekly,Monthly bases.
When a user subscribe weekly or monthly, app getting subscription purchase details with OrderID like GPA.0000-0000-0000-00000 and purchased date in long.
And as per the Android developer blog after auto renewal we will get new order id with suffix ..1,..2,..3
GPA.0000-0000-0000-00000..0
GPA.0000-0000-0000-00000..1
GPA.0000-0000-0000-00000..2
GPA.0000-0000-0000-00000..3
But, my problem is after renewing the subscription also I'm still getting old subscription purchase details. No changes in OrderID and Purchased Date.
So, please anyone help me to get the Subscription Renewal Details.
Thanks.

If a recurring payment fails (for example, because the customer’s credit card has become invalid), the subscription does not renew.
The getPurchases() method does not return failed or expired subscriptions.
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. (Seasonal subscriptions are charged annually, on the first day of the season.)
Refer for more details In-app Subscriptions

Related

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.

Getting Billing details of Subscription android?

I am using InAppBilling version 3 in my app, I am able to purchase subscriptions using test account. Now my question is how do I know the billing details in my app againt one subscription plan. Suppose I have purchase one plan and it renews Daily, Is there any provision or method to know that renew is done to this product with details(like for ex. product_id, time, date, update, renewing_status...etc). I have refered to this link.
And the other thing is that do a user can subscribed to multiple subscription at a time ?
After searching quite a bit, finally I found my solution. Google don't provide subscription order number for test purchases(if you are using test account to test your application without going to production). It only provide product_id, token, purchase_time, developer_payload, autoRenewing, package_name and purchase_state as if Google don't send details to Play Billing server as it is not a real purchase. Still your can implement your own logic as it provide autoRenewing = true(if product is in renewal state) and false(if product is in non-renewal state) with purchase_state = 0(purchased) , 1(canceled) and 2(refunded). And one more thing I came to know after reading documentation of Google that, test user who has taken the subscriptions the recur on daily basis, but they will only get the same details, which they get while purchasing a test subscription plan.
It provide order Id for real purchases with other details. If your subscription is monthly and your order Id is GPA.1234-5678-9012-34567 while purchasing the plan. Then next month Google append your order Id with GPA.1234-5678-9012-34567..0(second month) , GPA.1234-5678-9012-34567..1 (third month) and so on. So you can track your renewal of purchases with order Id as described in here. Rest are same.

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.

InApp Subscriptions or Google Wallet

I have gone through most of the links here on stackoverflow and i have some doubts regarding InApp Subscriptions and Google Wallet.
What i know:
InApp Subscriptions basically allows a user to be able to subscribe to an app, say for example if it offers one year trial period, then once thats over, Google automatically handles the subscriptions then after.
Google Wallet, its a method that can be used to perform the purchase. What i don't understand is, can i use this method in order to allow users to use the app for one year, and then make them pay for the next years?
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. (Seasonal subscriptions are charged annually, on the first day of the season.)
This is what happens in my app:
1. A user logs in, and i get a date that probably keeps track of the billing cycle
2. If the sessions expired, the user is asked to pay using the inApp Billing serivce
3. Based on TrivailDriveApp Example, where we have the success log printed on subscription, we update the date of payment.
Some questions i have:
As per the quote from android, if the user is automatically subscribed to the service, and if a mail is sent to the user, does that mean that i would never be able to get a notification about the payment extension? How do i sync that with the server then?
Is my approach wrong in handling this kind of scenario? Or do i have to select a different method of handling app extensions?
P.S: There is no way of testing inapp subscriptions also. I wonder if i could do that without using real credit/debit card credentials.
EDIT:
I would also want to keep track of when the purchase or billing was done, if subscriptions are auto-renewed, then should i take up the purchase flow as an InApp Product instead of an InApp Subscription?
Please help.

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