5. 线下充值
5.1 支付回调
- action:
payNotify - 通知游戏发货
请求data
| 参数 | 类型 | 描述 |
|---|---|---|
| appId | int | 游戏ID |
| channelId | String | 渠道ID 补单时为补单渠道号 |
| userId | String | 平台用户ID |
| orderId | String | 平台订单号 |
| price | String | 商品单价,单位 分 |
| buyNum | int | 购买数量 |
| currency | String | 货币类型,默认 CNY(ISO4217)。 |
| money | String | 订单金额(商品单价 * 购买数量 = 订单金额),单位 分 |
| roleId | String | 角色ID |
| serverId | String | 游戏服务器ID |
| businessType | int | 业务来源,默认 官网商城1-官网商城,2-抖店,3-渠道店铺。 |
| version | String | 接口版本号 |
| title (可选) | String | 邮件标题(未设置邮件信息时,游戏道具将直接发放,无需通过邮件发送。) |
| content (可选) | String | 邮件标题(未设置邮件信息时,游戏道具将直接发放,无需通过邮件发送。) |
| items | JSONArray | 道具列表。注:在批量购买的场景中,道具数量也会是最终发货数量,研发无需再次将其与购买数量进行相乘。 |
| isTest | int | 是否为测试订单。0:否,1:是。仅在测试环境下生效:测试订单默认不发货,仅当 userId 加入研发白名单时才会发货。 |
示例:
{
"appId": 13,
"channelId": "13003",
"userId": "25833270",
"orderId": "202502180181891674322112614400",
"price": "6800",
"buyNum": 1,
"currency": "CNY",
"money": "6800",
"roleId": "7b86ae6e906b23027534e074",
"serverId": "31622",
"businessType": 1,
"version": "v2",
"items": [
{
"id": "65030",
"number": 10
},
{
"id": "67036",
"number": 50
}
],
"title": "官网充值已到账",
"content": "感谢您的购买!你购买的积分礼包已到账。"
}
该请求表示用户购买了一个道具商品,订单金额为 6800 分。其中包含 10 个 道具id 为 65030 的道具和 50 个 道具id 为 67036 的道具。
对应items
| 参数 | 类型 | 描述 |
|---|---|---|
| id | String | 道具ID |
| number | int | 道具数量 |
{"data":"{\"appId\":13,\"channelId\":\"13010\",\"userId\":\"18003403\",\"orderId\":\"202303290161640971641766846464\",\"price\":\"6800\",\"buyNum\":1,\"currency\":\"CNY\",\"money\":\"6800\",\"serverId\":\"501\",\"roleId\":\"01f555310072128a83cda549\",\"businessType\":1,\"title\":\"邮件标题\",\"content\":\"邮件内容\",\"version\":\"v2\",\"items\":[{\"number\":\"5\",\"id\":\"1\"},{\"number\":\"30\",\"id\":\"2\"}]}","sign":"this is sign string","action":"payNotify","ts":1234567890}
响应data
{"msg":"success","code":1000}
5.2 支付回调(旧版本)
- action:
payNotify - 通知游戏发货
- 13-新不良人/23-不良人破局使用
请求data
| 参数 | 类型 | 描述 |
|---|---|---|
| appId | int | 游戏ID |
| channelId | String | 渠道ID 补单时为补单渠道号 |
| userId | String | 平台用户ID |
| orderId | String | 平台订单号 |
| productId | String | 商品ID |
| productType | int | 商品类型:1-内购商品,2-道具商品,3-游戏代币。只有在 productType=2 或 productType=3 时,attributes 和 items 字段是可选的。 |
| buyNum | int | 购买数量 |
rewardNum(可选) | int | 返利数量: 默认为 0。仅 在 productType=1 时可选。返利数量不和购买数量挂钩,直接根据订单走返利发放即可。 |
| currency | String | 货币类型,默认 CNY(ISO4217)。 |
| money | String | 订单金额,单位 分 |
| roleId | String | 角色ID |
| serverId | String | 游戏服务器ID |
| businessType | int | 业务来源,默认 官网商城1-官网商城,2-抖店,3-渠道店铺。 |
| version | String | 接口版本号,固定值 v2 |
| title (可选) | String | 邮件标题(未设置邮件信息时,游戏道具将直接发放,无需通过邮件发送。) |
| content (可选) | String | 邮件内容(未设置邮件信息时,游戏道具将直接发放,无需通过邮件发送。) |
| attributes (可选) | JSONArray | 属性列表,仅在 productType=2 或 productType=3 时可选。 |
| items (可选) | JSONArray | 道具列表,仅在 productType=2 或 productType=3 时可选,注:在批量购买的场景中,道具数量也会是最终发货数量,研发无需再次将其与购买数量进行相乘。 。 |
| isTest | int | 是否为测试订单。0:否,1:是。仅在测试环境下生效:测试订单默认不发货,仅当 userId 加入研发白名单时才会发货。 |
参数说明 productType
| 值 | 描述 |
|---|---|
1 | 内购商品:需要与研发团队约定固定的商品档位 ID。 当 productType=1 时,需要根据商品ID对应的价格、货币,并计算订单总价格(单价 * 数量)进行验证。同时,根据订单携带的返利数量【rewardNum】进行返利。 |
2 | 道具商品:根据 attributes 和 items 中的 道具与属性数量 * 购买数量,将物品直接发放到玩家背包,无需额外约定和验证商品ID信息。productType=2 只关注道具发放。 |
3 | 游戏代币: 根据 items 中的 道具ID 和 道具数量 * 购买数量,将物品直接发放到玩家背包,无需额外约定和验证商品ID信息。productType=3 只关注道具发放。 |
处理逻辑:
1. 内购商品(productType=1):
- 根据
productId查询商品价格和货币类型并验证。 - 校验订单金额(
money)与商品价格*数量的匹配情况。 - 根据
rewardNum进行返利。 - 注意: 邮件标题
title和 邮件内容content有值时使用自定义的邮件标题和内容,没有时用游戏内自定义默认邮件标题和内容
2. 道具商品(productType=2):
- 根据
attributes和items列表中的道具和属性数量*购买数量发放道具。 - 注意:
rewardNum字段在productType=2时不会使用,仅考虑items中的道具ID数量和购买数量buyNum的关系。
3. 游戏代币(productType=3):
- 根据
items列表中的游戏代币-道具ID和游戏代币-道具数量发放道具。 - 游戏代币在游戏侧以道具ID表示,因此游戏端仍统一按照 items 发放。items 中可以同时包含普通道具和游戏代币道具。
- 注意:
rewardNum字段在productType=3时不会使用,如有返利会累加到items.number中。
示例:
内购商品(productType=1):
请求data
{
"appId": 13,
"channelId": "13003",
"userId": "25833270",
"orderId": "202502180181891676215874420736",
"productId": "fake_money_448",
"productType": 1,
"buyNum": 1,
"rewardNum": 2,
"currency": "CNY",
"money": "44800",
"roleId": "7b86ae6e906b23027534e074",
"serverId": "31622",
"businessType": 1,
"version": "v2"
}
该请求表示用户购买了一个448【游戏代币】商品,订单金额为 44800 分,并且用户将获得 2 个返利【游戏代币】。
道具商品(productType=2):
请求data
{
"appId": 13,
"channelId": "13003",
"userId": "25833270",
"orderId": "202502180181891674322112614400",
"productId": "fake_score_gift",
"productType": 2,
"buyNum": 1,
"currency": "CNY",
"money": "6800",
"roleId": "7b86ae6e906b23027534e074",
"serverId": "31622",
"businessType": 1,
"version": "v2",
"items": [
{
"id": "65030",
"number": 10
},
{
"id": "67036",
"number": 50
}
],
"title": "官网充值已到账",
"content": "感谢您的购买!你购买的积分礼包已到账。"
}
该请求表示用户购买了一个道具商品,订单金额为 6800 分。其中包含 10 个 道具id 为 65030 的道具和 50 个 道具id 为 67036 的道具。
游戏代币(productType=3):
请求data
{
"appId": 13,
"channelId": "13003",
"userId": "25833270",
"orderId": "202502180181891674322112614400",
"productId": "fake_voucher_xxx",
"productType": 3,
"buyNum": 1,
"currency": "CNY",
"money": "6800",
"roleId": "7b86ae6e906b23027534e074",
"serverId": "31622",
"businessType": 1,
"version": "v2",
"items": [
{
"id": "90001",
"number": 70
}
],
"title": "官网充值已到账",
"content": "感谢您的购买!你购买的积分礼包已到账。"
}
该请求表示用户购买了一个68【游戏代币】商品,订单金额为 6800 分,并且用户将获得 2 个返利【游戏代币】,发放时【游戏代币】数量为70。
对应attributes
| 参数 | 类型 | 描述 |
|---|---|---|
| id | String | 属性ID |
| value | int | 属性值 |
对应items
| 参数 | 类型 | 描述 |
|---|---|---|
| id | String | 道具ID |
| number | int | 道具数量 |
{ "data":"{\"appId\":13,\"channelId\":\"13010\",\"userId\":\"18003403\",\"orderId\":\"202303290161640971641766846464\",\"productId\":\"activity-gift-1004\",\"productType\":2,\"buyNum\":1,\"currency\":\"CNY\",\"money\":\"6800\",\"serverId\":\"501\",\"roleId\":\"01f555310072128a83cda549\",\"businessType\":1,\"title\":\"邮件标题\",\"content\":\"邮件内容\",\"version\":\"v2\",\"items\":[{\"number\":\"5\",\"id\":\"1\"},{\"number\":\"30\",\"id\":\"2\"}]}", "sign":"this is sign string", "action":"payNotify", "ts":1234567890 }
响应data
{"msg":"success","code":1000}