Google Play Android Developer API . purchases . subscriptions

Instance Methods

acknowledge(packageName, subscriptionId, token, body=None, x__xgafv=None)

Acknowledges a subscription purchase.

cancel(packageName, subscriptionId, token, x__xgafv=None)

Deprecated: Use purchases.subscriptionsv2.cancel instead. Cancels a user's subscription purchase. The subscription remains valid until its expiration time. Newer version is available at purchases.subscriptionsv2.cancel for better client library support.

close()

Close httplib2 connections.

defer(packageName, subscriptionId, token, body=None, x__xgafv=None)

Deprecated: Use purchases.subscriptionsv2.defer instead. Defers a user's subscription purchase until a specified future expiration time.

Method Details

acknowledge(packageName, subscriptionId, token, body=None, x__xgafv=None)
Acknowledges a subscription purchase.

Args:
  packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required)
  subscriptionId: string, Note: Since May 21, 2025, subscription_id is not required, and not recommended for subscription with add-ons. The purchased subscription ID (for example, 'monthly001'). (required)
  token: string, The token provided to the user's device when the subscription was purchased. (required)
  body: object, The request body.
    The object takes the form of:

{ # Request for the purchases.subscriptions.acknowledge API.
  "developerPayload": "A String", # Payload to attach to the purchase.
  "externalAccountIds": { # User account identifier in your app. # Optional. User account identifier in your app.
    "obfuscatedAccountId": "A String", # Optional. Specifies an optional obfuscated string that is uniquely associated with the purchaser's user account in your app. If you pass this value, Google Play can use it to detect irregular activity. Do not use this field to store any Personally Identifiable Information (PII) such as emails in cleartext. Attempting to store PII in this field will result in purchases being blocked. Google Play recommends that you use either encryption or a one-way hash to generate an obfuscated identifier to send to Google Play. This identifier is limited to 64 characters. This field can only be set for resubscription purchases. See https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid to set this field for purchases made using the standard in-app billing flow.
    "obfuscatedProfileId": "A String", # Optional. Specifies an optional obfuscated string that is uniquely associated with the purchaser's user profile in your app. If you pass this value, Google Play can use it to detect irregular activity. Do not use this field to store any Personally Identifiable Information (PII) such as emails in cleartext. Attempting to store PII in this field will result in purchases being blocked. Google Play recommends that you use either encryption or a one-way hash to generate an obfuscated identifier to send to Google Play. This identifier is limited to 64 characters. This field can only be set for resubscription purchases. See https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid to set this field for purchases made using the standard in-app billing flow.
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format
cancel(packageName, subscriptionId, token, x__xgafv=None)
Deprecated: Use purchases.subscriptionsv2.cancel instead. Cancels a user's subscription purchase. The subscription remains valid until its expiration time. Newer version is available at purchases.subscriptionsv2.cancel for better client library support.

Args:
  packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required)
  subscriptionId: string, Note: Since May 21, 2025, subscription_id is not required, and not recommended for subscription with add-ons. The purchased subscription ID (for example, 'monthly001'). (required)
  token: string, The token provided to the user's device when the subscription was purchased. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format
close()
Close httplib2 connections.
defer(packageName, subscriptionId, token, body=None, x__xgafv=None)
Deprecated: Use purchases.subscriptionsv2.defer instead. Defers a user's subscription purchase until a specified future expiration time.

Args:
  packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required)
  subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required)
  token: string, The token provided to the user's device when the subscription was purchased. (required)
  body: object, The request body.
    The object takes the form of:

{ # Request for the purchases.subscriptions.defer API.
  "deferralInfo": { # A SubscriptionDeferralInfo contains the data needed to defer a subscription purchase to a future expiry time. # The information about the new desired expiry time for the subscription.
    "desiredExpiryTimeMillis": "A String", # The desired next expiry time to assign to the subscription, in milliseconds since the Epoch. The given time must be later/greater than the current expiry time for the subscription.
    "expectedExpiryTimeMillis": "A String", # The expected expiry time for the subscription. If the current expiry time for the subscription is not the value specified here, the deferral will not occur.
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response for the purchases.subscriptions.defer API.
  "newExpiryTimeMillis": "A String", # The new expiry time for the subscription in milliseconds since the Epoch.
}