Payment Query API
The Payment Query API provides the ability to query order and refund status, making it easier for developers to proactively check payment results when needed.
Integration Guide
Before integrating this API, developers need to obtain the corresponding ServiceToken as the API access credential.
The production API is used as follows:
METHOD PATH HTTP/1.1
Host: minihost.tuanjie.cn
Authorization: Bearer <ServiceToken>
Content-Type: application/json
Both request and response bodies use JSON by default.
Order Query API
Developers can use the order query API to proactively check the payment status of an order.
POST /game-api/v2/orders/order/query
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| appid | string | Yes | Minigame Game ID |
| cp_order_no | string | Yes | Game order number, generated by the developer system |
| channel_order_no | string | Yes | Channel order number, generated by the platform |
Request Example
{
"appid": "appid",
"cp_order_no": "cp_order_no",
"channel_order_no": "channel_order_no"
}
Response Parameters
| Field | Type | Description |
|---|---|---|
| code | int | 200 indicates success |
| message | string | Error message |
| data | Object | Order information |
data Object
| Field | Type | Description |
|---|---|---|
| appid | string | Minigame Game ID |
| cp_order_no | string | Game order number |
| cp_extra | string | Custom pass-through parameter |
| channel_order_no | string | Channel order number |
| amount | int64 | Actual payment amount |
| quantity | int64 | Purchase quantity |
| currency | string | Currency type, such as CNY |
| coupon_deduct_amount | int64 | Coupon discount amount |
| product_code | string | Product code |
| product_name | string | Product name |
| product_price | int64 | Product unit price |
| status | string | Order status |
| created_time | int64 | Order creation timestamp |
Order Status
| Status | Description |
|---|---|
| pending | Waiting for payment |
| complete | Payment completed |
| failed | Payment failed |
| refunded | Refunded |
Response Example
{
"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
}
}
Refund Query API
Developers can use the refund query API to proactively check the status of a refund order.
POST /game-api/v2/orders/refund/query
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| appid | string | Yes | Minigame Game ID |
| refund_no | string | Yes | Refund number |
Request Example
{
"appid": "appid",
"refund_no": "refund_no"
}
Response Parameters
| Field | Type | Description |
|---|---|---|
| code | int | 200 indicates success |
| message | string | Error message |
| data | Object | Refund information |
data Object
| Field | Type | Description |
|---|---|---|
| appid | string | Minigame Game ID |
| cp_order_no | string | Game order number |
| channel_order_no | string | Channel order number |
| refund_no | string | Refund number |
| refund_amount | int64 | Refund amount |
| created_time | int64 | Refund request timestamp |
Response Example
{
"code": 200,
"message": "success",
"data": {
"appid": "appid",
"cp_order_no": "cp_order_no",
"channel_order_no": "channel_order_no",
"refund_no": "refund_no",
"refund_amount": 50,
"created_time": 1640995200
}
}