查询订单
订单查询订单区块链订单详情
本文档描述了 Spell 中的订单查询 API 的使用方式。
在订单生成后,用户可以通过 Web 界面或 API 请求来查询订单。
订单详情包含 Spell 订单基本信息,以及区块链交易明细:区块链、区块编号、交易哈希、时间戳、发送方、接收方、转账币种、转账金额、网络费用等。并且可以通过交易哈希在对应的区块链浏览器中验证转账明细。
API 文档
准备工作
发起请求前可以进行如下准备,查询到的ID可用于请求参数中的过滤条件:
- 获取支持的区块链列表:
GET /api/v1/chain
- 获取支持的币种列表:
GET /api/v1/token
- 获取已经创建的地址列表:
GET /api/v1/address
请求
GET /api/v1/order
- 请求头:
X-API-Key: '<API Key>'
- 请求参数:
参数名称 | 类型 | 必填 | 其他要求 | 参数描述 |
---|---|---|---|---|
page | number | 否 | 页码,默认为1 | |
size | number | 否 | 每页数量,默认为10 | |
sort | string | 否 | 排序字段,通过添加- 前缀倒序。默认:-created | |
type | string | 否 | 订单确认类型 | |
group_no | string | 否 | 组编号 | |
order_no | string | 否 | 订单号 | |
chain | string | 否 | 15位字符串 | 从准备工作中提前获取的链ID |
token | string | 否 | 15位字符串 | 从准备工作中提前获取的币种ID |
address | string | 否 | 15位字符串 | 从准备工作中提前获取的地址ID |
响应
响应类型为 application/json
。
total
为满足条件的总数量page
和size
为当前分页条件items
为当前页数据,类型为订单数组。
成功 200
{
"code": 200,
"page":1,
"size":10,
"total": 100,
"items": [
{
"id": "order_id",
"type": "tail", // id | tail
"group_no": "",
"order_no": "external_order_no",
"user": "RELATION_RECORD_ID",
"chain": "RELATION_RECORD_ID",
"address": "RELATION_RECORD_ID",
"token": "RELATION_RECORD_ID",
"amount": 123,
"tail": "5623", // empty for id type
"status": 0, // 0: pending, 1: success, 2: overdue
"pay_time": "", // empty when created
"timeout": 1800, // seconds, default 1800
"return_url": "https://domain.com/path",
"created": "2022-01-01 10:00:00.123Z",
"updated": "2022-01-01 10:00:00.123Z"
}
]
}
失败 400
{
"code": 400,
"message": "error message"
}