AinePay
EN中文
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

parametertypedescriptionrequiredexample
orderIdstringMerchant order ID, length 5~256, identifying the order to cancel.yesORDER_10001

Response Fields

Top-level response structure:

fieldtypedescription
successbooleantrue when the request succeeds.
codeintegerBusiness result code. Successful responses return 0.
dataobjectCancelled order business data.
msgstringTypically ok on success; otherwise an error message.

Order data:

parametertypedescriptionrequiredexample
data.idstringAinePay internal order ID.yes123456
data.orderIdstringMerchant-side order ID, same as the request.yesORDER_10001
data.merchantIdintegerMerchant ID.yes20001
data.userIdstringThe user ID assigned by the merchant in the AinePay system.yesU_90001
data.coinstring(enum)Coin.yesUSDT
data.chainstring(enum)Blockchain code.yesETH
data.addressobjectPayment address info. Returned only when status is INIT (awaiting payment); after cancellation the order is CANCEL, so this field is null.conditionalnull
data.qtystringOrder amount as string.yes100.12
data.statusstring(enum)Order status; CANCEL after a successful cancellation.yesCANCEL
data.expiredintegerOrder expiration timestamp in milliseconds.yes1760000600000
data.payExpiredintegerPayment page expiration timestamp in milliseconds.yes1760000300000
data.createdintegerCreation timestamp in milliseconds.yes1760000000000
data.updatedintegerLast update timestamp in milliseconds.yes1760000300000

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 INIT status can be cancelled; calling it on PENDING, PAID, EXPIRED, or REFUND orders returns ORDER_STATUS_INVALID.
  • Cancellation is idempotent: repeated calls on an already cancelled (CANCEL) order still return success.
  • If no order matches the given orderId, PARAMETER_ERROR is returned.
  • Write operations that are too frequent are rate-limited and return RATE_LIMITED.