优惠券接口

接口列表

接口名称 接口方法 说明
1.查询我的优惠券 Coupon.GetMyCoupons 查询我的优惠券
2.查询优惠券信息 Coupon.GetCoupon 根据优惠券号获取优惠券信息
3.检查优惠券是否可用 Coupon.CheckCoupon 检查优惠券是否可用
4.查询可用的优惠券 Coupon.GetAvailableCoupons 查询可用的优惠券
5.使用优惠券 Coupon.UseCoupon 使用优惠券
6.查询优惠券模板 Coupon.GetCouponTemplate 根据优惠券模板ID查询优惠券模板
7.发放优惠券 Coupon.Publish 发放优惠券
8.搜索优惠券模板 Coupon.GetCouponTemplates 根据酒店ID或房型查询符合条件的所有优惠券模板

1.查询我的优惠券

Coupon.GetMyCoupons

应用场景

查询我的优惠券

请求参数

字段名 变量名 必填 类型 示例值 描述
会员ID MemberId string
会员手机号 MobileNo string
用户其它标识 UserOtherId string 第三方标识,比如微信的OpenId
用户来源类型 UserFromType string 第三方标识,目前只有微信 传递Wechat即可
优惠券状态 CouponStatus CouponStatus ReadyForUse 待使用:ReadyForUse、已使用:Used、过期:Expire)
分页大小 PageSize int 10 每页显示10条记录
页索引 PageIndex int 1 从1开始

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.GetMyCoupons",
    "BizContent":"{\"CouponStatus\":\"ReadyForUse\",\"PageSize\":10000,
    \"PageIndex\":1,\"MemberId\":\"101517429\"}",
    "Sign":"C6E402F6148664A1C1CC5B927465AFE9",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}

其中BizContent是接口参数的json字符串,其json格式如下:

{
    "CouponStatus":"ReadyForUse",
    "PageSize":10000,
    "PageIndex":1,
    "MemberId":"101517429"
}

返回结果

字段名 变量名 必填 类型 示例值 描述
优惠券Id Id long
优惠券号 SerialNo string
优惠券有效期开始时间 ValidStartDate DateTime
优惠券有效期结束时间 ValidEndDate DateTime
折扣类型 TemplateDeductionTypeId string
备注 TemplateMemo string
折扣值 TemplateDeductionItemValue string
使用状态 StatusId string
使用时间 UseDate DateTime
券持者 HolderName string
优惠启作用的入住时间 Date DateTime
优惠券模板Id TemplateId long
优惠模板名称 TemplateName string

示例

                        
                            {
                            "Code":10000,
                            "Message":null,
                            "SubCode":null,
                            "SubMessage":null,
                            "Data":{
                            "PageSize":10000,
                            "PageIndex":1,
                            "RecordCount":6320,
                            "PageCount":1,
                            "Content":[{
                            "Id":660262399403982,
                            "SerialNo":"4964074243245337143",
                            "ValidStartDate":"2017-11-07T17:16:35.29",
                            "ValidEndDate":"2027-11-07T17:16:35.29",
                            "TemplateDeductionTypeId":"Discount",
                            "TemplateMemo":null,
                            "TemplateDeductionItemValue":"20",
                            "StatusId":"ReadyForUse",
                            "UseDate":null,
                            "HolderName":"华鹤轩",
                            "Date":null,
                            "TemplateId":1141828229365761,
                            "TemplateName":"10元折扣券"
                            },
                            {"
                            Id":660262399403983,
                            "SerialNo":"5417772683160661272",
                            "ValidStartDate":"2017-11-07T17:16:35.293",
                            "ValidEndDate":"2027-11-07T17:16:35.293",
                            "TemplateDeductionTypeId":"Discount",
                            "TemplateMemo":null,
                            "TemplateDeductionItemValue":"20",
                            "StatusId":"ReadyForUse",
                            "UseDate":null,
                            "HolderName":"华鹤轩",
                            "Date":null,
                            "TemplateId":1141828229365761,
                            "TemplateName":"10元折扣券"
                            }]
                            }}
                        

业务异常码表

Code
(返回码)
Message
(返回码描述)
SubCode
(业务返回码)
SubMessage
(业务返回码描述)
解决方案
50000 业务处理失败 coupon.coupon-has-used 此优惠券已使用
coupon.coupon-not-apply-hotel 此优惠券不适用于该酒店
coupon.coupon-not-apply-room-type 此优惠券不适用于该房型
coupon.coupon-not-enough 优惠券不足
coupon.coupon-not-found 优惠券不存在
coupon.coupon-not-published 此优惠券还未发布
coupon.coupon-not-within-date 此优惠券不在有效期内
coupon.invalid-argument 无效的参数
coupon.invalid-phone-number 无效的手机号
coupon.invalid-room-type 无效的房型
coupon.member-not-found 会员不存在
coupon.missing-coupon-publish-info 缺少需要发放的优惠券信息
coupon.unknow-error 未知异常
coupon.user-not-found 用户不存在

