Reputation: 23029
I have just read this: Google Play Developer API: "startTimeMillis" is updated when it should not
But it is rather old. Can someone confirm it is working like that or not?
The current problem is that in our system for other payment methods, we create our own subscription. When this subscription ends, we cancel the subscription and user is not allowed anymore. If user resubscribes later, it is new subscription for us.
However if user resubscribe, we get new purchaseToken and this part would work fine. But the old subscrition should remain unpaid. However if user subscribes and old token became active again and two different tokens will return same result, it is kind of issue.
We are going to use this endpoint: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get which should have this result: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource
Can we somehow find out that the old token was already cancelled, then resubscribed and that we should expect new subscription?
Upvotes: 2
Views: 635
Reputation: 23029
We have simulated it and this is the result:
This was the requirement:
Register new user
Buy subscription
Save response fields to be able to call this into comments https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get
Call the previous endpoint and save response into comments
Cancel the subscription
Wait 1 month for expiration
Call the endpoint, check if it is expired and save the response
Resubscribe
Call the endpoint with the old data, call the endpoint with data from resubscribing, save both responses to comments
Buy first subscription:
{ "orderId": "GPA.3353-9191-0752-74136", "packageName": "xxx", "productId": "xxx", "purchaseTime": 1526543042663, "purchaseState": 0, "developerPayload": "ee40691d0a3e5f3600df9f35e3346ba7", "signature": "xxx", "purchaseToken": "xxx", "autoRenewing": true }
Google response to first subscription:
{ "kind": "androidpublisher#subscriptionPurchase", "startTimeMillis": "1526543042663", "expiryTimeMillis": "1526543456810", "autoRenewing": true, "priceCurrencyCode": "GBP", "priceAmountMicros": "11990000", "countryCode": "GB", "developerPayload": "xxx", "paymentState": 1, "orderId": "GPA.3353-9191-0752-74136", "purchaseType": 0 }
Buy second subscription:
{ "orderId": "GPA.3348-1559-2255-63309", "packageName": "xxx", "productId": "de.mp.ft.01.test", "purchaseTime": 1526543263033, "purchaseState": 0, "developerPayload": "xxx", "purchaseToken": "mibhepofikjpphaoimomekai.AO-J1Oytkgta2QbLt9lQa7y66eVnqqU1-yjOQJ9B4Sq5Md3Y1OvXJzE-MaazMhAr8gdazydx5sUHTPYg_93mocy37UW8c2M4RFDd0HmbP36lz9HIT7SJmAU", "autoRenewing": true }
Google response to second subscription:
{ "kind": "androidpublisher#subscriptionPurchase", "startTimeMillis": "1526543263033", "expiryTimeMillis": "1526543756810", "autoRenewing": true, "priceCurrencyCode": "GBP", "priceAmountMicros": "11990000", "countryCode": "GB", "developerPayload": "xxx", "paymentState": 1, "orderId": "GPA.3348-1559-2255-63309..0", "linkedPurchaseToken": "ldblmpncfnknbgdmojghdkgj.AO-J1Oy6BqXGaqL355JjzOTQrwfzmLPtckmXmQLfgxX-pwVM3iRin81_AiYVUKsg4FX_ojD_MZabwj886prQhI2jjTXiDWjGqYPp5ZJVbGhZwdHQJkyi2WQ", "purchaseType": 0 }
Google response to first subscription called at the end of test flow (8.)
{ "kind": "androidpublisher#subscriptionPurchase", "startTimeMillis": "1526543042663", "expiryTimeMillis": "1526543336810", "autoRenewing": false, "priceCurrencyCode": "GBP", "priceAmountMicros": "11990000", "countryCode": "GB", "developerPayload": "xxx", "cancelReason": 0, "userCancellationTimeMillis": "1526543175826", "orderId": "GPA.3353-9191-0752-74136", "purchaseType": 0 }
Conclusion - the original subscription (luckily) is not clone of the new one, the fields like expiryTimeMillis are not shared between these two tokens. However it is true, that the startTimeMillis is the same for both
Upvotes: 5