创建预约订单
接口说明
抖音侧调用第三方创建酒店订单。
基本信息
Scope | life.capacity.trip_trade_order | |||
权限要求 | 住宿预售券交易正向能力 |
请求头
- •Content-Type:
application/json
- •X-Bytedance-Logid: 请求 logid, 用于问题排查用
- •x-life-clientkey: 服务商应用的 client_key
- •X-life-sign: 请求签名,签名规则
请求体
参数名称 | 参数类型 | 必须参数 | 备注 |
» order_id | string | 必填 | 抖音订单id |
» source_order_id | string | 选填 | biz_type= 2012的情况下,赋值为预售订单的order_id |
» rate_plan_id | string | 必填 | 抖音售卖房型ID |
» biz_type | int | 必填 | 2011:酒店预售券 2012:酒店预约单 2021:日历房 |
» check_in_date | string | 必填 | 入住日期 yyyy-MM-dd |
» check_out_date | string | 必填 | 离店日期yyyy-MM-dd |
» early_arrival_time | string | 选填 | 预计最早到店时间 |
» last_arrival_time | string | 选填 | 预计最晚到店时间 |
» number_of_units | int | 必填 | 预定间数 |
» number_of_guests | int | 必填 | 入住人数 |
» daily_rates | list<object> | 必填 | 单日单间价格 |
»» original_amount | int | 必填 | 原始价格(分),对于非中国大陆商家,代表税后价 |
»» amount_before_tax | int | 选填 | 税前价,非中国大陆商家使用 |
»» currency | string | 选填 | 发单价格币种,CNY,USD国际标准枚举值 非国内大陆商家必填 |
»» period_start_date | string | 必填 | 时间段开始时间 |
»» period_end_date | string | 必填 | 时间段结束时间 |
»» period_start_time | string | 选填 | 开始时间点,新增选择钟点房时为必填,格式 yyyy-MM-dd hh:mm:ss |
»» period_end_time | string | 选填 | 结束时间点,新增选择钟点房时为必填,格式 yyyy-MM-dd hh:mm:ss |
»» usage_duration | int | 选填 | 使用时长 选择钟点房时为必填 校验逻辑:
|
» cancel_rule | list<object> | 选填 | 取消规则( trip/hotel_model.CancelRule 结构见公共结构2.1.5) |
»» cancel_type | enum | 必填 | 取消订单规则 (结构见公共结构2.2.4) |
»» cancel_time_type | enum | 选填 | 若取消订单规则为限时取消,该字段表示取消订单需要参考的时间点,例如以入住时间为参考,判断用户是否可取消。 (结构见公共结构2.2.2) |
»» cancel_offset_time | object | 选填 | 若取消订单规则为限时取消,该字段表示取消订单需要参考的时间时间长度,例如以入住时间为参考,长度6小时,则用户最晚可在入住前6小时取消。 |
»»» day | int | 选填 | |
»»» hour | int | 选填 | |
»»» minute | int | 选填 | |
»» cut_type | enum | 选填 | 取消扣费类型 (结构见公共结构2.2.3) |
»» cut_value | int | 选填 | 取消扣费数额 |
» create_order_time_unix | int | 选填 | 创建订单时间戳,秒 |
» total_amount | int | 必填 | 总预约房型原始价格(分),对于非中国大陆商家,代表税后价(取自三方 同步到预约房型上的价格) |
» amount_before_tax | int | 选填 | 税前价,非中国大陆商家使用 |
» currency | string | 选填 | 发单价格币种,CNY,USD国际标准枚举值 非国内大陆商家必填 |
» meals | list<struct> | 选填 | 餐食信息( trip/trade_openapi.Meal 结构见公共结构2.1.7) |
»» meal_type | int | 选填 | 餐食类型 1:早餐 2:中餐 3:晚餐 4:无餐食 |
»» meal_number | int | 选填 | 餐食数量 |
» occupancies | list<struct> | 选填 | 入住人列表 |
»» first_name | string | 选填 | 姓 |
»» last_name | string | 选填 | 名 |
»» name | string | 必填 | 姓名, |
»» phone | string | 必填 | 联系电话,加密 |
»» license_type | int | 选填 | 1 身份证 |
»» license_id | string | 选填 | 证件 ID,加密 |
» contact_info | struct | 必填 | 联系人信息 |
»» name | string | 必填 | 姓名, |
»» phone | string | 必填 | 联系电话,加密 |
» pay_info | struct | 选填 | 供应商在模式为支付后创单时该参数为必传参数 |
»» origin_amount | int | | 预售券原始金额,取值为商品售价,单位分 |
»» add_amount | int | | 取加价金额的应付原始金额,单位分 |
»» pay_amount | int | | 预售券实付金额 + 预约单加价实付金额,单位分 |
»» merchant_receivable_amount | int | | 预售券原始金额 + 加价原始金额 - 商家补贴,单位分 |
»» pay_time_unix | int | 选填 | 支付时间戳,秒 |
»» commissions | list<struct> | 选填 | 佣金信息 (预计费数据,在能获取到的情况下返回,计费和支付是同时进行的,且有场景会延迟计费) |
»»» role_type | int | 选填 | 1:达人佣金 2:服务商佣金 3:平台佣金 |
»»» rate | int | 选填 | 佣金率 万分位整数值,如果值为390则表达3.9% |
»»» amount | int | 选填 | 佣金值分 |
» remark_from_douyin | string | 选填 | 抖音平台备注 格式 权益订单、抖音预售券订单id:xxx、商品名称(预售券名称):xx、原始金额:x元、加价金额:x元、实付金额:x元、商家应收金额:x元、商品搭配:xxx (住:x选x+房型名称、餐:全部可选或x选x+餐食内容、享/礼遇:全部可选或x选x+内容)、权益内容、Order from douyin 币种 |
» remark_from_guest | string | 选填 | 客人备注 |
» sales_type | string | 选填 | 售卖形式:默认为全日房; 全日房: 钟点房:hourly-room |
»appointment_award | object | 选填 | 预约激励 |
»» award_type | enum | 选填 | 预约激励类型公共结构:房型升级、餐食升级、游乐升级、其他
结构见公共结构2.3.32 |
»» content | string | 选填 | 权益内容:
|
»member_info | object | 选填 | 会员信息 |
»»member_level | int | 必填 | 会员等级 |
»»member_id | string | 选填 | 会员卡号 |
»»member_name | string | 选填 | 会员姓名 |
»»member_phone | string | 选填 | 会员手机号(加密传输) |
解密方法
- 1.根据ClientKey找到ClientSecret,将ClientSecret向左右使用字符补齐32位/裁剪至32位,补齐:补位字符:#, 先补左侧再补右侧再补左侧······直到补满32位。裁剪:先裁剪左侧再裁右侧再裁左侧······直到剩余32位。(正常不需要补齐,secret默认为32位,此举是为了以防万一)
- 2.将ClientSecret作为Key, 右侧16位为向量IV
- 3.将密文进行base64解码。
- 4.使用AES-256-CBC模式解密解码后的密文,对齐使用PKCS5Padding方式
详情请参考:加密字段解密方法
请求示例
{ "order_id": "1000946099201940764", "source_order_id": "1000946099201940761", "rate_plan_id": "1763526448072717", "check_in_date": "2023-04-20", "check_out_date": "2023-04-23", "number_of_units": 1, "number_of_guests": 1, "total_amount": 20000, "amount_before_tax": 20000, "currency":"CNY", "daily_rates": [ { "period_start_date": "2023-04-20", "period_end_date": "2023-04-21", "original_amount": 1000, "amount_before_tax": 1000, "currency": "CNY" } ], "biz_type": 2011, "meals": [ { "meal_type": 1, "meal_number": 1 } ], "occupancies": [ { "first_name":"", "last_name":"", "name": "test", "phone": "13111111111", "license_type": 1, "license_id": "422202020202020202" } ], "contact_info": { "name": "test", "phone": "13111111111" }, "cancel_rule": [{ "cancel_type": 1, "cancel_time_type": 1, "cancel_offset_time": { "day": 1, "hour": 1, "minute": 1, "second": 1 }, "cut_type": 6948897508913326394, "cut_value": 2048624488842148897 }], "early_arrival_time": "", "last_arrival_time": "", "create_order_time_unix": 1902790713142520557, "remark_from_guest": "", "remark_from_douyin":"权益订单,抖音预售券订单id:1016716518400664370、商品名称(预售券名称):测试预售券餐食预约权益3、原始金额:11.00元、加价金额:0.00元、实付金额:11.00元、商品搭配:(住:2选1:1份免审-物理房测试4/1份物理房型类目测试 餐:全部可选:1份早餐 ) 、快预约尊享免费升级豪华房 Order from douyin CNY", "appointment_award":{ "content":"快预约尊享免费升级豪华房", "AwardType":1 } }
响应参数
参数名称 | 参数类型 | 必须参数 | 备注 |
data | struct | 必填 | |
» error_code | int | 必填 | 错误码详见 |
» description | string | 选填 | 描述信息 |
» order_id | string | 必填 | 抖音订单号 |
» order_out_id | string | 选填 | 第三方订单 ID,成功的情况下该参数必传 |
» confirm_info | struct | 选填 | 供应商在交易模式为支付后创单时该对象必须返回,否则会导致订单取消 |
» » hotel_confirm_number | string | 选填 | 订单确认时必填 |
» » confirm_mode | int | 选填 | 在confirm_mode对象有返回的时候必填通过后接单方式 1:同步接单,需要返回hotel_confirm_number和confirm_result 2:异步接单 抖音订单为支付态,待三方回调 接单接口 |
» » confirm_result | int | 选填 | 交易模式为支付后创单模式必填 0: 异步 1:接单 2:拒单 |
响应示例
{ "data":{ "error_code": 0, "description": "successs", "order_id": "1000946099201940764", "order_out_id": "nZJs9msX3I" } }
错误码
枚举id | 参数名称 | 备注 |
0 | 成功 | |
1 | 房型不存在/失效 | |
2 | 入住总人数超过上限 | |
3 | 不符合最大/最小连住天数限制 | |
4 | 入住时期内已满 | |
5 | 日期格式错误 | |
6 | 姓名/联系电话格式错 | |
7 | 重复提交预定请求 | 如订单已经生成后收到重复请求,请返回成功,不要返回错误 |
8 | 价格与酒店实际价格不一致 | |
9 | 订单不存在或状态异常 | |
10 | 日期格式错误 | |
11 | 手机号/证件号码已达到购买上限 | |
12 | 购买该产品必须填写身份证号码 | |
13 | 其他异常(服务商自定义) | |
14 | 会员信息不一致 | |
100 | 需要重试 | 三方如果需要重试传该code,目前在创单和支付通知场景生效 |