GET /verify/bank/jobs/:jobId
ดึงสถานะและผลลัพธ์ของ Job การตรวจสอบแบบ async ใช้เป็น ทางสำรอง หากคุณพลาด Webhook Callback หรือเพื่อกระทบยอดผลลัพธ์
Endpoint
GET /verify/bank/jobs/:jobIdURL เต็ม: https://api.easyslip.com/v2/verify/bank/jobs/{jobId}
การยืนยันตัวตน
จำเป็น ดูคู่มือการยืนยันตัวตน
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 | รอตรวจซ้ำ, รอ rate limit หรือรอ billing กลับมา |
done | จบการตรวจ: result.status เป็น success หรือ not_found; callback อาจยังรอส่ง |
failed | ตรวจต่อไม่ได้เพราะ error/ข้อจำกัดบริการ ดู error และ failed callback |
Type Definitions
interface JobRecord {
jobId: string;
batchId?: string; // มีเมื่อ Job เป็นส่วนหนึ่งของ batch
status: 'queued' | 'processing' | 'retrying' | 'done' | 'failed';
result?:
| { status: 'success'; data: VerifyBankData }
| { status: 'not_found'; data: unknown };
error?: {
code?: string;
message?: string;
webhook?: 'failed';
status?: number; // callback HTTP status
url?: string;
at?: string;
};
attempts: number; // metadata ที่เก็บไว้ ไม่ใช่ตัวนับ retry ที่เชื่อถือได้
createdAt: string; // ISO 8601
updatedAt: string; // ISO 8601
}
interface JobResponse {
success: true;
data: JobRecord;
}result ครอบ { status, data } เมื่อสำเร็จ result.data ตรงกับ data ของ POST /verify/bank แบบ sync ถ้าตรวจซ้ำครบแล้วยังไม่พบ จะเป็น done พร้อม result.status: "not_found" ไม่ใช่ failed
ส่ง failure callback สำเร็จแล้ว Job ยังคงเป็น failed ถ้าส่งไม่สำเร็จจะคง error.code/message เดิม และเพิ่ม error.webhook พร้อมรายละเอียดการส่ง งาน done ก็มี error เฉพาะการส่ง callback ได้
ตัวอย่าง
curl https://api.easyslip.com/v2/verify/bank/jobs/3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b \
-H "Authorization: Bearer YOUR_API_KEY"Response
กำลังประมวลผล (200)
{
"success": true,
"data": {
"jobId": "3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b",
"status": "retrying",
"attempts": 0,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:31:10+07:00"
}
}เสร็จแล้ว (200)
{
"success": true,
"data": {
"jobId": "3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b",
"status": "done",
"result": {
"status": "success",
"data": {
"remark": "Order #1001",
"isDuplicate": false,
"amountInSlip": 1500,
"isAmountMatched": true,
"rawSlip": {
"payload": "00000000000000000000000000000000000000",
"transRef": "68370160657749I376388B35",
"date": "2024-01-15T14:30:00+07:00",
"countryCode": "TH",
"amount": {
"amount": 1500,
"local": {
"amount": 1500,
"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": 0,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:32:05+07:00"
}
}ล้มเหลว (200)
{
"success": true,
"data": {
"jobId": "3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b",
"status": "failed",
"error": {
"code": "API_SERVER_ERROR",
"message": "External API service is temporarily unavailable"
},
"attempts": 0,
"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 อื่น
{
"success": false,
"error": {
"code": "JOB_NOT_FOUND",
"message": "Job 3f2b1c8a-9d4e-4f10-b7a2-6c5d4e3f2a1b not found"
}
}หมายเหตุ
- Job หมดอายุ 7 วันหลังการเขียน job record ครั้งล่าสุด ทุกการอัปเดตสถานะ/ผลการส่งจะต่อ TTL ใหม่ หลังหมดอายุได้
404 - ปัจจุบัน worker ยังเก็บ
attemptsเป็น0แม้มี retry ห้ามใช้ค่านี้นับจำนวนครั้งที่เรียกธนาคารหรือตัดสินว่า retry ครบแล้ว ให้ดูstatus,resultและerror processingเป็นสถานะที่นิยามไว้ แต่ worker ปัจจุบันยังไม่ได้เขียน ไม่ควรบังคับว่าต้องเห็นทุกสถานะระหว่างทาง- งานที่ไม่ใช่ batch จะไม่มี
batchIdใน polling แต่ Webhook ใช้batchId: null; polling อาจมี metadata เจ้าของเป็นตัวเลขbranchIdและserviceIdด้วย - แนะนำให้ใช้ Webhook รับผลลัพธ์ ใช้ polling เป็นทางสำรองหรือกระทบยอดเท่านั้น
- HTTP Response ที่นี่จะเป็น
200เสมอตราบใดที่ Job ยังอยู่ — ผลของ Job อยู่ในฟิลด์status/result/errorไม่ใช่ที่ HTTP Status