Reseller API
เชื่อมต่อร้านค้าของคุณกับ GOODBUY24 — สั่งซื้อสินค้าอัตโนมัติผ่าน API
กรุณา เข้าสู่ระบบ หรือ สมัครสมาชิก เพื่อสร้าง API Key
Authentication & Base URL
ทุก request ต้องส่ง API Key อย่างใดอย่างหนึ่ง:
Header: X-API-Key: YOUR_API_KEY
Query param: ?api_key=YOUR_API_KEY
Base URL:
Parameters
ไม่มี parameter เพิ่มเติม
Response
Parameters
| Name | Type | Description |
|---|---|---|
| category_id optional | int | กรองตามหมวดหมู่ |
Response
Parameters
| Name | Type | Description |
|---|---|---|
| id required | int | Product ID |
Response
Parameters (POST body)
| Name | Type | Description |
|---|---|---|
| product_id required | int | ID สินค้าที่ต้องการซื้อ |
| quantity optional | int | จำนวน (default: 1, จำกัดตาม min_qty/max_qty) |
Response (Success)
Parameters
| Name | Type | Description |
|---|---|---|
| page optional | int | หน้า (default: 1) |
| limit optional | int | จำนวนต่อหน้า (default: 20, max: 50) |
Response
Parameters
| Name | Type | Description |
|---|---|---|
| order_id required | int | Order ID |
Response
Response
Response
Parameters
| Name | Type | Description |
|---|---|---|
| country optional | int | รหัสประเทศ (default: 52 = Thailand) |
Response
Parameters (POST body)
| Name | Type | Description |
|---|---|---|
| service required | string | รหัสบริการ เช่น "tg", "wa", "fb" |
| country optional | int | รหัสประเทศ (default: 52) |
| provider optional | string | "otp24hr" (default) หรือ "herosms" |
Response (Success)
Flow
1. เรียก otp_services เพื่อดูรายการบริการและราคา
2. เรียก otp_buy — ระบบหักเงินและส่งคืน order_id + เบอร์โทร
3. เรียก otp_status ซ้ำทุก 3-5 วินาที จนกว่าจะได้รับ OTP code
4. (ถ้าต้องการรอบถัดไป) เรียก otp_resend — ได้ order_id ใหม่ฟรี
5. (ถ้ายกเลิก) เรียก otp_cancel — ระบบคืนเงินอัตโนมัติ
Parameters
| Name | Type | Description |
|---|---|---|
| order_id required | int | Order ID ที่ได้จาก otp_buy |
Response
สถานะที่เป็นไปได้
| Status | Description |
|---|---|
| waiting | รอรับ OTP อยู่ |
| received | ได้รับ OTP แล้ว |
| success | เสร็จสิ้น (ใช้ resend ไปแล้ว) |
| cancel | ยกเลิกแล้ว (คืนเงินแล้ว) |
| timeout | หมดเวลา (20 นาที) |
Parameters (POST body)
| Name | Type | Description |
|---|---|---|
| order_id required | int | Order ID ปัจจุบัน (ต้องได้รับ OTP แล้วอย่างน้อย 1 ครั้ง) |
Response
⚠️ เฉพาะ OTP24HR เท่านั้น — ได้เบอร์เดิม ไม่เสียค่าใช้จ่าย
ใช้ new_order_id เรียก otp_status ต่อเพื่อรอรับ OTP รอบใหม่
Parameters (POST body)
| Name | Type | Description |
|---|---|---|
| order_id required | int | Order ID ที่ต้องการยกเลิก (status ต้องเป็น waiting หรือ received) |
Response
Parameters
| Name | Type | Description |
|---|---|---|
| page optional | int | หน้า (default: 1) |
| limit optional | int | จำนวนต่อหน้า (default: 20, max: 50) |
Response
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request — parameter ไม่ถูกต้อง |
| 401 | Unauthorized — API Key ไม่ถูกต้อง |
| 403 | Forbidden — Key ถูกปิดหรือบัญชีถูกระงับ |
| 404 | Not Found |
| 429 | Too Many Requests — เกิน rate limit (60 req/min) |
| 500 | Server Error |
API Key
Endpoint
// กด Send Request เพื่อดู response