Google Play Android Developer API . purchases . subscriptionsv2

Instance Methods

close()

Close httplib2 connections.

get(packageName, token, x__xgafv=None)

Get metadata about a subscription

revoke(packageName, token, body=None, x__xgafv=None)

Revoke a subscription purchase for the user.

Method Details

close()
Close httplib2 connections.
get(packageName, token, x__xgafv=None)
Get metadata about a subscription

Args:
  packageName: string, The package of the application for which this subscription was purchased (for example, 'com.some.thing'). (required)
  token: string, Required. 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

Returns:
  An object of the form:

    { # Indicates the status of a user's subscription purchase.
  "acknowledgementState": "A String", # The acknowledgement state of the subscription.
  "canceledStateContext": { # Information specific to a subscription in the SUBSCRIPTION_STATE_CANCELED or SUBSCRIPTION_STATE_EXPIRED state. # Additional context around canceled subscriptions. Only present if the subscription currently has subscription_state SUBSCRIPTION_STATE_CANCELED or SUBSCRIPTION_STATE_EXPIRED.
    "developerInitiatedCancellation": { # Information specific to cancellations initiated by developers. # Subscription was canceled by the developer.
    },
    "replacementCancellation": { # Information specific to cancellations caused by subscription replacement. # Subscription was replaced by a new subscription.
    },
    "systemInitiatedCancellation": { # Information specific to cancellations initiated by Google system. # Subscription was canceled by the system, for example because of a billing problem.
    },
    "userInitiatedCancellation": { # Information specific to cancellations initiated by users. # Subscription was canceled by user.
      "cancelSurveyResult": { # Result of the cancel survey when the subscription was canceled by the user. # Information provided by the user when they complete the subscription cancellation flow (cancellation reason survey).
        "reason": "A String", # The reason the user selected in the cancel survey.
        "reasonUserInput": "A String", # Only set for CANCEL_SURVEY_REASON_OTHERS. This is the user's freeform response to the survey.
      },
      "cancelTime": "A String", # The time at which the subscription was canceled by the user. The user might still have access to the subscription after this time. Use line_items.expiry_time to determine if a user still has access.
    },
  },
  "externalAccountIdentifiers": { # User account identifier in the third-party service. # User account identifier in the third-party service.
    "externalAccountId": "A String", # User account identifier in the third-party service. Only present if account linking happened as part of the subscription purchase flow.
    "obfuscatedExternalAccountId": "A String", # An 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.
    "obfuscatedExternalProfileId": "A String", # An 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.
  },
  "kind": "A String", # This kind represents a SubscriptionPurchaseV2 object in the androidpublisher service.
  "latestOrderId": "A String", # The order id of the latest order associated with the purchase of the subscription. For autoRenewing subscription, this is the order id of signup order if it is not renewed yet, or the last recurring order id (success, pending, or declined order). For prepaid subscription, this is the order id associated with the queried purchase token.
  "lineItems": [ # Item-level info for a subscription purchase. The items in the same purchase should be either all with AutoRenewingPlan or all with PrepaidPlan.
    { # Item-level info for a subscription purchase.
      "autoRenewingPlan": { # Information related to an auto renewing plan. # The item is auto renewing.
        "autoRenewEnabled": True or False, # If the subscription is currently set to auto-renew, e.g. the user has not canceled the subscription
        "installmentDetails": { # Information to a installment plan. # The installment plan commitment and state related info for the auto renewing plan.
          "initialCommittedPaymentsCount": 42, # Total number of payments the user is initially committed for.
          "pendingCancellation": { # This is an indicator of whether there is a pending cancellation on the virtual installment plan. The cancellation will happen only after the user finished all committed payments. # If present, this installment plan is pending to be canceled. The cancellation will happen only after the user finished all committed payments.
          },
          "remainingCommittedPaymentsCount": 42, # Total number of committed payments remaining to be paid for in this renewal cycle.
          "subsequentCommittedPaymentsCount": 42, # Total number of payments the user will be committed for after each commitment period. Empty means the installment plan will fall back to a normal auto-renew subscription after initial commitment.
        },
        "priceChangeDetails": { # Price change related information of a subscription item. # The information of the last price change for the item since subscription signup.
          "expectedNewPriceChargeTime": "A String", # The renewal time at which the price change will become effective for the user. This is subject to change(to a future time) due to cases where the renewal time shifts like pause. This field is only populated if the price change has not taken effect.
          "newPrice": { # Represents an amount of money with its currency type. # New recurring price for the subscription item.
            "currencyCode": "A String", # The three-letter currency code defined in ISO 4217.
            "nanos": 42, # Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
            "units": "A String", # The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
          },
          "priceChangeMode": "A String", # Price change mode specifies how the subscription item price is changing.
          "priceChangeState": "A String", # State the price change is currently in.
        },
      },
      "deferredItemReplacement": { # Information related to deferred item replacement. # Information for deferred item replacement.
        "productId": "A String", # The product_id going to replace the existing product_id.
      },
      "expiryTime": "A String", # Time at which the subscription expired or will expire unless the access is extended (ex. renews).
      "offerDetails": { # Offer details information related to a purchase line item. # The offer details for this item.
        "basePlanId": "A String", # The base plan ID. Present for all base plan and offers.
        "offerId": "A String", # The offer ID. Only present for discounted offers.
        "offerTags": [ # The latest offer tags associated with the offer. It includes tags inherited from the base plan.
          "A String",
        ],
      },
      "prepaidPlan": { # Information related to a prepaid plan. # The item is prepaid.
        "allowExtendAfterTime": "A String", # If present, this is the time after which top up purchases are allowed for the prepaid plan. Will not be present for expired prepaid plans.
      },
      "productId": "A String", # The purchased product ID (for example, 'monthly001').
    },
  ],
  "linkedPurchaseToken": "A String", # The purchase token of the old subscription if this subscription is one of the following: * Re-signup of a canceled but non-lapsed subscription * Upgrade/downgrade from a previous subscription. * Convert from prepaid to auto renewing subscription. * Convert from an auto renewing subscription to prepaid. * Topup a prepaid subscription.
  "pausedStateContext": { # Information specific to a subscription in paused state. # Additional context around paused subscriptions. Only present if the subscription currently has subscription_state SUBSCRIPTION_STATE_PAUSED.
    "autoResumeTime": "A String", # Time at which the subscription will be automatically resumed.
  },
  "regionCode": "A String", # ISO 3166-1 alpha-2 billing country/region code of the user at the time the subscription was granted.
  "startTime": "A String", # Time at which the subscription was granted. Not set for pending subscriptions (subscription was created but awaiting payment during signup).
  "subscribeWithGoogleInfo": { # Information associated with purchases made with 'Subscribe with Google'. # User profile associated with purchases made with 'Subscribe with Google'.
    "emailAddress": "A String", # The email address of the user when the subscription was purchased.
    "familyName": "A String", # The family name of the user when the subscription was purchased.
    "givenName": "A String", # The given name of the user when the subscription was purchased.
    "profileId": "A String", # The Google profile id of the user when the subscription was purchased.
    "profileName": "A String", # The profile name of the user when the subscription was purchased.
  },
  "subscriptionState": "A String", # The current state of the subscription.
  "testPurchase": { # Whether this subscription purchase is a test purchase. # Only present if this subscription purchase is a test purchase.
  },
}
revoke(packageName, token, body=None, x__xgafv=None)
Revoke a subscription purchase for the user.

Args:
  packageName: string, Required. The package of the application for which this subscription was purchased (for example, 'com.some.thing'). (required)
  token: string, Required. 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.subscriptionsv2.revoke API.
  "revocationContext": { # Revocation context of the purchases.subscriptionsv2.revoke API. # Required. Additional details around the subscription revocation.
    "fullRefund": { # Used to determine if the refund type in the RevocationContext is a full refund. # Optional. Used when users should be refunded the full amount of the latest order of the subscription.
    },
    "proratedRefund": { # Used to determine if the refund type in the RevocationContext is a prorated refund. # Optional. Used when users should be refunded a prorated amount they paid for their subscription based on the amount of time remaining in a subscription.
    },
  },
}

  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.subscriptionsv2.revoke API.
}