consumePurchase API

本文档主要关注用于服务器端购买消费的 consumePurchase API。

您验证购买后,应将其标记为已消费。

购买的消费包含:

  • 将购买的产品分配给用户。
  • 通知now.gg产品已被消费。

消费购买的示例代码

以下示例代码演示了使用 consumePurchase API的关联请求。

import requests

  url = "https://cloud-api.bluestacks.cn/v2/order/consumePurchase"

  payload = 'purchaseToken=nowgg-_purchase_token'
  headers = {
    'Authorization': 'payment_api_key_here',
    'Content-Type': 'application/x-www-form-urlencoded'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

重要信息

预期响应

以下是 consumePurchase API 的示例响应。

 {  
   "success": true,
   "code": 0,
   "codeMsg": "success",
   "data": {}
 }

响应参数

参数 类型 描述
success boolean 返回是否成功,true或false。
code int 成功返回0,失败返回非0
codeMsg string 返回错误码关联的消息。
data object 作为响应返回的数据。

错误码映射

错误码 消息 描述
3800 ERROR_CONSUMING_PRODUCT 消费产品发生错误。
3900 INVALID_AUTHORIZATION_KEY 提供的用于授权的API秘钥无效。
3901 INVALID_PURCHASE_TOKEN 提供的购买令牌无效。
×
文本已复制到剪贴板
copyLinkText
有疑问?请通过以下方式联系我们: dev-support@now.gg