PAYMENT / V1
MERCHANT API
JSON body
x-api-key
HS256
| Header | ||
|---|---|---|
x-api-key | ||
Content-Type | application/json |
Node.js
const jwt = require("jsonwebtoken");
function sign(body, apiKey) {
const { signature, ...rest } = body;
const sorted = {};
Object.keys(rest).sort().forEach((key) => {
sorted[key] = rest[key];
});
return jwt.sign(sorted, apiKey, {
algorithm: "HS256",
noTimestamp: true,
});
}
POST /payment/v1/payin
Body
merchantId | string | |
transactionId | string | |
amount | number | |
bankName | string | |
bankAccountNumber | string | |
name | string | |
callbackUrl | string | |
member_redirect_url | string | |
type | string | |
timestamp | number | |
signature | string |
Request
{
"merchantId": "shop01",
"transactionId": "AG20261120001",
"amount": 1000,
"bankName": "KBANK",
"bankAccountNumber": "1234567890",
"name": "สมชาย ใจดี",
"callbackUrl": "https://agent.example.com/deposit/callback",
"member_redirect_url": "https://agent.example.com/pay/return",
"type": "QR",
"timestamp": 1763640000,
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
{
"status": "success",
"message": "Create Success",
"data": {
"order_no": "TD1732100000000AB12CD",
"agent_order_no": "AG20261120001",
"status": "PENDING",
"amount": 1000.07,
"depositAmount": 1000.07,
"qr_payload": "00020101021229370016A000000677010111",
"url": "https://pay.example.com/pay/TD1732100000000AB12CD",
"expireDate": "2026-11-20T16:10:00.000Z",
"customerData": {
"bankAccountNumber": "1234567890",
"bankName": "KBANK",
"name": "สมชาย ใจดี"
}
}
}
{
"status": "error",
"message": "Invalid signature",
"code": 400
}{
"status": "error",
"message": "IP not in whitelist, Your IP:203.0.113.10",
"code": 403
}| message | code |
|---|---|
| Invalid API key | 401 |
| Access denied | 403 |
| merchantId does not match API key | 403 |
| Deposit maintainance | 400 |
| minimum deposit amount is 200 | 400 |
| maximum deposit amount is 200000 THB | |
| transactionId already exists | 400 |
| amount must be a whole number of THB | 400 |
POST /payment/v1/payout
Body
agent_order_no | string | |
amount | number | |
bank_code | string | |
account_no | string | |
account_name | string | |
callback_url | string | |
timestamp | number | |
signature | string |
Request
{
"agent_order_no": "WD-AGENT-001",
"amount": 500,
"bank_code": "KBANK",
"account_no": "1234567890",
"account_name": "สมหญิง มั่นคง",
"callback_url": "https://agent.example.com/withdraw/callback",
"timestamp": 1763640300,
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
{
"code": 200,
"message": "Success",
"data": {
"order_no": "WD1732100300000CD34EF",
"agent_order_no": "WD-AGENT-001",
"amount": 500,
"fee": 0,
"transfer_amount": 500,
"status": "PENDING"
}
}
{
"code": 400,
"message": "Withdrawal maintainance"
}{
"code": 400,
"message": "Insufficient balance. Available: 120.00 THB, Required: 500.00 THB"
}| message | code |
|---|---|
| Invalid API key | 401 |
| Access denied | 403 |
| IP not in whitelist | 403 |
| Invalid signature | 400 |
| minimum withdrawal amount is 300 | 400 |
| maximum withdrawal amount is 200000 THB | 400 |
| transactionId already exists | 400 |
| Daily maximum withdrawal limit reached | 400 |
| amount must be a whole number of THB | 400 |
KBANKBBLKTBTTB
SCBCIMBTUOBTBAY
GSBGHBBAACTISCO
KKPLHFGCLICXTMN
POST /payment/v1/balance
Body
timestamp | number | |
signature | string |
Request
{
"timestamp": 1763640400,
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
{
"code": 200,
"message": "Success",
"data": { "balance": 15000.5, "currency": "THB" }
}
POST /payment/v1/withdrawal-balance
{
"code": 200,
"message": "Success",
"data": {
"total_balance": 20000,
"current_balance": 15000.5,
"currency": "THB"
}
}
POST /payment/v1/order/inquiry
| Body | ||
|---|---|---|
order_no | ||
agent_order_no | ||
timestamp | ||
signature |
Request
{
"order_no": "TD1732100000000AB12CD",
"timestamp": "1763640600",
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
{
"code": 200,
"message": "Success",
"data": {
"order_no": "TD1732100000000AB12CD",
"agent_order_no": "AG20261120001",
"type": "deposit",
"amount": 1000,
"fee": 15,
"transfer_amount": 1000.07,
"actual_amount": 985,
"status": "SUCCESS",
"created_at": "2026-11-20T16:05:00.000Z",
"updated_at": "2026-11-20T16:08:12.000Z"
}
}
GET /payment/v1/banks
code | string | |
name | string | |
name_th | string | |
active | boolean |
{
"code": 200,
"message": "Success",
"data": {
"banks": [
{ "code": "KBANK", "name": "Kasikorn Bank", "name_th": "ธนาคารกสิกรไทย", "active": true },
{ "code": "SCB", "name": "Siam Commercial Bank", "name_th": "ธนาคารไทยพาณิชย์", "active": true },
{ "code": "BBL", "name": "Bangkok Bank", "name_th": "ธนาคารกรุงเทพ", "active": true },
{ "code": "KTB", "name": "Krungthai Bank", "name_th": "ธนาคารกรุงไทย", "active": true },
{ "code": "BAY", "name": "Bank of Ayudhya (Krungsri)", "name_th": "ธนาคารกรุงศรีอยุธยา", "active": true },
{ "code": "TTB", "name": "TMB Bank (TTB)", "name_th": "ธนาคารทหารไทยธนชาต", "active": true },
{ "code": "CIMBT", "name": "CIMB Thai Bank", "name_th": "ธนาคารซีไอเอ็มบีไทย", "active": true },
{ "code": "TISCO", "name": "Tisco Bank", "name_th": "ธนาคารทิสโก้", "active": true },
{ "code": "KKP", "name": "Kiatnakin Phatra Bank", "name_th": "ธนาคารเกียรตินาคินภัทร", "active": true },
{ "code": "GSB", "name": "Government Savings Bank", "name_th": "ธนาคารออมสิน", "active": true },
{ "code": "BAAC", "name": "Bank for Agriculture and Agricultural Cooperatives", "name_th": "ธนาคารเพื่อการเกษตรและสหกรณ์การเกษตร", "active": true },
{ "code": "GHB", "name": "Government Housing Bank", "name_th": "ธนาคารอาคารสงเคราะห์", "active": true },
{ "code": "LHFG", "name": "Land and Houses Bank", "name_th": "ธนาคารแลนด์ แอนด์ เฮ้าส์", "active": true },
{ "code": "UOBT", "name": "United Overseas Bank (Thai)", "name_th": "ธนาคารยูโอบี", "active": true },
{ "code": "CLICX", "name": "Click online bank", "name_th": "ธนาคารคลิกออนไลน์", "active": true },
{ "code": "TMN", "name": "TRUEWALLET", "name_th": "TRUEWALLET", "active": true }
]
}
}
GET /payment/v1/health
{
"code": 200,
"message": "OK",
"data": {
"status": "healthy",
"timestamp": "2026-11-20T16:40:00.000Z",
"uptime": 3600.12
}
}
{
"order_no": "TD1732100000000AB12CD",
"agent_order_no": "AG20261120001",
"status": "SUCCESS",
"amount": 1000,
"transfer_amount": 1000.07,
"actual_amount": 985.07,
"fee": 15,
"type": "deposit",
"trans_date": "2026-11-20T16:05:00.000Z",
"to_account_name": "สมชาย ใจดี",
"timestamp": 1763640500,
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
{
"order_no": "WD1732100300000CD34EF",
"agent_order_no": "WD-AGENT-001",
"status": "FAILED",
"amount": 500,
"transfer_amount": 500,
"actual_amount": 0,
"fee": 0,
"type": "withdrawal",
"trans_date": "2026-11-20T16:06:00.000Z",
"to_account_name": "สมหญิง มั่นคง",
"timestamp": 1763640800,
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
| PENDING | ||
| SUCCESS | ||
| FAILED | ||
| EXPIRED | — |