🔐Auth
Scenarios:
Merchant calls Xcash API to create an invoice.
Xcash sends invoice notification to the merchant's Webhook URL.
1 Request Header Conventions
XC-Appid
Project AppID
Yes
string
Specifies the project
XC-Nonce
16-64 character random string
Yes
string
Prevents replay attacks, ensures idempotency
XC-Timestamp
Unix timestamp (seconds)
Yes
string
Server requires within ±60 seconds of current time
XC-Signature
Signature string
Yes
string
HMAC-SHA256 result (hex lowercase)
Content-Type
application/json
Yes
string
Requests/notifications are UTF-8 encoded JSON strings
2 Signature Algorithm
Construct message string:
message = nonce + timestamp + request_body.request_bodyis the JSON string of the request body.Keep JSON serialization consistent (recommended to use compact mode: no extra spaces or line breaks).
hmac_keyis obtained from the backend project management section.
Calculate using HMAC-SHA256:
signature = HMAC_SHA256(key=hmac_key, message).Convert the result to a 64-character hexadecimal lowercase string, which becomes
XC-Signature.
Last updated