Skip to main content

Overview

Orders represent the commerce lifecycle (placed/shipped/delivered/cancelled). Use these endpoints for merchant dashboards and operational tooling.

Authentication

Requires x-commerce-api-key.

Request

List merchant orders

Retrieve an order

Cancel an order

Devnet order simulation (devnet only)

Use this to advance a devnet order through its lifecycle for integration testing and to trigger the same webhook + event stream updates you will receive in production.

How it works

  • Requires a devnet commerce API key and only operates on orders created in devnet.
  • Each simulation emits a commerce.order.updated merchant webhook event and a matching event on the commerce WebSocket stream.
  • If the simulated transition changes the linked invoice state, corresponding invoice.* events are emitted as well.

Suggested end-to-end test flow

  1. Create a devnet order + invoice via commerce.checkout.createInvoice (save orderId and invoiceId).
  2. Configure webhooks or connect a WebSocket listener (examples below).
  3. Simulate the happy path sequence:
    • payment_confirmed
    • payment_settled
    • placed
    • shipped (include tracking)
    • delivery_confirmed
  4. Optionally test failure paths:
    • failed (only valid from status=processing)
    • cancelled (only valid from status=placed)
    • refunded (requires a valid BSC refund destination)

Webhook setup (merchant)

Configure webhooks in the dashboard (or via /api/v1/webhooks/*) to receive:
  • X-Pepay-Event: commerce.order.updated
  • data.object.id set to the orderId you simulated

WebSocket updates (commerce stream)

Response

Example merchant order snapshot (truncated):

Errors

  • 401 missing/invalid commerce API key
  • 404 order not found
  • 400 missing Idempotency-Key on cancel

Examples

  • When building an order dashboard, combine:
    • order snapshot (orders.retrieve)
    • payment status (payments.status)
    • invoice reconciliation (merchantInvoices.status) Next: Payments