Overview
Pepay SDK (pepay) is the recommended way to integrate Pepay from Node.js and modern browsers.
Why use the SDK:
- Typed: TypeScript-first exports with predictable shapes.
- Safe-by-default: browser runtime blocks server API keys unless explicitly allowed.
- Practical: built-in idempotency keys and retry behavior for common failure modes.
Authentication
Choose the auth mode that matches your surface area:- Merchant server:
apiKey→x-api-key - Commerce server:
commerceApiKey→x-commerce-api-key - Browser/payor:
sessionToken+signature→x-session-token+x-signature - WebSockets in browser/mobile: mint a
ws_tokenserver-to-server
Request
Create an invoice (merchant/server)
Response
Errors
401missing/invalid auth headers409idempotency conflicts on write requests (retry with the sameIdempotency-Key)429rate limits (respectRetry-After)

