เชื่อมต่อ OMI PAYMENT ได้อย่างมั่นใจ
คู่มือสำหรับนักพัฒนา ตั้งแต่การสร้าง API Key การส่ง Request การอ่าน Response ไปจนถึงการจัดการ Error, Rate Limit และ Billing
ภาพรวม API
OMI PAYMENT ช่วยให้ระบบของคุณส่งรูปสลิป เพื่ออ่านข้อมูลธุรกรรม ตรวจสอบสถานะ และตรวจสอบยอดเงินที่คาดหวังผ่าน HTTP API
Authentication
ยืนยันตัวตนด้วย API Key
ทุกคำขอต้องส่ง API Key ผ่าน HTTP Header โดยสร้างและจัดการ API Key ได้จาก Dashboard
X-API-Key: YOUR_API_KEY
Quick Start
เริ่มใช้งานใน 3 ขั้นตอน
ตรวจสอบสลิป
https://api.thairak.store/v1/slips/verify.php
Request Parameters
| ชื่อ | ประเภท | จำเป็น | รายละเอียด |
|---|---|---|---|
| slip_image | File | จำเป็น | รูปสลิป JPG, PNG หรือ WEBP ขนาดไม่เกิน 10 MB |
| amount | Number | ไม่บังคับ | ยอดเงินที่คาดหวัง เช่น 100 หรือ 100.50 |
amount
ระบบจะตรวจสอบว่ายอดเงินบนสลิป
ตรงกับยอดที่ระบุหรือไม่
ตัวอย่างการเรียก API
เลือกภาษาที่ใช้ในระบบของคุณ
curl --request POST \
--url https://api.thairak.store/v1/slips/verify.php \
--header "X-API-Key: YOUR_API_KEY" \
--form "slip_image=@/path/to/slip.jpg" \
--form "amount=100.50"
<?php
$curl = curl_init();
curl_setopt_array(
$curl,
[
CURLOPT_URL =>
'https://api.thairak.store/v1/slips/verify.php',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_POST =>
true,
CURLOPT_HTTPHEADER => [
'X-API-Key: YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => [
'slip_image' =>
new CURLFile(
'/path/to/slip.jpg'
),
'amount' =>
'100.50',
],
]
);
$response = curl_exec(
$curl
);
$httpStatus = curl_getinfo(
$curl,
CURLINFO_HTTP_CODE
);
curl_close(
$curl
);
$data = json_decode(
(string)$response,
true
);
print_r(
$data
);
const formData = new FormData();
formData.append(
'slip_image',
slipFile
);
formData.append(
'amount',
'100.50'
);
const response = await fetch(
'https://api.thairak.store/v1/slips/verify.php',
{
method: 'POST',
headers: {
'X-API-Key':
'YOUR_API_KEY'
},
body:
formData
}
);
const result = await response.json();
console.log(
result
);
Successful Response
HTTP 200
เมื่อคำขอสำเร็จ API จะตอบข้อมูลผลตรวจสอบ ข้อมูลธุรกรรม ค่าใช้จ่าย และ Request ID
{
"success": true,
"message": "ตรวจสอบสลิปสำเร็จ",
"data": {
"request_id": "56570345-477a-4593-a3fd-c39e30f962ad",
"verified": true,
"slip": {
"verified": true,
"reference": "619115344637I000015B9790",
"transaction_date": "2026-07-10T08:04:00.000Z",
"amount": 100.5,
"sender": {
"bank_code": "030",
"name": "ชื่อผู้โอน",
"account": "0204xxxx4444"
},
"receiver": {
"bank_code": "004",
"name": "ชื่อผู้รับ",
"account": "12xxxx2589"
}
},
"billing": {
"billable": true,
"cost": 0.5,
"balance_after": 299.5
}
}
}
Error Response
รูปแบบข้อผิดพลาดมาตรฐาน
{
"success": false,
"message": "เครดิตไม่เพียงพอ",
"data": {
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"error": {
"code": "insufficient_credit"
}
}
Error Codes
| HTTP | Error Code | รายละเอียด |
|---|---|---|
| 401 | invalid_api_key | API Key ไม่ถูกต้อง หรือไม่ได้ส่ง API Key |
| 402 | insufficient_credit | เครดิตใน Wallet ไม่เพียงพอ |
| 405 | method_not_allowed | เรียก Endpoint ด้วย Method ที่ไม่รองรับ |
| 422 | slip_image_required | ไม่ได้ส่งไฟล์ slip_image |
| 422 | invalid_amount | ยอดเงินที่ส่งมาไม่ถูกต้อง |
| 429 | rate_limit_exceeded | เรียก API เกินขีดจำกัดของแพ็กเกจ |
| 500 | internal_error | เกิดข้อผิดพลาดภายในระบบ |
| 503 | service_unavailable | บริการหรือ Provider ยังไม่พร้อมใช้งาน |
Rate Limit
จำนวน Request ขึ้นอยู่กับแพ็กเกจ และระบบส่งข้อมูลขีดจำกัดกลับผ่าน Response Header
X-RateLimit-Limit-Minute
จำนวนสูงสุดต่อนาที
X-RateLimit-Remaining-Minute
จำนวนที่เหลือในนาทีปัจจุบัน
X-RateLimit-Limit-Day
จำนวนสูงสุดต่อวัน
X-RateLimit-Remaining-Day
จำนวนที่เหลือภายในวัน
Retry-After
เพื่อแจ้งเวลาที่ควรรอก่อนเรียกใหม่
Billing และเครดิต
ค่าบริการจะถูกหักจาก Wallet ตามราคาแพ็กเกจและ Billing Mode ของบริการ
สมาชิกสามารถดูเครดิตคงเหลือ ประวัติ Wallet ค่าใช้จ่ายของแต่ละ Request และยอดคงเหลือหลังหักได้จาก Dashboard
ดูราคาและแพ็กเกจพร้อมทดลองเรียก API จริง
ใช้ API Tester ใน Dashboard เพื่อเลือก API Key อัปโหลดรูปสลิป ส่ง Request และดูผลตอบกลับได้จากหน้าเดียว
เข้าสู่ระบบเพื่อทดสอบ APIต้องการความช่วยเหลือ?
พบปัญหาในการเชื่อมต่อ หรือมีคำถามเกี่ยวกับ API สามารถติดต่อทีมงานพร้อมแจ้ง Request ID เพื่อช่วยให้ตรวจสอบได้รวดเร็วขึ้น
ติดต่อเรา