الحجز
تُرسَل الغرفة ونوع الإقامة والسعر الذي اختاره النزيل إلى HMS في بنية BookingPushRQ. وتعالج نقطة النهاية نفسها الإلغاء والتعديل بإرسال type بالقيمة Cancel أو Modify. راجع دليل مسار الحجز للاطلاع على العملية كاملة.
إرسال حجز (BookingPushRQ)#
/external/online/channel/bookingالمصادقة: Authorization: Bearer · المتن: application/json
تسجّل حجزًا واحدًا أو أكثر في HMS. ID هو رمز الحجز الفريد الذي تولّده في نظامك؛ إرسال Modify بقيمة ID نفسها يحدّث السجل، وإرسال Cancel يلغيه. عند بيع عدة غرف من نوع الغرفة ونوع الإقامة نفسيهما، تكون كل غرفة عنصرًا مستقلًا في RoomStays وتأخذ NumberOfUnits القيم 1، 2، 3…
في نوع الدفع بطاقة الائتمان (9) تُرسَل بيانات البطاقة ضمن PaymentCard؛ ولا تُرسل هذا الحقل مع أنواع الدفع الأخرى. التعامل مع بيانات البطاقات يُخضعك لمتطلبات PCI DSS.
متن الطلب
BookingPushRQ.Bookings[]object[]إلزاميhotelIDstringإلزاميIDstringإلزاميtypestringإلزاميBookModifyCancelcreateDateTimedatetimecheckinDate / checkoutDatedateإلزاميYYYY-MM-DD.RoomStays[]object[]إلزاميroomTypeIDstringإلزاميitems[].id من قائمة الغرف.roomNamestringratePlanIDstringإلزاميaccommodationTypes[].id من قائمة الغرف.ratePlanNamestringtypestringBookModifyCancelNumberOfUnitsstringإلزاميcheckinDate / checkoutDatedateإلزاميGuestCountobjectإلزاميadult (البالغين) وchild (الأطفال).PerDayRatesobjectcurrency وPerDayRate[]: stayDate، baseRate، hotelServiceFees.TotalobjectإلزاميamountAfterTaxes، amountOfTaxes، currency.PaymentCardobjectCardHolder{fullname, address, country, city}، cardNumber، expireDate (MMYY)، cardCode، seriesCode (CVV).PrimaryGuests[]object[]إلزاميname، surname، PhoneNumber، email، CountryCode.ChildGuests[]object[]age إلزامي؛ وname وsurname وyear وdate وdetail اختيارية.SpecialRequest[]object[]text. تُدمَج في ملاحظات الحجز.extras[]object[]name، note، person، piece، price، priceMode، priceTotal، stockID (قيمة id من قائمة الباقات).TotalobjectإلزاميamountAfterTaxes، amountOfTaxes، extraTotal، currency.الاستجابة
200 كائن BookingPushRS. عند النجاح يتضمن Success: true ومعرّف الحجز في HMS (HMS_ID)؛ وعند الفشل رسالة Error وBookingConfirmNumbers[].Error[].
استجابات الأخطاء
- 200
Error: No available data could be found. (01، متن فارغ أو تعذّر تحليله) · Hotel registration not found on HMS. (02، الفندق غير مرتبط بقناة الحجز عبر الإنترنت) · Could not register. · Failed to parse information.
curl -X POST "https://test.hms.gen.tr/external/online/channel/booking" \
-H "Authorization: Bearer $HMS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"BookingPushRQ": {
"Bookings": [
{
"hotelID": "1000",
"ID": "4811174883",
"type": "Book",
"createDateTime": "2026-08-01T08:32:11:293Z",
"checkinDate": "2026-08-18",
"checkoutDate": "2026-08-20",
"RoomStays": [
{
"roomTypeID": "2",
"roomName": "غرفة قياسية",
"ratePlanID": "2",
"ratePlanName": "مبيت وإفطار",
"type": "Book",
"NumberOfUnits": "1",
"checkinDate": "2026-08-18",
"checkoutDate": "2026-08-20",
"GuestCount": {
"adult": 2,
"child": 1
},
"PerDayRates": {
"currency": "TRY",
"PerDayRate": [
{
"stayDate": "2026-08-18",
"baseRate": "965.00",
"hotelServiceFees": "0"
},
{
"stayDate": "2026-08-19",
"baseRate": "965.00",
"hotelServiceFees": "0"
}
]
},
"Total": {
"amountAfterTaxes": "1930.00",
"amountOfTaxes": "175.45",
"currency": "TRY"
}
}
],
"PrimaryGuests": [
{
"name": "Ayşe",
"surname": "Demir",
"PhoneNumber": "+905551112233",
"email": "[email protected]",
"CountryCode": "TR"
}
],
"ChildGuests": [
{
"age": 7
}
],
"SpecialRequest": [
{
"text": "وصول متأخر، نحو الساعة 23:00."
}
],
"extras": [
{
"name": "عشاء",
"note": "",
"person": 2,
"piece": 1,
"price": "400.00",
"priceMode": null,
"priceTotal": "400.00",
"stockID": 12
}
],
"Total": {
"amountAfterTaxes": "2330.00",
"amountOfTaxes": "211.82",
"extraTotal": "400.00",
"currency": "TRY"
}
}
]
}
}'const res = await fetch("https://test.hms.gen.tr/external/online/channel/booking", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.HMS_TOKEN}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"BookingPushRQ": {
"Bookings": [
{
"hotelID": "1000",
"ID": "4811174883",
"type": "Book",
"createDateTime": "2026-08-01T08:32:11:293Z",
"checkinDate": "2026-08-18",
"checkoutDate": "2026-08-20",
"RoomStays": [
{
"roomTypeID": "2",
"roomName": "غرفة قياسية",
"ratePlanID": "2",
"ratePlanName": "مبيت وإفطار",
"type": "Book",
"NumberOfUnits": "1",
"checkinDate": "2026-08-18",
"checkoutDate": "2026-08-20",
"GuestCount": {
"adult": 2,
"child": 1
},
"PerDayRates": {
"currency": "TRY",
"PerDayRate": [
{
"stayDate": "2026-08-18",
"baseRate": "965.00",
"hotelServiceFees": "0"
},
{
"stayDate": "2026-08-19",
"baseRate": "965.00",
"hotelServiceFees": "0"
}
]
},
"Total": {
"amountAfterTaxes": "1930.00",
"amountOfTaxes": "175.45",
"currency": "TRY"
}
}
],
"PrimaryGuests": [
{
"name": "Ayşe",
"surname": "Demir",
"PhoneNumber": "+905551112233",
"email": "[email protected]",
"CountryCode": "TR"
}
],
"ChildGuests": [
{
"age": 7
}
],
"SpecialRequest": [
{
"text": "وصول متأخر، نحو الساعة 23:00."
}
],
"extras": [
{
"name": "عشاء",
"note": "",
"person": 2,
"piece": 1,
"price": "400.00",
"priceMode": null,
"priceTotal": "400.00",
"stockID": 12
}
],
"Total": {
"amountAfterTaxes": "2330.00",
"amountOfTaxes": "211.82",
"extraTotal": "400.00",
"currency": "TRY"
}
}
]
}
})
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/online/channel/booking');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('HMS_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'BookingPushRQ' => [
'Bookings' => [
[
'hotelID' => '1000',
'ID' => '4811174883',
'type' => 'Book',
'createDateTime' => '2026-08-01T08:32:11:293Z',
'checkinDate' => '2026-08-18',
'checkoutDate' => '2026-08-20',
'RoomStays' => [
[
'roomTypeID' => '2',
'roomName' => 'غرفة قياسية',
'ratePlanID' => '2',
'ratePlanName' => 'مبيت وإفطار',
'type' => 'Book',
'NumberOfUnits' => '1',
'checkinDate' => '2026-08-18',
'checkoutDate' => '2026-08-20',
'GuestCount' => [
'adult' => 2,
'child' => 1,
],
'PerDayRates' => [
'currency' => 'TRY',
'PerDayRate' => [
[
'stayDate' => '2026-08-18',
'baseRate' => '965.00',
'hotelServiceFees' => '0',
],
[
'stayDate' => '2026-08-19',
'baseRate' => '965.00',
'hotelServiceFees' => '0',
],
],
],
'Total' => [
'amountAfterTaxes' => '1930.00',
'amountOfTaxes' => '175.45',
'currency' => 'TRY',
],
],
],
'PrimaryGuests' => [
[
'name' => 'Ayşe',
'surname' => 'Demir',
'PhoneNumber' => '+905551112233',
'email' => '[email protected]',
'CountryCode' => 'TR',
],
],
'ChildGuests' => [
[
'age' => 7,
],
],
'SpecialRequest' => [
[
'text' => 'وصول متأخر، نحو الساعة 23:00.',
],
],
'extras' => [
[
'name' => 'عشاء',
'note' => '',
'person' => 2,
'piece' => 1,
'price' => '400.00',
'priceMode' => null,
'priceTotal' => '400.00',
'stockID' => 12,
],
],
'Total' => [
'amountAfterTaxes' => '2330.00',
'amountOfTaxes' => '211.82',
'extraTotal' => '400.00',
'currency' => 'TRY',
],
],
],
],
]),
]);
$data = json_decode(curl_exec($ch), true);{
"BookingPushRS": {
"Success": true,
"BookingConfirmNumbers": [
{
"confirmTime": 1755500000,
"bookingID": 48213,
"bookingType": "Book",
"HMS_ID": 48213
}
]
}
}{
"BookingPushRS": {
"Error": "Hotel registration not found on HMS.",
"BookingConfirmNumbers": [
{
"bookingID": null,
"bookingType": null,
"confirmTime": 1755500000,
"Error": [
{
"code": "02",
"text": "Hotel registration not found on HMS."
}
]
}
]
}
}