Method: purchases.subscriptionsv2.cancel
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
对用户购买的订阅执行 subscriptionsv2.cancel 操作。
HTTP 请求
POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:cancel
网址采用 gRPC 转码语法。
路径参数
参数 |
packageName |
string
必需。购买的相应订阅所对应的应用的软件包(例如“com.some.thing”)。
|
token |
string
必需。在用户购买订阅时向用户设备提供的令牌。
|
请求正文
请求正文中包含结构如下的数据:
字段 |
cancellationContext |
object (CancellationContext )
必需。有关撤消订阅的其他详细信息。
|
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/androidpublisher
CancellationContext
purchases.subscriptionsv2.cancel API 的取消上下文。
字段 |
cancellationType |
enum (CancellationType )
必需。所购买订阅的取消类型。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-12。
[null,null,["最后更新时间 (UTC):2025-09-12。"],[],[],null,["- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [CancellationContext](#CancellationContext)\n - [JSON representation](#CancellationContext.SCHEMA_REPRESENTATION)\n- [CancellationType](#CancellationType)\n- [Try it!](#try-it)\n\nsubscriptionsv2.cancel a subscription purchase for the user.\n\nHTTP request\n\n`POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:cancel`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\nPath parameters\n\n| Parameters ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------|\n| `packageName` | `string` Required. The package of the application for which this subscription was purchased (for example, 'com.some.thing'). |\n| `token` | `string` Required. The token provided to the user's device when the subscription was purchased. |\n\nRequest body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"cancellationContext\": { object (/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/cancel#CancellationContext) } } ``` |\n\n| Fields ||\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `cancellationContext` | `object (`[CancellationContext](/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/cancel#CancellationContext)`)` Required. Additional details around the subscription revocation. |\n\nResponse body\n\nIf successful, the response body is empty.\n\nAuthorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`\n\nCancellationContext Cancellation context of the purchases.subscriptionsv2.cancel API.\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"cancellationType\": enum (/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/cancel#CancellationType) } ``` |\n\n| Fields ||\n|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `cancellationType` | `enum (`[CancellationType](/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/cancel#CancellationType)`)` Required. The type of cancellation for the purchased subscription. |\n\nCancellationType The type of cancellation requested by the developer.\n\n| Enums ||\n|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `CANCELLATION_TYPE_UNSPECIFIED` | Cancellation type unspecified. |\n| `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 \u003chttps://developer.android.com/google/play/billing/subscriptions#installments\u003e |\n| `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 \u003chttps://developer.android.com/google/play/billing/subscriptions#installments\u003e |"]]