Auto Payment
Create one invoice per order, send the customer to pay, and credit the order when the webhook arrives.
How it fits together
- 1
Look up the codes you will send
Bank codes for payer_bank_provider come from GET /v1/ebank/bankConfig. Chains for a crypto invoice come from GET /v1/chain/list.
- 2
Create the invoice
Call createInvoicePayment/fiat for baht or createInvoicePayment/crypto for USDT, with your own order_id. The response carries payment_url for the customer.
- 3
Send the customer to pay
A baht invoice lives 900 seconds and a crypto one 3,600. An invoice that expires sends no webhook.
- 4
Credit the order on PAYMENT_PAID
Post to your ledger from this webhook only. Check an invoice with GET /v1/payment/info, or cancel one that is still unpaid with POST /v1/payment/cancel.
In this section
Bank List (Fiat)
Bank codes to use in payer_bank_provider and receiver_bank
GET/v1/ebank/bankConfigChain List (Crypto)
Supported networks and the token standard of each
GET/v1/chain/listCreate Payment
Pick the currency pair: THB, USDT, or automatic conversion between the two
POST/v1/payment/createInvoicePayment/{fiat|crypto}Get Invoice Info
Read payment_status for the states that send no webhook
GET/v1/payment/infoCancel Payment
Cancel an invoice the customer has not paid
POST/v1/payment/cancelBefore you start
Keep the same order_id on retry
Use one order_id per transaction. When you retry, send the same value again instead of generating a new one.
Automatic conversion
Add auto_convert: true and convert_to to be credited in the other currency. The Binance TH rate is locked when the invoice is created, and merchant_amount is what you will receive.
Webhooks on the payment side
PAYMENT_PAID credits the order. PAYMENT_CANCELED can refer to an older invoice the platform cancelled when the same payer created a new one, so match it on data.payment.id. With automatic conversion on, PAYMENT_CONVERTED follows under a different system_id.
No webhook does not mean done
An expired invoice and a slip under review send no webhook. Run a job that polls GET /v1/payment/info for invoices that stay open.
