预订
客人所选的房型、餐食类型和价格以 BookingPushRQ 结构推送到 HMS。同一端点也可处理取消和修改:将 type 设为 Cancel 或 Modify 即可。端到端流程见预订流程指南。
推送预订(BookingPushRQ)#
POST
/external/online/channel/booking身份验证: Authorization: Bearer · 请求体: application/json
在 HMS 中记录一个或多个预订。ID 是由您一方生成的唯一预订编号;使用相同 ID 发送 Modify 会更新该记录,发送 Cancel 则取消该预订。同一房型和餐食类型售出多间房时,每间房都是一个独立的 RoomStays 项,NumberOfUnits 依次为 1、2、3…
支付方式为信用卡(9)时,卡信息放在 PaymentCard 下;其他支付方式请省略该字段。处理卡数据意味着您需要满足 PCI DSS 合规要求。
请求体
BookingPushRQ.Bookings[]object[]必填预订列表。通常只有一项。
hotelIDstring必填酒店 ID。
IDstring必填您系统中的唯一预订编号。同时保存为凭证(voucher)编号。
typestring必填操作类型。
BookModifyCancelcreateDateTimedatetime预订创建时间(ISO 8601)。
checkinDate / checkoutDatedate必填入住和退房日期,
YYYY-MM-DD。RoomStays[]object[]必填售出的房间。
roomTypeIDstring必填房型列表中的
items[].id。roomNamestring房型名称(仅供参考)。
ratePlanIDstring必填房型列表中的
accommodationTypes[].id。ratePlanNamestring餐食类型名称(仅供参考)。
typestring该房间的操作类型。
BookModifyCancelNumberOfUnitsstring必填同一房型/餐食类型下各房间的序号:1、2、3…
checkinDate / checkoutDatedate必填该房间的入住和退房日期。
GuestCountobject必填adult 和 child 人数。PerDayRatesobjectcurrency 及 PerDayRate[]:stayDate、baseRate、hotelServiceFees。Totalobject必填房间合计:
amountAfterTaxes、amountOfTaxes、currency。PaymentCardobject仅限支付方式 9(信用卡)。
CardHolder{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 预订 ID(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."
}
]
}
]
}
}