Creates a payout from your merchant balance to an end customer's bank account — e.g. a player cashing out winnings. Your merchant balance is placed on a 10-minute hold immediately. When the bank transfer completes (or fails), we POST a callback to your notify_url.
สร้างคำสั่งจ่ายเงินจาก merchant balance ไปยังบัญชีของ ลูกค้าปลายทาง — เช่น ลูกค้าถอนเงิน — merchant balance จะถูก hold ไว้ 10 นาทีทันที — เมื่อโอนสำเร็จหรือไม่สำเร็จ ระบบจะ POST callback ไปที่ notify_url
This endpoint pays out to end customers' bank accounts. To withdraw your own merchant balance into
your company's bank account (periodic settlement), use
/thb-settlement/create instead.
Endpoint นี้จ่ายเงินไปยังบัญชีของ ลูกค้าปลายทาง (รายการต่อรายการ, ค่าธรรมเนียมแบบ %).
ถ้าจะถอน merchant balance ของคุณ เข้า บัญชีบริษัทตัวเอง
(settle เป็นรอบ, ค่าธรรมเนียมคงที่) ให้ใช้
/thb-settlement/create แทน
Request
Request
Body fields
Body fields
| Field | Type | Required | Notes | ฟิลด์ | ประเภท | บังคับ | หมายเหตุ |
|---|---|---|---|---|---|---|---|
| merchant_id | string | Yes | Your merchant identifier. | merchant_id | string | Yes | รหัส merchant ของคุณ |
| token | string | Yes | Your API token. | token | string | Yes | API token ของคุณ |
| time | number | string | Yes | Unix epoch (seconds). See Authentication. | time | number | string | Yes | Unix epoch (วินาที) — ดู Authentication |
| merchant_order_id | string | Yes | Your unique order identifier. Alphanumeric, max 40 chars. | merchant_order_id | string | Yes | รหัสคำสั่งฝั่งคุณ ตัวอักษร/ตัวเลข ไม่เกิน 40 ตัว |
| amount | number | string | Yes | Payout amount in THB. Subject to the configured min/max (default min 20.00). 2 decimal places. | amount | number | string | Yes | จำนวนเงินที่ถอน (THB) — ขั้นต่ำ/สูงสุดตามที่ตั้งไว้สำหรับบัญชีคุณ (default ขั้นต่ำ 20.00) ทศนิยม 2 ตำแหน่ง |
| bank | string | Yes | Destination bank code, uppercase. See Bank codes. See the full list at Bank codes. | bank | string | Yes | รหัสธนาคารปลายทาง ตัวพิมพ์ใหญ่ — ดูที่ Bank codes — ดูรายการทั้งหมดที่ Bank codes |
| account_name | string | Yes | Destination account holder name. | account_name | string | Yes | ชื่อบัญชีปลายทาง |
| account_no | string | Yes | Destination account number, 10–15 digits. | account_no | string | Yes | เลขบัญชีปลายทาง 10–15 หลัก |
| notify_url | string | Optional | HTTPS URL we'll POST the callback to. If omitted, you must poll /withdraw/query. | notify_url | string | Optional | HTTPS URL สำหรับ callback — ถ้าไม่ส่งต้อง poll /withdraw/query |
Code samples
ตัวอย่างโค้ด
TIME=$(date +%s)
BODY="{\"merchant_id\":\"AA12345678\",\"token\":\"YOUR_TOKEN\",\"time\":$TIME,\"merchant_order_id\":\"PAYOUT-2026-001\",\"amount\":\"1000.00\",\"bank\":\"KBANK\",\"account_name\":\"ลูกค้า ปลายทาง\",\"account_no\":\"1234567890\",\"notify_url\":\"https://<your-merchant-webhook-URL>/withdraw-callback\"}"
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "YOUR_SECRET" | awk '{print $2}')
curl -X POST https://<your-api-domain>/withdraw/create \
-H "Content-Type: application/json" \
-H "X-SIGNATURE: $SIG" \
-d "$BODY"
import crypto from 'node:crypto';
const SECRET = 'YOUR_SECRET';
const body = JSON.stringify({
merchant_id: 'AA12345678',
token: 'YOUR_TOKEN',
time: Math.floor(Date.now() / 1000),
merchant_order_id: 'PAYOUT-2026-001',
amount: '1000.00',
bank: 'KBANK',
account_name: 'ลูกค้า ปลายทาง',
account_no: '1234567890',
notify_url: 'https://<your-merchant-webhook-URL>/withdraw-callback',
});
const sig = crypto.createHmac('sha256', SECRET).update(body).digest('hex');
const r = await fetch('https://<your-api-domain>/withdraw/create', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-SIGNATURE': sig },
body
});
console.log(await r.json());
<?php
$secret = 'YOUR_SECRET';
$body = json_encode([
'merchant_id' => 'AA12345678',
'token' => 'YOUR_TOKEN',
'time' => time(),
'merchant_order_id' => 'PAYOUT-2026-001',
'amount' => '1000.00',
'bank' => 'KBANK',
'account_name' => 'ลูกค้า ปลายทาง',
'account_no' => '1234567890',
'notify_url' => 'https://<your-merchant-webhook-URL>/withdraw-callback',
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$sig = hash_hmac('sha256', $body, $secret);
$ch = curl_init('https://<your-api-domain>/withdraw/create');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
"X-SIGNATURE: $sig",
],
]);
echo curl_exec($ch);
Response
Response
Success — HTTP 200
สำเร็จ — HTTP 200
{
"code": 200,
"message": "Success",
"data": {
"platform_order_id": "ABCW20260508abc123XYZ456",
"merchant_order_id": "PAYOUT-2026-001",
"order_datetime": "2026-05-08 11:00:00",
"amount": 1000.00,
"bank": "KBANK",
"account_no": "1234567890",
"account_name": "ลูกค้า ปลายทาง"
},
"success": true
}
Response fields
Response fields
| Field | Type | Description | ฟิลด์ | ประเภท | คำอธิบาย |
|---|---|---|---|---|---|
| data.platform_order_id | string | Withdraw order ID (24 chars). Use for /withdraw/query and matching the callback's platform_order_id. |
data.platform_order_id | string | Withdraw order ID (24 ตัวอักษร) — ใช้กับ /withdraw/query และจับคู่ platform_order_id ใน callback |
| data.merchant_order_id | string | Echo of input. | data.merchant_order_id | string | Echo |
| data.order_datetime | string | Creation datetime (YYYY-MM-DD HH:mm:ss GMT+7). |
data.order_datetime | string | เวลาสร้างคำสั่ง (YYYY-MM-DD HH:mm:ss GMT+7) |
| data.amount | number | Payout amount. | data.amount | number | จำนวนเงินที่ถอน |
| data.bank | string | Same as the value you sent in the request. | data.bank | string | ค่าเดียวกับที่คุณส่งใน request |
| data.account_no | string | Same as the value you sent in the request. | data.account_no | string | ค่าเดียวกับที่คุณส่งใน request |
| data.account_name | string | Same as the value you sent in the request. | data.account_name | string | ค่าเดียวกับที่คุณส่งใน request |
status in the create responsestatus ใน response ของ createThe order is implicitly open right after creation. The final status (SUCCESS or FAIL) is delivered via the webhook callback to your notify_url, or visible via /withdraw/query.
ตอนเพิ่งสร้าง order จะอยู่สถานะ open โดยปริยาย — สถานะสุดท้าย (SUCCESS หรือ FAIL) จะส่งผ่าน webhook callback ไปยัง notify_url หรือเรียกดูผ่าน /withdraw/query
Errors
Errors
| HTTP | Error code | When it happens | Error code | เกิดเมื่อ |
|---|---|---|---|---|
| 400 | invalid-inputs |
Missing/invalid fields, amount outside min/max, or insufficient available balance. | invalid-inputs |
Field ขาด/ผิด, amount เกินขอบเขต, หรือยอดคงเหลือไม่พอ |
| 409 | duplicate-entry |
A withdraw with the same bank + account_no + amount was created in the past 3 minutes (when duplicate prevention is enabled for your account). |
duplicate-entry |
มี withdraw ด้วย bank + account_no + amount เดียวกันสร้างใน 3 นาทีที่ผ่านมา (ถ้าเปิด duplicate prevention สำหรับบัญชีคุณ) |
| 403 | permission-denied |
Withdraw is disabled on your merchant. | permission-denied |
Merchant ของคุณถูกปิดการถอนเงิน |
| 404 | not-found |
Partner configuration not found — contact your admin. | not-found |
ไม่พบ partner config — ติดต่อ admin |
Behavior & notes
พฤติกรรม & หมายเหตุ
- Balance hold (10 minutes). On successful creation,
amount+ the fixed withdraw fee is held from your available balance. If the order fails, the hold is released. - Hold ยอดเงิน 10 นาที — ตอนสร้างสำเร็จ ระบบจะ hold
amount+ ค่าธรรมเนียมคงที่ ไว้จาก balance — ถ้า order ล้มเหลว hold จะถูกปล่อยกลับ - Status flow.
open→successorfailed. Status only changes once; once final, it cannot revert. - การไหลของสถานะ —
open→successหรือfailed— เปลี่ยนได้ครั้งเดียวและไม่ย้อนกลับ - Bank account validation. The destination bank may reject the transfer (closed account, name mismatch). In that case the callback delivers
status: "FAIL". - การ validate ปลายทาง — ธนาคารอาจปฏิเสธ (บัญชีปิด, ชื่อไม่ตรง) — ในกรณีนั้น callback จะส่ง
status: "FAIL" - End-customer payouts only. This endpoint is for paying out to your end customers' bank accounts. To withdraw your own merchant balance to your company's bank account, see /thb-settlement/create (different fee model).
- ใช้กับการจ่ายให้ลูกค้าปลายทางเท่านั้น — endpoint นี้สำหรับจ่ายเงินไปยังบัญชีของลูกค้าปลายทาง — ถ้าจะถอน merchant balance ของคุณเข้าบัญชีบริษัทตัวเอง ให้ใช้ /thb-settlement/create (ค่าธรรมเนียมคนละแบบ)