创建预售订单
接口说明
抖音侧调用第三方创建酒店预售订单。
使用限制
三方对接请做好order_id的订单创单幂等,超时会重试。研发请重点关注!!!
基本信息
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 |
» pre_sale_coupon_id | string | 必填 | 抖音酒店预售券ID |
» biz_type | int | 必填 | 2011:酒店预售券 |
» create_order_time_unix | int | 选填 | 创建订单时间戳,秒 |
» currency | string | 选填 | 币种,仅港澳商家需要关注 注: 港澳商家暂不支持营销,对于外币订单, total_coupon_discount&total_coupon_actual_count固定为空 |
» total_amount | int | 必填 | 总房型原始价格(分) |
» total_coupon_count | int | 必填 | 券的张数 |
» each_coupon_amount | int | 必填 | 单张券原始价格 |
» total_coupon_discount | int | 选填 | 预售券优惠总金额 |
»total_coupon_actual_count | int | 选填 | 预售券总促后金额 |
» promotion_info | struct | 选填 | 预售券营销信息 |
»» coupon_promotion_id | string | 选填 | 预售券营销活动规则ID |
»»coupon_promotion_type | string | 选填 | 券营销活动类型 |
»»coupon_promotion_discount | int | 选填 | 预售券营销折扣金额 |
» contact_info | struct | 必填 | 联系人信息 |
»» name | string | 选填 | 姓名, |
»» phone | string | 选填 | 联系电话,加密 |
» pay_info | struct | 选填 | 供应商在模式为支付后创单时该参数为必传参数 |
»» pay_time_unix | int | 选填 | 支付时间戳,秒 |
» remark_from_douyin | string | 选填 | 抖音平台备注 |
» remark_from_guest | string | 选填 | 客人备注 |
»member_info | object | 选填 | 会员信息 |
»»member_level | int | 必填 | 会员等级 |
»»member_id | string | 选填 | 会员卡号 |
»»member_name | string | 选填 | 会员姓名 |
»»member_phone | string | 选填 | 会员手机号(加密传输) |
»member_required | int | 必填 | 0:无限制,1:只有会员可购买 |
解密方法
- 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", "pre_sale_coupon_id":"1784699158873100", "total_coupon_count":1, "each_coupon_amount":17900, "rate_plan_id": "1763526448072717", "check_in_date": "2023-04-20", "check_out_date": "2023-04-23", "currency":"HKD", // 大陆商家可不关注 "total_amount": 17900, "biz_type": 2011, "contact_info": { "name": "test", "phone": "13111111111" }, "early_arrival_time": "", "last_arrival_time": "", "create_order_time_unix": 1902790713142520557, "remark_from_guest": "", "remark_from_douyin": "" }
响应参数
参数名称 | 参数类型 | 必须参数 | 备注 |
data | struct | 必填 | |
» error_code | int | 必填 | 错误码 |
» description | string | 选填 | 描述信息 |
» order_id | string | 必填 | 抖音订单号 |
» order_out_id | string | 选填 | 第三方订单 ID,成功的情况下该参数必传 |
响应示例
{ "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,目前在创单和支付通知场景生效 |