Integrate TowanPay
One REST API for one-time payments and subscription renewals. Use orders, hosted checkout, and webhooks — subscription logic stays in your app.
API base URL
https://pay.andgroupco.com/api/v1Production host: https://pay.andgroupco.com. All merchant resources nest under /api/v1/projects/{projectId}/…5-minute quick start
- Create account and complete verification
- Copy your project id from Dashboard → Settings
- Create a
tp_test_API key withorders:write - Verify credentials, create an order, share the payment link
- Register a webhook for
order.paid
curl -s "https://pay.andgroupco.com/api/v1/merchant" \
-H "Authorization: Bearer tp_test_xxxxxxxxxxxxxxxx"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"
}
}'Integration patterns
Hosted checkout
Lowest effortPOST /orders → share paymentLinkUrl. Customer pays on /pay/{token}. Handle order.paid webhook.
Server redirect
LowCreate order server-side, redirect browser to paymentLinkUrl from the response.
Full API
More controlPOST /orders → POST /orders/:id/payments → show QR in your app → voucher → webhook.
Subscriptions
Same APIYour cron creates a new order each billing cycle with metadata.subscription_id. Webhook extends access.
Subscriptions
TowanPay is payment infrastructure — not a subscription product. Your app owns plans, billing schedules, and entitlements. Each renewal is a new order with metadata your webhook handler uses to extend access.
Subscription billing guideWebhooks
Verify X-TowanPay-Signature (HMAC-SHA256 of raw body). Subscribe to order.paid and order.failed.
Documentation
Getting started
5-step quick start
Authentication
API keys, Bearer auth, test vs live
Projects
Project scoping and X-Project-Id
Merchant verification
KYC documents and live access
Orders
Create orders and payment flow
Payment links
Hosted checkout
Subscriptions
Recurring billing with the same API
Webhooks
Events, HMAC verification
Test mode
Sandbox, tp_test_ keys, simulate
Error codes
Error types and HTTP codes
API reference
Full endpoint table
