API Request

API Request

The merchant needs to obtain a token before using the API normally

Send Request Use different Service Parameters to access the API

  • Serialize all business parameters into json to generate bizContent

  • Use the merchant's private key to sign bizContent

  • AES encryption of bizContent

Common Request

POST {{ base_url }}/api/v2/pay

Method: POST

Headers

Name
Type
Description

Authorization*

String

Bearer token

Request Body

Name
Type
Description

service*

String

Sample: createPayer

bizContent*

String

AES encrypted containing all business parameters

sign*

String

Signature

API Request Sample

API Response

The API returns in json format. When statusCode=0, it means the API request is successful. The specific business return parameters are in bizContent.

Handling Return Parameters

  • Decrypt the bizContent field by using AES

  • Verify the signature by decrypted bizContent

The API returns responses in a standard JSON format that includes the following properties in response payload:

  1. status: An integer representing the status of the response.

  2. errors: A list of error objects that provide additional information about any errors that occurred during processing.

  3. data: The actual data payload of the response, which can be of any type.

bizContent Business Data Sample

The table below shows the property name, data type, possible values (for the status property), and a description of what each property means.

PROPERTY
TYPE
VALUES
DESCRIPTION

status

integer

0 or -1

Status of the response: 0 indicates success, -1 indicates failure.

errorCode

String

Application specific error code about any error that occurred during processing.

errorMessage

String

Error Description

data

any

Any

The actual data payload of the response, which can be of any JSON-compatible type

Successful Response:

A successful response payload will have:

  • Status property with a value of 0

  • Error Code property as null

  • Error Message property as null

  • Data property containing the requested data (JSON-compatible)

For example, a successful response to a request for getting cardholders might look like this:

Unsuccessful Response:

An unsuccessful response will have:

  • Status property with a value of -1

  • Error Code property with a value

  • Error Code property with a description

  • Data property as null

If there is no associated error code for the error, a default error code value of -1 will be returned.

For example, an unsuccessful response with an invalid userID might look like this:

Last updated