# 兑换道具接口
POST https://game.kwai.com/rest/o/game/pay/balance/pay?access_token=ACCESS_TOKEN
Content-Type: application/json
Param
属性 | 类型 | 说明 |
---|---|---|
access_token | string | 游戏服务器通过 获取 access_token 接口获取(不参与签名) |
Cookie
无
Body
属性 | 类型 | 说明 | 是否参与签名 |
---|---|---|---|
open_id | string | 游戏服务器通过 code2Session 接口换的用户唯一标识 | 是 |
app_id | string | 应用appid | 是 |
zone_id | string | 区服ID + "_" + 角色ID 的格式拼接 serverId_roleId | 是 |
os | string | 用户设备系统,为固定值:android | 是 |
user_ip | string | 用户设备ip | 是 |
ts | long | 时间戳,单位:毫秒 | 是 |
amount | long | 游戏币数量 | 是 |
third_party_trade_no | string | 游戏业务订单号,游戏需要确保全局唯一,相同订单号不会重复扣款 长度不超过63字符,数字字符不限,不能包含特殊字符 有效期48小时 | 是 |
product_name | string | 道具名称(如果是礼包,则是礼包名称) | 是 |
product_info | string | 道具信息列表List<item>,item取值如下表,需要将JsonArray转成JsonString,见下面示例代码 | 是 |
product_desc | string | 备注 | 是 |
extension | string | 扩展字段,非必填 | 为非空字符串时参与签名,否则不参与 |
sign | string | 签名信息 签名规则 | 否 |
product_info中item结构
属性 | 类型 | 说明 |
---|---|---|
product_id | long | 道具id |
product_num | int | 道具数量 |
product_type | int | 道具类型,0:一次性道具,如双倍卡;1:有效期道具,如月卡;2:永久性道具,如皮肤 |
product_start_time | long | 道具有效期开始时间,单位毫秒,product_type为1时必填 |
product_period | long | 道具有效期结束时间,单位毫秒,product_type为1时必填 |
product_info字段代码示例,javascript代码,其他语言类比实现即可
let items = [
{
product_id: 1,
product_num: 1,
product_type: 1,
product_start_time: Date.now(),
product_period: 1
}
]
var product_info = JSON.stringify(items)
返回结果示例
{
"result": 1,
"message": "SUCCESS",
"data": {
"thirdPartyTradeNo": "768680008989",
"totalBalance": 70
}
}