Method: purchases.subscriptionsv2.revoke

对用户购买的订阅执行 subscriptionsv2.revoke 操作。

HTTP 请求

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

网址采用 gRPC 转码语法。

路径参数

参数
packageName

string

必需。之前购买的订阅所对应的应用的软件包(例如“com.some.thing”)。

token

string

必需。在用户购买订阅时向用户设备提供的令牌。

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "revocationContext": {
    object (RevocationContext)
  }
}
字段
revocationContext

object (RevocationContext)

必需。有关撤消订阅的其他详细信息。

响应正文

如果成功,则响应正文为空。

示例

以下是一个请求示例:

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": {}
    }
  }'

授权范围

需要以下 OAuth 范围:

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

RevocationContext

purchases.subscriptionsv2.revoke API 的撤消上下文。

JSON 表示法
{
  "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.
}
字段
etag

string

可选。表示订阅状态的 ETag。如果提供此值,则仅当其与当前服务器状态匹配时,撤消操作才会继续。

确定应批准的退款类型。必须在有效请求中指定退款类型。以下是互斥字段的列表。在响应中,最多只能设置其中一个字段:
fullRefund

object (FullRefund)

可选。应当全额退还用户为订阅中每件商品支付的最新一笔费用时,使用此字段。

proratedRefund

object (ProratedRefund)

可选。应当根据订阅的剩余时间按比例退还用户支付的订阅费时,使用此字段。

itemBasedRefund

object (ItemBasedRefund)

可选。当订阅中包含加购项,且应当退还特定商品的费用时,使用此字段。

互斥字段结束。

FullRefund

此类型没有字段。

用于确定 RevocationContext 中的退款类型是不是全额退款。

ProratedRefund

此类型没有字段。

用于确定 RevocationContext 中的退款类型是不是按比例退款。

ItemBasedRefund

用于确定在包含多项内容的订阅中撤消哪项特定内容。

JSON 表示法
{
  "productId": string
}
字段
productId

string

必需。如果订阅是包含加购项的订阅,则为要撤消的订阅项的产品 ID。