Coupon
Valide les coupons de réduction en ligne définis par l’hôtel dans le panneau. Appliquez la réduction de votre côté et envoyez les montants remisés lors de la transmission de la réservation.
Valider un coupon#
POST
/external/online/coupon/searchAuthentification: Authorization: Bearer · Corps: application/x-www-form-urlencoded ou multipart/form-data
Vérifie que le code coupon est actif, non expiré et utilisable pour cet hôtel ; renvoie le type et le taux de réduction.
Champs de formulaire
hotelIDintegerobligatoireIdentifiant de l’hôtel.
couponstringobligatoireCode coupon saisi par le client.
Réponse
200 Succès.
cupon.idintegerIdentifiant du coupon.
cupon.changeintegerType de réduction :
0 pourcentage (rate est un %), 1 montant fixe (rate dans la devise de l’hôtel).cupon.ratestringTaux ou montant de la réduction.
Réponses d’erreur
- 200
online_cupon_is_not_found— code inconnu, inactif ou expiré ;hotel_id_is_not_found—hotelIDmanquant.
curl "https://test.hms.gen.tr/external/online/coupon/search" \
-H "Authorization: Bearer $HMS_TOKEN" \
-d "hotelID=1000" \
-d "coupon=ETE2026"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", "ETE2026"]
])
});
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' => 'ETE2026',
]),
]);
$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"
}