I have created an application in which there is in-app purchases which has monthly auto renewal.. on first time successful payment i have called a web-service in which i have made the user to premium class.
Now if the user has cancelled the payment manually from the google server, how could i know that user has cancelled his/her subscription.
Is there is some PHP code query or from android i have to called something in background to check the status??
Thank you in advace
I haven't tested this, but could you use the
autoRenewing
field in INAPP_PURCHASE_DATA?http://developer.android.com/google/play/billing/billing_reference.html#getBuyIntent
Apparently, the
autoRenewing
field was added or at least documented in the beginning of 2015.Check the getPurchases() method here. Or if you use Android Studio and have the source code downloaded just press
Ctrl
+Q
onIInAppBillingService.getPurchases
methodYou can check the purchased subscriptions inside the app via
Edit: For subscriptions use "subs", for inapp-purchases use "inapp" e.g.:
Inapp-Purchases:
mService.getPurchases(3, getPackageName(), "inapp", null);
Subscriptions:
mService.getPurchases(3, getPackageName(), "subs", null);
See also
Querying for Purchased Items
at http://developer.android.com/google/play/billing/billing_integrate.htmlSo you can implement a task in your app where you check if the user still has a subscription. If not, you can remove the premium status. Moreover this information could be useful for you:
source: http://developer.android.com/google/play/billing/billing_subscriptions.html under
subscription cancelled
Hope this could help you
Edit2: Because the AIDL library which is mentioned in my answer is deprecated and deactivated in the future, it is recommended to switch to the new Google Play Billing Library.