Orders

Orders are the core payment resource. Creating an order auto-generates a payment link for hosted checkout.

Payment flows

Hosted checkout (recommended): create order → share paymentLinkUrl → customer pays on /pay/{token} using your enabled gateway(s) → order.paid webhook. See payment links.

Personal QR (embedded): e.g. WeChat Pay or Alipay — create order → initiate payment with a configured gateway slug → customer scans QR → upload voucher → admin verifies → webhook fires.

Direct gateway API: use POST …/gateways/{slug}/payments for Stripe, Paystack, PayPal, and other registry gateways.

Supported gateways

Each project can enable one or more payment gateways. Merchants configure credentials and collection profiles per channel in the dashboard. Customers see only the methods enabled for that project at checkout.

Cards & embedded wallets

  • Stripe stripe
  • Visa (Cybersource) visa
  • Google Pay googlepay
  • Apple Pay applepay

Global checkout

  • PayPal paypal

China personal QR

  • WeChat Pay wechatpay
  • Alipay alipay

African gateways

  • Paystack paystack
  • Flutterwave flutterwave

Mobile money

  • M-Pesa mpesa
  • MTN MoMo mtnmomo
  • Airtel Money airtelmoney

Bank transfer & remittance

  • Bank Transfer banktransfer
  • Western Union westernunion
  • MoneyGram moneygram

The registry in src/lib/modules/payments/registry.ts is extensible — additional gateways can be added without changing your integration contract.

Configure gateways in the dashboard →

Create an order

POST/api/v1/projects/:projectId/orders

Creates an order and auto-generates a payment link.

Permission: orders:write

Parameters

NameTypeRequiredDescription
amountMinor
integerYesAmount in minor units (CNY fen). 9900 = ¥99.00
currency
stringNoISO 4217 code. Default CNY.
description
stringNoCheckout label, max 300 characters.
buyerEmail
stringNoCustomer email for receipts.
buyerName
stringNoCustomer display name.
metadata
objectNoString key-value pairs (e.g. subscription_id, plan, billing_period) — echoed in webhooks.

Response

{
  "success": true,
  "data": {
    "order": {
      "id": "ord_xxxxxxxx",
      "reference": "TP-202603-001",
      "amountMinor": 9900,
      "currency": "CNY",
      "status": "pending",
      "paymentLinkUrl": "https://pay.andgroupco.com/pay/pl_test_…"
    }
  }
}
Example request
curl -s -X POST "https://pay.andgroupco.com/api/v1/projects/PROJECT_ID/orders" \
  -H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: quickstart-order-1" \
  -d '{
    "amountMinor": 9900,
    "currency": "CNY",
    "description": "Pro Plan — March 2026",
    "buyerEmail": "customer@example.com",
    "buyerName": "Jane Doe",
    "metadata": {
      "subscription_id": "sub_abc123",
      "plan": "pro",
      "billing_period": "2026-03"
    }
  }'

Send Idempotency-Key on POST requests to safely retry without duplicate orders (24h cache).

Read & list orders

GET/api/v1/projects/:projectId/orders/:id

Retrieve a single order by id.

Permission: orders:read
GET/api/v1/projects/:projectId/orders

Cursor pagination: ?limit=20&starting_after={order_id}

Permission: orders:read

Initiate payment (personal QR)

Starts a personal collection QR session for the order. The gateway field must match an enabled, configured channel for the project (collection profile for WeChat Pay / Alipay today).

POST/api/v1/projects/:projectId/orders/:id/payments

Initiate personal QR payment on an enabled gateway channel.

Permission: orders:write

Parameters

NameTypeRequiredDescription
gateway
stringYesEnabled personal QR gateway slug for this project. Today: "wechatpay" | "alipay". Other slugs (stripe, visa, googlepay, applepay, …) use POST …/gateways/{slug}/payments.
Example (WeChat Pay personal QR)
curl -s -X POST "https://pay.andgroupco.com/api/v1/projects/PROJECT_ID/orders/ORDER_ID/payments" \
  -H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"gateway":"wechatpay"}'
POST/api/v1/projects/:projectId/orders/:id/voucher

Upload payment proof after customer pays via personal QR.

Permission: orders:write
POST/api/v1/projects/:projectId/gateways/:slug/payments

Initiate payment on any enabled registry gateway (stripe, paystack, paypal, …).

Permission: payments:write

Test mode

POST/api/v1/projects/:projectId/orders/:id/simulate-payment

TEST only — mark order paid without real payment. Fires order.paid with livemode: false.

Permission: orders:write
Simulate payment
curl -s -X POST "https://pay.andgroupco.com/api/v1/projects/PROJECT_ID/orders/ORDER_ID/simulate-payment" \
  -H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx"
Full test mode guide →