Documentation Index
Fetch the complete documentation index at: https://docs-alpha.pepay.io/llms.txt
Use this file to discover all available pages before exploring further.
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.
Authentication
Deliveries are signed usingX-Pepay-Timestamp and X-Pepay-Signature. Validate signatures before processing payloads.
See Webhook Authentication.
Request
- 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.
Response
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)
Errors
- Return
400for invalid signatures or malformed payloads. - Non-2xx responses trigger retry delivery attempts.
- Ensure handlers are idempotent because duplicate deliveries can occur.
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.
Examples
- Single endpoint for all events:
enabled_events=["invoice.*","invoice_payment.*","commerce.order.*"] - Split by environment: one
devnetendpoint and onemainnetendpoint, each with different secrets.

