API Reference
Cancel Order
Actively cancel an order that has not been paid. Only orders in INIT status can be cancelled; after cancellation the order status becomes CANCEL.
Endpoint
- Method:
POST - Path:
/api/merchant/order/cancel - Authentication: Required
- Content-Type:
application/x-www-form-urlencoded
Request Parameters
| parameter | type | description | required | example |
|---|---|---|---|---|
| orderId | string | Merchant order ID, length 5~256, identifying the order to cancel. | yes | ORDER_10001 |
Response Fields
Top-level response structure:
| field | type | description |
|---|---|---|
success | boolean | true when the request succeeds. |
code | integer | Business result code. Successful responses return 0. |
data | object | Cancelled order business data. |
msg | string | Typically ok on success; otherwise an error message. |
Order data:
| parameter | type | description | required | example |
|---|---|---|---|---|
data.id | string | AinePay internal order ID. | yes | 123456 |
data.orderId | string | Merchant-side order ID, same as the request. | yes | ORDER_10001 |
data.merchantId | integer | Merchant ID. | yes | 20001 |
data.userId | string | The user ID assigned by the merchant in the AinePay system. | yes | U_90001 |
data.coin | string(enum) | Coin. | yes | USDT |
data.chain | string(enum) | Blockchain code. | yes | ETH |
data.address | object | Payment address info. Returned only when status is INIT (awaiting payment); after cancellation the order is CANCEL, so this field is null. | conditional | null |
data.qty | string | Order amount as string. | yes | 100.12 |
data.status | string(enum) | Order status; CANCEL after a successful cancellation. | yes | CANCEL |
data.expired | integer | Order expiration timestamp in milliseconds. | yes | 1760000600000 |
data.payExpired | integer | Payment page expiration timestamp in milliseconds. | yes | 1760000300000 |
data.created | integer | Creation timestamp in milliseconds. | yes | 1760000000000 |
data.updated | integer | Last update timestamp in milliseconds. | yes | 1760000300000 |
Example Response
{
"success": true,
"code": 0,
"data": {
"id": 123456,
"orderId": "ORDER_10001",
"merchantId": 20001,
"userId": "U_90001",
"coin": "USDT",
"chain": "ETH",
"address": null,
"qty": "100.12",
"status": "CANCEL",
"expired": 1760000600000,
"payExpired": 1760000300000,
"created": 1760000000000,
"updated": 1760000300000
},
"msg": "ok"
}Notes
- Only orders in
INITstatus can be cancelled; calling it onPENDING,PAID,EXPIRED, orREFUNDorders returnsORDER_STATUS_INVALID. - Cancellation is idempotent: repeated calls on an already cancelled (
CANCEL) order still return success. - If no order matches the given
orderId,PARAMETER_ERRORis returned. - Write operations that are too frequent are rate-limited and return
RATE_LIMITED.