Method: purchases.subscriptions.get

已废弃:请改用 purchases.subscriptionsv2.get。检查用户购买的订阅是否有效并返回其过期时间。

HTTP 请求

GET https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}

网址采用 gRPC 转码语法。

路径参数

参数
packageName

string

购买相应订阅所对应的应用的软件包名称(例如:“com.some.thing”)。

subscriptionId

string

所购买订阅的 ID(例如“monthly001”)。

token

string

在用户购买订阅时向用户设备提供的令牌。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 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": "[email protected]",   "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