Kupon
Otelin panelde tanımladığı online indirim kuponlarını doğrular. İndirim, fiyat hesabına sizin tarafınızda uygulanır; rezervasyon aktarımında indirimli tutarları gönderin.
Kupon doğrula#
POST
/external/online/coupon/searchKimlik doğrulama: Authorization: Bearer · Gövde: application/x-www-form-urlencoded veya multipart/form-data
Kupon kodunun bu otel için aktif, süresi geçmemiş ve kullanıma açık olduğunu doğrular; indirim türünü ve oranını döner.
Form alanları
hotelIDintegerzorunluOtel kimliği.
couponstringzorunluMisafirin girdiği kupon kodu.
Yanıt
200 Başarılı.
cupon.idintegerKupon kimliği.
cupon.changeintegerİndirim türü:
0 yüzde (rate % değeri), 1 net tutar (rate para birimi cinsinden indirim).cupon.ratestringİndirim oranı veya tutarı.
Hata yanıtları
- 200
online_cupon_is_not_found— kod yok, pasif veya süresi dolmuş;hotel_id_is_not_found—hotelIDeksik.
curl "https://test.hms.gen.tr/external/online/coupon/search" \
-H "Authorization: Bearer $HMS_TOKEN" \
-d "hotelID=1000" \
-d "coupon=YAZ2026"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", "YAZ2026"]
])
});
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' => 'YAZ2026',
]),
]);
$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"
}