Method: purchases.subscriptionsv2.get

  • The subscriptionsv2.get method retrieves metadata about a subscription using a GET request to a specified URL.

  • The request requires path parameters for the package name and subscription token.

  • The request body should be empty, and a successful response contains a SubscriptionPurchaseV2 object.

  • Authorization requires the https://www.googleapis.com/auth/androidpublisher OAuth scope.

subscriptionsv2.get metadata about a subscription

HTTP request

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

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
packageName

string

The package of the application for which this subscription was purchased (for example, 'com.some.thing').

token

string

Required. The token provided to the user's device when the subscription was purchased.

Request body

The request body must be empty.

Response body

If successful, the response body contains an instance of SubscriptionPurchaseV2.

Sample

The following is a sample request:

curl -X GET \
  'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/purchases/subscriptionsv2/tokens/sample-token-123' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'

The following is a sample response:

{
  "kind": "androidpublisher#subscriptionPurchaseV2",
  "regionCode": "US",
  "startTime": "2024-01-15T10:00:00Z",
  "subscriptionState": "SUBSCRIPTION_STATE_ACTIVE",
  "latestOrderId": "GPA.3345-1234-5678-90123",
  "linkedPurchaseToken": null,
  "pausedStateContext": null,
  "canceledStateContext": null,
  "testPurchase": null,
  "acknowledgementState": "ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED",
  "externalAccountIdentifiers": {
    "externalAccountId": "user-ext-acc-88765",
    "obfuscatedExternalAccountId": " obfuscated-acc-id-aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789",
    "obfuscatedExternalProfileId": "obfuscated-prof-id-9876543210zYxWvUtSrQpOnMlKjIhGfEdCbA"
  },
  "subscribeWithGoogleInfo": {
    "profileId": "109876543210987654321",
    "profileName": "Alex Smith",
    "emailAddress": "alex.smith.swg@example.com",
    "givenName": "Alex",
    "familyName": "Smith"
  },
  "lineItems": [
    {
      "productId": "premium_monthly_v2",
      "expiryTime": "2025-01-15T10:00:00Z",
      "autoRenewingPlan": {
        "autoRenewEnabled": true,
        "recurringPrice": {
          "units": "12",
          "nanos": 990000000,
          "currencyCode": "USD"
        },
        "priceChangeDetails": null,
        "priceStepUpConsentDetails": null,
        "installmentDetails": null
      },
      "prepaidPlan": null,
      "offerDetails": {
        "basePlanId": "premium-monthly",
        "offerId": "intro-offer-7day",
        "offerTags": [
          "initial_discount",
          "seasonal_promo"
        ]
      },
      "deferredItemReplacement": null,
      "signupPromotion": null
    }
  ]
}

Authorization scopes

Requires the following OAuth scope:

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