Background
I'm currently implementing a google play subscription. I am experienced with regular in app purchases.
Issue
The recommended way to get updates about subscription events is to enable pub/sub notifications. However I've noticed 2 sections in the documentation contradict each other:
On the subscriptions page it's stated that
The purchase token is valid from subscription signup until 60 days after expiration. After this date, the purchase token is no longer valid to use to call the Google Play Developer API.
However, in the documentation about the notification payload it's stated that
purchaseToken string The token provided to the user's device when the subscription was purchased.
Google tells you to use the purchaseToken from the notification to call the google play api to fetch details about the subscription, however that would imply that after 60 days this isn't possible as the token would have expired?
How is this usually handled? If statement 2 is correct, the purchase token always stays the same (which makes sense) but then it shouldn't expire as I'm otherwise not able to query details about this subscription anymore.
1 Answer 1
You should be saving the details about the purchase token to your database, especially if you plan to use information for reference after the purchase token (subscription) is expired.
If expired and it's been longer than 60 days. You'll get the error:
subscriptionPurchaseNoLongerAvailable
If the user's account that made the token is deleted, when querying the purchase token, you'll get this error:
purchaseTokenNoLongerValid
Solution:
Update server code to contain the info of future purchase tokens when you receive them or within 60 days of them expiring.
Comments
Explore related questions
See similar questions with these tags.