How signature generation works
- Collect request parameters
- Sort parameters by name
- Append your
client_key - Hash the final string
- Send the signature in the request header
Step 1: Sort parameters
Sort all request parameters by parameter name in ASCII ascending order. Example:| Parameter | Value |
|---|---|
| mchid | ZaMVg12345 |
| txamt | 100 |
| txcurrcd | HKD |
Step 2: Append your client key
Append your secretclient_key to the end of the string.
If:
Step 3: Hash the string
Hash the final string. SHA256 is recommended.MD5 may be required by certain channels — follow the API specification. Example:
Step 4: Add signature to header
Include the hash result in the request header:Important Rules
- Sort parameters alphabetically by name.
- Do not include empty or null parameters.
- Do not include the signature itself in the signing string.
- Parameter names and values are case-sensitive.
- Use UTF-8 encoding when building the string.
- Do not include spaces, line breaks, or extra characters.
Include
mchid in the signature only if it is part of the request parameters.