POST /verify/bank
ตรวจสอบสลิปโอนเงินธนาคารไทยด้วย QR Payload, อัปโหลดรูปภาพ, Base64 หรือ URL
Endpoint
http
POST /verify/bankURL เต็ม: https://api.easyslip.com/v2/verify/bank
การยืนยันตัวตน
จำเป็น ดูคู่มือการยืนยันตัวตน
http
Authorization: Bearer YOUR_API_KEYRequest
วิธีการส่งข้อมูล
| วิธี | ฟิลด์ | Content-Type | คำอธิบาย |
|---|---|---|---|
| Payload | payload | application/json | ข้อมูล QR Code |
| รูปภาพ | image | multipart/form-data | อัปโหลดไฟล์รูปภาพ |
| Base64 | base64 | application/json | รูปภาพที่เข้ารหัส Base64 |
| URL | url | application/json | URL ของรูปภาพสลิป |
ต้องระบุวิธีเดียว
คุณต้องระบุเพียง 1 อย่างจาก: payload, image, base64 หรือ url
พารามิเตอร์เสริม
| พารามิเตอร์ | ประเภท | คำอธิบาย |
|---|---|---|
remark | string | หมายเหตุสำหรับติดตาม (1-255 ตัวอักษร) |
matchAccount | boolean | จับคู่ผู้รับกับบัญชีที่ลงทะเบียน |
matchAmount | number | จำนวนเงินที่คาดหวังเพื่อตรวจสอบ |
checkDuplicate | boolean | ตรวจสอบว่าสลิปถูกตรวจสอบแล้วหรือไม่ (ค่าเริ่มต้น: false) |
Type Definitions
typescript
// Request Types
interface VerifyBankRequest {
// ต้องระบุอย่างใดอย่างหนึ่ง
payload?: string; // QR payload (1-128 ตัวอักษร)
image?: File; // ไฟล์รูปภาพ (multipart/form-data)
base64?: string; // รูปภาพเข้ารหัส Base64
url?: string; // URL ของรูปภาพ (1-255 ตัวอักษร)
// พารามิเตอร์เสริม
remark?: string; // 1-255 ตัวอักษร
matchAccount?: boolean;
matchAmount?: number;
checkDuplicate?: boolean;
}
// Response Types
interface VerifyBankResponse {
success: true;
data: VerifyBankData;
message: string;
}
interface VerifyBankData {
remark?: string;
isDuplicate: boolean;
matchedAccount: MatchedAccount | null;
amountInOrder?: number;
amountInSlip: number;
isAmountMatched?: boolean;
rawSlip: RawSlip;
}
interface MatchedAccount {
bank: {
nameTh: string;
nameEn: string;
code: string;
shortCode: string;
};
nameTh: string;
nameEn: string;
type: 'PERSONAL' | 'JURISTIC';
bankNumber: string;
}
interface RawSlip {
payload: string;
transRef: string;
date: string; // ISO 8601
countryCode: string;
amount: Amount;
fee: number;
ref1: string;
ref2: string;
ref3: string;
sender: Party;
receiver: Party & { merchantId?: string | null };
}
interface Amount {
amount: number;
local: {
amount: number;
currency: string;
};
}
interface Party {
bank: {
id: string;
name: string;
short: string;
};
account: {
name: {
th?: string;
en?: string;
};
bank?: {
type: 'BANKAC' | 'TOKEN' | 'DUMMY';
account: string;
};
proxy?: {
type: 'NATID' | 'MSISDN' | 'EWALLETID' | 'EMAIL' | 'BILLERID';
account: string;
};
};
}
// Error Response
interface ErrorResponse {
success: false;
error: {
code: string;
message: string;
};
}ตัวอย่าง
bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"payload": "00000000000000000000000000000000000000"}'bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@/path/to/slip.jpg"bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"base64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA..."}'bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/slip.jpg"}'Response
Response สำเร็จ (200)
json
{
"success": true,
"data": {
"remark": "Order #12345",
"isDuplicate": false,
"matchedAccount": {
"bank": {
"nameTh": "กสิกรไทย",
"nameEn": "KASIKORNBANK",
"code": "004",
"shortCode": "KBANK"
},
"nameTh": "บริษัท ตัวอย่าง จำกัด",
"nameEn": "EXAMPLE CO., LTD.",
"type": "JURISTIC",
"bankNumber": "123-4-56789-0"
},
"amountInOrder": 1500.00,
"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"
},
"proxy": {
"type": "MSISDN",
"account": "08xxxxxxxx89"
}
},
"merchantId": null
}
}
},
"message": "Bank slip verified successfully"
}Error Responses
Validation Error (400)
json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "At least one of payload, image, url, or base64 is required"
}
}ไม่พบสลิป (404)
json
{
"success": false,
"error": {
"code": "SLIP_NOT_FOUND",
"message": "The slip could not be found or is invalid"
}
}เกินโควต้า (403)
json
{
"success": false,
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Your API quota has been exceeded"
}
}ข้อกำหนดรูปภาพ
เมื่อใช้อัปโหลดรูปภาพ, Base64 หรือ URL:
| ข้อกำหนด | ค่า |
|---|---|
| ขนาดสูงสุด | 4 MB |
| รูปแบบที่รองรับ | JPEG, PNG, GIF, WebP |
| QR Code | ต้องมองเห็นได้ชัดเจน |
| ข้อจำกัด URL | HTTP/HTTPS เท่านั้น, ไม่รองรับ Private IP |
การจัดการสลิปซ้ำ
เมื่อ checkDuplicate: true:
| สถานการณ์ | ผลลัพธ์ | โควต้า |
|---|---|---|
| Branch เดียวกัน, ตรวจสอบแล้ว | ข้อมูล Cache, isDuplicate: true | ไม่หัก |
| Branch อื่น, ตรวจสอบแล้ว | ข้อมูลใหม่, isDuplicate: true | หัก |
| สลิปใหม่ | ข้อมูลใหม่, isDuplicate: false | หัก |
การจับคู่บัญชี
เมื่อ matchAccount: true:
- ระบบตรวจสอบผู้รับกับบัญชีธนาคารที่คุณลงทะเบียน
- ใช้การจับคู่ชื่ออัจฉริยะ (85% similarity threshold)
- รองรับ PromptPay, บัญชีธนาคารปกติ และบัญชีร้านค้า
- คืน
matchedAccount: nullถ้าไม่พบบัญชีที่ตรงกัน
หมายเหตุ
- Request ถูกนับรวมในโควต้ารายเดือน
- ตรวจสอบ
/infoendpoint สำหรับการใช้งานปัจจุบัน - ดูหน้าวิธีการแต่ละแบบสำหรับตัวอย่างโดยละเอียด