Method: purchases.subscriptions.get

Verworfen. Verwenden Sie stattdessen purchases.subscriptionsv2.get. Prüft, ob der Kauf eines Abos durch einen Nutzer gültig ist, und gibt die Ablaufzeit zurück.

HTTP-Anfrage

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

Die URL verwendet die Syntax der gRPC-Transcodierung.

Pfadparameter

Parameter
packageName

string

Der Paketname der App, für die dieses Abo gekauft wurde (z. B. „com.some.thing“).

subscriptionId

string

Die ID des gekauften Abos (z. B. „monthly001“).

token

string

Das Token, das dem Gerät des Nutzers beim Kauf des Abos zur Verfügung gestellt wurde.

Anfragetext

Der Anfragetext muss leer sein.

Antworttext

Wenn der Vorgang erfolgreich abgeschlossen wurde, enthält der Antworttext eine Instanz von SubscriptionPurchase.

Beispiel

Das folgende Beispiel zeigt eine -Anfrage:

curl -X GET \
  'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/purchases/subscriptions/monthly.premium/tokens/abcdefghijklmnopqrstuvwxyz.0123456789' \
  -H 'Accept: application/json'

Hier ist eine Beispielantwort:

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

Autorisierungsbereiche

Erfordert den folgenden OAuth-Bereich:

  • https://www.googleapis.com/auth/androidpublisher