Google Play商店SubscriptionPurchase.Get API响应说明

时间:2019-11-12 08:42:13

标签: google-play subscription android-billing google-play-developer-api android-inapp-purchase

我正在通过Google Developer Subscription Purchase的响应中的以下链接查看此文档:

https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#methods

具体来说,对于字段linkedPurchaseToken,提到了两种情况:

  1. 重新注册已取消但未失效的订阅
  2. 从先前的订阅升级/降级

我不确定情况#1何时发生。尝试购买,取消和还原(虽然没有失效)自动续订的订阅,但是还原后,我在响应中没有得到linkedPurchaseToken。

以下是三种情况下的答复:

购买后:

{
    "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
}

取消后:

{
    "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
}

还原后:

{
    "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
}

在什么情况下应该为#1情景获取LinkedPurchaseToken吗?

1 个答案:

答案 0 :(得分:1)

Re-signup of a canceled but non-lapsed subscription

从Play商店取消订阅后->订阅,您可以通过两种方式重新订阅/重新注册-

1)从应用内重新订阅-购买令牌不同,Developer API for Subscription Purchases会在有linkedPurchaseToken的情况下给出响应。

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. here所述。

2)从Play商店还原-将按原样还原。在这种情况下,购买令牌是相同的,因此在这种情况下,您将不会获得linkedPurchaseToken