คูปอง
ตรวจสอบคูปองส่วนลดออนไลน์ที่โรงแรมกำหนดไว้ในแผงควบคุม ให้คำนวณส่วนลดในฝั่งของคุณ แล้วส่งยอดเงินหลังหักส่วนลดในการส่งการจอง
ตรวจสอบคูปอง#
POST
/external/online/coupon/searchการยืนยันตัวตน: Authorization: Bearer · เนื้อหา: application/x-www-form-urlencoded หรือ multipart/form-data
ตรวจสอบว่ารหัสคูปองเปิดใช้งานอยู่ ยังไม่หมดอายุ และใช้ได้กับโรงแรมนี้ แล้วส่งคืนประเภทและอัตราส่วนลด
ฟิลด์แบบฟอร์ม
hotelIDintegerจำเป็นID ของโรงแรม
couponstringจำเป็นรหัสคูปองที่ผู้เข้าพักกรอก
การตอบกลับ
200 สำเร็จ
cupon.idintegerID ของคูปอง
cupon.changeintegerประเภทส่วนลด:
0 เปอร์เซ็นต์ (rate เป็น %), 1 จำนวนเงินคงที่ (rate เป็นสกุลเงินของโรงแรม)cupon.ratestringอัตราหรือจำนวนส่วนลด
การตอบกลับเมื่อเกิดข้อผิดพลาด
- 200
online_cupon_is_not_found— ไม่รู้จักรหัส ถูกปิดใช้งาน หรือหมดอายุแล้ว;hotel_id_is_not_found— ไม่ได้ส่งhotelID
curl "https://test.hms.gen.tr/external/online/coupon/search" \
-H "Authorization: Bearer $HMS_TOKEN" \
-d "hotelID=1000" \
-d "coupon=SUMMER2026"const res = await fetch("https://test.hms.gen.tr/external/online/coupon/search", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.HMS_TOKEN}`
},
body: new URLSearchParams([
["hotelID", "1000"],
["coupon", "SUMMER2026"]
])
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/online/coupon/search');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('HMS_TOKEN'),
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'hotelID' => '1000',
'coupon' => 'SUMMER2026',
]),
]);
$data = json_decode(curl_exec($ch), true);{
"success": true,
"cupon": {
"id": 12,
"change": 0,
"rate": "10.00"
}
}{
"success": false,
"message": "online_cupon_is_not_found"
}