Webhooks
Get notified the moment an invoice changes status.
Events
| Event | When |
|---|---|
invoice.confirming | Full amount seen, waiting for confirmations. |
invoice.paid | Payment confirmed. |
invoice.partial | Part of the amount arrived. |
invoice.expired | The invoice expired unpaid. |
invoice.cancelled | You cancelled the invoice. |
Payload
POST https://shop.example/uxa-webhook
Content-Type: application/json
X-UXa-Event: invoice.paid
X-UXa-Delivery: 812
X-UXa-Signature: t=1792681200,v1=5f0c…e9
{
"id": "evt_Qm3p…",
"type": "invoice.paid",
"created": 1792681200,
"previous_status": "confirming",
"data": { "invoice": { "id": "inv_7fK2…", "status": "paid", "order_id": "1042" } }
}
Verify the signature
Compute HMAC-SHA256(secret, t + "." + raw_body) with your webhook secret (shown in the app) and compare it to v1. Reject events older than five minutes.
$body = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_UXA_SIGNATURE'] ?? '';
parse_str(str_replace(',', '&', $header), $sig);
$expected = hash_hmac('sha256', $sig['t'] . '.' . $body, getenv('UXA_WEBHOOK_SECRET'));
if (!hash_equals($expected, $sig['v1'] ?? '') || abs(time() - (int) $sig['t']) > 300) {
http_response_code(400);
exit;
}
$event = json_decode($body, true);
if ($event['type'] === 'invoice.paid') {
markOrderPaid($event['data']['invoice']['order_id']);
}
http_response_code(200);
import crypto from 'node:crypto';
export function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 || ''));
}
Retries
Answer with any 2xx status within 10 seconds. Otherwise the delivery is retried after 1 min, 5 min, 15 min, 1 h, 3 h, 6 h, 12 h and 24 h. Webhook URLs must use HTTPS and resolve to a public address. Handle events idempotently — the same event can arrive more than once.
Test it
Use Send test webhook in the app to deliver a test event to your URL and see the response code.