Webhooks Guide
Webhooks notify your backend when payment and payout states change. Your handler should verify the signature, process the event idempotently, and return a 2xx response quickly.Prerequisites: a public HTTPS callback URL configured for your account,
and the secret that signs its deliveries. A dedicated webhook secret is shown
only once, when the callback is created or its secret is rotated; store it
separately from your API credentials. Older callback set-ups are signed with
your production API secret instead — see Signing secret.
Events
Each callback destination receives only the events it is subscribed to. A callback URL configured during onboarding is subscribed to
payment.completed, payment.failed and payment.processing by default. If you also need payment.created, payment.cancelled or payment.refunded, add them to the destination’s subscription (webhook settings in the merchant dashboard, or ask support). Without a payment.cancelled subscription, cancelled payments produce no callback.
Payouts are delivered under the same payment.* event names as deposits. Use data.result.payment.destination: "out" to identify payout callbacks. payment.refunded applies to deposits only.
payment.processing is not sent on status changes. It can only arrive as a re-notification requested with payment.notification for a deposit that is still processing. A webhook.test event may be delivered when a test is triggered for your destination; it carries test data in data.test_data and is signed like any other delivery.
Callback URLs
- Your account can have one callback URL for both deposits and payouts, or separate URLs for deposits and for payouts (set up by our team). When a separate URL exists for a direction, events of that direction go only to it.
- The URL must be a public
https://address with a valid TLS certificate. Redirects are not followed: a3xxresponse counts as a failed delivery. - Optional static headers (for example, your own authorization token) can be added to every delivery of a destination. They cannot replace the signature headers listed below.
- A per-payment
webhook_urlis temporarily unavailable.
Payload
Webhook deliveries use an outer envelope. The payment object is underdata.result.payment and uses the same payment projection as the payment.status result.
idis{h_id}:{event}, for examplepay_123:payment.completed. Eachpayment.refundedoccurrence gets its own suffix ({h_id}:payment.refunded:{hash}), so several partial refunds have distinct ids.- The body of a delivery does not change between retry attempts. A manual re-delivery builds a new body with a new
data.request_id, but keeps the sameid. payer,description,client,redirect,status.historyandoperationsappear only when data is available. Whenoperationsis present,data.result.operationrepeats its first element.identifiers.utrappears only when a non-empty UTR/reference value is available.status.erroris a numeric public error code when one is mapped, otherwise an error text ornull.
Headers
All three signatures are sent on every delivery and use the same secret.
Signing Secret
Every destination is signed with exactly one secret:- Dedicated webhook secret (recommended). Generated when a destination is created for an account without an active production API key, for every separate deposit-only or payout-only URL, and whenever the webhook secret is rotated. It is shown once. Rotation takes effect immediately and has no overlap period: retries of earlier events are signed with the new secret.
- Production API secret (compatibility). A callback URL created while your account already had an active production API key is signed with your newest active production API secret. Rotating that API key therefore changes callback verification within seconds. If no active production API key exists, these deliveries fail until a key is active again or the webhook secret is rotated. Rotate the webhook secret to move such a destination to a dedicated secret.
Verify Signatures
Use the exact raw request body bytes. Re-serializing parsed JSON changes whitespace/key ordering and will break verification. PreferX-Webhook-Signature-V3. It binds the timestamp, nonce, delivery id, and raw body. X-Webhook-Signature-V2 and X-Data-Hash remain for backward-compatible verification.
For replay protection, reject timestamps more than a few minutes away from your clock (each attempt carries a fresh timestamp, so a 5-minute window is safe) and remember recently seen X-Webhook-Nonce values. Do not reject a repeated X-Webhook-Id: it is the same on every retry of a delivery.
Retry Behavior
A delivery succeeds when your endpoint answers with any HTTP2xx status within the timeout. The response body is ignored. Any other status (including 3xx redirects), a timeout, a connection or TLS error, or a URL that fails validation at delivery time is a failed attempt.
Defaults per destination:
The first attempt is made right after the event. Retries use exponential backoff with jitter: retry
n waits between 50% and 100% of base delay × 2^(n−1), at least 1 second and at most 24 hours. Retries are picked up by a scheduler that runs every 30 seconds, so with the defaults all three attempts happen within one to two minutes. The timeout and number of attempts (up to 10) can be adjusted per destination.
If your endpoint keeps returning server errors or timing out, deliveries to it are paused for a short time (about two minutes by default). Paused deliveries are rescheduled and do not use up attempts.
After the last failed attempt there are no further automatic retries. To recover, query payment.status, use the payment-level resend, or call payment.notification.
Delivery is at-least-once and order is not guaranteed — for example, a retried payment.created can arrive after payment.completed. Your handler must be idempotent.
Handling Statuses
Usepayment.status.final to decide whether the payment reached a terminal state, and payment.status.status to decide which one. Do not rely on success alone: refunds are final with success: true.
Per-Payment Webhook URLs
When the field becomes available again, it works as follows:- The URL must be an absolute public
https://URL. It is validated when the payment is created and again before each delivery. - The URL receives only that payment’s
payment.created,payment.completedandpayment.failedevents — notpayment.cancelledorpayment.refunded. Your account-level callback keeps receiving its own subscribed events as well. - Deliveries are signed with a secret derived from the API secret that authenticated the create request: lowercase hex
HMAC-SHA256(apiSecret, "quadpay:merchant-webhook-signing:v1"). Do not verify with the API secret itself. - Up to 3 attempts, with a 60-second base retry delay.
Best Practices
- Verify every signature before processing.
- Return 2xx quickly and process heavy work asynchronously.
- Deduplicate on the body
id(it identifies the payment event); logX-Webhook-IdandX-Webhook-Noncefor support. - Store
data.request_id,identifiers.c_id, andidentifiers.h_idfor support and reconciliation. - Treat webhook delivery as at-least-once and unordered; keep polling
payment.statusas a fallback for payments that stay non-final.
