支付查询 API
支付查询 API 提供了查询订单状态和退款状态的能力,方便开发者在需要时主动查询支付结果。
接入说明
在进行 API 对接之前,开发者需要获取对应的 服务端令牌 作为 API 访问密钥。
生产环境的 API 使用规则如下:
METHOD PATH HTTP/1.1
Host: minihost.tuanjie.cn
Authorization: Bearer <ServiceToken>
Content-Type: application/json
请求体和响应体默认均为 JSON 格式。
订单查询接口
开发者可以通过订单查询接口主动查询订单的支付状态。
POST /game-api/v2/orders/order/query
请求参数说明
| 字段 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| appid | string | 是 | 小游戏的 Game ID |
| cp_order_no | string | 是 | 游戏订单号(开发者系统生成的订单号) |
| channel_order_no | string | 是 | 渠道订单号(平台生成的订单号) |
请求示例
{
"appid": "appid",
"cp_order_no": "cp_order_no",
"channel_order_no": "channel_order_no"
}
响应参数说明
| 字段 | 类型 | 描述 |
|---|---|---|
| code | int | 200 表示成功 |
| message | string | 异常信息 |
| data | Object | 订单信息 |
data 对象说明
| 字段 | 类型 | 描述 |
|---|---|---|
| appid | string | 小游戏的 Game ID |
| cp_order_no | string | 游戏订单号 |
| cp_extra | string | 自定义透传参数 |
| channel_order_no | string | 渠道订单号 |
| amount | int64 | 实际支付金额 |
| quantity | int64 | 购买数量 |
| currency | string | 货币类型,如 CNY |
| coupon_deduct_amount | int64 | 优惠券抵扣金额 |
| product_code | string | 商品编码 |
| product_name | string | 商品名称 |
| product_price | int64 | 商品单价 |
| status | string | 订单状态 |
| created_time | int64 | 订单创建时间戳 |
订单状态说明
| 状态 | 描述 |
|---|---|
| pending | 等待支付 |
| complete | 支付完成 |
| failed | 支付失败 |
| refunded | 已退款 |
响应示例
{
"code": 200,
"message": "success",
"data": {
"appid": "appid",
"cp_order_no": "cp_order_no",
"cp_extra": "extra_info",
"channel_order_no": "channel_order_no",
"amount": 100,
"quantity": 1,
"currency": "CNY",
"coupon_deduct_amount": 0,
"product_code": "example_product_code",
"product_name": "Example Product",
"product_price": 100,
"status": "pending",
"created_time": 1640995200
}
}
退款查询接口
开发者可以通过退款查询接口主动查询退款订单的状态。
POST /game-api/v2/orders/refund/query
请求参数说明
| 字段 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| appid | string | 是 | 小游戏的 Game ID |
| refund_no | string | 是 | 退款单号 |