pay-svr/docs/api.md
2023-07-27 12:02:34 +08:00

75 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
## 说明
3. 接口签名字段说明
```
# 1. 将参与签名的参数按照key=value的格式并按照参数名ASCII字典序升序排序, 例如:
var signStr = 'timestamp=1624332778169&tokenid=10012211250000001&val1=v1&val2=v2'
# 2. 把我们提供的 secretKey(37284c327e10d8b73cf4325f33a3de4b34032e3f) 作为key, 使用HMAC-SHA256得到签名
var sign = HmacSHA256(signStr, secretKey)
```
4. 如无特殊说明, 所有接口返回 json, 顶级结构如下, 接口 Response 的数据结构说明只包含 data 部分
```JSON
{
"code": 0, //0:成功 2: 缺少必要参数(accountid, sessionid) 4: 帐号被封, 5: 帐号未找到 100: 所有未定义的错误
"msg": "", //错误描述, 一般在code=0时, 该字段为空
"data": {}, // 数据
}
```
## 接口列表
### 1. 获取订单信息
1. Method: GET
2. URI: /api/internal/alchemy/order/:id
3. HOST: https://pay.cebggame.com/v2
> url param 参数
| 字段 | 说明 |
| --------- | -------------------- |
| timestamp | 时间戳, 5 分钟内有效 |
| sign | 签名 |
4. 签名说明
# 1. 将参与签名的参数按照 key=value 的格式,并按照参数名 ASCII 字典序升序排序, 例如:
var signStr = 'id=64b783f19cc05a67d33b4487&timestamp=1624332778'
# 2. 使用 HMAC-SHA256 得到签名
var sign = HmacSHA256(signStr, secretKey)
5. Response: JSON
```js
{
"errcode": 0,
"errmsg": '', //只有在发生错误时, 才有该字段
"data": {
"account_id": "6517_2006_0_102830253510763522848",
"order_id": "2023071906342410001270", // 游戏服开始购买时生产的订单号
"status": 99, // 0: 默认状态, 未支付
// 3, // 已支付
// 9 // 成功
// 99, // 交易失败
"id": "64b783f19cc05a67d33b4487", // 本地订单流水号
"fiat": "USD", // 法币名称
"fiat_amount": "1.49", // 法币金额
"country": "US", // ISO 3166-1 二位字母国家code
"payway_code": "10001", // 支付方式代码
"crypto": "CEG", // 购买的crypto名称
"network": "ARBITRUM", // 购买的网络名称
"crypto_amount": "7.6", // 实际支付的crypto数量
"address": "0x123456...def", //实际转账地址
}
}
```