AinePay
EN中文
API Reference

Responses and Error Codes

This page covers merchant API responses and common error codes.

Unified response structure

Responses uniformly contain four top-level fields: success, code, data, and msg.

fieldtypemeaning
successbooleantrue indicates success; false indicates failure.
codeinteger0 means success; any other value is an error code.
dataobject | array | nullResponse data.
msgstringError message.

Except for authentication failures, which return HTTP 401, all other failures return HTTP 200 with the failure indicated inside the response structure.

Example responses

Typical success response:

{
  "success": true,
  "code": 0,
  "data": {
    "orderId": "ORDER_10001"
  },
  "msg": "ok"
}

Typical business failure response:

{
  "success": false,
  "code": 2,
  "data": null,
  "msg": "parameter error"
}

Typical authentication failure response:

HTTP/1.1 401 Unauthorized

{
  "success": false,
  "code": 14,
  "data": null,
  "msg": "signature is invalid"
}

Error codes

codenamedefault messagemeaning
0OKokRequest succeeded.
1UNKNOWN_ERRORunknown errorUnexpected internal failure.
2PARAMETER_ERRORparameter errorRequest parameters are invalid, missing, or unsupported.
14TOKEN_INVALIDThe token is invalid.API authentication failed because of missing headers, invalid timestamp, invalid signature, expired key, replayed request, or similar signing issues.
15MERCHANT_IS_BANNEDThe merchant is banned.Merchant is unavailable.
18ORDER_PAY_EXPIREDThe order payment has expired.Order has expired.
19RATE_LIMITEDtoo many requestsRequest rate limit exceeded.
24MERCHANT_NOT_ACTIVEmerchant is not active, please rechargeMerchant is not active; please top up the processing fee balance.
26ORDER_STATUS_INVALIDorder status is invalidThe order status does not allow this operation (e.g. cancelling a non-INIT order, or refunding a non-PAID order).
27LEDGER_INCONSISTENTledger inconsistentA ledger consistency check failed and the operation was aborted; please contact AinePay.

Integration recommendations

  • Always inspect the JSON body, not only the HTTP status code.
  • Treat code = 0 as the success condition for business logic.
  • For request signing, refer to Authentication.