# Method: purchases.subscriptionsv2.revoke

- [HTTP request](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#body.request_body)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#body.response_body)
- [Authorization scopes](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#body.aspect)
- [RevocationContext](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#RevocationContext)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#RevocationContext.SCHEMA_REPRESENTATION)
- [FullRefund](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#FullRefund)
- [ProratedRefund](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ProratedRefund)
- [ItemBasedRefund](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ItemBasedRefund)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ItemBasedRefund.SCHEMA_REPRESENTATION)
- [Try it!](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#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](https://google.aip.dev/127) 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 (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#RevocationContext`) } } ``` |

| Fields ||
|---|---|
| `revocationContext` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#RevocationContext`)`` Required. Additional details around the subscription revocation. |

### Response body

If successful, the response body is empty.

### Sample

The following is a sample request:

```json
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 `RefundType` can be only one of the following: "fullRefund": { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#FullRefund`) }, "proratedRefund": { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ProratedRefund`) }, "itemBasedRefund": { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ItemBasedRefund`) } // End of list of possible types for union field `RefundType`. } ``` |

| 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. `RefundType` can be only one of the following: ||
| `fullRefund` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#FullRefund`)`` Optional. Used when users should be refunded the full amount of latest charge on each item in the subscription. |
| `proratedRefund` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#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 (`https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#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` | `string` Required. If the subscription is a subscription with add-ons, the product id of the subscription item to revoke. |