POST https://<your-api-domain>/thb-settlement/query

Read-only lookup for a settlement order created via /thb-settlement/create.

เรียกดู settlement order ที่สร้างจาก /thb-settlement/create

Request

Request

Body fields

Body fields

FieldTypeRequiredNotes ฟิลด์ประเภทบังคับหมายเหตุ
merchant_idstring Yes Your merchant identifier. merchant_idstring Yes รหัส merchant
tokenstring Yes Your API token. tokenstring Yes API token
time number | string Yes Unix epoch (seconds). See Authentication. time number | string Yes Unix epoch (วินาที) — ดู Authentication
platform_order_idstring Yes Settlement order ID — format <3-char prefix>M<YYYYMMDD><12 random alphanumeric chars>. platform_order_idstring Yes Settlement order ID — รูปแบบ <prefix 3 ตัวอักษร>M<YYYYMMDD><12 ตัวสุ่ม>

Code samples

ตัวอย่างโค้ด

TIME=$(date +%s)
BODY="{\"merchant_id\":\"AA12345678\",\"token\":\"YOUR_TOKEN\",\"time\":$TIME,\"platform_order_id\":\"ABCM20260509abc123XYZ456\"}"
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "YOUR_SECRET" | awk '{print $2}')

curl -X POST https://<your-api-domain>/thb-settlement/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: 'ABCM20260509abc123XYZ456',
});
const sig = crypto.createHmac('sha256', SECRET).update(body).digest('hex');

const r = await fetch('https://<your-api-domain>/thb-settlement/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' => 'ABCM20260509abc123XYZ456',
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$sig = hash_hmac('sha256', $body, $secret);

$ch = curl_init('https://<your-api-domain>/thb-settlement/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": "ABCM20260509abc123XYZ456",
    "merchant_order_id": "SETTLE-2026-001",
    "order_datetime":    "2026-05-09 03:00:00",
    "amount":            50000.00,
    "bank":              "KBANK",
    "account_no":        "1234567890",
    "account_name":      "บริษัท เมอร์แชนต์ จำกัด",
    "status":            "success",
    "done_datetime":     "2026-05-09 03:05:18"
  },
  "success": true
}

Field semantics match /withdraw/query: status is one of open | success | failed; done_datetime is null while open.

ความหมายของฟิลด์เหมือน /withdraw/query: status คือ open | success | faileddone_datetime เป็น null ตอนยัง open

Errors

Errors

HTTPError codeWhenError codeเกิดเมื่อ
400invalid-inputs Missing or malformed platform_order_id (mode marker must be M for settlement). invalid-inputs ไม่มี หรือรูปแบบ platform_order_id ผิด (ตัว mode ต้องเป็น M สำหรับ settlement)
404not-found Settlement not found, or owned by a different merchant. not-found ไม่พบ settlement หรือเป็นของ merchant อื่น