Appearance
Orders API
สร้างและตรวจสอบสถานะ order การเติมเกม
Auth required:
x-partner-id+x-signature— ดู Authentication
POST /orders
สร้าง order เติมเกมใหม่
Request
http
POST {API_PREFIX}/orders
Content-Type: application/json
x-partner-id: {PARTNER_ID}
x-signature: {SIGNATURE}Body
json
{
"refID": "{vendor_referenceID}",
"packageID": "ROLTH_A01_P001",
"topupInfo": {
"gameid": "user_game_id",
"server": "1"
},
"hookURL": "https://vendor-server.com/callback"
}| Field | Type | Required | คำอธิบาย |
|---|---|---|---|
packageID | string | ✅ | ID แพ็กเกจที่ต้องการเติม |
refID | string | ✅ | Reference ID จากฝั่ง Vendor |
topupInfo | object | ✅ | ข้อมูลเติมเงินเกม เช่น GameID, เซิร์ฟเวอร์ |
hookURL | string (URI) | URL สำหรับรับ webhook เมื่อ order เสร็จสิ้น |
Response 201
json
{
"success": true,
"statusCode": 201,
"code": "ORDER_CREATED",
"data": {
"orderID": "{p2w_orderID}",
"refID": "{vendor_referenceID}",
"status": "pending",
"packageID": "ROLTH_A01_P001",
"topupInfo": {
"gameid": "user_game_id",
"server": "1"
},
"createdAt":"2026-03-21T21:05:39.790Z"
},
"timestamp": "2026-03-16T10:00:00Z"
}| Status | ความหมาย |
|---|---|
pending | รอประมวลผล |
processing | กำลังเติม / อยู่ในคิว P2W |
succeeded | เติมสำเร็จ |
failed | เติมไม่สำเร็จ |
Errors
| Code | Status | คำอธิบาย |
|---|---|---|
REF_ID_EXISTS | 400 | refID นี้ถูกใช้ไปแล้ว |
MISSING_FIELD | 400 | ข้อมูลสำหรับเติมเกมใน topupInfo ไม่ครบ |
INSUFFICIENT_BALANCE | 400 | ยอด Balance ไม่พอสำหรับเติมเกม |
INTERNAL_SERVER_ERROR | 500 | เกิดข้อผิดพลาดภายในระบบ |
ตัวอย่าง 400 REF_ID_EXISTS
json
{
"success": false,
"statusCode": 400,
"code": "REF_ID_EXISTS",
"message": "refID already exists",
"timestamp": "2026-03-22T05:42:20.429Z"
}GET /orders/:id
ตรวจสอบสถานะ order ด้วย P2W orderID
Request
http
GET https://vendor.p2wtopup.com/api/v1/orders/{p2w_orderID}
x-partner-id: {PARTNER_ID}
x-signature: {SIGNATURE}Path Parameters
| Parameter | Type | Required | คำอธิบาย |
|---|---|---|---|
id | string | ✅ | P2W orderID ที่ได้รับตอนสร้าง order |
Response 200
json
{
"success": true,
"statusCode": 200,
"code": "OK",
"data": {
"orderID": "{p2w_orderID}",
"refID": "{vendor_referenceID}",
"status": "successed",
"packageID": "ROLTH_A01_P001",
"topupInfo": {
"gameid": "user_game_id",
"server": "1"
},
"reason": "",
"createdAt": "2026-03-21T21:05:39.790Z"
},
"timestamp": "2026-03-16T10:05:00Z"
}Errors
| Code | Status | คำอธิบาย |
|---|---|---|
ORDER_NOT_FOUND | 404 | ไม่พบ order ด้วย orderID นี้ |
FORBIDDEN | 403 | order นี้ไม่ใช่ของ Vendor ท่าน |
INTERNAL_SERVER_ERROR | 500 | เกิดข้อผิดพลาดภายในระบบ |
Webhook Callback
ถ้าระบุ hookURL ตอนสร้าง order ระบบจะ POST ไปยัง URL เมื่อ order เสร็จสิ้น
Callback Payload
json
{
"orderID": "{p2w_orderID}",
"refID": "{vendor_referenceID}",
"status": "successed",
"balance": 1000,
"reason": ""
}