Every API request to XPayLabs must include a cryptographic signature. This page details the exact signing algorithm, the purpose of each field, and common pitfalls.Documentation Index
Fetch the complete documentation index at: https://docs.xpaylabs.com/llms.txt
Use this file to discover all available pages before exploring further.
Signing Algorithm
Thesign field is computed as:
datais the request body payload (thedatafield ofReqPayload)merchant_tokenis your configured secret tokenHMAC-SHA256produces a binary digestHEXconverts it to a lowercase hexadecimal string (64 characters)
Important: JSON Serialization
Thedata object must be serialized to JSON with no extra whitespace. Different JSON libraries may produce different output:
| Library | Output | Valid? |
|---|---|---|
JSON.stringify(obj) | {"amount":"100.00","symbol":"USDT","chain":"TRON"} | ✅ Yes |
json.dumps(obj, separators=(",",":")) | {"amount":"100.00","symbol":"USDT","chain":"TRON"} | ✅ Yes |
json.dumps(obj, indent=2) | Formatted with spaces/newlines | ❌ No |
Request Envelope
Each request must include these four fields as a JSON object:Language Examples
Node.js
Python
Java
Go
Verification
XPayLabs verifies each request by:- Recomputing the HMAC-SHA256 signature from the
datafield and your stored merchant token. - Checking that the computed signature matches the provided
signvalue. - Validating that the
timestampis within 5 minutes of the server clock. - Ensuring the
noncehas not been used before.
401 Unauthorized response:
GET Request Signing
ForGET requests that require authentication (e.g., /v1/order/status/{orderId}, /v1/order/pay, /v1/order/getOrderStatus), the sign parameter is passed as a query string value. The signature is computed over the relevant parameters (typically orderId):

