增加二次确认的文档

This commit is contained in:
CounterFire2023 2023-07-19 19:19:07 +08:00
parent cf3ac60e91
commit 46ecff221a

66
docs/api.md Normal file
View File

@ -0,0 +1,66 @@
#
## 说明
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" // 本地订单流水号
}
}
```