Reseller API

เชื่อมต่อร้านค้าของคุณกับ GOODBUY24 — สั่งซื้อสินค้าอัตโนมัติผ่าน API

API Key
Documentation
Playground

Authentication & Base URL

ทุก request ต้องส่ง API Key:

แนะนำ: Header X-API-Key: YOUR_API_KEY

Compatibility: ?api_key=YOUR_API_KEY ยังใช้ได้ แต่หลีกเลี่ยงกับระบบใหม่เพราะ key อาจติดใน URL/access log

Base URL:

https://xn--82c0bb3a8eta9e8cn.store/api/v1/
📱 OTP Endpoints
GET ?action=categories รายการหมวดหมู่ทั้งหมด

ไม่มี parameter เพิ่มเติม

{ "status": "success", "message": "OK", "data": [ { "id": 1, "name": "Game Top-Up", "slug": "game-top-up", "icon": "shopping-cart", "description": "เติมเกมทุกแพลตฟอร์ม" } ] }
GET ?action=products รายการสินค้า
NameTypeDescription
category_id optionalintกรองตามหมวดหมู่
{ "status": "success", "data": [ { "id": 5, "name": "Roblox 100 Robux", "price": "35.00", "min_qty": 1, "max_qty": 10, "stock": 24 } ] }
GET ?action=product_detail รายละเอียดสินค้า
NameTypeDescription
id requiredintProduct ID
{ "status": "success", "data": { "id": 5, "name": "Roblox 100 Robux", "price": "35.00", "stock": 24, "category_name": "Game Top-Up", "total_sold": 150 } }
POST ?action=purchase สั่งซื้อสินค้า
NameTypeDescription
product_id requiredintID สินค้าที่ต้องการซื้อ
quantity optionalintจำนวน (default: 1, จำกัดตาม min_qty/max_qty)
{ "status": "success", "message": "Purchase successful.", "data": { "order_id": 42, "product_name": "Roblox 100 Robux", "quantity": 2, "total_price": 70, "balance_after": 430, "items": ["CODE-XXXX-1", "CODE-XXXX-2"] } }
GET ?action=orders ประวัติการสั่งซื้อ
NameTypeDescription
page optionalintหน้า (default: 1)
limit optionalintจำนวนต่อหน้า (default: 20, max: 50)
{ "data": { "orders": [{"id":42, "product_name":"...", "quantity":2, "total_price":"70.00", "status":"completed"}], "total": 15, "page": 1, "total_pages": 1 } }
GET ?action=order_detail รายละเอียดออเดอร์ + items
NameTypeDescription
order_id requiredintOrder ID
{ "data": { "id": 42, "product_name": "Roblox 100 Robux", "items": ["CODE-XXXX-1", "CODE-XXXX-2"] } }
GET ?action=balance เช็คยอดเงินคงเหลือ
{ "data": { "balance": 500.00 } }
GET ?action=profile ข้อมูล reseller
{ "data": { "user": {"username":"reseller01", "balance":"500.00"}, "total_orders": 15, "total_spent": 1250.50, "rate_limit": 60 } }
📱 OTP Endpoints
GET ?action=otp_services รายการบริการ OTP ทั้งหมด
NameTypeDescription
country optionalintรหัสประเทศ (default: 52 = Thailand)
{ "status": "success", "data": [ { "code": "tg", "name": "Telegram", "price": 3.50, "available": true, "available_count": 5776, "provider": "otp24hr" } ] }
POST ?action=otp_buy ซื้อเบอร์ OTP
NameTypeDescription
service requiredstringรหัสบริการ เช่น "tg", "wa", "fb"
country optionalintรหัสประเทศ (default: 52)
provider optionalstring"otp24hr"
{ "status": "success", "message": "OTP purchased.", "data": { "order_id": 12345, "phone": "0812345678", "service": "Telegram", "price": 3.50, "balance_after": 496.50, "expires_in_min": 20, "provider": "otp24hr" } }

1. เรียก otp_services เพื่อดูรายการบริการและราคา
2. เรียก otp_buy — ระบบหักเงินและส่งคืน order_id + เบอร์โทร
3. เรียก otp_status ซ้ำทุก 3-5 วินาที จนกว่าจะได้รับ OTP code
4. (ถ้าต้องการรอบถัดไป) เรียก otp_resend — ฟรี; OTP24HR ได้ order_id ใหม่ ส่วน HeroSMS ใช้ order_id เดิม
5. (ถ้ายกเลิก) เรียก otp_cancel — ระบบคืนเงินอัตโนมัติ

