GET /verify/bank/jobs/:jobId
ดึงสถานะและผลลัพธ์ของ Job การตรวจสอบแบบ async ใช้เป็น ทางสำรอง หากคุณพลาด Webhook Callback หรือเพื่อกระทบยอดผลลัพธ์
Endpoint
http
GET /verify/bank/jobs/:jobIdURL เต็ม: https://api.thunder.in.th/v2/verify/bank/jobs/{jobId}
การยืนยันตัวตน
จำเป็น ดูคู่มือการยืนยันตัวตน
http
Authorization: Bearer YOUR_API_KEYเฉพาะเจ้าของเท่านั้น
Job อ่านได้เฉพาะ Branch ที่สร้างมัน เท่านั้น การขอ Job ที่เป็นของ Branch อื่นจะได้ 404 JOB_NOT_FOUND (แยกไม่ออกจาก Job ที่ไม่มีอยู่จริง)
Path Parameters
| พารามิเตอร์ | ประเภท | คำอธิบาย |
|---|---|---|
jobId | string | jobId ที่ได้จาก /async หรือ /batch |
สถานะของ Job
| สถานะ | ความหมาย |
|---|---|
queued | รับเข้าแล้ว รอประมวลผล |
processing | กำลังตรวจสอบอยู่ |
retrying | ข้อมูลสลิปยังไม่พร้อม (เช่น ธนาคารกรุงเทพ pending) — กำลังลองใหม่ภายในไม่กี่นาที |
done | เสร็จแล้ว — result มีข้อมูล |
failed | เสร็จโดยไม่สำเร็จ (เช่น ไม่พบสลิปหลังลองใหม่หมดแล้ว) — ดู error |
Type Definitions
typescript
interface JobRecord {
jobId: string;
batchId?: string; // มีเมื่อ Job เป็นส่วนหนึ่งของ batch
status: 'queued' | 'processing' | 'retrying' | 'done' | 'failed';
result?: VerifyBankData; // มีเมื่อ status เป็น 'done' — โครงสร้างเดียวกับ data ของ sync verify
error?: { // มีเมื่อ status เป็น 'failed'
code: string;
message: string;
};
attempts: number; // จำนวนครั้งที่ Job ถูกลองประมวลผล
createdAt: string; // ISO 8601
updatedAt: string; // ISO 8601
}
interface JobResponse {
success: true;
data: JobRecord;
}ออบเจกต์ result มี โครงสร้างเดียวกัน กับ data ของ POST /verify/bank แบบซิงโครนัสที่สำเร็จ (rawSlip, matchedAccount, isDuplicate, amountInSlip, isAmountMatched, remark ฯลฯ)
ตัวอย่าง
bash
curl https://api.thunder.in.th/v2/verify/bank/jobs/3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b \
-H "Authorization: Bearer YOUR_API_KEY"Response
กำลังประมวลผล (200)
json
{
"success": true,
"data": {
"jobId": "3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b",
"batchId": null,
"status": "retrying",
"attempts": 2,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:31:10+07:00"
}
}เสร็จแล้ว (200)
json
{
"success": true,
"data": {
"jobId": "3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b",
"batchId": null,
"status": "done",
"result": {
"remark": "Order #1001",
"isDuplicate": false,
"amountInSlip": 1500.00,
"isAmountMatched": true,
"rawSlip": {
"payload": "00000000000000000000000000000000000000",
"transRef": "68370160657749I376388B35",
"date": "2024-01-15T14:30:00+07:00",
"countryCode": "TH",
"amount": {
"amount": 1500.00,
"local": { "amount": 1500.00, "currency": "THB" }
},
"fee": 0,
"ref1": "",
"ref2": "",
"ref3": "",
"sender": {
"bank": { "id": "004", "name": "กสิกรไทย", "short": "KBANK" },
"account": {
"name": { "th": "นาย ผู้โอน ทดสอบ", "en": "MR. SENDER TEST" },
"bank": { "type": "BANKAC", "account": "123-4-xxxxx-5" }
}
},
"receiver": {
"bank": { "id": "014", "name": "ไทยพาณิชย์", "short": "SCB" },
"account": {
"name": { "th": "บริษัท ตัวอย่าง จำกัด" },
"bank": { "type": "BANKAC", "account": "xxx-x-x5678-x" }
},
"merchantId": null
}
}
},
"attempts": 3,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:32:05+07:00"
}
}ล้มเหลว (200)
json
{
"success": true,
"data": {
"jobId": "3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b",
"batchId": null,
"status": "failed",
"error": {
"code": "SLIP_NOT_FOUND",
"message": "The slip could not be found or is invalid"
},
"attempts": 5,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:35:00+07:00"
}
}Error Responses
Job Not Found (404)
คืนค่าสำหรับ Job ที่ไม่รู้จักหรือหมดอายุ หรือ Job ที่เป็นของ Branch อื่น
json
{
"success": false,
"error": {
"code": "JOB_NOT_FOUND",
"message": "Job 3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b not found"
}
}หมายเหตุ
- Job เก็บไว้ ~7 วัน แล้วจะหมดอายุ (หลังจากนั้นได้
404) - แนะนำให้ใช้ Webhook รับผลลัพธ์ ใช้ polling เป็นทางสำรองหรือกระทบยอดเท่านั้น
- HTTP Response ที่นี่จะเป็น
200เสมอตราบใดที่ Job ยังอยู่ — ผลของ Job อยู่ในฟิลด์status/result/errorไม่ใช่ที่ HTTP Status
