POST/api/v2/payins
建立自動收款訂單 (POST /v2/payins)
ENDPOINT OVERVIEW
呼叫 POST /api/v2/payins 將動態分配最優收款通道並返回 paypage_url。注意簽名中間件會剝離 /api 前綴,請求 /api/v2/payins 時須對 /v2/payins 簽名;範例網域為 api.example.com,正式端點將於開戶審核通過後派發。
Protocol Rules
- 請求標頭須包含 X-API-Key、X-Timestamp 與 X-Signature;計算 HMAC-SHA256 時須去掉 /api 前綴(對 /v2/payins 簽名)。
- 標準請求欄位包含 merchant_ref_id、currency_code、request_amount、customer_id (UUIDv7)、customer_account_id 與 redirect_url。
- 可隨時透過 GET /api/v1/payins/{id} 查詢權威狀態,或透過 POST /api/v2/payins/{id}/cancel 取消未付訂單。
Request Examples
# Note: api.example.com is a placeholder — your Sandbox & Production endpoints are issued at onboarding.
# Middleware strips /api before verifying, so compute X-Signature over /v2/payins.
curl -X POST https://api.example.com/api/v2/payins \
-H "Content-Type: application/json" \
-H "X-API-Key: <your-api-key>" \
-H "X-Timestamp: <unix-timestamp>" \
-H "X-Signature: <hmac-sha256-of-path>" \
-d '{
"merchant_ref_id": "unique-order-ref-id-2025001",
"currency_code": "THB",
"request_amount": 1000,
"customer_id": "0198cbc6-fd02-7459-a671-78c306d0a1ad",
"customer_account_id": "0198cbc7-35ec-7c8c-8994-d3ac3e7f5255",
"redirect_url": "https://merchant.example.com/payment/success"
}'Sample JSON Response
{
"id": "0198cbff-db9b-7b6a-9f82-6a55fdfb6575",
"merchant_ref_id": "unique-order-ref-id-2025001",
"status": "pending",
"request_amount": 1000,
"paypage_url": "https://pay.example.com/pay/0198cbff-db9b-7b6a-9f82-6a55fdfb6575"
}