即时预订
我们的模块化 API 将为您提供您和您的旅客完成住宿预订需要的所有数据点。
点击此处了解有关 Rapid API 运行及其为合作伙伴提供功能的更多信息。
1. 选购
选购 API 返回有关指定住宿所有房型的房价和房态信息(每个请求最多返回 250 家住宿的信息)。响应包含各种房价详细信息(例如促销、房价是否可退款、取消手续费以及完整的价格明细),以符合您所在市场的价格显示要求。点击此处了解有关这项服务的更多信息。
获取供应情况
GetAvailabilityOperationParams getAvailabilityOperationParams = GetAvailabilityOperationParams.builder()
.checkin("YYYY-MM-DD")
.checkout("YYYY-MM-DD")
.currency("USD")
.language("en_US")
.countryCode("US")
.occupancy(List.of("OCCUPANCY"))
.propertyId(List.of("PROPERTY ID"))
.customerIp("127.0.0.1")
.ratePlanCount(BigDecimal.ONE)
.salesChannel("SALES CHANNEL")
.salesEnvironment("SALES ENVIRONMENT")
.build();
GetAvailabilityOperation getAvailabilityOperation = new GetAvailabilityOperation(getAvailabilityOperationParams);
Response<List<Property>> propertiesResponse = rapidClient.execute(getAvailabilityOperation);
查询客房价格
Property property = propertiesResponse.getData().get(0);
if (!(property instanceof PropertyAvailability)) {
return;
}
PropertyAvailability propertyAvailability = (PropertyAvailability) property;
Link propertyAvailabilityLink = propertyAvailability.getRooms().get(0).getRates().get(0).getBedGroups().entrySet().stream().findFirst().get().getValue().getLinks().getPriceCheck(); // selecting the first rate for the first room
PriceCheckOperationContext priceCheckOperationContext = PriceCheckOperationContext.builder().customerIp("1.2.3.4").customerSessionId("12345").build(); // fill the context as needed
PriceCheckOperation priceCheckOperation = new PriceCheckOperation(propertyAvailabilityLink, priceCheckOperationContext);
Response<RoomPriceCheck> response = rapidClient.execute(priceCheckOperation);
RoomPriceCheck roomPriceCheck = response.getData();
2. 预订
预订 API 允许您预订经价格检查响应确认的房型和房价。点击此处了解有关 Rapid 预订 API 的更多信息。
创建行程
预订 API 的主要行程方法可创建所选住宿、客房、房价和入住人数的预订。付款信息(包括账单/持卡人联系信息)直接在请求中提供。点击此处了解更多信息。
Link postItineraryLink = roomPriceCheck.getLinks().getBook(); // from the previous step
PostItineraryOperationContext postItineraryOperationContext = PostItineraryOperationContext.builder().customerIp("1.2.3.4").customerSessionId("12345").build(); // fill the context as needed
PostItineraryOperation itineraryCreationOperation = new PostItineraryOperation(postItineraryLink, postItineraryOperationContext, createItineraryRequest(false));
Response<ItineraryCreation> response = rapidClient.execute(itineraryCreationOperation);
ItineraryCreation itineraryCreationResponse = response.getData();