# 价格确认

房型级别的实时报价。
如果要创建订单,需要先用此接口,获取 Dida 订单(参考)号。
请注意,如果 PricceConfirm 取消政策 (mealtype/rate/RoomName/available 等)与 PriceSearch 不一致,请使用 priceconfirm 信息作为最终信息。
一般情况下,Dida 会在2秒内返回验价结果, 最多不超过 20 秒。如果超过 20 秒还未收到结果,建议重发一次请求。

POST
https://api.didatravel.com/api/rate/PriceConfirm?$format=json

# PreBook true / false 的区别

PreBook = true 时,在 Response 中会返回一个 ReferenceNo。
这个 ReferenceNo 是下一步订单创建时需要填的。
如果客人只是需要验价,并没有进入订单创建的流程,不需要设置 PreBook 为 true,这样能有更好的性能表现,减少超时的情况。

In the following example, the code parameters inside are modifiable.
Use the following method to test API:
{
    "PreBook": true,
    "CheckInDate": "2023-08-01",
    "CheckOutDate": "2023-08-02",
    "NumOfRooms": 1,
    "HotelID": 512,
    "Header": {
        "ClientID": "DidaApiTestID",
        "LicenseKey": "TestKey"
    },
    "OccupancyDetails": [
        {
            "ChildCount": 2,
            "AdultCount": 2,
            "RoomNum": 1,
            "ChildAgeDetails": [1,2]
        }
    ],
    "Currency": "USD",
    "Nationality": "CN",
    "RatePlanID": "1494507509528725623",
    "IsNeedOnRequest": false
}
In the following example, the code parameters inside are modifiable.
Use the following method to test API:
<PriceConfirmRequest>
  <Header>
    <ClientID>DidaApiTestID</ClientID>
    <LicenseKey>TestKey</LicenseKey>
  </Header>
  <HotelID>512</HotelID>
  <RatePlanID>1494507509528725623</RatePlanID>
  <CheckInDate>2023-08-01</CheckInDate>
  <CheckOutDate>2023-08-02</CheckOutDate>
  <Nationality>CN</Nationality>
  <NumOfRooms>1</NumOfRooms>
  <OccupancyDetails>
    <RoomOccupancy RoomNum="1" AdultCount="2" ChildCount="2">
       <ChildAgeDetails>
			<ChildAge>1</ChildAge>
            <ChildAge>2</ChildAge>
	   </ChildAgeDetails>
    </RoomOccupancy>
  </OccupancyDetails>
  <PreBook>true</PreBook>
  <Currency>USD</Currency>
  <IsNeedOnRequest>false</IsNeedOnRequest>
