Method: purchases.subscriptionsv2.revoke

  • The subscriptionsv2.revoke API is used to revoke a subscription purchase for a user.

  • The API requires the package name of the application and the purchase token as path parameters.

  • The request body must include a revocationContext object, which specifies the type of refund (full, prorated, or item-based).

  • The API requires the https://www.googleapis.com/auth/androidpublisher authorization scope.

subscriptionsv2.revoke a subscription purchase for the user.

HTTP request

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

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
packageName

string

Required. 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 contains data with the following structure:

JSON representation
{
  "revocationContext": {
    object (RevocationContext)
  }
}
Fields
revocationContext

object (RevocationContext)

Required. Additional details around the subscription revocation.

Response body

If successful, the response body is empty.

Sample

The following is a sample request:

curl -X POST \
  'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.myapp/purchases/subscriptionsv2/tokens/sample_purchase_token:revoke' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "revocationContext": {
      "proratedRefund": {}
    }
  }'

Authorization scopes

Requires the following OAuth scope:

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

RevocationContext

Revocation context of the purchases.subscriptionsv2.revoke API.

JSON representation
{
  "etag": string,

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "fullRefund": {
    object (FullRefund)
  },
  "proratedRefund": {
    object (ProratedRefund)
  },
  "itemBasedRefund": {
    object (ItemBasedRefund)
  }
  // End of mutually exclusive fields.
}
Fields
etag

string

Optional. The ETag representing the subscription state. If provided, the revocation will only proceed if it matches the current server state.

Determines the type of refund that should be granted. A refund type must be specified as part of a valid request. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
fullRefund

object (FullRefund)

Optional. Used when users should be refunded the full amount of latest charge on each item in the subscription.

proratedRefund

object (ProratedRefund)

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.

itemBasedRefund

object (ItemBasedRefund)

Optional. Used when a specific item should be refunded in a subscription with add-on items.

End of mutually exclusive fields.

FullRefund

This type has no fields.

Used to determine if the refund type in the RevocationContext is a full refund.

ProratedRefund

This type has no fields.

Used to determine if the refund type in the RevocationContext is a prorated refund.

ItemBasedRefund

Used to determine what specific item to revoke in a subscription with multiple items.

JSON representation
{
  "productId": string
}
Fields
productId

string

Required. If the subscription is a subscription with add-ons, the product id of the subscription item to revoke.