Skip to content
On this page

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"
}
FieldTypeRequiredคำอธิบาย
packageIDstringID แพ็กเกจที่ต้องการเติม
refIDstringReference ID จากฝั่ง Vendor
topupInfoobjectข้อมูลเติมเงินเกม เช่น GameID, เซิร์ฟเวอร์
hookURLstring (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

CodeStatusคำอธิบาย
REF_ID_EXISTS400refID นี้ถูกใช้ไปแล้ว
MISSING_FIELD400ข้อมูลสำหรับเติมเกมใน topupInfo ไม่ครบ
INSUFFICIENT_BALANCE400ยอด Balance ไม่พอสำหรับเติมเกม
INTERNAL_SERVER_ERROR500เกิดข้อผิดพลาดภายในระบบ

ตัวอย่าง 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

ParameterTypeRequiredคำอธิบาย
idstringP2W 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

CodeStatusคำอธิบาย
ORDER_NOT_FOUND404ไม่พบ order ด้วย orderID นี้
FORBIDDEN403order นี้ไม่ใช่ของ Vendor ท่าน
INTERNAL_SERVER_ERROR500เกิดข้อผิดพลาดภายในระบบ

Webhook Callback

ถ้าระบุ hookURL ตอนสร้าง order ระบบจะ POST ไปยัง URL เมื่อ order เสร็จสิ้น

Callback Payload

json
{
  "orderID": "{p2w_orderID}",
  "refID": "{vendor_referenceID}",
  "status": "successed",
  "balance": 1000,
  "reason": ""
}