购买商品
在销售系统下单购买商品。
接口方法
esales.order.purchase
传入参数
| 名称 | 类型 | 必须 | 描述 |
|---|---|---|---|
| out_order_id | string | true | 商家订单号 |
| product_id | int | true | 商品编号 |
| quantity | int | true | 购买数量 |
| charge_params | json | false | 充值参数,充值类商品必须传入 |
| notify_url | string | false | 订单异步通知地址 |
| end_customer_ip | string | false | 终端客户IP |
| end_customer_region | string | false | 终端客户区域 |
| end_total_price | decimal | false | 终端客户总价 |
自定义模板charge_params参数说明
假设商品的充值参数如下:
[
{
"name": "充值账号",
"type": "charge_account",
"comment": "请输入充值账号",
"key": "charge_account"
},
{
"name": "充值方式",
"type": "select",
"options": [
"月卡",
"季卡",
"年卡"
],
"comment": "请选择充值方式",
"key": "charge_type"
}
]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
charge_params参数示例:
{
"charge_account": 18055615168,
"charge_type": "月卡"
}
1
2
3
4
2
3
4
有些参数可能没有key值,此种情况下,用name作为键名也可以,下面的参数效果一样:
{
"charge_account": 18055615168,
"充值方式": "月卡"
}
1
2
3
4
2
3
4
建议优先使用key作为json对象的键名,方便后期维护(如name由手机号改为手机号码,如果用key,则不受影响)。
预置模板charge_params说明
| 名称 | 类型 | 必须 | 描述 |
|---|---|---|---|
| charge_account | string | true | 充值账号 |
| game | string | false | 游戏值 |
| game_name | string | false | 游戏名称 |
| area | string | false | 区域值 |
| area_name | string | false | 区域名称 |
| server | string | false | 服务器值 |
| server_name | string | false | 服务器名称 |
| charge_mode | string | false | 充值类型值 |
| charge_mode_name | string | false | 充值类型名称 |
| charge_account_type | string | false | 充值账号类型值 |
| charge_account_type_name | string | false | 充值账号类型名称 |
| charge_account_password | string | false | 充值账号密码 |
示例:
{
"game": "110",
"charge_mode": "1021101902000000001",
"charge_account": "1",
"area": "1",
"server": "1"
}
1
2
3
4
5
6
7
2
3
4
5
6
7
返回数据
| 参数名 | 类型 | 说明 |
|---|---|---|
| order_id | bigint | 订单号 |
| status | int | 订单状态(100:等待发货,200:交易成功,500:交易失败,300:可疑订单) |
| status_info | string | 充值返回信息 |
| total_price | decimal | 总支付价格 |
| cards | json | 卡密(仅当订单成功并且商品类型为卡密时返回此数据) |
示例
{
"code": "0",
"message": "",
"data": {
"order_id": 557305089422,
"status": 200,
"status_info": "交易成功",
"total_price": "3.0000",
"cards": [{
"card_no": "vip009",
"card_password": "DDd2kpCxZosyy7d",
"expiration_date": "2025-05-28"
}, {
"card_no": "vip010",
"card_password": "UwQ4WnAKfi6wby6",
"expiration_date": "2025-05-28"
}, {
"card_no": "vip011",
"card_password": "qKgITDZUuahfmiu",
"expiration_date": "2025-05-28"
}]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23