已淘汰:請改用 purchases.subscriptionsv2.get。檢查使用者的訂閱購買交易是否有效,並傳回其到期時間。
HTTP 要求
GET https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 | |
---|---|
packageName |
購買此訂閱項目的應用程式套件名稱 (例如「com.some.thing」)。 |
subscriptionId |
所購買訂閱項目的 ID (例如「monthly001」)。 |
token |
購買訂閱項目時提供給使用者裝置的權杖。 |
要求主體
要求主體必須為空白。
回應主體
如果成功,回應主體會包含 SubscriptionPurchase
的執行例項。
範例
以下是要求範例:
curl -X GET \ 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/purchases/subscriptions/monthly.premium/tokens/abcdefghijklmnopqrstuvwxyz.0123456789' \ -H 'Accept: application/json'
以下是回應範例:
{ "kind": "androidpublisher#subscriptionPurchase", "startTimeMillis": "1678886400000", "expiryTimeMillis": "1710470400000", "autoRenewing": true, "priceCurrencyCode": "USD", "priceAmountMicros": "9990000", "introductoryPriceInfo": { "introductoryPriceCurrencyCode": "USD", "introductoryPriceAmountMicros": "4990000", "introductoryPricePeriod": "P1M", "introductoryPriceCycles": 1 }, "countryCode": "US", "developerPayload": "{\"userId\": \"user12345\", \"source\": \"app-promo\"}", "paymentState": 1, "cancelReason": 0, "userCancellationTimeMillis": "1709251200000", "cancelSurveyResult": { "cancelSurveyReason": 3, "userInputCancelReason": null }, "orderId": "GPA.3344-5566-7788-99001", "linkedPurchaseToken": null, "purchaseType": 0, "priceChange": null, "profileName": "Jane Doe", "emailAddress": "jane.doe@example.com", "givenName": "Jane", "familyName": "Doe", "profileId": "109876543210987654321", "acknowledgementState": 1, "externalAccountId": "user-jane-doe-app-id", "promotionType": 1, "promotionCode": "WELCOME20", "obfuscatedExternalAccountId": "obfUaCcOunTId123", "obfuscatedExternalProfileId": "obfPrOfiLeId456", "autoResumeTimeMillis": null }
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/androidpublisher