Signing
Requests and callbacks use the same HMAC-MD5 algorithm. Sign the marked fields you send. After a callback, recompute from fields marked signable and compare.
Generate a signature as follows:
- Select fields marked signable, sort them by ASCII key name, and join them as
key1=value1&key2=value2…to create stringA. - HMAC-MD5 stringA with
appSecretas the key, then uppercase the hex digest — that issignature. The secret is only the HMAC key; do not append it to stringA.
Keys are case-sensitive. Use fields marked Sign = Yes in each API table. signature only carries the result.
Example (PHP)
Signable fields for Submit Order, already in ASCII order:
$stringA = 'amount=10.99&appId=k-mch8x2k1p4q9&asset=USDT¤cy=USD&merchantOrderNo=ORD-20260822-0001&network=TRC¬ifyUrl=https://merchant.example.com/ucashier/notify';
$appSecret = 'sk-w7Kp2nQm4xR9aB3c';
$signature = strtoupper(hash_hmac('md5', $stringA, $appSecret));
// 07BA8514788F143D2437E0D6F4C028D0Example (Node.js)
const crypto = require('crypto');
const stringA = 'amount=10.99&appId=k-mch8x2k1p4q9&asset=USDT¤cy=USD&merchantOrderNo=ORD-20260822-0001&network=TRC¬ifyUrl=https://merchant.example.com/ucashier/notify';
const appSecret = 'sk-w7Kp2nQm4xR9aB3c';
const signature = crypto.createHmac('md5', appSecret).update(stringA, 'utf8').digest('hex').toUpperCase();Example (Java)
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
String stringA = "amount=10.99&appId=k-mch8x2k1p4q9&asset=USDT¤cy=USD&merchantOrderNo=ORD-20260822-0001&network=TRC¬ifyUrl=https://merchant.example.com/ucashier/notify";
String appSecret = "sk-w7Kp2nQm4xR9aB3c";
Mac mac = Mac.getInstance("HmacMD5");
mac.init(new SecretKeySpec(appSecret.getBytes(StandardCharsets.UTF_8), "HmacMD5"));
byte[] digest = mac.doFinal(stringA.getBytes(StandardCharsets.UTF_8));
StringBuilder hex = new StringBuilder();
for (byte value : digest) {
hex.append(String.format("%02X", value & 0xFF));
}
String signature = hex.toString();Example (Python)
import hashlib
import hmac
string_a = (
"amount=10.99&appId=k-mch8x2k1p4q9&asset=USDT¤cy=USD&merchantOrderNo=ORD-20260822-0001&network=TRC¬ifyUrl=https://merchant.example.com/ucashier/notify"
)
app_secret = "sk-w7Kp2nQm4xR9aB3c"
signature = hmac.new(app_secret.encode("utf-8"), string_a.encode("utf-8"), hashlib.md5).hexdigest().upper()