Skip to main content

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: apiKeyx-api-key
  • Commerce server: commerceApiKeyx-commerce-api-key
  • Browser/payor: sessionToken + signaturex-session-token + x-signature
  • WebSockets in browser/mobile: mint a ws_token server-to-server

Request

Create an invoice (merchant/server)

Response

Errors

  • 401 missing/invalid auth headers
  • 409 idempotency conflicts on write requests (retry with the same Idempotency-Key)
  • 429 rate limits (respect Retry-After)
  • SDK errors include the API code and message so you can map to user-friendly copy.

Examples

Poll invoice status until it reaches a terminal state:
Next: Install