Payment - Order Query
This interface should be called on the server side. It must never be called directly from the front end (APP client, web page, minigame, etc.) to avoid the risk of credential leakage.
Interface Description
Interface Name pay.orderQuery
Description Query a payment order.
Note: This interface requires service communication secondary encryption and signatures: request parameters must be encrypted and signed, and responses must be signature-verified and decrypted. This effectively prevents data tampering and leakage.
Call Method
HTTPS Call
http
POST /v1/pay/order/query?access_token=ACCESS_TOKENPrepend the base URL for your game's service region to the API path. See Service Regions and API Addresses.
Request Parameters - Query
| Field | Type | Default | Required | Description |
|---|---|---|---|---|
| access_token | string | Yes | API call credential |
Request Parameters - Body
| Field | Type | Default | Required | Description |
|---|---|---|---|---|
| env | number | Yes | Environment: 0-production, 1-sandbox | |
| out_trade_no | string | Yes | Business order number |
Response
The returned JSON data package
| Field | Type | Description |
|---|---|---|
| errcode | int32 | Error code |
| errmsg | string | Error message |
| mode | string | Payment type. Currently supported types: goods, game |
| product_id | string | Product ID |
| product_name | string | Product name |
| quantity | number | Purchase quantity |
| unit_price | number | Unit price (in cents) |
| currency | string | Currency: CNY |
| out_trade_no | string | Business order number |
| sud_trade_no | string | SUD order number |
| env | number | Environment: 0-production, 1-sandbox |
| status | string | Status, enum: PAYING-paying, PAID-paid, CLOSED-closed, DELIVERED-delivered, REFUNDING-refunding, REFUNDED-refunded, REFUND_FAIL-refund failed |
| attach | string | Pass-through data |
Example
cURL Request
bash
# Mainland China example; use the corresponding base URL for other regions.
BASE_URL='https://cn-cpapi.sudbiz.cloud'
curl -X POST \
"${BASE_URL}/v1/pay/order/query?access_token=ACCESS_TOKEN" \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"env": 0,
"out_trade_no": "order_20231024123456"
}'Request Example
json
{
"env": 0,
"out_trade_no": "order_20231024123456"
}Response Example
json
{
"errcode": 0,
"errmsg": "ok",
"mode": "goods",
"product_id": "item_001",
"product_name": "100 Coins",
"quantity": 1,
"unit_price": 600,
"currency": "CNY",
"out_trade_no": "order_20231024123456",
"sud_trade_no": "sud_20231024123456",
"env": 0,
"status": "PAID",
"attach": "custom_passthrough_data"
}