ข้ามไปยังเนื้อหา
สำหรับนักพัฒนา
ซิงก์สินค้า สต็อก และออเดอร์ของร้านกับระบบของคุณเอง และรับแจ้งเมื่อมีออเดอร์ใหม่ผ่าน webhook
สร้างคีย์ที่ศูนย์ผู้ขาย เลือกสิทธิ์ที่ต้องใช้ แล้วส่งคีย์ใน header Authorization ทุกคำขอทำงานในนามเจ้าของร้าน ใช้กฎเดียวกับศูนย์ผู้ขาย
ตัวอย่าง
curl -H "Authorization: Bearer odx_..." https://demo-api.odinmax.com/v1/public/listingsจำกัดการเรียก
120 ครั้งต่อนาทีต่อคีย์ และ 600 ครั้งต่อนาทีต่อร้าน เกินแล้วได้ 429 RATE_LIMITEDจำนวนเงิน
เป็นหน่วยย่อย (สตางค์หรือเซนต์) แบบข้อความ เช่น "35500" คือ 355.00 บาทข้อผิดพลาด
ตอบเป็น code เช่น LISTING_NOT_FOUND ไม่ใช่ประโยค ใช้ code ตัดสินในระบบของคุณListings get /v1/public/listingsสิทธิ์ listings.read
List your listings
ตัวอย่างคำตอบ 200
[
{
"shortId": "string",
"status": "DRAFT",
"title": {
"en": "Genshin Impact AR 58",
"th": "ไอดี Genshin AR 58"
},
"type": "TOPUP",
"deliveryMode": "AUTO",
"priceTh": {
"amount": "35500",
"currency": "THB"
},
"priceIntl": {
"amount": "35500",
"currency": "THB"
},
"price": "string",
"priceThCustom": false,
"quantityAvailable": 1,
"imageUrl": "string",
"salesCount": 1,
"moderationNote": "string",
"updatedAt": "2026-10-01T12:00:00.000Z"
}
]200 All listings of the shop401 Missing or unknown key403 Key lacks the scope, or the shop is restricted (SHOP_RESTRICTED) or paused for writes (SHOP_PAUSED)429 Rate limited: 120 requests/minute per key, 600 per shop, 300 per IP
patch /v1/public/listings/{shortId}สิทธิ์ listings.write
Change price, quantity or pause a listing
พารามิเตอร์
shortIdpath · จำเป็น ^[A-Za-z0-9]{4,12}$ ตัวอย่างข้อมูลที่ส่ง
{
"price": {
"currency": "THB",
"amount": "string"
},
"priceTh": "string",
"priceIntl": "string",
"quantity": 0,
"paused": false
}ตัวอย่างคำตอบ 200
{
"shortId": "string",
"status": "string",
"quantityAvailable": 1
}200 Updated400 Invalid body (VALIDATION_FAILED)401 Missing or unknown key Key lacks the scope, or the shop is restricted (SHOP_RESTRICTED) or paused for writes (SHOP_PAUSED)
Stock post /v1/public/listings/{shortId}/stockสิทธิ์ stock.write
Add delivery codes to an automatic-delivery listing
พารามิเตอร์
shortIdpath · จำเป็น ^[A-Za-z0-9]{4,12}$ ตัวอย่างข้อมูลที่ส่ง
{
"codes": [
"string"
]
}201 Codes added (duplicates in the request are counted once)400 Invalid body (VALIDATION_FAILED)401 Missing or unknown key Key lacks the scope, or the shop is restricted (SHOP_RESTRICTED) or paused for writes (SHOP_PAUSED)
Orders get /v1/public/ordersสิทธิ์ orders.read
List orders, newest first
พารามิเตอร์
statusquery PAID | DELIVERED | COMPLETED | DISPUTED | REFUNDED limitquery 1-100 (50) ตัวอย่างคำตอบ 200
[
{
"code": "string",
"status": "string",
"subtotal": {
"amount": "35500",
"currency": "THB"
},
"commission": {
"amount": "35500",
"currency": "THB"
},
"createdAt": "2026-10-01T12:00:00.000Z",
"paidAt": "2026-10-01T12:00:00.000Z",
"deliveredAt": "2026-10-01T12:00:00.000Z",
"completedAt": "2026-10-01T12:00:00.000Z",
"autoConfirmAt": "2026-10-01T12:00:00.000Z",
"items": [
{
"shortId": "string",
"title": {
"en": "Genshin Impact AR 58",
"th": "ไอดี Genshin AR 58"
},
"quantity": 1,
"unitPrice": {
"amount": "35500",
"currency": "THB"
}
}
]
}
]200 Orders Missing or unknown key
Webhookตั้ง URL ที่ศูนย์ผู้ขายแล้วเลือกเหตุการณ์ ทุกคำขอมีลายเซ็นใน X-Odinmax-Signature ให้ตรวจก่อนเชื่อ และใช้ X-Odinmax-Delivery กันรับซ้ำ ตอบ 2xx ภายใน 10 วินาที ถ้าไม่สำเร็จจะส่งซ้ำ 8 ครั้งในหนึ่งวัน
order.paidorder.completedorder.refundeddispute.openedping
ตัวอย่างข้อมูลที่ได้รับ
{
"id": "string",
"type": "order.paid",
"createdAt": "2026-10-01T12:00:00.000Z",
"data": {
"order": {
"code": "string",
"status": "string",
"subtotal": {
"amount": "35500",
"currency": "THB"
},
"items": [
{}
]
}
}
}ตรวจลายเซ็น (Node.js)
import crypto from 'node:crypto';
// header = request.headers['x-odinmax-signature'], rawBody = the body exactly as received
const [t, v1] = header.split(',').map((p) => p.split('=')[1]);
const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
const ok = fresh && crypto.timingSafeEqual(Buffer.from(v1, 'hex'), Buffer.from(expected, 'hex'));403
404 Not your listing (LISTING_NOT_FOUND)
429 Rate limited: 120 requests/minute per key, 600 per shop, 300 per IP
403
404 Not your listing (LISTING_NOT_FOUND)
409 Not an automatic-delivery listing (STOCK_NOT_AUTO)
429 Rate limited: 120 requests/minute per key, 600 per shop, 300 per IP
401
403 Key lacks the scope, or the shop is restricted (SHOP_RESTRICTED) or paused for writes (SHOP_PAUSED)
429 Rate limited: 120 requests/minute per key, 600 per shop, 300 per IP
get /v1/public/orders/{code}สิทธิ์ orders.read
One order
พารามิเตอร์
codepath · จำเป็น ^[A-Z0-9-]{4,24}$ ตัวอย่างคำตอบ 200
{
"code": "string",
"status": "string",
"subtotal": {
"amount": "35500",
"currency": "THB"
},
"commission": {
"amount": "35500",
"currency": "THB"
},
"createdAt": "2026-10-01T12:00:00.000Z",
"paidAt": "2026-10-01T12:00:00.000Z",
"deliveredAt": "2026-10-01T12:00:00.000Z",
"completedAt": "2026-10-01T12:00:00.000Z",
"autoConfirmAt": "2026-10-01T12:00:00.000Z",
"items": [
{
"shortId": "string",
"title": {
"en": "Genshin Impact AR 58",
"th": "ไอดี Genshin AR 58"
},
"quantity": 1,
"unitPrice": {
"amount": "35500",
"currency": "THB"
}
}
]
}200 The order401 Missing or unknown key403 Key lacks the scope, or the shop is restricted (SHOP_RESTRICTED) or paused for writes (SHOP_PAUSED)404 Not an order of your shop (ORDER_NOT_FOUND)429 Rate limited: 120 requests/minute per key, 600 per shop, 300 per IP