I am looking at this document from Google Developer API for Subscription Purchases response the link below:
https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#methods
Specifically, for the field linkedPurchaseToken
, two scenarios are mentioned:
I am not sure when does the scenario #1 occur. Tried purchasing, canceling and restoring (while not-lapsed) an auto-renewable subscription, but I did not get a linkedPurchaseToken in the response after the restore.
Here are the responses in the three cases:
After Purchase:
{
"kind": "androidpublisher#subscriptionPurchase",
"startTimeMillis": "1573546099994",
"expiryTimeMillis": "1573548136296",
"autoRenewing": true,
"priceCurrencyCode": "INR",
"priceAmountMicros": "85000000",
"countryCode": "IN",
"developerPayload": "",
"paymentState": 1,
"orderId": "GPA.3359-7048-7648-05268",
"purchaseType": 0,
"acknowledgementState": 1
}
After cancellation:
{
"kind": "androidpublisher#subscriptionPurchase",
"startTimeMillis": "1573546099994",
"expiryTimeMillis": "1573548016296",
"autoRenewing": false,
"priceCurrencyCode": "INR",
"priceAmountMicros": "85000000",
"countryCode": "IN",
"developerPayload": "",
"paymentState": 1,
"cancelReason": 0,
"userCancellationTimeMillis": "1573546553870",
"cancelSurveyResult": {
"cancelSurveyReason": 0
},
"orderId": "GPA.3359-7048-7648-05268",
"purchaseType": 0,
"acknowledgementState": 1
}
After restoring:
{
"kind": "androidpublisher#subscriptionPurchase",
"startTimeMillis": "1573546099994",
"expiryTimeMillis": "1573548136296",
"autoRenewing": true,
"priceCurrencyCode": "INR",
"priceAmountMicros": "85000000",
"countryCode": "IN",
"developerPayload": "",
"paymentState": 1,
"orderId": "GPA.3359-7048-7648-05268",
"purchaseType": 0,
"acknowledgementState": 1
}
Is there a clue in what situation I should get the linkedPurchaseToken for #1 scenario?
Re-signup of a canceled but non-lapsed subscription
:
Once the subscription is cancelled from Play Store->Subscriptions, you can Resubscribe/Re-signup in two ways-
1) Resubscribe from within the app - Purchase token is different, Developer API for Subscription Purchases
will give response with linkedPurchaseToken
present.
You can allow users to resubscribe within your app by applying the same in-app product purchase flow as with a cancelled subscription by using the same product ID.
as mentioned here.
2) Restore from play store - will be restored as it is. Purchase token is same in this case, hence you will get no linkedPurchaseToken
in this case.