paysigDocs
PAYMENTS, MADE CLEAR

Help & documentation

Understand PaySig. Set up your project. Accept your first payment.

For developers

Automatic order updates

A webhook is an automatic message from PaySig to your website. It can update an order after payment, without someone watching the dashboard.

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

EventMeaning
invoice.createdPayment instructions issued; not payment confirmation.
payment.confirmedA confirmed receipt, which may still be only a partial payment.
invoice.status_changedInvoice state changed, including partial and late states.
invoice.paidConfirmed receipts reached the expected amount. Match the order and apply your late-payment policy.
payment.review_requiredManual review is needed.

Payloads contain id, type, projectId, createdAt and data. Checkout-related events include the checkout ID and order reference where available.

  1. Verify the signature

    Read the raw body before JSON parsing. Verify PaySig-Signature over PaySig-Timestamp + "." + raw body, using the webhook secret, not the API secret.

  2. Validate the order

    Check the timestamp, expected project and event type. Match the invoice or checkout to a saved order.

  3. Save once, then acknowledge

    Persist PaySig-Event-Id with a unique constraint. Accept the event durably before returning 2xx. Repeated delivery must not fulfil an order twice.

Webhook signature verification helper
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.