Skip to main content

subscriptions

Overview

Namesubscriptions
TypeResource
Idgoogledevelopers.androidpublisher.subscriptions

Fields

NameDatatypeDescription
obfuscatedExternalProfileIdstringAn obfuscated version of the id that is uniquely associated with the user's profile in your app. Only present if specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made.
externalAccountIdstringUser account identifier in the third-party service. Only present if account linking happened as part of the subscription purchase flow.
cancelReasonintegerThe reason why a subscription was canceled or is not auto-renewing. Possible values are: 0. User canceled the subscription 1. Subscription was canceled by the system, for example because of a billing problem 2. Subscription was replaced with a new subscription 3. Subscription was canceled by the developer
linkedPurchaseTokenstringThe purchase token of the originating purchase if this subscription is one of the following: 0. Re-signup of a canceled but non-lapsed subscription 1. Upgrade/downgrade from a previous subscription For example, suppose a user originally signs up and you receive purchase token X, then the user cancels and goes through the resignup flow (before their subscription lapses) and you receive purchase token Y, and finally the user upgrades their subscription and you receive purchase token Z. If you call this API with purchase token Z, this field will be set to Y. If you call this API with purchase token Y, this field will be set to X. If you call this API with purchase token X, this field will not be set.
kindstringThis kind represents a subscriptionPurchase object in the androidpublisher service.
purchaseTypeintegerThe type of purchase of the subscription. This field is only set if this purchase was not made using the standard in-app billing flow. Possible values are: 0. Test (i.e. purchased from a license testing account) 1. Promo (i.e. purchased using a promo code)
startTimeMillisstringTime at which the subscription was granted, in milliseconds since the Epoch.
cancelSurveyResultobjectInformation provided by the user when they complete the subscription cancellation flow (cancellation reason survey).
countryCodestringISO 3166-1 alpha-2 billing country/region code of the user at the time the subscription was granted.
priceCurrencyCodestringISO 4217 currency code for the subscription price. For example, if the price is specified in British pounds sterling, price_currency_code is "GBP".
promotionTypeintegerThe type of promotion applied on this purchase. This field is only set if a promotion is applied when the subscription was purchased. Possible values are: 0. One time code 1. Vanity code
orderIdstringThe order id of the latest recurring order associated with the purchase of the subscription. If the subscription was canceled because payment was declined, this will be the order id from the payment declined order.
developerPayloadstringA developer-specified string that contains supplemental information about an order.
priceAmountMicrosstringPrice of the subscription, For tax exclusive countries, the price doesn't include tax. For tax inclusive countries, the price includes tax. Price is expressed in micro-units, where 1,000,000 micro-units represents one unit of the currency. For example, if the subscription price is €1.99, price_amount_micros is 1990000.
expiryTimeMillisstringTime at which the subscription will expire, in milliseconds since the Epoch.
autoResumeTimeMillisstringTime at which the subscription will be automatically resumed, in milliseconds since the Epoch. Only present if the user has requested to pause the subscription.
emailAddressstringThe email address of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'.
paymentStateintegerThe payment state of the subscription. Possible values are: 0. Payment pending 1. Payment received 2. Free trial 3. Pending deferred upgrade/downgrade Not present for canceled, expired subscriptions.
profileNamestringThe profile name of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'.
promotionCodestringThe promotion code applied on this purchase. This field is only set if a vanity code promotion is applied when the subscription was purchased.
autoRenewingbooleanWhether the subscription will automatically be renewed when it reaches its current expiry time.
profileIdstringThe Google profile id of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'.
givenNamestringThe given name of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'.
obfuscatedExternalAccountIdstringAn obfuscated version of the id that is uniquely associated with the user's account in your app. Present for the following purchases: If account linking happened as part of the subscription purchase flow. It was specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made.
userCancellationTimeMillisstringThe time at which the subscription was canceled by the user, in milliseconds since the epoch. Only present if cancelReason is 0.
familyNamestringThe family name of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'.
acknowledgementStateintegerThe acknowledgement state of the subscription product. Possible values are: 0. Yet to be acknowledged 1. Acknowledged
introductoryPriceInfoobjectContains the introductory price information for a subscription.
priceChangeobjectContains the price change information for a subscription that can be used to control the user journey for the price change in the app. This can be in the form of seeking confirmation from the user or tailoring the experience for a successful conversion.

Methods

NameAccessible byRequired ParamsDescription
monetization_subscriptions_getSELECTpackageName, productIdReads a single subscription.
monetization_subscriptions_listSELECTpackageNameLists all subscriptions under a given app.
purchases_subscriptions_getSELECTpackageName, subscriptionId, tokenChecks whether a user's subscription purchase is valid and returns its expiry time.
monetization_subscriptions_createINSERTpackageNameCreates a new subscription. Newly added base plans will remain in draft state until activated.
monetization_subscriptions_deleteDELETEpackageName, productIdDeletes a subscription. A subscription can only be deleted if it has never had a base plan published.
monetization_subscriptions_archiveEXECpackageName, productIdArchives a subscription. Can only be done if at least one base plan was active in the past, and no base plan is available for new or existing subscribers currently. This action is irreversible, and the subscription ID will remain reserved.
monetization_subscriptions_patchEXECpackageName, productIdUpdates an existing subscription.
purchases_subscriptions_acknowledgeEXECpackageName, subscriptionId, tokenAcknowledges a subscription purchase.
purchases_subscriptions_cancelEXECpackageName, subscriptionId, tokenCancels a user's subscription purchase. The subscription remains valid until its expiration time.
purchases_subscriptions_deferEXECpackageName, subscriptionId, tokenDefers a user's subscription purchase until a specified future expiration time.
purchases_subscriptions_refundEXECpackageName, subscriptionId, tokenRefunds a user's subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur.
purchases_subscriptions_revokeEXECpackageName, subscriptionId, tokenRefunds and immediately revokes a user's subscription purchase. Access to the subscription will be terminated immediately and it will stop recurring.