</PriceConfirmRequest>
   [
    {
        "name": "Header",
        "description": "机构账号信息",
        "children": [
            {
                "name": "ClientID",
                "description": "机构账号"
            },
            {
                "name": "LicenseKey",
                "description": "机构账号密码"
            }
        ]
    },
    {
        "name": "HotelID",
        "description": "HotelID"
    },
    {
        "name": "RatePlanID",
        "description": "RateplanID"
    },
    {
        "name": "CheckInDate",
        "description": "Check-indate"
    },
    {
        "name": "CheckOutDate",
        "description": "Check-outdate"
    },
    {
        "name": "Nationality",
        "description": "ISO 3166-1 alpha-2, 2个字母的地区代码. 如果不提供, 默认是 CN"
    },
    {
        "name": "NumOfRooms",
        "description": "房间数"
    },
    {
        "name": "OccupancyDetails",
        "description": "入住人信息",
        "children": [
            {
                "name": "ChildAgeDetails",
                "description": "儿童年龄列表。没有数字限制,哪怕填的是 80岁。只要报价有返回,就说明输入是合法的。"
            },
            {
                "name": "RoomNum",
                "description": "房间索引,从 1 开始每个房间递增"
            },
            {
                "name": "AdultCount",
                "description": "这个房间要入住的成人数"
            },
            {
                "name": "ChildCount",
                "description": "这个房间要入住的儿童数"
            }
        ]
    },
    {
        "name": "PreBook",
        "description": "是否 PreBook。如果不是真的进入了订单流程,只是验价,不要设成 true,因为这样会影响 Response 的返回时长。"
    },
    {
        "name": "Currency",
        "description": "Currency code"
    }
]
Request Parameters
Header HeaderType
机构账号信息HeaderType
HotelID Int32 HotelIDInt32
RatePlanID String RateplanIDString
CheckInDate DateTime Check-indateDateTime
CheckOutDate DateTime Check-outdateDateTime
Nationality String ISO 3166-1 alpha-2, 2个字母的地区代码. 如果不提供, 默认是 CNString
NumOfRooms Int32 房间数Int32
OccupancyDetails List<RoomOccupancyType>
入住人信息List<RoomOccupancyType>
PreBook Boolean 是否 PreBook。如果不是真的进入了订单流程,只是验价,不要设成 true,因为这样会影响 Response 的返回时长。Boolean
Currency String Currency codeString
Request Sample
{
    "PreBook": true,
    "CheckInDate": "2023-08-01",
    "CheckOutDate": "2023-08-02",
    "NumOfRooms": 1,
    "HotelID": 512,
    "Header": {
        "ClientID": "DidaApiTestID",
        "LicenseKey": "TestKey"
    },
    "OccupancyDetails": [
        {
            "ChildCount": 0,
            "AdultCount": 2,
            "RoomNum": 1,
            "ChildAgeDetails": []
        }
    ],
    "Currency": "USD",
    "Nationality": "CN",
    "RatePlanID": "1494507509528725623",
    "IsNeedOnRequest": true
}
Request Sample
<PriceConfirmRequest>
  <Header>
    <ClientID>DidaApiTestID</ClientID>
    <LicenseKey>TestKey</LicenseKey>
  </Header>
  <HotelID>512</HotelID>
  <RatePlanID>1494507509528725623</RatePlanID>
  <CheckInDate>2023-08-01</CheckInDate>
  <CheckOutDate>2023-08-02</CheckOutDate>
  <Nationality>CN</Nationality>
  <NumOfRooms>1</NumOfRooms>
  <OccupancyDetails>
    <RoomOccupancy RoomNum="1" AdultCount="2" ChildCount="0">
      <ChildAgeDetails />
    </RoomOccupancy>
  </OccupancyDetails>
  <PreBook>true</PreBook>
  <Currency>USD</Currency>
  <IsNeedOnRequest>true</IsNeedOnRequest>
