AI-generated Key Takeaways
-
The subscriptionsv2.cancel API is used to cancel a subscription purchase for a user.
-
The API uses a POST request to a specific URL that includes the package name and subscription token as path parameters.
-
The request body requires a
cancellationContext
object, which contains thecancellationType
to specify how the subscription should be cancelled. -
The response body is empty if the cancellation is successful.
-
The API requires the
https://www.googleapis.com/auth/androidpublisher
OAuth scope for authorization.
- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- CancellationContext
- CancellationType
- Try it!
subscriptionsv2.cancel a subscription purchase for the user.
HTTP request
POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:cancel
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 |
---|
{
"cancellationContext": {
object ( |
Fields | |
---|---|
cancellationContext |
Required. Additional details around the subscription revocation. |
Response body
If successful, the response body is empty.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/androidpublisher
CancellationContext
Cancellation context of the purchases.subscriptionsv2.cancel API.
JSON representation |
---|
{
"cancellationType": enum ( |
Fields | |
---|---|
cancellationType |
Required. The type of cancellation for the purchased subscription. |
CancellationType
The type of cancellation requested by the developer.
Enums | |
---|---|
CANCELLATION_TYPE_UNSPECIFIED |
Cancellation type unspecified. |
USER_REQUESTED_STOP_RENEWALS |
Cancellation requested by the user, and the subscription can be restored. It only stops the subscription's next renewal. For an installment subscription, users still need to finish the commitment period. For more details on renewals and payments, see https://developer.android.com/google/play/billing/subscriptions#installments |
DEVELOPER_REQUESTED_STOP_PAYMENTS |
Cancellation requested by the developer, and the subscription cannot be restored. It stops the subscription's next payment. For an installment subscription, users will not need to pay the next payment and finish the commitment period. For more details on renewals and payments, see https://developer.android.com/google/play/billing/subscriptions#installments |