POST /verify/truewallet
ตรวจสอบสลิปโอนเงิน TrueMoney Wallet ด้วยอัปโหลดรูปภาพ, Base64, URL หรือข้อความใน QR ของสลิป
API อ่าน QR โอนเงิน TrueMoney (P2P) บนสลิปแล้วตรวจกับ TrueMoney โดยตรง ไม่ได้อ่านตัวหนังสือบนสลิป รูปจึงต้องมี QR นี้ ถ้าเป็น QR ของสลิปธนาคารจะได้ INVALID_WALLET_QR
Endpoint
POST /verify/truewalletURL เต็ม: https://api.thunder.in.th/v2/verify/truewallet
การยืนยันตัวตน
จำเป็น ดูคู่มือการยืนยันตัวตน
Authorization: Bearer YOUR_API_KEYRequest
วิธีการส่งข้อมูล
| วิธี | ฟิลด์ | Content-Type | คำอธิบาย |
|---|---|---|---|
| รูปภาพ | image | multipart/form-data | อัปโหลดไฟล์รูปภาพ |
| Base64 | base64 | application/json | รูปภาพที่เข้ารหัส Base64 |
| URL | url | application/json | URL ของรูปภาพสลิป |
| Payload | payload | application/json | ข้อความใน QR ของ TrueMoney (1-256 ตัวอักษร) |
ต้องระบุวิธีเดียว
คุณต้องระบุเพียง 1 อย่างจาก: payload, image, base64 หรือ url
พารามิเตอร์เสริม
| พารามิเตอร์ | ประเภท | คำอธิบาย |
|---|---|---|
remark | string | หมายเหตุสำหรับติดตาม (1-255 ตัวอักษร) |
matchAccount | boolean | จับคู่ผู้รับกับบัญชี TrueMoney Wallet ที่ลงทะเบียน |
matchAmount | number | จำนวนเงินที่คาดหวังเพื่อตรวจสอบ |
checkDuplicate | boolean | ตรวจสอบว่าสลิปถูกตรวจสอบแล้วหรือไม่ (ค่าเริ่มต้น: false) |
Type Definitions
// Request Types
interface VerifyTrueWalletRequest {
// ต้องระบุอย่างใดอย่างหนึ่ง
image?: File; // ไฟล์รูปภาพ (multipart/form-data)
base64?: string; // รูปภาพเข้ารหัส Base64
url?: string; // URL ของรูปภาพ (1-255 ตัวอักษร)
payload?: string; // ข้อความใน QR ของ TrueMoney (1-256 ตัวอักษร)
// พารามิเตอร์เสริม
remark?: string; // 1-255 ตัวอักษร
matchAccount?: boolean;
matchAmount?: number;
checkDuplicate?: boolean;
}
// Response Types
interface VerifyTrueWalletResponse {
success: true;
data: VerifyTrueWalletData;
message: string;
}
interface VerifyTrueWalletData {
remark?: string;
isDuplicate: boolean;
matchedAccount: MatchedAccount | null;
amountInOrder?: number;
amountInSlip: number;
isAmountMatched?: boolean;
rawSlip: TrueWalletSlip;
}
interface MatchedAccount {
bank: {
nameTh: string;
nameEn: string;
code: string;
shortCode: string;
};
nameTh: string;
nameEn: string;
type: 'NATURAL' | 'JURISTIC';
bankNumber: string;
}
interface TrueWalletSlip {
transactionId: string;
date: string; // ISO 8601
amount: number;
sender?: { // มีเมื่อ TrueMoney ส่งเบอร์ผู้โอนมา
phone: string; // เบอร์มือถือปิดบังบางส่วน เช่น 08-xxx-2345
};
receiver?: { // มีเมื่อ TrueMoney ส่งเบอร์ผู้รับมา
phone: string; // เบอร์มือถือปิดบังบางส่วน เช่น 08-xxx-4567
};
}
// Error Response
interface ErrorResponse {
success: false;
error: {
code: string;
message: string;
};
}ตัวอย่าง
curl -X POST https://api.thunder.in.th/v2/verify/truewallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@/path/to/truemoney-slip.jpg"curl -X POST https://api.thunder.in.th/v2/verify/truewallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"base64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA..."}'curl -X POST https://api.thunder.in.th/v2/verify/truewallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"payload": "TRUEMONEY_QR_TEXT"}'curl -X POST https://api.thunder.in.th/v2/verify/truewallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/truemoney-slip.jpg"}'Response
Response สำเร็จ (200)
{
"success": true,
"data": {
"remark": "Order #12345",
"isDuplicate": false,
"matchedAccount": {
"bank": {
"nameTh": "ทรูมันนี่ วอลเล็ท",
"nameEn": "TrueMoney Wallet",
"code": "TRUEMONEYWALLET",
"shortCode": "TRUEWALLET"
},
"nameTh": "นาย รับเงิน ทดสอบ",
"nameEn": "",
"type": "NATURAL",
"bankNumber": "0891234567"
},
"amountInOrder": 500.00,
"amountInSlip": 500.00,
"isAmountMatched": true,
"rawSlip": {
"transactionId": "12345678901234",
"date": "2024-01-15T14:30:00+07:00",
"amount": 500.00,
"sender": {
"phone": "08-xxx-2345"
},
"receiver": {
"phone": "08-xxx-4567"
}
}
},
"message": "TrueMoney Wallet slip verified successfully"
}rawSlip คือข้อมูลที่ TrueMoney ส่งกลับมาจาก QR ของรายการโอน ไม่มีชื่อผู้โอนและผู้รับ sender และ receiver มีแค่เบอร์มือถือที่ปิดบังบางส่วนในรูป 0X-xxx-NNNN และจะมีแต่ละ object ก็ต่อเมื่อ TrueMoney ส่งเบอร์นั้นมา
Error Responses
Validation Error (400)
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Provide exactly one of payload, image, url or base64"
}
}ไม่พบ QR ของ TrueMoney (400)
{
"success": false,
"error": {
"code": "INVALID_WALLET_QR",
"message": "No readable TrueMoney Wallet QR code"
}
}ไม่พบสลิป (404)
{
"success": false,
"error": {
"code": "SLIP_NOT_FOUND",
"message": "TrueMoney Wallet slip not found or invalid"
}
}เกินโควต้า (403)
{
"success": false,
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Service quota limit has been reached"
}
}TrueMoney ใช้งานไม่ได้ (502/503)
message เป็นข้อความเดียวกับ code ให้ลองใหม่ภายหลัง ถ้า Response มี Header Retry-After ให้รออย่างน้อยตามจำนวนวินาทีนั้น
| Status | Code | กรณี |
|---|---|---|
| 503 | WALLET_PROVIDER_BUSY | มี Request ไปที่ TrueMoney มากเกินไปในตอนนี้ |
| 503 | WALLET_PROVIDER_UNAVAILABLE | TrueMoney ไม่ตอบภายในเวลาที่กำหนด |
| 503 | WALLET_PROVIDER_NOT_CONFIGURED | ระบบฝั่งเรายังไม่ได้ตั้งค่าการตรวจกับ TrueMoney |
| 502 | WALLET_PROVIDER_INVALID_RESPONSE | TrueMoney ส่งข้อมูลที่ API ใช้ไม่ได้ |
ข้อกำหนดรูปภาพ
| ข้อกำหนด | ค่า |
|---|---|
| ขนาดสูงสุด | 4 MB |
| รูปแบบที่รองรับ | JPEG, PNG, GIF, WebP |
| QR Code | ต้องมี QR โอนเงิน TrueMoney (P2P) ที่อ่านได้ |
| ข้อจำกัด URL | HTTP/HTTPS เท่านั้น, ไม่รองรับ Private IP |
การจัดการสลิปซ้ำ
เมื่อ checkDuplicate: true:
| สถานการณ์ | ผลลัพธ์ | โควต้า |
|---|---|---|
| Branch เดียวกัน, ตรวจสอบแล้ว | ข้อมูลล่าสุดจาก TrueMoney, isDuplicate: true | ไม่หัก |
| สลิปใหม่ | ข้อมูลใหม่, isDuplicate: false | หัก |
การจับคู่บัญชี
เมื่อ matchAccount: true:
- ระบบตรวจสอบเบอร์โทรผู้รับกับบัญชี TrueMoney Wallet ที่คุณลงทะเบียน
- ทุกหลักที่ TrueMoney แสดงในเบอร์ผู้รับ (ที่ปิดบังบางส่วน) ต้องตรงกับเบอร์ที่ลงทะเบียน
- คืน
matchedAccount: nullถ้าไม่พบบัญชีที่ตรงกัน ถ้าตรงกับหลายเบอร์ หรือถ้า TrueMoney ไม่ได้ส่งเบอร์ผู้รับมา
หมายเหตุ
- Request ถูกนับรวมในโควต้ารายเดือน
- ตรวจสอบ
/infoendpoint สำหรับการใช้งานปัจจุบัน - QR Code ต้องมองเห็นได้ชัดเจนเพื่อผลลัพธ์ที่ดีที่สุด
- ใช้
checkDuplicate: trueเสมอเพื่อป้องกันการฉ้อโกง - ดูหน้าวิธีการแต่ละแบบสำหรับตัวอย่างโดยละเอียด
