优惠券
验证酒店在后台设置的在线折扣优惠券。折扣由您一方计算;推送预订时请发送折后金额。
验证优惠券#
POST
/external/online/coupon/search身份验证: Authorization: Bearer · 请求体: application/x-www-form-urlencoded 或 multipart/form-data
检查优惠码对该酒店是否有效、未过期且可用;返回折扣类型和折扣值。
表单字段
hotelIDinteger必填酒店 ID。
couponstring必填客人输入的优惠码。
响应
200 成功。
cupon.idinteger优惠券 ID。
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"
}