Prerequisites
- Pepay dashboard access
- A merchant API key (scope=merchant)
- A backend service to create invoices and handle events
Mainnet access is gated. Request access in the dashboard or via [email protected]. Until then, use devnet keys and testnet flows.Base URL for examples:
https://api-beta.pepay.io
Step 1 - Create a merchant API key
Create a key in the dashboard and store it in your server config. Dashboard: https://pepay.io/loginStep 2 - Create an invoice (server)
Invoices are the source of truth for payment status and reconciliation.invoice_id: canonical id for reconciliationpayment_url: hosted checkout link (valid until expiration)payment_session_headers: session headers for embedded checkout flows
Step 3 - Present checkout (payor)
Send the payor to the hostedpayment_url, or embed checkout using the payment session headers (x-session-token and x-signature) on payor endpoints.
Step 4 - Track status (server)
Use realtime delivery and/or polling:- Webhooks: configure in the dashboard and process
invoice.updatedandinvoice_payment.updated. - Merchant WebSocket: connect with an API key or ws_token to stream the same events in realtime.
- Use both webhooks and WebSockets for resiliency.
- Deduplicate by
event.id. - Keep handlers idempotent.
Step 5 - Reconcile
Use invoice status for business decisions and reconciliation:GET /api/v1/invoices/{invoiceId}GET /api/v1/invoices/{invoiceId}/status
Step 6 - Go live
When mainnet access is enabled:- Switch to a mainnet API key.
- Verify webhook delivery in production.
- Monitor invoice lifecycle events and settlement.
Integration checklist
- Merchant API key stored in server config
- Invoice creation wired to your backend
- Hosted or embedded checkout presented to payors
- Webhooks configured and verified
- WebSocket or polling added for redundancy
- Invoice reconciliation logic implemented
- Devnet flows verified and mainnet access requested
SDK references
- Create an invoice
- Poll status and wait for terminal status
- Event recovery
- Realtime stream
- Payor session details (embedded)

