Prerequisites
- Pepay dashboard access
- A commerce API key (scope=commerce)
- A backend service to create checkout orders and handle events
Mainnet access is gated. Request access in the dashboard or via [email protected]. Devnet orders use testnet flows and do not place real retailer orders.Base URL for examples:
https://api-beta.pepay.io
Step 1 - Create a commerce API key
Create a key in the dashboard and store it in your server config. Dashboard: https://pepay.io/sign-inStep 2 - Verify commerce availability
Check that commerce is enabled for your key:Step 3 - Search products (optional)
If you are building a catalog experience, query the search endpoint:Step 4 - Identify the customer
Commerce checkout requires one identifier:customer_id(merchant-owned customer id), orwallet_address+wallet_network
Step 5 - Create checkout (estimate -> address -> invoice)
The checkout flow is three steps:- Estimate: validate items and pricing
- Address: attach shipping details
- Invoice: finalize checkout and create the order
orderId and invoiceId.
Step 6 - Collect payment
Use the commerce invoice to present checkout and collect payment. The payment status and order status move together under the hood.Step 7 - Track order lifecycle
Use these for merchant-facing order state:GET /api/commerce/merchant/ordersGET /api/commerce/merchant/orders/{orderId}- Filter by
customer_idor wallet when listing
- Commerce WebSocket for streaming
commerce.order.* - Webhooks for delivery to your backend (same events)
- Use both WebSockets and webhooks.
- Deduplicate by
event.id. - Keep handlers idempotent.
Step 8 - Cancellation and refunds
If you support cancellations:POST /api/commerce/merchant/orders/{orderId}/cancel- Provide an
Idempotency-Key - Include a refund destination when applicable
Step 9 - Devnet simulation (testing)
On devnet, you can simulate order transitions:POST /api/commerce/devnet/orders/{orderId}/simulate
commerce.order.updated event so you can test your event handling.
Step 10 - Go live
When mainnet access is enabled:- Switch to a mainnet commerce API key.
- Verify webhook delivery in production.
- Monitor commerce order updates and settlement.
Integration checklist
- Commerce API key stored in server config
- Commerce status verified as available
- Customer identification strategy chosen and consistent
- Checkout flow wired (estimate -> address -> invoice)
- Merchant order views implemented
- Webhooks configured and verified
- WebSocket stream added for realtime
- Devnet simulation used to validate lifecycle handling
- Mainnet access requested
SDK references
- Checkout estimate
- Create invoice
- List merchant orders and retrieve an order
- Cancel orders
- Webhook config
- Commerce WebSocket stream

