Android in-app-purchase how to get expiration date of subscription - android

I have subscription feature in my app. Is there any way can I get expiration date of subscribed product without any additional code on the server?
I have searched a lot and didn't get the answer.
Thanks

No, you must send a request to the Google API service specifing the product SKU and the purchaseToken

Related

Android Developer Notification For In App Billing

Can any one provide complete documentation for auto renew subscription and update status on backend using android developer notification with pub/sub?
We have to do Monthly & Yearly auto renew in app purchase subscription. If we subscribe using app,then we are getting purchase token and updating on backend.I have some query for auto renew subscription.
Please check the same as below:
1.Do we need to check subscription status at the time subscription period over using cron job? If yes,do we need to pass same purchasetoken in Purchases.subscriptions: get api?
2.If we enable developer notification for real time update on server,then we are getting notification on server. It doesn't contain any purchase information or unique user id.
Please check the below documentation :
https://developer.android.com/google/play/billing/realtime_developer_notifications
Real-time developer notifications do not provide full information about the state of the subscription, such as whether the user is currently entitled to access subscription content. When you receive the token, you should always use the purchase token to query the Google Play Developer API to get the full information and update your backend with the user's current entitlement status.
-> Will we get purchase token from realtime developer notifications?
I implemented with the help of the official implementation. I hope this helps.

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 Billing Version 3 get expired subscriptions

the google api documentation states that you should call the method
getPurchases()
to know currently active subscriptions, but is there a way to get from Google the expired subscriptions too? Or should I store the subscription informations on a custom server?
I'm doing a magazine app and, even if the subscription is expired, I should be able to allow the user to re-download the issues published while the subscription was active…
Yes of course there is the way for the android application and your back end server to check your subscription details and it's expiration date and even if have access to cancel subscription manually from your server. Using "purchase-status-api", you can check it's expiration date and auto-recurring bill flag.
AFTER LOT OF SEARCH I GOT FOLLOWING LINKS,
PURCHASE-STATUS-API
AUTHENTICATION DEVELOPER DOC
GET EXPIRATION DATE FOR SUBSCRIPTION PRODUCT
REFERENCE LINKS:
MORE LINKS TO IMPLEMENT GOOGLE API
HELP TO IMPLEMENT FOR SERVER OR CLIENT SIDE GOOGLE API
Hope it will solved your problem.

How to get Google Play subscription expiration date from backend server

I'm astonished to find very little documentation or examples about obtaining the expiration date for a Play Store subscription. Throughout the official In-app Billing documentation, the following is noted:
When the user successfully purchases a new subscription, your app
notifies a backend server, which stores the purchase token, user name,
and other information in a secure location.
Since your app cannot know the expiration date, your server can poll
Google Play to get the expiration and store it with the purchase token
and other data.
Because your server now knows the expiration date, it does not need to
poll Google Play again until after the expiration date, at which time
it can confirm that the subscription was not cancelled.
In my app I'm able to obtain an Authorization Token via OAuth and a Purchase Token (using convenience methods for in-app billing) and I can send that information to my back end server. However at that point I can find little information on what to do with those tokens once I have them. The only information I've been able to uncover is reference to Google APIs Client Libraries, which provides sample libraries for various languages Client Libraries (I happen to be using PHP). Inspection of the PHP "Documentation" sample (Getting up and running in 60 seconds LOL), shows the following line of code:
$client->setApplicationName('Google+ PHP Starter Application');
What does this have to do with finding a subscription expiration date???? It seems to me that the parameter passed to setApplicationName should have some reference to the Play Store, but there seems to be NO reference to the Play Store in the list of samples (i.e. Google Analytics API, YouTube Data API, etc) Google APIS
So I'm really at a loss on how to move forward.
Any direction would be appreciated.
You need to use the Purchase Status API, which has the Purchases:get method which takes a packageName, subscriptionId, and token and returns a Purchases resource, which contains (among other things) the validUntilTimestampMsec field which is the time at which the subscription will expire.

in app billing: How to find expiration date of user subscription

I am adding a subscription feature to my app. Is there any way I can know the expiry date of the current subscription?
I searched everywhere and cant seem to find the answer
Thanks you
Getting the expiration date for subscriptions is only available through the Google Play Android Develop HTTP-based API. You can always calculate the expiration date using theAIDL for subscriptions. If you request RESTORE_TRANSACTIONS (assuming you have no previous local data) you'll get the purchase date and the current state of the the subscription and a couple of other data.

Categories

Resources