2.查询优惠券信息

Coupon.GetCoupon

应用场景

根据优惠券号获取优惠券信息

请求参数

字段名 变量名 必填 类型 示例值 描述
优惠券号 SerialNo string

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.GetCoupon",
    "BizContent":"{\"SerialNo\":\"4964074243245337143\"}",
    "Sign":"F01124D2B7BDAE71925DE0A47C9EE534",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}

返回结果

字段名 变量名 必填 类型 示例值 描述
优惠券Id Id long
优惠券号 SerialNo string
优惠券有效期开始时间 ValidStartDate DateTime
优惠券有效期结束时间 ValidEndDate DateTime
折扣类型 TemplateDeductionTypeId string
备注 TemplateMemo string
折扣值 TemplateDeductionItemValue string
使用状态 StatusId string
使用时间 UseDate DateTime
券持者 HolderName string
优惠启作用的入住时间 Date DateTime

示例

{
    "Code":10000,
    "Message":null,
    "SubCode":null,
    "SubMessage":null,
    "Data":{
        "Id":660262399403982,
        "SerialNo":"4964074243245337143",
        "ValidStartDate":"2017-11-07T17:16:35.29",
        "ValidEndDate":"2027-11-07T17:16:35.29",
        "TemplateDeductionTypeId":"Discount",
        "TemplateMemo":null,
        "TemplateDeductionItemValue":"20",
        "StatusId":"ReadyForUse",
        "UseDate":null,
        "HolderName":"华鹤轩",
        "Date":null
}}

3.检查优惠券是否可用

Coupon.CheckCoupon

应用场景

检查优惠券是否可用

请求参数

字段名 变量名 必填 类型 示例值 描述
酒店ID OrgId long
优惠券号 SerialNo string
优惠房型 RoomTypeId string

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.CheckCoupon",
    "BizContent":"{\"OrgId\":660247752032257,\"SerialNo\":\"4964074243245337143\"}",
    "Sign":"35B8A3BA81ACB789D503E434CF15309C",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}
                        

返回结果

字段名 变量名 必填 类型 示例值 描述
bool 成功或失败

示例

{
    "Code":10000,
    "Message":null,
    "SubCode":null,
    "SubMessage":null,
    "Data":true
}

4.查询可用的优惠券

Coupon.GetAvailableCoupons

应用场景

查询可用的优惠券

请求参数

字段名 变量名 必填 类型 示例值 描述
酒店ID OrgId long
优惠房型 RoomTypeId string
优惠券折扣类型 DeductionTypeIds string[] 折扣率(Rate)、抵扣价(Discount)、免房费(RoomPriceFree)
会员ID MemberId string
会员手机号 MobileNo string
用户其它标识 UserOtherId string
用户来源类型 UserFromType string 目前只有微信 传递Wechat即可

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.GetAvailableCoupons",
    "BizContent":"{\"MemberId\":\"101517429\",
    \"OrgId\":660247752032257,
    \"RoomTypeId\":\"TR\",
    \"DeductionTypeIds\":[\"Discount\"]}",
    "Sign":"C138D0784828F278D55CB6517608E914",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}
                            

返回结果

字段名 变量名 必填 类型 示例值 描述
优惠券Id Id long
优惠券号 SerialNo string
使用渠道 Channels string[]
优惠券有效期开始时间 ValidStartDate DateTime
优惠券有效期结束时间 ValidEndDate DateTime
折扣类型 TemplateDeductionTypeId string
备注 TemplateMemo string
折扣值 TemplateDeductionItemValue string
使用状态 StatusId string
使用时间 UseDate DateTime
券持者 HolderName string
优惠启作用的入住时间 Date DateTime
优惠券模板Id TemplateId long
优惠模板名称 TemplateName string

