Method: monetization.onetimeproducts.purchaseOptions.batchUpdateStates

激活或停用一个或多个一次性商品的购买选项。

HTTP 请求

POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions:batchUpdateStates

网址采用 gRPC 转码语法。

路径参数

参数
packageName

string

必需。要更新的购买选项所对应的父级应用(软件包名称)。

productId

string

必需。如果所有要更新的购买选项属于同一个一次性商品,则为父级一次性商品的 ID。如果此批量更新涉及多个一次性商品,请将此字段设置为“-”。

请求正文

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

JSON 表示法
{
  "requests": [
    {
      object (UpdatePurchaseOptionStateRequest)
    }
  ]
}
字段
requests[]

object (UpdatePurchaseOptionStateRequest)

必需。包含最多 100 个元素的更新请求列表。各个请求申请更新的购买选项必须各不相同。

响应正文

针对 purchaseOptions.batchUpdateStates 的响应消息。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "oneTimeProducts": [
    {
      object (OneTimeProduct)
    }
  ]
}
字段
oneTimeProducts[]

object (OneTimeProduct)

已更新的一次性商品的列表。此列表中的订阅将按相同顺序与请求一一匹配。

授权范围

需要以下 OAuth 范围:

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

UpdatePurchaseOptionStateRequest

用于更新一次性商品购买选项状态的请求消息。

JSON 表示法
{

  // Union field state_transition_type can be only one of the following:
  "activatePurchaseOptionRequest": {
    object (ActivatePurchaseOptionRequest)
  },
  "deactivatePurchaseOptionRequest": {
    object (DeactivatePurchaseOptionRequest)
  }
  // End of list of possible types for union field state_transition_type.
}
字段
联合字段 state_transition_type。要应用的状态转换的类型,只能设置一个值。state_transition_type 只能是下列其中一项:
activatePurchaseOptionRequest

object (ActivatePurchaseOptionRequest)

激活购买选项。购买选项激活后即可使用。

deactivatePurchaseOptionRequest

object (DeactivatePurchaseOptionRequest)

停用购买选项。购买选项停用后即无法使用。

ActivatePurchaseOptionRequest

针对 UpdatePurchaseOptionState 的请求消息。

JSON 表示法
{
  "packageName": string,
  "productId": string,
  "purchaseOptionId": string,
  "latencyTolerance": enum (ProductUpdateLatencyTolerance)
}
字段
packageName

string

必需。要激活的购买选项所对应的父级应用(软件包名称)。

productId

string

必需。要激活的购买选项所对应的父级一次性商品 (ID)。

purchaseOptionId

string

必需。要激活的购买选项的购买选项 ID。

latencyTolerance

enum (ProductUpdateLatencyTolerance)

可选。相应商品更新的传播延迟容忍度。默认设置为对延迟敏感。

DeactivatePurchaseOptionRequest

针对 UpdatePurchaseOptionState 的请求消息。

JSON 表示法
{
  "packageName": string,
  "productId": string,
  "purchaseOptionId": string,
  "latencyTolerance": enum (ProductUpdateLatencyTolerance)
}
字段
packageName

string

必需。要停用的购买选项所对应的父级应用(软件包名称)。

productId

string

必需。要停用的购买选项所对应的父级一次性商品 (ID)。

purchaseOptionId

string

必需。要停用的购买选项的购买选项 ID。

latencyTolerance

enum (ProductUpdateLatencyTolerance)

可选。相应商品更新的传播延迟容忍度。默认设置为对延迟敏感。