Payout Callback

Payout callbacks use the same signature headers and retry mechanism as pay-in callbacks.

The platform calls back only when a payout reaches the confirmed or failed final state.

POSTnotifyUrl from the create payout order request body

Request Headers

FieldTypeRequiredDescription
content-typeapplication/jsonYesAlways application/json.
x-callback-timestampstringYesCallback timestamp in milliseconds.
x-callback-noncestringYesCallback nonce.
x-callback-signaturestringYesHMAC-SHA256(apiKey, timestamp + "." + nonce + "." + rawBody)。
x-callback-signature-algorithmstringYesAlways HMAC-SHA256.
x-callback-signature-versionstringYesAlways v1.

Request Parameters

FieldTypeRequiredDescription
merchantUidstringYesMerchant UID.
orderNostringYesPlatform payout order number.
merchantOrderNostring | nullYesMerchant order number.
chainCodestringYesChain code.
tokenSymbolstringYesToken symbol.
fromAddressstring | nullYesSender address.
toAddressstringYesReceiving address.
txHashstring | nullNoOn-chain hash.
amountstringYesPayout amount.
statusstringYesFinal payout state: confirmed or failed.
failedStagestringNoReturned only when status=failed.

Request Example

{
  "merchantUid": "880001",
  "orderNo": "PO1776193200A1B2C3D4",
  "merchantOrderNo": "PO202604150001",
  "chainCode": "TRON",
  "tokenSymbol": "USDT",
  "fromAddress": "TNjBrNq2a9FK2vwu4W9C1QdLKSZ42Yx5YY",
  "toAddress": "TS7b7iD8G2PaPqK1TqSmLJ9nrrYH4oKX1S",
  "txHash": "b3d4fb0cb11eb86bb906d1e0ee3b84e17f40d5441d1e4c651ea46920a48a9a01",
  "amount": "35.500000",
  "status": "confirmed"
}

Response Fields

FieldTypeRequiredDescription
HTTP Status200-299YesAny 2xx response is treated as success.
Response Bodystring | jsonNoThe response body can be customized.

Response Example

HTTP/1.1 200 OK
Content-Type: text/plain

success

Code Examples

Run: save Java as UUGateExample.java (UUGateCallback.java for callbacks) and use java filename; PHP: php example.php; Go: go run example.go; Node.js: node example.mjs. Callback verifiers read the raw body from standard input.

import { createHmac, timingSafeEqual } from 'node:crypto';

function required(name) {
  const value = process.env[name]?.trim();
  if (!value) throw new Error(name + ' is required');
  return value;
}
const key = required('UUGATE_API_KEY');
const timestamp = required('UUGATE_CALLBACK_TIMESTAMP'), nonce = required('UUGATE_CALLBACK_NONCE');
const signature = required('UUGATE_CALLBACK_SIGNATURE');
const chunks = [];
for await (const chunk of process.stdin) chunks.push(chunk);
const rawBody = Buffer.concat(chunks);
const expected = createHmac('sha256', key).update(timestamp + '.' + nonce + '.', 'utf8').update(rawBody).digest();
const actual = Buffer.from(signature, 'hex');
if (!/^[a-fA-F0-9]{64}$/.test(signature) || actual.length !== expected.length || !timingSafeEqual(expected, actual))
  throw new Error('Invalid callback signature');
console.log('VERIFIED');

Notes

  • Handle callbacks idempotently by orderNo; only confirmed or failed final states are sent automatically.
  • This code only verifies callbacks. Pass the raw request body to standard input and map callback headers to UUGATE_CALLBACK_TIMESTAMP, UUGATE_CALLBACK_NONCE and UUGATE_CALLBACK_SIGNATURE. UUGATE_API_KEY must be the key used to create the order. Then validate the order and persist it idempotently in a transaction before returning HTTP 2xx.