For the merchant
Ask your developer for a public HTTPS webhook URL. Save it in the project Webhooks tab. Keep its separate signing secret private. Inspect deliveries and errors in the main Webhooks page.
For the developer
| Event | Meaning |
|---|---|
| invoice.created | Payment instructions issued; not payment confirmation. |
| payment.confirmed | A confirmed receipt, which may still be only a partial payment. |
| invoice.status_changed | Invoice state changed, including partial and late states. |
| invoice.paid | Confirmed receipts reached the expected amount. Match the order and apply your late-payment policy. |
| payment.review_required | Manual review is needed. |
Payloads contain id, type, projectId, createdAt and data. Checkout-related events include the checkout ID and order reference where available.
- Verify the signature
Read the raw body before JSON parsing. Verify
PaySig-SignatureoverPaySig-Timestamp + "." + raw body, using the webhook secret, not the API secret. - Validate the order
Check the timestamp, expected project and event type. Match the invoice or checkout to a saved order.
- Save once, then acknowledge
Persist
PaySig-Event-Idwith a unique constraint. Accept the event durably before returning 2xx. Repeated delivery must not fulfil an order twice.
import { createHmac, timingSafeEqual } from 'node:crypto';
// Use original request bytes, BEFORE JSON parsing. Node header names are lowercase.
export function verifyPaySigWebhook(rawBody, headers, secret, now = Date.now()) {
const timestamp = String(headers['paysig-timestamp'] || '');
const signature = String(headers['paysig-signature'] || '');
if (!/^\d{10}$/.test(timestamp) || !/^v1=[a-f0-9]{64}$/.test(signature)) return false;
if (Math.abs(now / 1000 - Number(timestamp)) > 300) return false;
const expected = createHmac('sha256', secret)
.update(timestamp + '.').update(rawBody).digest();
const received = Buffer.from(signature.slice(3), 'hex');
return received.length === expected.length && timingSafeEqual(received, expected);
}The helper verifies the signature only. Add persistent deduplication, order validation and durable processing in your application.