示例

                        
                            {
                            "Code":10000,
                            "Message":null,
                            "SubCode":null,
                            "SubMessage":null,
                            "Data":{
                            "PageSize":10000,
                            "PageIndex":1,
                            "RecordCount":6320,
                            "PageCount":1,
                            "Content":[{
                            "Id":660262399403982,
                            "SerialNo":"4964074243245337143",
                            "Channels":["Hotel","TRIP"],
                            "ValidStartDate":"2017-11-07T17:16:35.29",
                            "ValidEndDate":"2027-11-07T17:16:35.29",
                            "TemplateDeductionTypeId":"Discount",
                            "TemplateMemo":null,
                            "TemplateDeductionItemValue":"20",
                            "StatusId":"ReadyForUse",
                            "UseDate":null,
                            "HolderName":"华鹤轩",
                            "Date":null,
                            "TemplateId":1141828229365761,
                            "TemplateName":"10元折扣券"
                            },
                            {"
                            Id":660262399403983,
                            "SerialNo":"5417772683160661272",
                            "Channels":["Hotel","TRIP"],
                            "ValidStartDate":"2017-11-07T17:16:35.293",
                            "ValidEndDate":"2027-11-07T17:16:35.293",
                            "TemplateDeductionTypeId":"Discount",
                            "TemplateMemo":null,
                            "TemplateDeductionItemValue":"20",
                            "StatusId":"ReadyForUse",
                            "UseDate":null,
                            "HolderName":"华鹤轩",
                            "Date":null,
                            "TemplateId":1141828229365761,
                            "TemplateName":"10元折扣券"
                            }]
                            }}
                        

5.使用优惠券

Coupon.UseCoupon

应用场景

使用优惠券

请求参数

字段名 变量名 必填 类型 示例值 描述
酒店ID OrgId long
优惠券号 SerialNo string
优惠房型 RoomTypeId string
订单号 OrderId long
账务ID BillId long
会员ID MemberId string
会员手机号 MobileNo string
用户其它标识 UserOtherId string
用户来源类型 UserFromType string 目前只有微信 传递Wechat即可

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.UseCoupon",
    "BizContent":"{\"MobileNo\":\"13099999999\",\"OrgId\":660247752032257,
    \"SerialNo\":\"5704573193283269669\",\"RoomTypeId\":\"TR\",\"OrderId\":678727960330241,
    \"BillId\":678727964524545}",
    "Sign":"DF70EFF9589C5A87699C8CF1F89BCFD3",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}

返回结果

字段名 变量名 必填 类型 示例值 描述
优惠房间号 RoomNumber string
优惠金额 Discount string
优惠房间对应的账务ID BillId long
对房间的哪一天进行优惠 Date DateTime
入账科目 EntrySubject string
被优惠的账务项Id DiscountedBillItemId long
被优惠的账务科目 DiscountedBillItemSubject string
使用状态 StatusId string

示例

{
    "Code":10000,
    "Message":null,
    "SubCode":null,
    "SubMessage":null,
    "Data":{
        "RoomNumber":null,
        "Discount":20.0,
        "BillId":678727964524545,
        "Date":"2017-12-21T01:57:55.083294Z",
        "EntrySubject":null,
        "DiscountedBillItemId":0,
        "DiscountedBillItemSubject":null
}}

6.查询优惠券模板

Coupon.GetCouponTemplate

应用场景

根据优惠券模板ID查询优惠券模板

请求参数

字段名 变量名 必填 类型 示例值 描述
优惠券模板Id TemplateId long

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.GetCouponTemplate",
    "BizContent":"{\"TemplateId\":660263405174785}",
    "Sign":"3D249DFDA66E61657CB9D0ACC432CC8D",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}

返回结果

字段名 变量名 必填 类型 示例值 描述
模板ID Id long
模板名称 Name string
有效时间类型 ValidDateTypeId long
固定有效开始时间 FixedValidStartDate DateTime
固定有效结束时间 FixedValidEndDate DateTime
动态有效发放后起始天数 DynamicBeginDay int
动态有效持续天数 DynamicStayDay int
是否有效 IsActive bool
是否为全数字 IsAllNumber bool
优惠券号前缀 SerialNoPrefix string
生成状态 GenerateStatusId string
发布状态 PublishStatusId string
是否生成 IsGenerated bool
是否发布 IsPublished bool
入账方式 EntryBehaviourId string
折扣类型 DeductionTypeId string 折扣率、抵扣价、免房费
折扣作用的科目 DeductionSubject string
折扣类型对应的值 DeductionItemValue string
备注 Memo string
已生成数量 GeneratedCount int
已发放数量 PublishedCount int
已使用数量 UsedCount int
可使用数量 NoUsedCount int
关联酒店ID数组 OrgInfoIDs long[]
渠道 Channels long[]

示例

