Reputation: 1596
I have implemented the subscription type in-app products in my app like 1 month or 2 months package, once a user subscribe to the product I let the server know and deal with him/her accordingly and it is working very fine.
According to Google at completion of subscription period:
Google auto-cut the credit and renew the package.
My problem: How do I get to know the user who have paid for next the month or not?
Upvotes: 3
Views: 3194
Reputation: 2850
Answering the question: You cant consume the subscriptions. You can consume only inapps.
Quote from docs:
Important: Unlike in-app products, subscriptions cannot be consumed.
Source: https://developer.android.com/google/play/billing/api.html
That page leads to these two: https://developer.android.com/google/play/billing/billing_subscriptions.html https://developer.android.com/google/play/billing/billing_integrate.html#Subs
Also notice that when offering subscription, it is best to allow user to restore the subscription. For example if a user logged in in your app, purchased a subscription and then logged in with another username, the subscription should be available there too, because it is attached to users google play account.
To do that you should query for purchased subs like marmor specified.
Upvotes: 7
Reputation: 28239
You can get a list of active purchases from Google Play, and then update your server accordingly (e.g. daily).
IInAppBillingService service = ...;
Bundle items = service.getPurchases(API_VERSION, PACKAGE_NAME, "subs", null);
int response = getResponseCodeFromBundle(items);
if (response != RESULT_OK) {
// handle error
}
ArrayList<String> productIDs = items.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
// update server with active product ids
Upvotes: 1