In our backend server, when user
- Cancel the subscription.
- Re-subscribe again after few days.
It is crucial for us to know, the old purchase token, and the new purchase token, are both referring to the same user.
Reason is that, previous, user had already created some data in server, using old cancelled subscription purchase token.
When user cancelled the subscription, and re-subscribe again, we want to ensure the user still authorized to access the old data, using the new purchase token.
We expect we can get the information from linkedPurchaseToken, where the new purchase token, will point to the old purchase token.
This is described in https://medium.com/androiddevelopers/implementing-linkedpurchasetoken-correctly-to-prevent-duplicate-subscriptions-82dfbf7167da
However, based on our test result, this is not the case.
Google Play Developer API
credentials = service_account.Credentials.from_service_account_file(
constant.PATH_TO_SERVICE_ACCOUNT_JSON,
scopes = constant.SCOPES
)
androidpublisher = googleapiclient.discovery.build(
'androidpublisher',
'v3',
credentials = credentials
)
product = androidpublisher.purchases().subscriptions().get(
packageName = "com.xxx.yyy",
subscriptionId = product_id,
token = token
).execute()
return product
Current active subscription
{
'startTimeMillis':'1619245597271',
'expiryTimeMillis':'1619246015249',
'autoRenewing':True,
'priceCurrencyCode':'SGD',
'priceAmountMicros':'6980000',
'countryCode':'SG',
'developerPayload':'',
'paymentState':1,
'orderId':'GPA.3314-4833-2752-47988',
'purchaseType':0,
'acknowledgementState':1,
'kind':'androidpublisher#subscriptionPurchase'
}
Previous cancelled subscription
{
'startTimeMillis':'1619244776697',
'expiryTimeMillis':'1619245074590',
'autoRenewing':False,
'priceCurrencyCode':'SGD',
'priceAmountMicros':'6980000',
'countryCode':'SG',
'developerPayload':'',
'cancelReason':3,
'orderId':'GPA.3358-9904-1003-13416',
'purchaseType':0,
'acknowledgementState':1,
'kind':'androidpublisher#subscriptionPurchase'
}
We do not have linkedPurchaseToken information. Hence, there is no way for us to know, both subscriptions are referring to a same user.
In Google Play Console, it is able to tell the subscriptions are from the same user, even the order id is different. However, there is no way to know such, via Google Play Developer API respond.
Our initial guess is that, this can due to Resubscribe feature is not enabled in our Google Play Console.
But, currently, all our production/ beta/ tester APK have been upgraded to 3.0.1 long time ago. So, we are not sure whether there is such "Resubscribe is not currently available for your users because your app does not use Billing Library 2.0 in all active APKs." message.
Any idea, how we can find out, whether the latest active subscription, and cancelled inactive subscription, are in fact referring to the same user?