{
    "Code":10000,
    "Message":null,
    "SubCode":null,
    "SubMessage":null,
    "Data":{
        "Id":660263405174785,
        "Name":"折扣价",
        "ValidDateTypeId":"Always",
        "FixedValidStartDate":null,
        "FixedValidEndDate":null,
        "DynamicBeginDay":null,
        "DynamicStayDay":null,
        "IsActive":true,
        "IsAllNumber":true,
        "SerialNoPrefix":null,
        "GenerateStatusId":"Complete",
        "PublishStatusId":"Complete",
        "IsGenerated":true,
        "IsPublished":true,
        "EntryBehaviourId":"AdjustCoupon",
        "DeductionTypeId":"Discount",
        "DeductionSubject":"D1000",
        "DeductionItemValue":"20",
        "Memo":null,
        "GeneratedCount":30000,
        "PublishedCount":5778,
        "UsedCount":223,
        "NoUsedCount":5555,
        "OrgInfoIDs":[467914382721028,660247752032257],
        "Channels":["Hotel","Web"]
}}

7.发放优惠券

Coupon.Publish

应用场景

酒店发放优惠券

请求参数

字段名 变量名 必填 类型 示例值 描述
优惠券模板Id PublishDetails CouponPublishDetailModel[]
优惠券发放方式 CouponPublishType CouponPublishType 请参考:数据字典->优惠券发放方式
会员ID MemberId string
会员手机号 MobileNo string
用户其它标识 UserOtherId string
用户来源类型 UserFromType string 目前只有微信 传递Wechat即可

CouponPublishDetailModel

字段名 变量名 必填 类型 示例值 描述
待发布的优惠券模板 TemplateId long
要发布的优惠券数量 Count int

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.Publish",
    "BizContent":"{\"MobileNo\":\"13099999999\",
    \"PublishDetails\":[{\"TemplateId\":660263405174785,\"Count\":1}]}",
    "Sign":"BE3F1C2D5F97A135D4E780B9B4BE8668",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}

返回结果

字段名 变量名 必填 类型 示例值 描述
bool 成功或者失败

示例

{
    "Code":10000,
    "Message":null,
    "SubCode":null,
    "SubMessage":null,
    "Data":true
}

8.搜索优惠券模板

Coupon.GetCouponTemplates

应用场景

根据酒店ID或房型查询符合条件的所有优惠券模板

请求参数

字段名 变量名 必填 类型 示例值 描述
酒店ID OrgId long
优惠房型 RoomTypeId string

示例

{
    "ChannelKey":"web",
    "Method":"Coupon.GetCouponTemplates",
    "BizContent":"{\"OrgId\":\"2147483644\",\"RoomTypeId\":\"DT\"}",
    "Sign":"B59911ECF4A719E912E8C9DED3710F8E",
    "SignType":"MD5",
    "Format":"json",
    "Charset":"utf-8",
    "Version":"1.0",
    "Timestamp":"2017-02-12 14:12:13"
}

返回结果

字段名 变量名 必填 类型 示例值 描述
模板ID Id long
模板名称 Name string
有效时间类型 ValidDateTypeId long
固定有效开始时间 FixedValidStartDate DateTime
固定有效结束时间 FixedValidEndDate DateTime
动态有效发放后起始天数 DynamicBeginDay int
动态有效持续天数 DynamicStayDay int
是否有效 IsActive bool
是否为全数字 IsAllNumber bool
优惠券号前缀 SerialNoPrefix string
优惠启作用的入住时间 GenerateStatusId string
发布状态 PublishStatusId string
是否生成 IsGenerated bool
是否发布 IsPublished bool
入账方式 EntryBehaviourId string
折扣类型 DeductionTypeId string 折扣率、抵扣价、免房费
折扣作用的科目 DeductionSubject string
折扣类型对应的值 DeductionItemValue string
备注 Memo string
已生成数量 GeneratedCount int
已发放数量 PublishedCount int
已使用数量 UsedCount int
可使用数量 NoUsedCount int
关联酒店ID数组 OrgInfoIDs long[]
渠道 Channels long[]

示例

{
    "Code":10000,
    "Message":null,
    "SubCode":null,
    "SubMessage":null,
    "Data":{
        "Id":660263405174785,
        "Name":"折扣价",
        "ValidDateTypeId":"Always",
        "FixedValidStartDate":null,
        "FixedValidEndDate":null,
        "DynamicBeginDay":null,
        "DynamicStayDay":null,
        "IsActive":true,
        "IsAllNumber":true,
        "SerialNoPrefix":null,
        "GenerateStatusId":"Complete",
        "PublishStatusId":"Complete",
        "IsGenerated":true,
        "IsPublished":true,
        "EntryBehaviourId":"AdjustCoupon",
        "DeductionTypeId":"Discount",
        "DeductionSubject":"D1000",
        "DeductionItemValue":"20",
        "Memo":null,
        "GeneratedCount":30000,
        "PublishedCount":5778,
        "UsedCount":223,
        "NoUsedCount":5555,
        "OrgInfoIDs":[467914382721028,660247752032257],
        "Channels":["Hotel","Web"]
}}