Reputation: 41
I have developed a chrome extension, I am trying to integrate in-app subscriptions using google.payments.inapp APIs, however while testing I found that if user cancels in-app subscription, the status from API shows ACTIVE instead of CANCELLED. Below is code that I am using to fetch purchased in-app subscriptions by user
google.payments.inapp.getPurchases({
'parameters': {env: "prod"},
'success': ami_onLicenseUpdate,
'failure': ami_onLicenseUpdateFailed
});
I am always receiving below response on success, even if user has cancelled subscription
{"response":{"details":[{"kind":"chromewebstore#payment","itemId":"xxxxxxxxx","sku":"xxxxxx_01","createdTime":"1509281736005","state":"ACTIVE"},{"kind":"chromewebstore#payment","itemId":"xxxxxxx","sku":"xxxxxxx_02","createdTime":"1508736958450","state":"ACTIVE"}]}}
How do I know if user has cancelled subscription?
Upvotes: 2
Views: 241
Reputation: 3292
One more note, for those who work with subscriptions.
Received from Chrome Web Store team:
After the cancellation, a user still will be able to access to your item until the next billing cycle starts and the extension should stop working after the subscription period is over (Monthly or Yearly). Therefore, the API is still responding back as "Active" right after the cancellation was initiated.
Upvotes: 1
Reputation: 41
After doing some research and testing, I found that if user is in subscription's trial period and user cancels subscription, google payment api will return subscription as active and once that trial period is over, it will not return any license related information for that subscription in api response. This way we can identify if user has active subscription or no.
Upvotes: 2