Skip to main content

Error Handling

To simplify client-side error handling logic, our API adopts a unified response structure.

Error Response Mechanism

Unlike traditional REST APIs, when a business logic error occurs, our API will still return an HTTP 200 OK status code.

Do not rely solely on the HTTP status code to judge whether the request was successful. You should check the code field in the response body.

Response Structure

When a request fails, the API will return the following JSON structure:

{
"code": 100101,
"message": "Payment link not found: We can not found payment link of id link_xyz...",
"data": null
}
  • code: Integer error code.
    • 0 (or omitted): Indicates request success.
    • Non-zero: Indicates request failure.
    • For full error codes, please read Error Codes Table →
  • message: Human-readable error description; some errors carry specific dynamic information (such as specific IDs).
  • data: Usually null or not provided in error cases.
Critical Tip

When using HTTP clients (such as Axios, Fetch, RestTemplate), do not configure interceptors to only intercept HTTP 4xx/5xx. You need to judge whether response.body.code is a non-zero value at the business layer.