Skip to main content

Protocol rules

Response format

Success example

Failure example

Parameter specification

Merchant’s order number

The merchant can customize the order number, which should be a combination of English half-width characters such as letters, numbers, dash-, and underscore_, but should not contain Chinese characters or full-width characters, the length should be limited to 100 characters. A unique order number should be generated for each deal (it is recommended to generate the order number based on the current system time plus in a random sequence). To initiate a repayment, the original order number should be submitted to avoid repeated payments.

Amount

All amount parameters are transmitted in strings with an accuracy of 6 decimal places, such as order amount, refund amount, etc. The minimum transaction amount of a single transaction amount is 0.0001, and the maximum is 5000000. The maximum amount that can be transferred using a personal QR code is 10000.

Currency type

For the currencies supported by GatePay, refer to the supported currencies section.

Time

Unless otherwise specified, all time fields should be in the form of millisecond-level Unix timestamps.

Request Headers

Signature

Signature specification

Constructing signature string rules We expect the merchant’s technical developers to construct the signature string according to the rules agreed in the current documentation. GatePay will construct the signature string in the same way. If the merchant constructs the signature string in the wrong way, the signature verification will not pass. The specific format of the signature string is explained first. Each line has one parameter. The end of the line is terminated by \n (a line feed, ASCII value 0x0A). If the parameter itself ends with \n, an additional \n is also required. timestamp\nnonce\nbodyString\n

Signature algorithm

Golang
Java
Python
PHP

Payment callback handling

Callback description

Gate Pay sends the callback message to the callback URL via a POST request. The request body contains JSON-formatted notification parameters. The parameter list is as follows:

Callback signature verification and response

Upon receiving the callback notification, the merchant must verify the signature and respond to the callback. Merchant response fields after signature verification: Response JSON format:

Callback handling steps

Signature verification steps: The callback request will include signature information in the HTTP headers, used for verifying the signature. Details are as follows: To verify the signature, the merchant should construct a signature verification string using the X-GatePay-Timestamp, X-GatePay-Nonce, and the JSON-formatted notification parameters in the request body (see the Signature Algorithm section for details on the signature construction). Then, use the merchant’s payment key to compute the signature and compare it with the X-GatePay-Signature value to ensure the callback is genuinely from Gate Pay.

Signature verification tool

Merchant developers can use this tool to troubleshoot the reasons why signature verification fails. Signature Verification Tool