POST
/withdraw/query
Look up the current status and details of a withdraw order.
ตรวจสอบสถานะและรายละเอียดของรายการถอน
POST
https://<your-api-domain>/withdraw/query
Read-only lookup for a withdraw order. Use as a fallback when the webhook callback is missed.
เรียกดู order ถอนเงิน — ใช้ fallback เวลา webhook callback หาย
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 |
| platform_order_id | string | Yes | Withdraw order ID returned by /withdraw/create. Format: <3-char prefix>W<YYYYMMDD><12 random alphanumeric chars> — 24 characters total. |
platform_order_id | string | Yes | Order ID ที่ได้จาก /withdraw/create — รูปแบบ: <prefix 3 ตัวอักษร>W<YYYYMMDD><12 ตัวสุ่ม> รวม 24 ตัว |
Code samples
ตัวอย่างโค้ด
TIME=$(date +%s)
BODY="{\"merchant_id\":\"AA12345678\",\"token\":\"YOUR_TOKEN\",\"time\":$TIME,\"platform_order_id\":\"ABCW20260508abc123XYZ456\"}"
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "YOUR_SECRET" | awk '{print $2}')
curl -X POST https://<your-api-domain>/withdraw/query \
-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),
platform_order_id: 'ABCW20260508abc123XYZ456',
});
const sig = crypto.createHmac('sha256', SECRET).update(body).digest('hex');
const r = await fetch('https://<your-api-domain>/withdraw/query', {
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(),
'platform_order_id' => 'ABCW20260508abc123XYZ456',
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$sig = hash_hmac('sha256', $body, $secret);
$ch = curl_init('https://<your-api-domain>/withdraw/query');
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
JSON
{
"code": 200,
"message": "Success",
"data": {
"platform_order_id": "ABCW20260508abc123XYZ456",
"merchant_order_id": "PAYOUT-2026-001",
"order_datetime": "2026-05-08 11:00:00",
"bank": "KBANK",
"account_no": "1234567890",
"account_name": "ลูกค้า ปลายทาง",
"amount": 1000.00,
"status": "success",
"done_datetime": "2026-05-08 11:00:42"
},
"success": true
}
Response fields
Response fields
| Field | Type | Description | ฟิลด์ | ประเภท | คำอธิบาย |
|---|---|---|---|---|---|
| data.platform_order_id | string | Echo of input. | data.platform_order_id | string | Echo |
| data.merchant_order_id | string | Your original merchant_order_id from the create call. |
data.merchant_order_id | string | merchant_order_id ที่คุณส่งตอน create |
| 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.bank / account_no / account_name | string | Echo of destination details. | data.bank / account_no / account_name | string | Echo ข้อมูลปลายทาง |
| data.amount | number | Payout amount. | data.amount | number | จำนวนเงินที่ถอน |
| data.status | enum | open (in progress) | success | failed. Mapped from internal status: new/queue/pending → open; success → success; failed/error/cancelled/rejected → failed. |
data.status | enum | open (กำลังดำเนินการ) | success | failed — map จากสถานะ internal: new/queue/pending → open; success → success; failed/error/cancelled/rejected → failed |
| data.done_datetime | string | null | When the withdraw completed (YYYY-MM-DD HH:mm:ss GMT+7), or null if still open. |
data.done_datetime | string | null | เวลาที่ withdraw เสร็จ (YYYY-MM-DD HH:mm:ss GMT+7) — เป็น null ถ้ายัง open |
Errors
Errors
| HTTP | Error code | When | Error code | เกิดเมื่อ |
|---|---|---|---|---|
| 400 | invalid-inputs |
Missing or malformed platform_order_id. |
invalid-inputs |
ไม่มีหรือรูปแบบ platform_order_id ผิด |
| 404 | not-found |
Order not found, or owned by a different merchant. | not-found |
ไม่พบ order หรือเป็นของ merchant อื่น |