# 携程优惠券对接接口文档 本文件描述我方对接携程的优惠券相关接口,包括创建、取消、核销等业务场景。 --- ## 1. 创建用户优惠券接口 - **接口地址**:`POST /coupon/ctrip/create` - **用途**:携程下单后回调,创建用户优惠券(手机号+携程券ID唯一,幂等)。 - **请求参数**: | 参数名 | 类型 | 必填 | 说明 | |----------------|-----------|------|------------------------| | ctripCouponId | string | 是 | 携程券ID(唯一) | | userPhone | string | 是 | 用户手机号 | | couponName | string | 是 | 优惠券名称 | | couponType | integer | 是 | 优惠券类型 | | amount | number | 是 | 优惠券面额 | | minAmount | number | 否 | 使用门槛金额 | | discountRate | integer | 否 | 折扣率 | | validStartTime | string | 是 | 有效期开始时间(yyyy-MM-dd或yyyy-MM-dd HH:mm:ss)| | validEndTime | string | 是 | 有效期结束时间(yyyy-MM-dd或yyyy-MM-dd HH:mm:ss)| - **返回示例**: ```json { "code": 0, "data": true, "resp_msg": "success" } ``` --- ## 2. 取消用户优惠券接口 - **接口地址**:`POST /coupon/ctrip/cancel` - **用途**:携程退券回调,取消用户优惠券(默认退第一个未用券)。 - **请求参数**: | 参数名 | 类型 | 必填 | 说明 | |-----------|--------|------|-----------| | userPhone | string | 是 | 用户手机号 | - **返回示例**: ```json { "code": 0, "data": true, "resp_msg": "success" } ``` 如无可退券: ```json { "code": 1, "data": null, "resp_msg": "无可退优惠券" } ``` --- ## 3. 核销用户优惠券接口 - **接口地址**:`POST /coupon/ctrip/verify` - **用途**:用户下单时,先查本地券,再调用携程核销接口,核销成功后本地状态设为已用。 - **请求参数**: | 参数名 | 类型 | 必填 | 说明 | |-----------|--------|------|-----------| | userPhone | string | 是 | 用户手机号 | | orderNo | string | 是 | 订单号 | - **返回示例**: ```json { "code": 0, "data": true, "resp_msg": "success" } ``` 如无可用券或核销失败: ```json { "code": 1, "data": null, "resp_msg": "无可用优惠券" // 或 "携程核销失败" } ``` --- ## 4. 业务说明 - **幂等性**:所有接口均需保证幂等,创建时手机号+携程券ID唯一。 - **状态同步**:本地与携程券状态需保持一致。 - **时间格式**:支持`yyyy-MM-dd`或`yyyy-MM-dd HH:mm:ss`。 - **安全性**:建议所有接口加签名校验。 - **返回结构**:统一为 `{ code, data, resp_msg }`,便于携程方解析。 --- ## 5. 示例请求 ### 创建优惠券 ```http POST /coupon/ctrip/create Content-Type: application/x-www-form-urlencoded ctripCouponId=CT123456&userPhone=13800000000&couponName=xxx&couponType=1&amount=100&validStartTime=2024-05-01&validEndTime=2024-06-01 ``` ### 取消优惠券 ```http POST /coupon/ctrip/cancel Content-Type: application/x-www-form-urlencoded userPhone=13800000000 ``` ### 核销优惠券 ```http POST /coupon/ctrip/verify Content-Type: application/x-www-form-urlencoded userPhone=13800000000&orderNo=ORDER123 ``` --- 如需OpenAPI YAML、签名校验、错误码说明等补充,请联系技术支持。