GET ?action=otp_status เช็คสถานะ OTP / รับรหัส
NameTypeDescription
order_id requiredintOrder ID ที่ได้จาก otp_buy
provider optionalstringใช้ค่า provider จาก otp_buy เมื่อมี order ID ซ้ำระหว่างผู้ให้บริการ
{ "status": "success", "data": { "order_id": 12345, "provider": "herosms", "phone": "0812345678", "status": "received", "otp_code": "123456", "messages": [ { "otp_code": "123456", "full_sms": "Your code is 123456", "received_at": "2025-01-15 12:30:45" } ], "seconds_left": 850 } }
StatusDescription
waitingรอรับ OTP อยู่
receivedได้รับ OTP แล้ว
successรอบเดิมเสร็จแล้ว (เช่น OTP24HR เมื่อสร้างออเดอร์รอบถัดไป)
cancelยกเลิกแล้ว (คืนเงินแล้ว)
timeoutหมดเวลา (20 นาที)
POST ?action=otp_resend ขอ OTP รอบถัดไป (ฟรี)
NameTypeDescription
order_id requiredintOrder ID ปัจจุบัน (ต้องได้รับ OTP รอบปัจจุบันแล้ว)
provider optionalstringค่า provider จาก otp_buy; ช่วยระบุรายการให้ตรงเมื่อ order ID ซ้ำ
{ "status": "success", "message": "Resend accepted. Continue polling otp_status.", "data": { "new_order_id": 12345, "original_order_id": 12345, "phone": "0812345678", "price": 0, "provider": "herosms", "same_order_id": true } }

รองรับ OTP24HR และ HeroSMS — ไม่มีค่าใช้จ่ายเพิ่ม และใช้หมายเลขเดิม
OTP24HR จะคืน new_order_id ใหม่; HeroSMS ใช้ activation/order ID เดิม โดย new_order_id จะเท่ากับ original_order_id
ส่ง provider จาก otp_buy ได้ในคำขอ status/resend/cancel เพื่อป้องกัน order ID ซ้ำ
หลัง resend ให้เรียก otp_status ต่อ; ระหว่างรอ status จะเป็น waiting และ otp_code จะว่าง ส่วน messages เก็บประวัติ SMS ก่อนหน้าไว้

POST ?action=otp_cancel ยกเลิก OTP + คืนเงิน
NameTypeDescription
order_id requiredintOrder ID ที่ต้องการยกเลิก (status ต้องเป็น waiting หรือ received)
provider optionalstringค่า provider จาก otp_buy; ช่วยระบุรายการให้ตรงเมื่อ order ID ซ้ำ
{ "status": "success", "message": "Order cancelled and refunded.", "data": { "order_id": 12345, "refunded": 3.50, "balance_after": 500.00, "provider": "herosms" } }

การคืนเงินจะทำหลัง provider ยืนยันการยกเลิกเท่านั้น; ถ้าส่งคำขอซ้ำหลังยกเลิกสำเร็จ API จะตอบว่าออเดอร์ยกเลิกแล้วและคืน refunded: 0 เพื่อป้องกันการคืนเงินซ้ำ

GET ?action=otp_history ประวัติ OTP ทั้งหมด
NameTypeDescription
page optionalintหน้า (default: 1)
limit optionalintจำนวนต่อหน้า (default: 20, max: 50)
{ "status": "success", "data": { "orders": [ { "order_id": 12345, "provider": "otp24hr", "service_code": "tg", "service_name": "Telegram", "phone": "0812345678", "price": "3.50", "otp_code": "123456", "status": "received", "created_at": "2025-01-15 12:30:00" } ], "total": 8, "page": 1, "limit": 20, "total_pages": 1 } }

Error Codes

CodeDescription
400Bad Request — parameter ไม่ถูกต้อง
401Unauthorized — API Key ไม่ถูกต้อง
403Forbidden — Key ถูกปิดหรือบัญชีถูกระงับ
404Not Found
409Conflict — สถานะออเดอร์ยังไม่พร้อม resend/cancel
429Too Many Requests — เกิน rate limit
500Server Error

API Key

Endpoint

GET categories
GET products
GET product_detail
POST purchase
GET orders
GET order_detail
GET balance
GET profile
OTP
GET otp_services
POST otp_buy
GET otp_status
POST otp_resend
POST otp_cancel
GET otp_history
GET ?action=categories
// กด Send Request เพื่อดู response