Overview
Webhooks deliver canonicalPepayEvent objects to your server when merchant or commerce activity changes. They mirror the same event types available via WebSockets, but are optimized for durable server-to-server processing.
How webhooks work
- Create a webhook endpoint in the dashboard (or via the API).
- Choose an environment scope:
devnet,mainnet, or all environments. - Subscribe to event types using
enabled_events(filters). - Pepay delivers signed HTTPS POSTs with a canonical event payload.
Access and subscriptions (enabled_events)
Each webhook endpoint has its own subscription list. You only receive events that match the list. Allowed event types:invoice.*(all invoice lifecycle events)invoice.created,invoice.updatedinvoice_payment.*(all payment lifecycle events)invoice_payment.created,invoice_payment.updatedcommerce.order.*(all commerce order lifecycle events)commerce.order.created,commerce.order.updatedtest.ping(test delivery)
invoice.* matches both invoice.created and invoice.updated.
Environment filtering
The webhookenvironment field controls which events are delivered:
nullor omitted: receive devnet and mainnet events.devnetormainnet: receive only matching events.
Payload shape
Webhook payloads use the samePepayEvent envelope as WebSockets:
Headers you can rely on
X-Pepay-Event: event type stringX-Pepay-Event-ID: event idX-Pepay-Timestamp: signed timestamp (ms)X-Pepay-Network-Environment:devnetormainnet(when available)
Delivery semantics
- At-least-once delivery; dedupe by
event.id(orX-Pepay-Event-IDheader). - Expect retries on non-2xx responses.
Webhooks vs WebSockets
- WebSockets provide realtime streams with replay + REST backfill for resilient live updates.
- Webhooks remain the durable server-to-server channel for side effects, analytics, and audit trails.
- For merchants, WebSockets are a scalable redundancy layer alongside webhooks: use both, dedupe by
event.id.