</PriceConfirmRequest>
   [{
		"name": "Error",
		"show": true,
		"description": "",
		"children": [{
				"name": "SessionID",
				"show": false,
				"description": "SessionID"
			},
			{
				"name": "Code",
				"show": true,
				"description": "Error code"
			},
			{
				"name": "Message",
				"show": true,
				"description": "Error message"
			}
		]
	},
	{
		"name": "Success",
		"show": true,
		"description": "",
		"children": [{
			"name": "PriceDetails",
			"show": true,
			"description": "Pricedetails",
			"children": [{
					"name": "ReferenceNo",
					"show": true,
					"description": "只会在 PreBook = true 时返回,在订单创建步骤需要填写此值"
				},
				{
					"name": "CheckInDate",
					"show": true,
					"description": "Check-indate"
				},
				{
					"name": "CheckOutDate",
					"show": true,
					"description": "Check-outdate"
				},

				{
					"name": "HotelList",
					"show": true,
					"description": "HotelinfoCollection",
					"children": [{
							"name": "HotelID",
							"show": true,
							"description": "HotelID"
						},
						{
							"name": "HotelName",
							"show": true,
							"description": "Hotel name"
						},
						{
							"name": "Destination",
							"show": true,
							"description": "Hotel destination",
							"children": [{
								"name": "CityCode",
								"show": true,
								"description": "Region code"
							}]
						},
						{
							"name": "TotalPrice",
							"show": true,
							"description": "订单总价,是所有间夜的总价"
						},

						{
							"name": "TotalSupplement",
							"show": true,
							"description": "请注意,在最新的 API 接口中,这个字段已经废弃,字段值不表示任何的意义。"
						},

						{
							"name": "TotalPriceWithoutSupplement",
							"show": true,
							"description": "请注意,在最新的 API 接口中,这个字段已经废弃,字段值不表示任何的意义。"
						},


						{
							"name": "RatePlanList",
							"show": true,
							"description": "Rateplan Collection",
							"children": [{
									"name": "RoomOccupancy",
									"show": true,
									"description": "Guest info",
									"children": [{
											"name": "ChildAgeDetails",
											"show": true,
											"description": "儿童年龄列表。没有数字限制,哪怕填的是 80岁。只要报价有返回,就说明输入是合法的。"
										},
										{
											"name": "RoomNum",
											"show": true,
											"description": "Booking room index"
										},
										{
											"name": "AdultCount",
											"show": true,
											"description": "Adult Count"
										},
										{
											"name": "ChildCount",
											"show": true,
											"description": "Child Count"
										}
									]
								},
								{
									"name": "RoomTypeID",
									"show": true,
									"description": "RoomTypeID"
								},

								{
									"name": "RoomName",
									"show": true,
									"description": "Room Name"
								},
								{
									"name": "RoomName_CN",
									"show": true,
									"description": "Room Name in CN"
								},
								{
									"name": "RatePlanID",
									"show": true,
									"description": "RateplanID"
								},
								{
									"name": "RecommendIndex",
									"show": true,
									"description": "RecommendIndex = 1 的时候,这个报价是我们推荐的"
								},

								{
									"name": "RatePlanName",
									"show": true,
									"description": "Ratepla nname"
								},
								{
									"name": "BedType",
									"show": true,
									"description": "BedtypeID"
								},
								{
									"name": "BreakfastType",
									"show": true,
									"description": "BreakfasttypeID. 已经过时了, 可以使用 MealType + MealAmount 组合. 当然, 这个字段的值会跟 MealType + MealAmount 保持一致。但有一种场景不一样。例如 入住 2 人, MealType = Breakfast, MealAmount = 1 (只含单早),此字段会表现为无早。如果人数跟餐数对不齐,就会认为是无早。"
								},
								{
									"name": "MaxOccupancy",
									"show": true,
									"description": "已经废弃"
								},

								{
									"name": "InventoryCount",
									"show": true,
									"description": "Inventory count. For reference only."
								},

								{
									"name": "RoomStatus",
									"show": true,
									"description": "已经废弃"
								},
								{
									"name": "Currency",
									"show": true,
									"description": "Currency code"
								},
								{
									"name": "TotalPrice",
									"show": true,
									"description": "此房间总价"
								},


								{
									"name": "PriceWithoutSupplement",
									"show": true,
									"description": "请注意,在最新的 API 接口中,这个字段已经废弃,字段值不表示任何的意义。"
								},

								{
									"name": "PriceList",
									"show": true,
									"description": "PriceinfoCollection",
									"children": [{
											"name": "Price",
											"show": true,
											"description": "Price"
										},
										{
											"name": "InventoryCount",
											"show": true,
											"description": null
										},

										{
											"name": "StayDate",
											"show": true,
											"description": "Staydate"
										},
										{
											"name": "MealType",
											"show": true,
											"description": ""
										},

										{
											"name": "关于餐型,Dida 有两个字段可以获取餐型信息。第一个是 BreakfastType,在 Response 里面,Dida 只返回是否含早或者不含早,不能显示具体的餐型份数,对于新开发 DidaAPI 的客户,不推荐使用这个字段。第二个是 MealType,在 Response 里面,不仅有 MealType 可以表示具体的餐型,还有 MealAmount 表示含餐的份数,如果您使用了 MealType,那么请一定要同时解析 MealAmount 字段,以免出现解析错误或者未来产生关于餐型份数的争议。 且理论上来说,MealAmount 的数量总是小于或者等于入住人数。例如,如果有两个客人入住,MealAmount 为 0,则表示不含早。MealAmount 为 1,表示只含1份早餐,这种情况是存在的,有些酒店2人入住,只包含1份免费早餐,如果需要2份早餐的话,另外一份需要在线或者到店额外付费购买。MealAmount 为 2,表示入住的2个人买,都含有早餐。",
											"show": true,
											"description": "Meal Amount"
										},





										{
											"name": "SalesRate",
											"show": true,
											"description": "推荐零售价"
										}
									]
								},

								{
									"name": "StandardOccupancy",
									"show": true,
									"description": "已经废弃"
								},


								{
									"name": "TotalSalesRate",
									"show": true,
									"description": "推荐零售价"
								},

								{
									"name": "IncludedFeeList",
									"show": true,
									"description": "此报价包含了的税费,仅供参考。实现的时候不要再把此税费列表里的价格跟 TotalPrice 运算, TotalPrice 就已经包含.",
									"children": [{
											"name": "FeeTypeName",
											"show": true,
											"description": "Fee type name"
										},
										{
											"name": "Currency",
											"show": true,
											"description": "Fee type name"
										},
										{
											"name": "Amount",
											"show": true,
											"description": null
										}
									]
								},
								{
									"name": "ExcludedFeeList",
									"show": true,
									"description": "此报价不包含的税费,这些税费是客人需要到酒店后付的。",
									"children": [{
											"name": "FeeTypeName",
											"show": true,
											"description": "Fee type name"
										},
										{
											"name": "Currency",
											"show": true,
											"description": "Fee type name"
										},
										{
											"name": "Amount",
											"show": true,
											"description": null
										}
									]
								}
							]
						},
						{
							"name": "CancellationPolicyList",
							"show": true,
							"description": "CancellationpolicyinfoCollection",
							"children": [{
									"name": "FromDate",
									"show": true,
									"description": "此取消政策生效的起始日期。注意了,是北京时间,不是酒店的当地时间"
								},
								{
									"name": "Amount",
									"show": true,
									"description": "Cancellation penalty amount"
								}
							]
						},



						{
							"name": "TotalSalesRate",
							"show": true,
							"description": "推荐零售价"
						},

						{
							"name": "IncludedFeeList",
							"show": true,
							"description": "此报价包含了的税费,仅供参考。实现的时候不要再把此税费列表里的价格跟 TotalPrice 运算, TotalPrice 就已经包含.",
							"children": [{
									"name": "FeeTypeName",
									"show": true,
									"description": "Fee type name"
								},
								{
									"name": "Currency",
									"show": true,
									"description": "Currency code"
								},
								{
									"name": "Amount",
									"show": true,
									"description": "Cancellation penalty amount"
								}
							]
						},
						{
							"name": "ExcludedFeeList",
							"show": true,
							"description": "此报价不包含的税费,这些税费是客人需要到酒店后付的。",
							"children": [{
									"name": "FeeTypeName",
									"show": true,
									"description": "Fee type name"
								},
								{
									"name": "Currency",
									"show": true,
									"description": "Currency code"
								},
								{
									"name": "Amount",
									"show": true,
									"description": "Cancellation penalty amount"
								}
							]
						}
					]
				}
			]
		}]
	}
]
Response Parameters
Error ErrorType
ErrorType
Success PriceConfirmResponseSuccess
PriceConfirmResponseSuccess
Response Sample
{
    "Success": {
        "PriceDetails": {
            "CheckOutDate": "2023-08-02 00:00:00",
            "CheckInDate": "2023-08-01 00:00:00",
            "HotelList": [
                {
                    "HotelID": 512,
                    "Destination": {
                        "CityCode": "179900"
                    },
                    "RatePlanList": [
                        {
                            "TotalPrice": 299.13,
                            "RoomStatus": 1,
                            "BreakfastType": 1,
                            "BedType": 2,
                            "RoomOccupancy": {
                                "ChildCount": 0,
                                "AdultCount": 2,
                                "RoomNum": 1
                            },
                            "PriceList": [
                                {
                                    "StayDate": "2023-08-01 00:00:00",
                                    "Price": 299.13,
                                    "MealAmount": 0,
                                    "MealType": 1
                                }
                            ],
                            "IsOnRequest": false,
                            "StandardOccupancy": 2,
                            "PriceWithoutSupplement": 299.13,
                            "Supplement": 0.0,
                            "InventoryCount": 5,
                            "MaxOccupancy": 2,
                            "Currency": "USD",
                            "RatePlanName": "Double Standard Floor 19-30F (28-31sqm)",
                            "RatePlanID": "1494507509528725623",
                            "RoomName": "Queen Room"
                        }
                    ],
                    "CancellationPolicyList": [
                        {
                            "Amount": 299.13,
                            "FromDate": "2023-07-29T14:00:00+08:00"
                        }
                    ],
                    "TotalPriceWithoutSupplement": 299.13,
                    "TotalSupplement": 0.0,
                    "TotalPrice": 299.13,
                    "HotelName": "Cerulean Tower Tokyu Hotel"
                }
            ],
            "ReferenceNo": "1674000176857108480"
        }
    }
}
Response Sample
<PriceConfirmResponse>
  <Success>
    <PriceDetails>
      <ReferenceNo>1674000176857108480</ReferenceNo>
      <CheckInDate>2023-08-01</CheckInDate>
      <CheckOutDate>2023-08-02</CheckOutDate>
      <HotelList>
        <Hotel>
          <HotelID>512</HotelID>
          <HotelName>Cerulean Tower Tokyu Hotel</HotelName>
          <Destination CityCode="179900" />
          <TotalPrice>299.13</TotalPrice>
          <TotalSupplement>0.00</TotalSupplement>
          <TotalPriceWithoutSupplement>299.13</TotalPriceWithoutSupplement>
          <RatePlanList>
            <RatePlan>
              <RoomOccupancy RoomNum="1" AdultCount="2" />
              <RoomName>Queen Room</RoomName>
              <RatePlanID>1494507509528725623</RatePlanID>
              <RatePlanName>Double Standard Floor 19-30F (28-31sqm)</RatePlanName>
              <BedType>2</BedType>
              <BreakfastType>1</BreakfastType>
              <MaxOccupancy>2</MaxOccupancy>
              <InventoryCount>5</InventoryCount>
              <RoomStatus>1</RoomStatus>
              <Currency>USD</Currency>
              <TotalPrice>299.13</TotalPrice>
              <Supplement>0.00</Supplement>
              <PriceWithoutSupplement>299.13</PriceWithoutSupplement>
              <PriceList>
                <PriceInfo>
                  <Price>299.13</Price>
                  <StayDate>2023-08-01</StayDate>
                  <MealType>1</MealType>
                  <MealAmount>0</MealAmount>
                </PriceInfo>
              </PriceList>
              <StandardOccupancy>2</StandardOccupancy>
              <IsOnRequest>false</IsOnRequest>
            </RatePlan>
          </RatePlanList>
          <CancellationPolicyList>
            <CancellationPolicy>
              <FromDate>2023-07-29T14:00:00+08:00</FromDate>
              <Amount>299.13</Amount>
            </CancellationPolicy>
          </CancellationPolicyList>
        </Hotel>
      </HotelList>
    </PriceDetails>
  </Success>
</PriceConfirmResponse>