เริ่มต้น
Base URL: https://api.seatbook.online/api/v1
Authentication
ส่ง API key (สร้างได้ที่แดชบอร์ด) ทาง header อย่างใดอย่างหนึ่ง:
Authorization: Bearer sk_live_xxxxxxxx X-API-Key: sk_live_xxxxxxxx
Rate limit: 60 requests/นาที ต่อ key (ดู header X-RateLimit-Remaining)
POST/verify/bank
ตรวจสลิปธนาคาร — ส่ง อย่างใดอย่างหนึ่ง ใน 4 แบบ:
| Field | Type | Content-Type | คำอธิบาย |
|---|---|---|---|
payload | string | application/json | ข้อความจาก QR บนสลิป (เร็วสุด) |
image | file | multipart/form-data | ไฟล์รูปสลิป ≤ 4MB (JPEG/PNG/GIF/WebP) |
base64 | string | application/json | รูป base64 มีหรือไม่มี prefix data:image/... ก็ได้ |
url | string | application/json | URL รูปสลิป (http/https, เข้าถึงได้จากภายนอก) |
Optional:
| Field | Type | คำอธิบาย |
|---|---|---|
matchAmount | number | ยอดที่คาดไว้ — ได้ amountInOrder, amountInSlip, isAmountMatched |
checkDuplicate | boolean | เช็กว่าสลิปนี้เคยตรวจด้วยบัญชีของคุณแล้วหรือยัง → isDuplicate |
remark | string | หมายเหตุ เช่นเลขออเดอร์ (1–255 ตัว) |
matchReceiver | boolean | ตรวจว่าผู้รับเงินในสลิปตรงกับบัญชีรับเงินที่คุณบันทึกไว้ (ธนาคาร / เลขบัญชี / ชื่อ) → isReceiverMatched |
receiverAccountId | number | ตรวจกับบัญชีที่ระบุเท่านั้น (ID จากหน้าบัญชีรับเงิน) ใส่แล้วไม่ต้องส่ง matchReceiver |
ผลการตรวจผู้รับเงิน
"isReceiverMatched": true,
"receiverMatch": {
"matched": true,
"checks": { "bank": true, "accountNo": true, "name": true },
"accountId": 3,
"label": "บัญชีหลักร้าน"
}
แต่ละ check เป็น true / false / null (null = สลิปไม่มีข้อมูลนี้ หรือคุณไม่ได้บันทึกไว้) · ผ่านเมื่อไม่มีข้อใดเป็น false และเลขบัญชีหรือชื่อเป็น true อย่างน้อย 1 อย่าง · ไม่มีบัญชีที่บันทึก → isReceiverMatched: null พร้อม reason: "NO_ACCOUNTS"
POST/verify/truewallet
ตรวจสลิป TrueMoney Wallet — field และ optional เหมือน /verify/bank ทุกอย่าง ใน rawSlip จะได้ transactionId แทน transRef
GET/me
ดูเครดิตคงเหลือ (ไม่หักเครดิต)
{ "success": true, "data": { "credits": 842, "creditsExpireAt": "2027-01-01T12:00:00+07:00",
"balance": 150.0, "requestsToday": 37, "rateLimitPerMin": 60 } }
Response
{
"success": true,
"data": {
"isDuplicate": false,
"amountInOrder": 1500, "amountInSlip": 1500, "isAmountMatched": true,
"rawSlip": {
"payload": "0041000600000101030040220...",
"transRef": "68370160657749I376388B35",
"date": "2024-01-15T14:30:00+07:00",
"amount": { "amount": 1500.00 },
"sender": { "bank": { "id": "004", "name": "กสิกรไทย", "short": "KBANK" }, "account": { "name": { "th": "นาย ผู้โอน ทดสอบ" } } },
"receiver": { "bank": { "id": "014", "name": "ไทยพาณิชย์", "short": "SCB" }, "account": { "name": { "th": "นาย รับเงิน ทดสอบ" } } }
}
},
"message": "Bank slip verified successfully",
"creditsRemaining": 841
}
การหักเครดิต: ตรวจสำเร็จ = 1 เครดิต · ข้อผิดพลาดอื่นทั้งหมด (input ผิด, ระบบขัดข้อง) ไม่หักเครดิต
API ยืนยันว่าสลิปเป็นของจริง — ใช้ matchReceiver เพื่อยืนยันว่าเงินเข้าบัญชีของคุณด้วย
Error codes
{ "success": false, "error": { "code": "SLIP_NOT_FOUND", "message": "..." }, "creditsRemaining": 841 }
| HTTP | Code | ความหมาย |
|---|---|---|
| 401 | MISSING_API_KEY / INVALID_API_KEY | ไม่มี key หรือ key ผิด |
| 402 | NO_CREDITS / CREDITS_EXPIRED | เครดิตหมด / แพ็กหมดอายุ |
| 403 | KEY_DISABLED / USER_BANNED / IP_NOT_ALLOWED | key ถูกปิด / บัญชีถูกระงับ / IP ไม่อยู่ใน whitelist |
| 429 | RATE_LIMITED | เกิน rate limit |
| 400 | VALIDATION_ERROR | body ไม่ถูกต้อง หรือส่ง input มากกว่า 1 แบบ |
| 400 | IMAGE_SIZE_TOO_LARGE / INVALID_IMAGE_FORMAT / INVALID_IMAGE_TYPE | ปัญหาไฟล์รูป |
| 400 | URL_PROTOCOL_NOT_ALLOWED / URL_INVALID_IP_RANGE / IMAGE_URL_UNREACHABLE | ปัญหา URL |
| 404 | SLIP_NOT_FOUND | สลิปไม่ถูกต้อง / ปลอม / ไม่มี QR |
| 404 | SLIP_PENDING | ธ.กรุงเทพยังประมวลผล (~5 นาที) ลองใหม่ |
| 502 / 503 | UPSTREAM_ERROR / SERVICE_UNAVAILABLE | ระบบขัดข้องชั่วคราว (ไม่หักเครดิต) — retry ได้ |
ตัวอย่างโค้ด
PHP
$ch = curl_init('https://api.seatbook.online/api/v1/verify/bank');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
CURLOPT_POSTFIELDS => [
'image' => new CURLFile($_FILES['slip']['tmp_name']),
'matchAmount' => $orderTotal,
'checkDuplicate' => 'true',
'matchReceiver' => 'true',
],
]);
$res = json_decode(curl_exec($ch), true);
if ($res['success'] && !$res['data']['isDuplicate'] && $res['data']['isAmountMatched'] && $res['data']['isReceiverMatched']) {
markOrderPaid($orderId);
}
JavaScript (Node 18+)
const fd = new FormData();
fd.append('image', new Blob([fs.readFileSync('slip.jpg')]), 'slip.jpg');
fd.append('matchAmount', '1500');
fd.append('checkDuplicate', 'true');
fd.append('matchReceiver', 'true');
const r = await fetch('https://api.seatbook.online/api/v1/verify/bank', {
method: 'POST', headers: { Authorization: `Bearer ${KEY}` }, body: fd,
});
console.log(await r.json());
Python
import requests
r = requests.post('https://api.seatbook.online/api/v1/verify/bank',
headers={'Authorization': f'Bearer {KEY}'},
json={'payload': qr_text, 'matchAmount': 1500, 'checkDuplicate': True, 'matchReceiver': True})
print(r.json())