Getting started

Integrate TowanPay in under an hour. One REST API powers one-time checkout and subscription renewals.

Base URL

Use a TEST project and tp_test_ key during development.

https://pay.andgroupco.com/api/v1

Start in test mode

Use a TEST project and tp_test_ key for sandbox integration before going live.

Five steps

  1. 1

    Create account & verify

    Register at TowanPay and submit business verification. You can configure gateways, API keys, and webhooks while pending — live payment writes require approval.

    Learn more →
  2. 2

    Configure gateways

    Enable payment gateways for your project in the dashboard (credentials, collection URLs). Copy the project id from Dashboard → Settings or list projects via GET /api/v1/projects.

    Learn more →
  3. 3

    Create a test API key

    Generate a tp_test_ key with orders:write and webhooks:write. Never expose keys in client-side code.

    Learn more →
  4. 4

    Create an order

    POST /api/v1/projects/{projectId}/orders returns paymentLinkUrl for hosted checkout.

    Learn more →
  5. 5

    Register webhook & go live

    Subscribe to order.paid. In test mode, use simulate-payment to complete the flow without a real QR scan.

    Learn more →

Copy & paste examples

Replace PROJECT_ID and your test key. Prefer nested routes /api/v1/projects/{projectId}/orders.

1. Verify credentials
curl -s "https://pay.andgroupco.com/api/v1/merchant" \
  -H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx"
2. Create order (includes paymentLinkUrl)
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"
    }
  }'
3. Register webhook
curl -s -X POST "https://pay.andgroupco.com/api/v1/projects/PROJECT_ID/webhooks" \
  -H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-server.com/webhooks/towanpay",
    "events": ["order.paid", "order.failed"]
  }'
4. Simulate payment (TEST only)
curl -s -X POST "https://pay.andgroupco.com/api/v1/projects/PROJECT_ID/orders/ORDER_ID/simulate-payment" \
  -H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx"

Dashboard walkthrough

If you are signed in, the dashboard getting started page tracks verification progress and links to API keys, webhooks, and orders.