AI-generated Key Takeaways
- 
          The subscriptionsv2.revokeAPI 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 revocationContextobject, which specifies the type of refund (full, prorated, or item-based).
- 
          The API requires the https://www.googleapis.com/auth/androidpublisherauthorization scope.
- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- RevocationContext
- FullRefund
- ProratedRefund
- ItemBasedRefund
- Try it!
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 | 
 Required. The package of the application for which this subscription was purchased (for example, 'com.some.thing'). | 
| token | 
 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 ( | 
| Fields | |
|---|---|
| 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 | 
|---|
| { // Union field | 
| Fields | |
|---|---|
| Union field RefundType. Determines the type of refund that should be granted. A refund type must be specified as part of a valid request.RefundTypecan be only one of the following: | |
| fullRefund | 
 Optional. Used when users should be refunded the full amount of latest charge on each item in the subscription. | 
| 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 | 
 Optional. Used when a specific item should be refunded in a subscription with add-on items. | 
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 | 
 Required. If the subscription is a subscription with add-ons, the product id of the subscription item to revoke. |