POST requests whenever an order or collection changes state.
How do webhooks work?
- You configure a
callback-urlandwebhook-secretin the gateway configuration. - When an event occurs (e.g., a payment is detected), the gateway constructs a
NotifyPayloadand sends it to your URL. - Your server verifies the HMAC-SHA256 signature and processes the event.
What is the webhook payload format?
Every webhook follows theNotifyPayload format:
What webhook event types are available?
Order Events
Collection (Settlement) Events
Signature Verification
Every webhook includes asign field computed as:
Delivery Guarantees
- At-least-once delivery. The same event may arrive more than once under rare conditions. Use the
noncefield for deduplication. - Retry with backoff. If your endpoint returns a non-
2xxstatus or times out, XPayLabs retries with exponential backoff. - Ordering. Events for a single order are delivered in sequence. Events across different orders may arrive out of order.
Best Practices
- Always verify the signature. Never process a webhook without validating the
signfield. - Return 200 quickly. Acknowledge receipt immediately and process the event asynchronously.
- Deduplicate with
nonce. Store processed nonces to handle duplicate deliveries safely. - Use
ORDER_PENDING_CONFIRMATIONfor early UX. Show “payment detected” in your UI before the transaction is fully confirmed. - Handle
ORDER_SUCCESSfor fulfillment. This is the signal to deliver goods or services.

