商家调用该接口创建商家券活动。
创建商家券活动接口同步返回创建请求受理结果,后续通过alipay.marketing.activity.message.created消息接口异步发送活动创建成功事件消息。
如果在code_mode=merchant_upload的模式下,创建商家券活动后,还需要进行券码导入操作,以及预算追加操作,然后商家券才能进行发放。
1 公共请求参数
参数 | 类型 | 是否必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
app_id | string | 是 | 32 | 支付宝分配给开发者的应用id | 2014072300007148 |
method | string | 是 | 128 | 接口名称 | alipay.marketing.activity.ordervoucher.create |
format | string | 否 | 40 | 仅支持json | json |
charset | string | 是 | 10 | 请求使用的编码格式,如utf-8,gbk,gb2312等 | utf-8 |
sign_type | string | 是 | 10 | 商户生成签名字符串所使用的签名算法类型,目前支持rsa2和rsa,推荐使用rsa2 | rsa2 |
sign | string | 是 | 344 | 商户请求参数的签名串,详见签名 | 详见示例 |
timestamp | string | 是 | 19 | 发送请求的时间,格式"yyyy-mm-dd hh:mm:ss" | 2014-07-24 03:07:50 |
version | string | 是 | 3 | 调用的接口版本,固定为:1.0 | 1.0 |
app_auth_token | string | 否 | 40 | 详见应用授权概述 | |
biz_content | string | 是 | 请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档 |
2 请求参数
参数 | 类型 | 是否必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
activity_name | string | 可选 | 20 | 活动名称。不对用户进行展示,仅供商家在后台管理活动使用。 | 满10减1活动 |
code_mode | string | 可选 | 20 | 码模式。merchant_upload:商户上传自定义code,发券时系统随机选取上传的券code发放。merchant_api:发奖时指定券码发奖,此模式无须提前上传券码。 | merchant_upload |
voucher_type | string | 可选 | 16 |
券类型。商家券支持三类券类型: fix_voucher:满减券; discount_voucher:折扣券; special_voucher:特价券; 兑换券仅支持一类券类型:exchange_voucher: 兑换券; |
fix_voucher |
publish_start_time | date | 可选 | 20 | 券发放开始时间。格式为:yyyy-mm-dd hh:mm:ss | 2017-01-01 00:00:01 |
publish_end_time | date | 可选 | 20 | 券发放结束时间。格式为:yyyy-mm-dd hh:mm:ss | 2017-01-29 23:59:59 |
belong_merchant_info | belongmerchantinfo | 特殊可选 | 商家券活动归属的商户信息。说明:如果该复杂对象不填。则默认为该商家券活动的归属者是调用者本人。如果填写,则认为该商家券活动的归属者是该商户。 | ||
└business_type | string | 可选 | 16 |
合作业务类型,默认为isv_for_merchant 枚举值: isv 服务商平台模式 isv_for_merchant 服务商代运营模式 限制: 1、isv(平台模式)只有兑换券即voucher_type值为exchange_voucher时才能使用 |
isv_for_merchant |
└merchant_id_type | string | 特殊可选 | 10 |
商户id类型。 枚举值: smid 间连smid pid 直连pid 特别说明: 如果merchant_id_type选择smid。则表明当前商家券活动的归属者是该smid所绑定的支付宝pid。 因此要求该smid必须绑定相应的支付宝pid。 限制: 服务商代运营模式必传 |
smid |
└merchant_id | string | 特殊可选 | 32 |
商户id 限制: 1、服务商代运营模式必传 2、服务商代运营模式下服务商必须与商户建立代运营授权关系。代运营授权流程https://opendocs.alipay.com/mini/01hm6i#代运营授权 |
2088102111111111 |
voucher_display_info | voucherdisplayinfo | 可选 | 券展示信息 | ||
└brand_name | string | 特殊可选 | 12 |
商户品牌名称。 如果不设置品牌名称,则默认使用支付宝商家系统中维护的商家别名。 如果没有维护商家别名,则使用默认名称: 商家优惠。 用户领取优惠券后,品牌名称会对用户进行展示 限制: 1、服务商平台模式即belong_merchant_info.business_type为isv时必传 |
商家优惠 |
└brand_logo | string | 特殊可选 | 64 |
商家logo 需要通过 alipay.marketing.material.image.upload接口上传图片,指定file_key为promo_brand_logo,返回的resource_id即为该参数的值 限制: 1、服务商平台模式即belong_merchant_info.business_type为isv时必传 2、上传图片尺寸600*600,支持格式:png、jpg、jpeg、bmp,大小不超过2mb |
adedsktiqo-u5vjuqvbcqwaaacmaaqed |
└voucher_comment | string | 特殊可选 | 12 |
券补充说明,该字段为可运营字段,可描述商品特色 会展示在用户支付宝卡包券详情页 限制: 1、该字段目前只支持兑换券即voucher_type为exchange_voucher |
食材新鲜,品质之选 |
└voucher_description | string | 必填 | 1000 | 券详细使用说明。 | 1、本券不可兑换现金,不可找零。2、每个用户最多可以领取1张。3、如果订单发生退款,优惠券无法退还。 |
└voucher_image | string | 特殊可选 | 64 |
券详情页封面图,会展示在用户支付宝卡包券详情页 需要通过 alipay.marketing.material.image.upload接口上传图片,指定file_key为promo_voucher_image,接口返回的resource_id即为该参数的值 限制: 该字段在兑换券场景下必传 上传图片尺寸670*335,支持格式:png、jpg、jpeg、bmp,大小不超过2mb |
adedsktiqo-u5vjuqvbcqwaaacmaaqed |
└voucher_detail_images | string[] | 特殊可选 | 256 |
券详细图列表,会展示在用户支付宝卡包券详情页 需要通过 alipay.marketing.material.image.upload接口上传图片,指定file_key为promo_voucher_detail_image ,接口返回的resource_id即为该参数的值 上传图片尺寸600*600,支持格式:png、jpg、jpeg、bmp,大小不超过2mb 限制 1、voucher_image填入,该值才能填入; 2、最多3张; 3、兑换券即voucher_type为exchange_voucher时不支持 |
["adedsktiqo-u5vjuqvbcqwaaacmaaqe1","adedsktiqo-u5vjuqvbcqwaaacmaaqe2","adedsktiqo-u5vjuqvbcqwaaacmaaqe3"] |
└customer_service_mobile | string | 特殊可选 | 20 | 客服电话 限制: 客服电话和客服链接必须二选一 | 81xxxxxxx |
└customer_service_url | string | 特殊可选 | 255 | 客服链接 限制: 客服电话和客服链接必须二选一 | alipay://xxxx |
voucher_use_rule | voucheruserule | 可选 | 券核销规则 | ||
└voucher_valid_period | vouchervalidperiod | 必填 | 日期区间内可以使用优惠 | ||
└type | string | 必填 | 32 |
券有效期。 枚举值: absolute:绝对时间 relative:相对时间 |
absolute |
└valid_begin_time | date | 可选 | 20 |
券可使用的开始时间。 格式为:yyyy-mm-dd hh:mm:ss 限制: type为absolute时该字段必填。 |
2017-01-10 00:00:00 |
└valid_end_time | date | 可选 | 20 |
券可使用的结束时间。 格式为yyyy-mm-dd hh:mm:ss 限制: type为absolute必填。 券可使用的结束时间valid_end_time 必须大于 券的发放结束时间 publish_end_time |
2017-01-13 23:59:59 |
└valid_days_after_receive | number | 可选 | 16 |
券生效后n天内可以使用。 可以配合wait_days_after_receive字段使用。 限制: type为relative时必填。 valid_days_after_receive必须大于0。 |
3 |
└wait_days_after_receive | number | 可选 | 16 |
用户领券后需要等待n天,券才可以生效。 如果该字段填入0或者不填写,则用户领券后立刻生效。 限制: type为relative时可选。 |
2 |
└fix_voucher | fixvoucher | 特殊可选 |
满减券详情 限制: 券类型为满减券时必传 |
||
└amount | price | 必填 | 16 |
面额,每张代金券可以抵扣的金额。 限制: 币种为人民币,单位为元。小数点以后最多保留两位。 取值范围:0.1<=x<=3000 |
50.00 |
└floor_amount | price | 可选 | 16 |
门槛金额。该字段不填写,认为无门槛。 限制: 只有当订单金额大于等于门槛金额时券才能使用。 币种为人民币,单位为元。小数点以后最多保留两位。 设置门槛:取值范围:0.1<=x<= 50000。 如果设置了门槛金额,则必须大于等于0.1,不可以等于0 |
1000.00 |
└goods_name | string | 可选 | 12 | 商品名称。 | 美味甜甜圈 |
└exchange_voucher | exchangevoucher | 特殊可选 |
兑换券详情 限制: 券类型为兑换券时必传 |
||
└voucher_name | string | 必填 | 12 | 对消费者展示的券(商品)名称。 | 火锅套餐、100元代金券 |
└sale_amount | price | 必填 | 16 |
用户购买优惠券需要支付的金额 限制: 币种为人民币,单位为元。小数点以后最多保留两位。 取值范围:0.1<=x<=3000 |
50.00 |
└amount | price | 必填 | 16 |
券的价值 限制: 币种为人民币,单位为元。小数点以后最多保留两位。 取值范围:0.1<=x<=3000 |
100.00 |
└floor_amount | string | 可选 | 16 |
优惠门槛金额,表示只有当订单金额大于等于门槛金额时券才能使用。该字段为空时表示无门槛。 门槛金额的校验由服务商(商户)核销时自行校验,支付宝侧只做展示使用。 币种为人民币,单位为元。小数点以后最多保留两位。 设置门槛:取值范围:0.1<=x<= 50000。 如果设置了门槛金额,则必须大于等于0.1,不可以等于0 |
1000.00 |
└customer_service_mobile | string | 特殊可选 | 20 |
客服电话 限制: 客服电话和客服链接必须二选一 |
81xxxxxxx |
└customer_service_url | string | 特殊可选 | 255 |
客服链接 限制: 客服电话和客服链接必须二选一 |
alipay://xxxx |
└refundable | boolean | 可选 | 10 |
购买的优惠券是否允许退款。 不填默认否,枚举值: true:是 false:否 |
false |
└overdue_refundable | boolean | 可选 | 10 |
是否支持优惠券过期后,自动退款给用户。 不填默认否,枚举值: true:是 false:否 自动退款功能需要服务商在优惠券过期时,主动调用alipay.marketing.activity.order.refund接口进行退款。 如果配置优惠券时选择了过期自动退款,但是实际券过期后,服务商没有进行退款,那么用户投诉后,需要服务商进行解决。 |
true |
└payee_pid | string | 特殊可选 | 32 |
收款账号。 目前的结算规则是,每核销一笔优惠券,支付宝会打款到该收款账户。 |
2088xxxxx |
└biz_type | string | 可选 | 64 |
兑换券业务类型。 枚举值 团购券:group_buy_exchange_voucher 代金券:fix_exchange_voucher |
group_buy_exchange_voucher |
└discount_voucher | discountvoucher | 特殊可选 | 折扣券详情 限制: 券类型voucher_type为折扣券discount_voucher时必传 | ||
└discount | string | 必填 | 12 |
折扣率。 限制: 取值范围:0.1<=x<=9.9,比如:6.5折填入6.5; |
6.5 |
└floor_amount | price | 可选 | 16 |
门槛金额。 限制: 币种为人民币,单位为元; 小数点以后最多保留两位; 取值范围:0.1<=x<= 50000; 说明: 该字段可不填,认为无门槛; |
1000.00 |
└ceiling_amount | price | 必填 | 16 |
封顶金额。 限制: 币种为人民币,单位为元; 小数点以后最多保留两位; 取值范围:0.1<=x<=15000; |
50.00 |
└goods_name | string | 可选 | 12 |
商品名称。 说明: 该字段可不填,填入则origin_amount必填。 |
美味甜甜圈 |
└origin_amount | price | 可选 | 16 |
原价。 限制: 币种为人民币,单位为元。小数点以后最多保留两位; 取值范围:0.1<=x<=9999; 说明: 该字段可不填,填入则商品名称goods_name必填; |
65.00 |
└special_voucher | specialvoucher | 特殊可选 | 特价券详情 限制: 券类型voucher_type为特价券special_voucher时必传 | ||
└floor_amount | price | 可选 | 16 |
门槛金额。 限制: 币种为人民币,单位为元; 小数点以后最多保留两位; 取值范围:0.1<=x<= 50000; 说明: 该字段可不填,认为无门槛; |
1000.00 |
└origin_amount | price | 必填 | 16 |
原价。 限制: 币种为人民币,单位为元。小数点以后最多保留两位; 取值范围:0.1<=x<=9999; 说明: 该字段可不填,填入则商品名称goods_name必填; |
65.00 |
└special_amount | string | 必填 | 16 |
特价,即:原价-特价=优惠金额。 限制: 币种为人民币,单位为元。小数点以后最多保留两位; 取值范围:0<=x<=999; 原价必须大于特价,即:origin_amount>special_amount; |
10.00 |
└goods_name | string | 必填 | 12 |
商品名称。 说明: 该字段可不填,填入则origin_amount必填。 |
美味甜甜圈 |
└voucher_available_scope | voucheravailablescope | 必填 | 商家券可用范围 | ||
└voucher_available_type | string | 必填 | 32 |
可用范围类型。 枚举值: shop:可用门店 city_code:可用城市 |
shop |
└order_voucher_available_shop | ordervoucheravailableshop | 特殊可选 |
券可用门店信息。 当voucher_available_type=shop时,该字段必填。 |
||
└order_voucher_merchant_all_shop | ordervouchermerchantallshop | 可选 |
商户全部门店可用。 限制: 1.shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 |
||
└exclude_shop_ids | string[] | 可选 | 84000 |
券不可使用的门店列表。指定商户全部门店可用时可通过该字段排除部分不可用门店。 列表中的门店id是通过调用接口ant.merchant.expand.shop.create创建门店返回的支付宝门店id 接口参数是列表类型。 限制: 1、exclude_shop_ids中的门店id必须是支付宝门店id。 2、exclude_shop_ids如果包含重复的门店id会自动进行去重操作。 |
["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└shop_ids | string[] | 特殊可选 | 8400000 |
券可使用的门店列表。列表中的门店id是通过调用接口ant.merchant.expand.shop.create创建门店返回的支付宝门店id 接口参数是列表类型。 限制: 1、shop_ids中的门店id必须是支付宝门店id。 2、shop_ids如果包含重复的门店id会自动进行去重操作。 3、shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 |
["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└real_shop_ids | string[] | 特殊可选 | 8400000 | 代运营商业关系门店列表,列表中的门店id是调用接口alipay.business.relation.shop.create创建门店返回的real_shop_id 接口参数是列表类型。 限制: 1、real_shop_ids中的门店id必须是代运营商业关系门店id。 2、real_shop_ids如果包含重复的门店id会自动进行去重操作。3、shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└order_voucher_available_city_code | ordervoucheravailablecitycode | 特殊可选 | 券可用城市信息。 当voucher_available_type=city_code时,该字段必填。 | ||
└all_city | boolean | 可选 | 16 |
是否全国。 选择全国后,无须填写city_codes字段。系统默认填充全国全部城市信息。 |
true |
└city_codes | string[] | 特殊可选 | 84000 | 城市编码。请按照https://gw.alipayobjects.com/os/basement_prod/253c4dcb-b8a4-4a1e-8be2-79e191a9b6db.xlsx 表格中内容填写。 (参考资料: http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/) | ["100100"] |
voucher_send_rule | vouchersendruledetail | 可选 | 券发放规则 | ||
└voucher_quantity | number | 可选 | 10 |
发行券的数量。 限制: code_mode=merchant_upload模式下数量必须为0或者选择不填。 其他模式下该数值必须是大于0的整数。 |
0 |
└voucher_quantity_limit_per_user | number | 可选 | 10 |
每人领取限制。 默认按照支付宝uid进行领取限制; 不填写或填入0,默认没有领取限制. |
1 |
└natural_person_limit | boolean | 可选 | 8 |
是否开启自然人领取限制。 自然人表示按照身份证纬度进行领取限制。 |
true |
└phone_number_limit | boolean | 可选 | 8 | 是否开启电话号码领取限制。 | false |
customer_guide | customerguide | 可选 | 自定义入口 | ||
└voucher_use_guide | voucheruseguide | 必填 | 券核销引导 | ||
└offline_code_use_guide | boolean | 可选 | 16 |
线下扫码核销。 说明: 1、该字段为true。则卡包会展示相应券码信息。 2、offline_code_use_guide 与 mini_app_use_guide至少2选1 |
true |
└mini_app_use_guide | boolean | 可选 | 16 | 小程序核销。 说明: 1、该字段为true。则卡包会展示小程序核销按钮跳转至小程序。 2、offline_code_use_guide 与 mini_app_use_guide至少2选1。3、该字段为true,则下面的mini_app_id字段必须填写。 | true |
└mini_app_id | string | 可选 | 16 | 券可用的小程序appid,卡包详情页可跳转到该appid 限制: 该appid归属的pid必须和当前商户存在同mid关系或跨mid的授权关系。 | 2021238412323412 |
└mini_app_path | string | 特殊可选 | 64 |
指定跳转到mini_app_id时的具体页面路径。 限制: 1、只有mini_app_id有值时该值传入才会有效 2、该小程序路径是相对路径。详情参考小程序scheme链接介绍https://opendocs.alipay.com/support/01rb18。 3.service_codes与mini_app_path只能二选一或者都不填写。 |
/index/path/path&query=xx=xx |
└service_codes | string[] | 特殊可选 | 1280 | 小程序服务编码,通过 alipay.open.app.appcontent.function.create(小程序服务创建)接口创建服务后获取。 限制: 1.只有mini_app_id有值时该值传入才会有效 2.当前只支持一个服务code 3.service_codes与mini_app_path只能二选一或者都不填写。 | ["2020030921000303380758"] |
└voucher_send_guide | vouchersendguide | 特殊可选 |
券发放引导信息。 说明: 当voucher_type=exchange_voucher时,该字段必须填写。 |
||
└voucher_detail_url | string | 特殊可选 | 255 |
领(购)券详情页链接,从支付宝公域跳转到服务商(商户)自定义领(购)券详情页。 说明: 当voucher_type=exchange_voucher时,该字段必须填写。 |
alipays://platformapi/startapp?appid=xxxx |
out_biz_no | string | 必选 | 64 |
外部业务单号,用作幂等控制。 幂等作用:参数不变的情况下,再次请求返回与上一次相同的结果。 |
20170101000001654bb46ba |
merchant_access_mode | string | 可选 | 32 | 商户接入模式 | agency_mode |
activity_base_info | activitybaseinfo | 可选 | 活动基础信息 | ||
└activity_id | string | 可选 | 128 | 活动id | 2016042700826004508401111111 |
└activity_name | string | 可选 | 20 | 活动名称。 不对用户进行展示,仅供商家在后台管理活动使用。 | 满10减1活动 |
└belong_merchant_info | belongmerchantinfo | 可选 | 商家券活动归属的商户信息。 说明: 如果该复杂对象不填。则默认为该商家券活动的归属者是调用者本人。 如果填写,则认为该商家券活动的归属者是该商户。 限制:自研商户可以不传,服务商身份接入时必传 | ||
└business_type | string | 可选 | 16 |
合作业务类型,默认为isv_for_merchant 枚举值: isv 服务商平台模式 isv_for_merchant 服务商代运营模式 限制: 1、isv(平台模式)只有兑换券即voucher_type值为exchange_voucher时才能使用 |
isv_for_merchant |
└merchant_id_type | string | 特殊可选 | 10 |
商户id类型。 枚举值: smid 间连smid pid 直连pid 特别说明: 如果merchant_id_type选择smid。则表明当前商家券活动的归属者是该smid所绑定的支付宝pid。 因此要求该smid必须绑定相应的支付宝pid。 限制: 服务商代运营模式必传 |
smid |
└merchant_id | string | 特殊可选 | 32 |
商户id 限制: 1、服务商代运营模式必传 2、服务商代运营模式下服务商必须与商户建立代运营授权关系。代运营授权流程https://opendocs.alipay.com/mini/01hm6i#代运营授权 |
2088102111111111 |
└code_mode | string | 可选 | 32 | 码模式。 枚举值: merchant_upload:商户上传自定义code,发券时系统随机选取上传的券code发放 merchant_api:发奖时指定券码发奖,此模式无须提前上传券码。 | merchant_upload |
└activity_operation_status | string | 可选 | 32 | 活动操作状态。 取值范围: 1.creating:创建中。 2.modifying:修改中。 3.appending:追加中。 4.finisheing:终止中。 限制: 该值为空,说明活动当前没有正在执行中的操作。 | modifying |
└activity_status | string | 可选 | 32 | 活动状态。 取值范围: 1.active:已激活(活动正常运行)。 2.finished:已终止(商家终止活动,不可再发放。 限制: 1.该值为空,说明活动还未创建成功。可以使用 activity_operation_status字段判断活动是否处于creating状态。 | active |
voucher_send_mode_info | vouchersendmodeinfo | 可选 | 券发放 | ||
└voucher_send_mode | string | 可选 | 32 |
券发放模式 枚举值: sale_mode:售卖模式 direct_send_mode:直领模式 voucher_package:券包 |
direct_send_mode |
└voucher_sale_mode_info | vouchersalemodeinfo | 可选 | 券售卖信息 | ||
└payee_pid | string | 可选 | 32 | 收款账号。 目前的结算规则是,每核销一笔优惠券,支付宝会打款到该收款账户。 | 2088xxxxx |
└sale_amount | price | 可选 | 16 | 用户购买优惠券需要支付的金额 限制: 币种为人民币,单位为元。小数点以后最多保留两位。 取值范围:0.1<=x<=3000 | 50.00 |
└fund_custody_mode | string | 可选 | 32 |
资金托管方式 枚举值: guarantee 担保交易 |
guarantee |
└refundable | boolean | 可选 | 8 | 购买的优惠券是否允许退款。 不填默认否,枚举值: true:是 false:否 | false |
└overdue_refundable | boolean | 可选 | 8 | 是否支持优惠券过期后,自动退款给用户。 不填默认否,枚举值: true:是 false:否 自动退款功能需要服务商在优惠券过期时,主动调用alipay.marketing.activity.order.refund接口进行退款。 如果配置优惠券时选择了过期自动退款,但是实际券过期后,服务商没有进行退款,那么用户投诉后,需要服务商进行解决。 | false |
└voucher_package_mode_info | voucherpackagemodeinfo | 可选 | 券包信息 | ||
└voucher_package_id | string | 可选 | 64 | 券包id,对应alipay.marketing.activity.voucherpackage.query中voucher_package_id。 | ip20220628016671405804297103167741 |
└voucher_send_rule_info | vouchersendruleinfo | 可选 | 券发放规则 | ||
└quantity | number | 可选 | 10 |
发行券的数量。 限制: code_mode=merchant_upload模式下数量必须为0。 其他模式下该数值必须是大于0的整数。 |
100 |
└max_quantity_by_day | number | 可选 | 10 |
设置此字段,允许指定单天最大发券数量。 限制: 每天发放张数*活动天数应小于等于优惠券发放总量 |
10 |
└quantity_limit_per_user | number | 可选 | 10 | 每人领取限制。 默认按照支付宝账号进行领取限制; 不填写或填入0表示没有领取限制. | 100 |
└quantity_limit_per_user_period_type | string | 可选 | 32 | 周期限领配置,限制每人在固定周期内领取张数(voucher_quantity_limit_per_user),默认life_cycle 枚举值为 day:每天 week:每周 month:每月 life_cycle:整个活动周期 | life_cycle |
└natural_person_limit | boolean | 可选 | 8 | 是否开启自然人领取限制。 自然人表示按照身份证纬度进行领取限制。 | false |
└phone_number_limit | boolean | 可选 | 8 | 是否开启电话号码领取限制。 | false |
└real_name_limit | boolean | 可选 | 8 | 限制支付宝实名用户才能领取支付券,默认为false表示不限制 枚举值 true\false | false |
└publish_start_time | date | 可选 | 19 | 券发放开始时间。 格式为:yyyy-mm-dd hh:mm:ss | 2017-01-01 00:00:01 |
└publish_end_time | date | 可选 | 19 | 券发放结束时间。 格式为:yyyy-mm-dd hh:mm:ss | 2017-01-29 23:59:59 |
voucher_deduct_info | voucherdeductinfo | 可选 | 券优惠抵扣信息 | ||
└voucher_type | string | 可选 | 32 | 券类型。 枚举值: 商家券支持三类券类型: fix_voucher:满减券; discount_voucher:折扣券; special_voucher:特价券; 兑换券仅支持一类券类型: exchange_voucher: 兑换券; | fix_voucher |
└fix_voucher_info | fixvoucherinfo | 可选 | 满减券详情 限制: 券类型为满减券时必传 | ||
└amount | price | 可选 | 16 | 面额,每张代金券可以抵扣的金额。 限制: 币种为人民币,单位为元。小数点以后最多保留两位。 取值范围:0.1<=x<=3000 | 50.00 |
└floor_amount | price | 可选 | 16 | 门槛金额。该字段不填写,认为无门槛。 限制: 只有当订单金额大于等于门槛金额时券才能使用。 币种为人民币,单位为元。小数点以后最多保留两位。 设置门槛:取值范围:0.1<=x<= 50000。 如果设置了门槛金额,则必须大于等于0.1,不可以等于0 | 1000.00 |
└discount_voucher_info | discountvoucherinfo | 可选 | 折扣券详情 限制: 券类型voucher_type为折扣券discount_voucher时必传 | ||
└discount | string | 可选 | 12 | 折扣率。 限制: 取值范围:0.1<=x<=9.9,比如:6.5折填入6.5; | 6.5 |
└ceiling_amount | price | 可选 | 16 | 封顶金额。 限制: 币种为人民币,单位为元; 小数点以后最多保留两位; 取值范围:0.1<=x<=15000; | 50.00 |
└floor_amount | price | 可选 | 16 | 门槛金额。 限制: 币种为人民币,单位为元; 小数点以后最多保留两位; 取值范围:0.1<=x<= 50000; 说明: 该字段可不填,认为无门槛; | 1000.00 |
└special_voucher_info | specialvoucherinfo | 可选 | 特价券详情 限制: 券类型voucher_type为特价券special_voucher时必传 | ||
└special_amount | price | 可选 | 16 | 特价,即:原价-特价=优惠金额。 限制: 币种为人民币,单位为元。小数点以后最多保留两位; 取值范围:0<=x<=999; 原价必须大于特价,即:origin_amount>special_amount; | 10.00 |
└floor_amount | price | 可选 | 16 | 门槛金额。 限制: 币种为人民币,单位为元; 小数点以后最多保留两位; 取值范围:0.1<=x<= 50000; 说明: 该字段可不填,认为无门槛; | 1000.00 |
└exchange_voucher_info | exchangevoucherinfo | 可选 | 兑换券详情 限制: 券类型为兑换券时必传 | ||
└amount | price | 可选 | 16 | 券的价值 限制: 币种为人民币,单位为元。小数点以后最多保留两位。 取值范围:0.1<=x<=3000 | 100.00 |
└floor_amount | price | 可选 | 16 | 优惠门槛金额,表示只有当订单金额大于等于门槛金额时券才能使用。该字段为空时表示无门槛。 门槛金额的校验由服务商(商户)核销时自行校验,支付宝侧只做展示使用。 币种为人民币,单位为元。小数点以后最多保留两位。 设置门槛:取值范围:0.1<=x<= 50000。 如果设置了门槛金额,则必须大于等于0.1,不可以等于0 | 1000.00 |
└biz_type | string | 可选 | 64 | 兑换券业务类型。 枚举值 团购券:group_buy_exchange_voucher 代金券:fix_exchange_voucher 注意:兑换券通过大促活动权益报名能力推广至支付宝会场时,本参数必填。 | group_buy_exchange_voucher |
voucher_available_scope_info | voucheravailablescopeinfo | 可选 | 券可用范围 | ||
└voucher_available_account_info | voucheravailableaccountinfo | 可选 | 券可用账号 | ||
└available_pids | string[] | 可选 | 84000 | 优惠券可核销的直连商户pid 限制: 1、available_pids和available_smids至少二选一。 | ["2088102111111111"] |
└available_smids | string[] | 可选 | 84000 | 优惠券可核销的间连商户smid 限制: 1、available_pids和available_smids至少二选一。 | ["2088102111111111"] |
└voucher_available_app_info | voucheravailableappinfo | 可选 | 券可用小程序 | ||
└available_app_ids | string[] | 可选 | 84000 | 可核销的支付宝小程序id 限制: 1、必须是支付宝小程序 2、如果包含重复的小程序id会自动进行去重操作。 | ["2021238412323412"] |
└voucher_available_geography_scope_info | voucheravailablegeographyscopeinfo | 可选 | 券可用地理位置 | ||
└available_geography_scope_type | string | 可选 | 32 |
券可用地理位置类型。 枚举值: shop:可用门店 city_code:可用城市 |
shop |
└available_geography_shop_info | voucheravailablegeographyshopinfo | 可选 | 券可用门店 | ||
└available_shop_ids | string[] | 可选 | 84000 | 券可使用的门店列表。列表中的门店id是通过调用接口ant.merchant.expand.shop.create创建门店返回的支付宝门店id 接口参数是列表类型。 限制: 1、shop_ids中的门店id必须是支付宝门店id。 2、shop_ids如果包含重复的门店id会自动进行去重操作。 3、shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└available_geography_all_shop | voucheravailablegeographyallshopinfo | 可选 | 全部门店可用 | ||
└merchant_ids | string[] | 可选 | 84000 |
全部门店可用的商户id 限制: 1.目前只支持传当前活动归属的商户id 2.目前只支持传入单个商户id |
["208805x000502"] |
└exclude_shop_ids | string[] | 可选 | 84000 | 券不可使用的门店列表。指定商户全部门店可用时可通过该字段排除部分不可用门店。 列表中的门店id是通过调用接口ant.merchant.expand.shop.create创建门店返回的支付宝门店id 接口参数是列表类型。 限制: 1、exclude_shop_ids中的门店id必须是支付宝门店id。 2、exclude_shop_ids如果包含重复的门店id会自动进行去重操作。 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└available_real_shop_ids | string[] | 可选 | 84000 | 代运营商业关系门店列表,列表中的门店id是调用接口alipay.business.relation.shop.create创建门店返回的real_shop_id 接口参数是列表类型。 限制: 1、real_shop_ids中的门店id必须是代运营商业关系门店id。 2、real_shop_ids如果包含重复的门店id会自动进行去重操作。3、shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└available_geography_city_info | voucheravailablegeographycityinfo | 可选 | 券可用城市 | ||
└all_city | boolean | 可选 | 8 | 是否全国。 选择全国后,无须填写city_codes字段。系统默认填充全国全部城市信息。 | false |
└available_city_codes | string[] | 可选 | 84000 | 城市编码。请按照https://gw.alipayobjects.com/os/basement_prod/253c4dcb-b8a4-4a1e-8be2-79e191a9b6db.xlsx 表格中内容填写。 (参考资料: http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/) | ["100100"] |
└voucher_available_goods_info | voucheravailablegoodsinfo | 可选 | 券可用商品 | ||
└goods_name | string | 可选 | 12 |
商品名称。 限制: 1.兑换券、特价券必填 |
美味甜甜圈 |
└goods_description | string | 可选 | 120 | 商品描述 | 美味甜甜圈很美味 |
└origin_amount | price | 可选 | 16 |
商品原价 限制: 特价券必填 |
100.00 |
└available_goods_sku_ids | string[] | 可选 | 84000 | 可优惠商品编码,商家自定义商品编码。当用户支付时,交易中的商品编码和支付券配置的商品编码有任一匹配时,可以使用优惠券。 | ["apple-01","apple-02"] |
└exclude_goods_sku_ids | string[] | 可选 | 84000 | 不可核销商品编码,商家自定义商品编码。当用户支付时,交易中的商品编码和支付券配置的商品编码有任一匹配时,不可以使用优惠券。 限制: 1、available_goods与unavailable_goods_ids只能二选一或者同时为空 | ['apple-03','apple-04'] |
voucher_use_rule_info | voucheruseruleinfo | 可选 | 券核销限制 | ||
└quantity_limit_per_user | number | 可选 | 10 | 核销次数限制 | 1 |
└quantity_limit_per_user_period_type | string | 可选 | 32 | 核销周期 | day |
└voucher_max_use_times | number | 可选 | 16 | 券最大核销次数 | 1 |
└voucher_use_time_info | voucherusetimeinfo | 可选 | 券核销时间 | ||
└period_type | string | 可选 | 32 |
券有效期。 枚举值: absolute:绝对时间 relative:相对时间 |
absolute |
└absolute_period_info | voucherabsoluteperiodinfo | 可选 | 券绝对时间可用 | ||
└valid_begin_time | date | 可选 | 19 | 券可使用的开始时间。 格式为:yyyy-mm-dd hh:mm:ss | 2017-01-10 00:00:00 |
└valid_end_time | date | 可选 | 19 |
券可使用的结束时间。 格式为yyyy-mm-dd hh:mm:ss 限制: 券可使用的结束时间valid_end_time 必须大于 券的发放结束时间 publish_end_time |
2017-01-13 23:59:59 |
└relative_period_info | voucherrelativeperiodinfo | 可选 | 券相对时间 | ||
└wait_days_after_receive | number | 可选 | 10 |
用户领券后需要等待n天,券才可以生效。 字段值为0表示用户领券后立刻生效。 |
1 |
└valid_days_after_receive | number | 可选 | 10 |
券生效后n天内可以使用。 可以配合wait_days_after_receive字段使用。 限制: valid_days_after_receive必须大于0。 |
1 |
voucher_customer_guide_info | vouchercustomerguideinfo | 可选 | 券引导详情 | ||
└voucher_send_guide_info | vouchersendguideinfo | 可选 | 券发放引导 | ||
└send_guide_mode | string[] | 可选 | 300 |
发放引导模式 枚举值: mini_app 小程序发放引导 |
["mini_app"] |
└mini_app_send_guide_info | voucherminiappsendguideinfo | 可选 | 小程序发放引导 | ||
└mini_app_url | string | 可选 | 255 | 指定跳转到mini_app_id时的具体页面路径。 限制: 1、只有mini_app_id有值时该值传入才会有效 2、该小程序路径是相对路径。详情参考小程序scheme链接介绍https://opendocs.alipay.com/support/01rb18。 3.service_codes与mini_app_path只能二选一或者都不填写。 | alipays://platformapi/startapp?appid=xxxx |
└voucher_use_guide_info | voucheruseguideinfo | 可选 | 券核销详情 | ||
└use_guide_mode | string[] | 可选 | 300 |
offline_code 券码扫码核销 mini_app 小程序线上核销 scan_code 跳转付款码支付核销 can_use 展示可使用 |
["mini_app"] |
└mini_app_use_guide_info | voucherminiappuseguideinfo | 可选 | 小程序核销引导 | ||
└mini_app_url | string | 可选 | 255 | 指定跳转到mini_app_id时的具体页面路径。 限制: 1、只有mini_app_id有值时该值传入才会有效 2、该小程序路径是相对路径。详情参考小程序scheme链接介绍https://opendocs.alipay.com/support/01rb18。 3.service_codes与mini_app_path只能二选一或者都不填写。 | alipays://platformapi/startapp?appid=xxxx |
└mini_app_service_codes | string[] | 可选 | 1000 | 小程序服务编码,通过 alipay.open.app.appcontent.function.create(小程序服务创建)接口创建服务后获取。 限制: 1.只有mini_app_id有值时该值传入才会有效 2.当前只支持一个服务code 3.service_codes与mini_app_path只能且必须二选一 | ["2020030921000303380758"] |
voucher_display_pattern_info | voucherdisplaypatterninfo | 可选 | 券展示信息 | ||
└brand_name | string | 可选 | 12 | 商户品牌名称。 如果不设置品牌名称,则默认使用支付宝商家系统中维护的商家别名。 如果没有维护商家别名,则使用默认名称: 商家优惠。 用户领取优惠券后,品牌名称会对用户进行展示 限制: 1、服务商平台模式即belong_merchant_info.business_type为isv时必传 | 商家优惠 |
└brand_logo | string | 可选 | 128 | 商家logo 需要通过 alipay.marketing.material.image.upload接口上传图片,指定file_key为promo_brand_logo,返回的resource_id即为该参数的值 限制: 1、服务商平台模式即belong_merchant_info.business_type为isv时必传 2、上传图片尺寸600*600,支持格式:png、jpg、jpeg、bmp,大小不超过2mb | adedsktiqo-u5vjuqvbcqwaaacmaaqed |
└brand_logo_url | string | 可选 | 255 | 商家品牌logo链接 | https://gw.alipayobjects.com/mdn/rms_9822d7/afts/img/a*1f4esaaphrqaaaaaaaaaaabkarqnaq |
└voucher_name | string | 可选 | 20 |
券名称 限制: 兑换券必传 |
满10减1券 |
└voucher_description | string | 可选 | 1000 | 券详细使用说明。 | 1、本券不可兑换现金,不可找零。2、每个用户最多可以领取1张。3、如果订单发生退款,优惠券无法退还。 |
└voucher_image | string | 可选 | 64 | 券详情页封面图,会展示在用户支付宝卡包券详情页 需要通过 alipay.marketing.material.image.upload接口上传图片,指定file_key为promo_voucher_image,接口返回的resource_id即为该参数的值 限制: 上传图片尺寸670*335,支持格式:png、jpg、jpeg、bmp,大小不超过2mb | adedsktiqo-u5vjuqvbcqwaaacmaaqed |
└voucher_image_url | string | 可选 | 255 | 券封面链接 | https://gw.alipayobjects.com/mdn/rms_9822d7/afts/img/a*1f4esaaphrqaaaaaaaaaaabkarqnaq |
└voucher_detail_images | string[] | 可选 | 256 | 券详细图列表,会展示在用户支付宝卡包券详情页 需要通过 alipay.marketing.material.image.upload接口上传图片,指定file_key为promo_voucher_detail_image ,接口返回的resource_id即为该参数的值 上传图片尺寸600*600,支持格式:png、jpg、jpeg、bmp,大小不超过2mb 限制 1、voucher_image填入,该值才能填入; 2、最多3张; 3、兑换券即voucher_type为exchange_voucher时不支持 | ["adedsktiqo-u5vjuqvbcqwaaacmaaqe1","adedsktiqo-u5vjuqvbcqwaaacmaaqe2","adedsktiqo-u5vjuqvbcqwaaacmaaqe3"] |
└voucher_detail_image_urls | string[] | 可选 | 800 | 券详情链接 | ["https://gw.alipayobjects.com/mdn/rms_9822d7/afts/img/a*1f4esaaphrqaaaaaaaaaaabkarqnaq"] |
└customer_service_mobile | string | 可选 | 20 | 客服电话 限制: 客服电话和客服链接必须二选一 | 81xxxxxxx |
└customer_service_url | string | 可选 | 255 | 客服链接 限制: 客服电话和客服链接必须二选一 | alipay://xxxx |
3 公共响应参数
参数 | 类型 | 是否必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
code | string | 是 | - | 网关返回码,详见文档 | 40004 |
msg | string | 是 | - | 网关返回码描述,详见文档 | business failed |
sub_code | string | 否 | - | 业务返回码,参见具体的api接口文档 | acq.trade_has_success |
sub_msg | string | 否 | - | 业务返回码描述,参见具体的api接口文档 | 交易已被支付 |
sign | string | 是 | - | 签名,详见文档 | dzxh8eetuahoye3w1j poiphfdxoybfunn1lket/v7p4zjdyojwea6izs6hz0ydw5cp/viufub5i0/v5wens3oyr8zredqo6d futdlhdc efyckiqhbxizgngpdpdfp1pis7bdhhzrszhbrqb7o4k3dxc aanfauu4v6zdwczo= |
4 响应参数
参数 | 类型 | 是否必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
activity_id | string | 必填 | 128 | 活动id | 2016042700826004508401111111 |
voucher_use_rule_result | ordervoucheruseruleresult | 选填 | 券核销规则请求结果 | ||
└voucher_available_scope_result | ordervoucheravailablescoperesult | 必填 | 商家券可用范围请求结果 | ||
└voucher_available_type | string | 必填 | 32 | 可用范围类型。 枚举值: shop:可用门店 city_code:可用城市 | shop |
└order_voucher_available_shop_result | ordervoucheravailableshopresult | 可选 | 可用门店请求结果 | ||
└success_shop_ids | string[] | 可选 | 84000 | 请求成功的支付宝门店。 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└shop_fail_infos | ordervouchershopfailinfo[] | 可选 | 请求失败的支付宝门店详情。 | ||
└shop_id | string | 必填 | 32 | 请求失败的支付门店id | 2018051000502000000011111111 |
└fail_reasons | string[] | 必填 | 32 |
请求失败的原因。 枚举值: shop_info_not_pass:门店信息不全 shop_not_exist:门店不存在 merchant_shop_relation_not_exist:门店与商户没有关联关系 activity_shop_not_exist:活动不存在该门店 |
["shop_not_exist"] |
└fail_message | string | 可选 | 1000 | 请求失败提示信息 | 门店不存在 |
└success_real_shop_ids | string[] | 可选 | 84000 | 请求成功的代运营商业关系门店 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└real_shop_fail_infos | ordervoucherrealshopfailinfo[] | 可选 | 请求失败的代运营商业关系门店详情 | ||
└real_shop_id | string | 必填 | 32 | 请求失败的代运营商业关系门店id | 2018051000502000000011111111 |
└fail_reasons | string[] | 必填 | 32 |
请求失败原因。 枚举值: shop_info_not_pass:门店信息不全 shop_not_exist:门店不存在 merchant_shop_relation_not_exist:门店与商户没有关联关系 activity_shop_not_exist:活动不存在该门店 |
["shop_not_exist"] |
└fail_message | string | 可选 | 1000 | 请求失败提示信息 | 门店不存在 |
└order_voucher_merchant_all_shop_result | ordervouchermerchantallshopresult | 可选 | 商户全部门店可用请求结果。 | ||
└success_exclude_shop_ids | string[] | 可选 | 84000 | 请求成功的不可用门店列表。 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└exclude_shop_fail_infos | ordervouchershopfailinfo[] | 可选 | 请求失败的不可用门店详情。 | ||
└shop_id | string | 必填 | 32 | 请求失败的支付门店id | 2018051000502000000011111111 |
└fail_reasons | string[] | 必填 | 32 |
请求失败的原因。 枚举值: shop_info_not_pass:门店信息不全 shop_not_exist:门店不存在 merchant_shop_relation_not_exist:门店与商户没有关联关系 activity_shop_not_exist:活动不存在该门店 |
["shop_not_exist"] |
└fail_message | string | 可选 | 1000 | 请求失败提示信息 | 门店不存在 |
voucher_available_scope_result_info | voucheravailablescoperesultinfo | 选填 | 可用范围结果 | ||
└voucher_available_geography_scope_result_info | voucheravailablegeographyscoperesultinfo | 可选 | 可用地理位置 | ||
└available_geography_shop_result_info | voucheravailablegeographyshopresultinfo | 可选 | 可用门店结果 | ||
└success_available_shop_ids | string[] | 可选 | 84000 | 券可使用的门店列表。列表中的门店id是通过调用接口ant.merchant.expand.shop.create创建门店返回的支付宝门店id 接口参数是列表类型。 限制: 1、shop_ids中的门店id必须是支付宝门店id。 2、shop_ids如果包含重复的门店id会自动进行去重操作。 3、shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└fail_available_shop_infos | voucherfailshopinfo[] | 可选 | 失败的可用门店 | ||
└shop_id | string | 可选 | 32 | 请求失败的支付门店id | 2018051000502000000011111111 |
└real_shop_id | string | 可选 | 32 | 请求失败的物理门店id | 1 |
└fail_reasons | string[] | 可选 | 32 | 请求失败的原因。 枚举值: shop_info_not_pass:门店信息不全 shop_not_exist:门店不存在 merchant_shop_relation_not_exist:门店与商户没有关联关系 activity_shop_not_exist:活动不存在该门店 | ["shop_not_exist"] |
└fail_message | string | 可选 | 1000 | 请求失败提示信息 | 门店不存在 |
└success_available_real_shop_ids | string[] | 可选 | 84000 | 代运营商业关系门店列表,列表中的门店id是调用接口alipay.business.relation.shop.create创建门店返回的real_shop_id 接口参数是列表类型。 限制: 1、real_shop_ids中的门店id必须是代运营商业关系门店id。 2、real_shop_ids如果包含重复的门店id会自动进行去重操作。3、shop_ids、real_shop_ids、order_voucher_merchant_all_shop必须三选一 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└fail_available_real_shop_infos | voucherfailshopinfo[] | 可选 | 失败的物理门店详情 | ||
└shop_id | string | 可选 | 32 | 请求失败的支付门店id | 2018051000502000000011111111 |
└real_shop_id | string | 可选 | 32 | 请求失败的物理门店id | 1 |
└fail_reasons | string[] | 可选 | 32 | 请求失败的原因。 枚举值: shop_info_not_pass:门店信息不全 shop_not_exist:门店不存在 merchant_shop_relation_not_exist:门店与商户没有关联关系 activity_shop_not_exist:活动不存在该门店 | ["shop_not_exist"] |
└fail_message | string | 可选 | 1000 | 请求失败提示信息 | 门店不存在 |
└available_geography_all_shop_result_info | voucheravailablegeographyallshopresultinfo | 可选 | 全部门店结果 | ||
└success_exclude_shop_ids | string[] | 可选 | 84000 | 请求成功的不可用门店列表。 | ["2018051000502000000011111111","2018040200502000000011111111","2018062800502000000022271997"] |
└fail_exclude_shop_infos | voucherfailshopinfo[] | 可选 | 请求失败的不可用门店详情。 | ||
└shop_id | string | 可选 | 32 | 请求失败的支付门店id | 2018051000502000000011111111 |
└real_shop_id | string | 可选 | 32 | 请求失败的物理门店id | 1 |
└fail_reasons | string[] | 可选 | 32 | 请求失败的原因。 枚举值: shop_info_not_pass:门店信息不全 shop_not_exist:门店不存在 merchant_shop_relation_not_exist:门店与商户没有关联关系 activity_shop_not_exist:活动不存在该门店 | ["shop_not_exist"] |
└fail_message | string | 可选 | 1000 | 请求失败提示信息 | 门店不存在 |
5 请求示例
package com.java.sdk.demo;
import com.alipay.api.alipayapiexception;
import com.alipay.api.alipayclient;
import com.alipay.api.defaultalipayclient;
import com.alipay.api.certalipayrequest;
import com.alipay.api.alipayconfig;
import com.alipay.api.domain.ordervoucheravailablecitycode;
import com.alipay.api.domain.voucherdisplaypatterninfo;
import com.alipay.api.domain.exchangevoucher;
import com.alipay.api.domain.vouchersalemodeinfo;
import com.alipay.api.domain.vouchervalidperiod;
import com.alipay.api.domain.specialvoucher;
import com.alipay.api.domain.voucheravailablescope;
import com.alipay.api.domain.voucherrelativeperiodinfo;
import com.alipay.api.domain.voucheruseguideinfo;
import com.alipay.api.domain.voucheravailableaccountinfo;
import com.alipay.api.domain.customerguide;
import com.alipay.api.domain.bizfundsettleinfo;
import com.alipay.api.domain.voucheruseruleinfo;
import com.alipay.api.domain.voucherminiappuseguideinfo;
import com.alipay.api.request.alipaymarketingactivityordervouchercreaterequest;
import com.alipay.api.domain.voucheruserule;
import com.alipay.api.domain.exchangevoucherinfo;
import com.alipay.api.domain.voucheravailablegeographyallshopinfo;
import com.alipay.api.domain.discountvoucherinfo;
import com.alipay.api.domain.voucherabsoluteperiodinfo;
import com.alipay.api.domain.activitybaseinfo;
import com.alipay.api.domain.belongmerchantinfo;
import com.alipay.api.domain.voucheravailablescopeinfo;
import com.alipay.api.domain.alipaymarketingactivityordervouchercreatemodel;
import com.alipay.api.domain.fixvoucherinfo;
import com.alipay.api.domain.voucherdeductinfo;
import com.alipay.api.domain.voucheruseguide;
import com.alipay.api.domain.fixvoucher;
import com.alipay.api.domain.voucheravailableappinfo;
import com.alipay.api.domain.voucherpackagemodeinfo;
import com.alipay.api.domain.voucherminiappsendguideinfo;
import com.alipay.api.domain.vouchersendguideinfo;
import com.alipay.api.domain.vouchersendguide;
import com.alipay.api.domain.vouchersendmodeinfo;
import com.alipay.api.domain.voucheravailablegeographyshopinfo;
import com.alipay.api.domain.ordervoucheravailableshop;
import com.alipay.api.domain.ordervouchermerchantallshop;
import com.alipay.api.domain.voucherusetimeinfo;
import com.alipay.api.domain.discountvoucher;
import com.alipay.api.domain.vouchercustomerguideinfo;
import com.alipay.api.domain.voucheravailablegoodsinfo;
import com.alipay.api.domain.vouchersendruleinfo;
import com.alipay.api.domain.vouchersendruledetail;
import com.alipay.api.response.alipaymarketingactivityordervouchercreateresponse;
import com.alipay.api.domain.voucheravailablegeographyscopeinfo;
import com.alipay.api.domain.voucheravailablegeographycityinfo;
import com.alipay.api.domain.specialvoucherinfo;
import com.alipay.api.domain.voucherdisplayinfo;
import com.alipay.api.fileitem;
import java.util.base64;
import java.util.arraylist;
import java.util.list;
import java.util.timezone;
import java.text.parseexception;
import java.text.simpledateformat;
public class alipaymarketingactivityordervouchercreate {
public static void main(string[] args) throws alipayapiexception, parseexception {
string privatekey = "<-- 请填写您的应用私钥,例如:miievqibadanb ... ... -->";
string alipaypublickey = "<-- 请填写您的支付宝公钥,例如:miibijanbg... -->";
alipayconfig alipayconfig = new alipayconfig();
alipayconfig.setserverurl("https://openapi.alipay.com/gateway.do");
alipayconfig.setappid("<-- 请填写您的appid,例如:2019091767145019 -->");
alipayconfig.setprivatekey(privatekey);
alipayconfig.setformat("json");
alipayconfig.setalipaypublickey(alipaypublickey);
alipayconfig.setcharset("utf8");
alipayconfig.setsigntype("rsa2");
simpledateformat sdf = new simpledateformat("yyyy-mm-dd hh:mm:ss");
sdf.settimezone(timezone.gettimezone("gmt 8"));
alipayclient alipayclient = new defaultalipayclient(alipayconfig);
alipaymarketingactivityordervouchercreaterequest request = new alipaymarketingactivityordervouchercreaterequest();
alipaymarketingactivityordervouchercreatemodel model = new alipaymarketingactivityordervouchercreatemodel();
model.setvouchertype("fix_voucher");
model.setpublishendtime(sdf.parse("2017-01-29 23:59:59"));
vouchersendmodeinfo vouchersendmodeinfo = new vouchersendmodeinfo();
vouchersendmodeinfo.setvouchersendmode("direct_send_mode");
vouchersendruleinfo vouchersendruleinfo = new vouchersendruleinfo();
vouchersendruleinfo.setquantity(100l);
vouchersendruleinfo.setpublishendtime(sdf.parse("2017-01-29 23:59:59"));
vouchersendruleinfo.setquantitylimitperuserperiodtype("life_cycle");
vouchersendruleinfo.setmaxquantitybyday(10l);
vouchersendruleinfo.setquantitylimitperuser(100l);
vouchersendruleinfo.setphonenumberlimit(false);
vouchersendruleinfo.setrealnamelimit(false);
vouchersendruleinfo.setnaturalpersonlimit(false);
vouchersendruleinfo.setpublishstarttime(sdf.parse("2017-01-01 00:00:01"));
vouchersendmodeinfo.setvouchersendruleinfo(vouchersendruleinfo);
vouchersalemodeinfo vouchersalemodeinfo = new vouchersalemodeinfo();
bizfundsettleinfo settleinfo = new bizfundsettleinfo();
settleinfo.setsettletargettype("merchant");
settleinfo.setsettlemode("period");
vouchersalemodeinfo.setsettleinfo(settleinfo);
vouchersalemodeinfo.setsaleamount("50.00");
vouchersalemodeinfo.setoverduerefundable(false);
vouchersalemodeinfo.setrefundable(false);
vouchersalemodeinfo.setpayeepid("2088xxxxx");
vouchersalemodeinfo.setfundcustodymode("guarantee");
vouchersendmodeinfo.setvouchersalemodeinfo(vouchersalemodeinfo);
voucherpackagemodeinfo voucherpackagemodeinfo = new voucherpackagemodeinfo();
voucherpackagemodeinfo.setvoucherpackageid("ip20220628016671405804297103167741");
vouchersendmodeinfo.setvoucherpackagemodeinfo(voucherpackagemodeinfo);
model.setvouchersendmodeinfo(vouchersendmodeinfo);
model.setcodemode("merchant_upload");
vouchercustomerguideinfo vouchercustomerguideinfo = new vouchercustomerguideinfo();
vouchersendguideinfo vouchersendguideinfo = new vouchersendguideinfo();
list<string> sendguidemode = new arraylist<string>();
sendguidemode.add("mini_app");
vouchersendguideinfo.setsendguidemode(sendguidemode);
voucherminiappsendguideinfo miniappsendguideinfo = new voucherminiappsendguideinfo();
miniappsendguideinfo.setminiappurl("alipays://platformapi/startapp?appid=xxxx");
vouchersendguideinfo.setminiappsendguideinfo(miniappsendguideinfo);
vouchercustomerguideinfo.setvouchersendguideinfo(vouchersendguideinfo);
voucheruseguideinfo voucheruseguideinfo = new voucheruseguideinfo();
voucherminiappuseguideinfo miniappuseguideinfo = new voucherminiappuseguideinfo();
list<string> miniappservicecodes = new arraylist<string>();
miniappservicecodes.add("2020030921000303380758");
miniappuseguideinfo.setminiappservicecodes(miniappservicecodes);
miniappuseguideinfo.setminiappurl("alipays://platformapi/startapp?appid=xxxx");
voucheruseguideinfo.setminiappuseguideinfo(miniappuseguideinfo);
list<string> useguidemode = new arraylist<string>();
useguidemode.add("mini_app");
voucheruseguideinfo.setuseguidemode(useguidemode);
vouchercustomerguideinfo.setvoucheruseguideinfo(voucheruseguideinfo);
model.setvouchercustomerguideinfo(vouchercustomerguideinfo);
voucherdisplaypatterninfo voucherdisplaypatterninfo = new voucherdisplaypatterninfo();
voucherdisplaypatterninfo.setbrandlogo("adedsktiqo-u5vjuqvbcqwaaacmaaqed");
voucherdisplaypatterninfo.setvoucherimage("adedsktiqo-u5vjuqvbcqwaaacmaaqed");
voucherdisplaypatterninfo.setcustomerservicemobile("81xxxxxxx");
voucherdisplaypatterninfo.setcustomerserviceurl("alipay://xxxx");
list<string> voucherdetailimages = new arraylist<string>();
voucherdetailimages.add("adedsktiqo-u5vjuqvbcqwaaacmaaqe1");
voucherdetailimages.add("adedsktiqo-u5vjuqvbcqwaaacmaaqe2");
voucherdetailimages.add("adedsktiqo-u5vjuqvbcqwaaacmaaqe3");
voucherdisplaypatterninfo.setvoucherdetailimages(voucherdetailimages);
list<string> voucherdetailimageurls = new arraylist<string>();
voucherdetailimageurls.add("https://gw.alipayobjects.com/mdn/rms_9822d7/afts/img/a*1f4esaaphrqaaaaaaaaaaabkarqnaq");
voucherdisplaypatterninfo.setvoucherdetailimageurls(voucherdetailimageurls);
voucherdisplaypatterninfo.setvoucherimageurl("https://gw.alipayobjects.com/mdn/rms_9822d7/afts/img/a*1f4esaaphrqaaaaaaaaaaabkarqnaq");
voucherdisplaypatterninfo.setvoucherdescription("1、本券不可兑换现金,不可找零。2、每个用户最多可以领取1张。3、如果订单发生退款,优惠券无法退还。");
voucherdisplaypatterninfo.setbrandname("商家优惠");
voucherdisplaypatterninfo.setbrandlogourl("https://gw.alipayobjects.com/mdn/rms_9822d7/afts/img/a*1f4esaaphrqaaaaaaaaaaabkarqnaq");
voucherdisplaypatterninfo.setvouchername("满10减1券");
model.setvoucherdisplaypatterninfo(voucherdisplaypatterninfo);
voucheruseruleinfo voucheruseruleinfo = new voucheruseruleinfo();
voucheruseruleinfo.setvouchermaxusetimes(1l);
voucheruseruleinfo.setquantitylimitperuserperiodtype("day");
voucheruseruleinfo.setquantitylimitperuser(1l);
voucherusetimeinfo voucherusetimeinfo = new voucherusetimeinfo();
voucherabsoluteperiodinfo absoluteperiodinfo = new voucherabsoluteperiodinfo();
absoluteperiodinfo.setvalidendtime(sdf.parse("2017-01-13 23:59:59"));
absoluteperiodinfo.setvalidbegintime(sdf.parse("2017-01-10 00:00:00"));
voucherusetimeinfo.setabsoluteperiodinfo(absoluteperiodinfo);
voucherusetimeinfo.setperiodtype("absolute");
voucherrelativeperiodinfo relativeperiodinfo = new voucherrelativeperiodinfo();
relativeperiodinfo.setvaliddaysafterreceive(1l);
relativeperiodinfo.setwaitdaysafterreceive(1l);
voucherusetimeinfo.setrelativeperiodinfo(relativeperiodinfo);
voucheruseruleinfo.setvoucherusetimeinfo(voucherusetimeinfo);
model.setvoucheruseruleinfo(voucheruseruleinfo);
vouchersendruledetail vouchersendrule = new vouchersendruledetail();
vouchersendrule.setvoucherquantitylimitperuser(1l);
vouchersendrule.setphonenumberlimit(false);
vouchersendrule.setnaturalpersonlimit(true);
vouchersendrule.setvoucherquantity(0l);
model.setvouchersendrule(vouchersendrule);
voucheravailablescopeinfo voucheravailablescopeinfo = new voucheravailablescopeinfo();
voucheravailableappinfo voucheravailableappinfo = new voucheravailableappinfo();
list<string> availableappids = new arraylist<string>();
availableappids.add("2021238412323412");
voucheravailableappinfo.setavailableappids(availableappids);
voucheravailablescopeinfo.setvoucheravailableappinfo(voucheravailableappinfo);
voucheravailablegeographyscopeinfo voucheravailablegeographyscopeinfo = new voucheravailablegeographyscopeinfo();
voucheravailablegeographycityinfo availablegeographycityinfo = new voucheravailablegeographycityinfo();
availablegeographycityinfo.setallcity(false);
list<string> availablecitycodes = new arraylist<string>();
availablecitycodes.add("100100");
availablegeographycityinfo.setavailablecitycodes(availablecitycodes);
voucheravailablegeographyscopeinfo.setavailablegeographycityinfo(availablegeographycityinfo);
voucheravailablegeographyshopinfo availablegeographyshopinfo = new voucheravailablegeographyshopinfo();
list<string> availablerealshopids = new arraylist<string>();
availablerealshopids.add("2018051000502000000011111111");
availablerealshopids.add("2018040200502000000011111111");
availablerealshopids.add("2018062800502000000022271997");
availablegeographyshopinfo.setavailablerealshopids(availablerealshopids);
voucheravailablegeographyallshopinfo availablegeographyallshop = new voucheravailablegeographyallshopinfo();
list<string> excludeshopids = new arraylist<string>();
excludeshopids.add("2018051000502000000011111111");
excludeshopids.add("2018040200502000000011111111");
excludeshopids.add("2018062800502000000022271997");
availablegeographyallshop.setexcludeshopids(excludeshopids);
list<string> merchantids = new arraylist<string>();
merchantids.add("208805x000502");
availablegeographyallshop.setmerchantids(merchantids);
availablegeographyshopinfo.setavailablegeographyallshop(availablegeographyallshop);
list<string> availableshopids = new arraylist<string>();
availableshopids.add("2018051000502000000011111111");
availableshopids.add("2018040200502000000011111111");
availableshopids.add("2018062800502000000022271997");
availablegeographyshopinfo.setavailableshopids(availableshopids);
voucheravailablegeographyscopeinfo.setavailablegeographyshopinfo(availablegeographyshopinfo);
voucheravailablegeographyscopeinfo.setavailablegeographyscopetype("shop");
voucheravailablescopeinfo.setvoucheravailablegeographyscopeinfo(voucheravailablegeographyscopeinfo);
voucheravailablegoodsinfo voucheravailablegoodsinfo = new voucheravailablegoodsinfo();
list<string> excludegoodsskuids = new arraylist<string>();
excludegoodsskuids.add("apple-03");
excludegoodsskuids.add("apple-04");
voucheravailablegoodsinfo.setexcludegoodsskuids(excludegoodsskuids);
voucheravailablegoodsinfo.setgoodsdescription("美味甜甜圈很美味");
voucheravailablegoodsinfo.setoriginamount("100.00");
voucheravailablegoodsinfo.setgoodsname("美味甜甜圈");
list<string> availablegoodsskuids = new arraylist<string>();
availablegoodsskuids.add("apple-01");
availablegoodsskuids.add("apple-02");
voucheravailablegoodsinfo.setavailablegoodsskuids(availablegoodsskuids);
voucheravailablescopeinfo.setvoucheravailablegoodsinfo(voucheravailablegoodsinfo);
voucheravailableaccountinfo voucheravailableaccountinfo = new voucheravailableaccountinfo();
list<string> availablesmids = new arraylist<string>();
availablesmids.add("2088102111111111");
voucheravailableaccountinfo.setavailablesmids(availablesmids);
list<string> availablepids = new arraylist<string>();
availablepids.add("2088102111111111");
voucheravailableaccountinfo.setavailablepids(availablepids);
voucheravailablescopeinfo.setvoucheravailableaccountinfo(voucheravailableaccountinfo);
model.setvoucheravailablescopeinfo(voucheravailablescopeinfo);
voucheruserule voucheruserule = new voucheruserule();
voucheravailablescope voucheravailablescope = new voucheravailablescope();
ordervoucheravailableshop ordervoucheravailableshop = new ordervoucheravailableshop();
ordervouchermerchantallshop ordervouchermerchantallshop = new ordervouchermerchantallshop();
list<string> excludeshopids = new arraylist<string>();
excludeshopids.add("2018051000502000000011111111");
excludeshopids.add("2018040200502000000011111111");
excludeshopids.add("2018062800502000000022271997");
ordervouchermerchantallshop.setexcludeshopids(excludeshopids);
ordervoucheravailableshop.setordervouchermerchantallshop(ordervouchermerchantallshop);
list<string> realshopids = new arraylist<string>();
realshopids.add("2018051000502000000011111111");
realshopids.add("2018040200502000000011111111");
realshopids.add("2018062800502000000022271997");
ordervoucheravailableshop.setrealshopids(realshopids);
list<string> shopids = new arraylist<string>();
shopids.add("2018051000502000000011111111");
shopids.add("2018040200502000000011111111");
shopids.add("2018062800502000000022271997");
ordervoucheravailableshop.setshopids(shopids);
voucheravailablescope.setordervoucheravailableshop(ordervoucheravailableshop);
voucheravailablescope.setvoucheravailabletype("shop");
ordervoucheravailablecitycode ordervoucheravailablecitycode = new ordervoucheravailablecitycode();
ordervoucheravailablecitycode.setallcity(true);
list<string> citycodes = new arraylist<string>();
citycodes.add("100100");
ordervoucheravailablecitycode.setcitycodes(citycodes);
voucheravailablescope.setordervoucheravailablecitycode(ordervoucheravailablecitycode);
voucheruserule.setvoucheravailablescope(voucheravailablescope);
exchangevoucher exchangevoucher = new exchangevoucher();
exchangevoucher.setbiztype("group_buy_exchange_voucher");
exchangevoucher.setflooramount("1000.00");
exchangevoucher.setsaleamount("50.00");
exchangevoucher.setcustomerservicemobile("81xxxxxxx");
exchangevoucher.setamount("100.00");
exchangevoucher.setcustomerserviceurl("alipay://xxxx");
exchangevoucher.setoverduerefundable(true);
exchangevoucher.setrefundable(false);
exchangevoucher.setsettletype("2");
exchangevoucher.setpayeepid("2088xxxxx");
exchangevoucher.setvouchername("火锅套餐、100元代金券");
voucheruserule.setexchangevoucher(exchangevoucher);
discountvoucher discountvoucher = new discountvoucher();
discountvoucher.setflooramount("1000.00");
discountvoucher.setceilingamount("50.00");
discountvoucher.setoriginamount("65.00");
discountvoucher.setgoodsname("美味甜甜圈");
discountvoucher.setdiscount("6.5");
voucheruserule.setdiscountvoucher(discountvoucher);
fixvoucher fixvoucher = new fixvoucher();
fixvoucher.setflooramount("1000.00");
fixvoucher.setamount("50.00");
fixvoucher.setgoodsname("美味甜甜圈");
voucheruserule.setfixvoucher(fixvoucher);
specialvoucher specialvoucher = new specialvoucher();
specialvoucher.setflooramount("1000.00");
specialvoucher.setspecialamount("10.00");
specialvoucher.setoriginamount("65.00");
specialvoucher.setgoodsname("美味甜甜圈");
voucheruserule.setspecialvoucher(specialvoucher);
vouchervalidperiod vouchervalidperiod = new vouchervalidperiod();
vouchervalidperiod.settype("absolute");
vouchervalidperiod.setvaliddaysafterreceive(3l);
vouchervalidperiod.setvalidendtime(sdf.parse("2017-01-13 23:59:59"));
vouchervalidperiod.setvalidbegintime(sdf.parse("2017-01-10 00:00:00"));
vouchervalidperiod.setwaitdaysafterreceive(2l);
voucheruserule.setvouchervalidperiod(vouchervalidperiod);
model.setvoucheruserule(voucheruserule);
model.setmerchantaccessmode("agency_mode");
model.setoutbizno("20170101000001654bb46ba");
customerguide customerguide = new customerguide();
voucheruseguide voucheruseguide = new voucheruseguide();
voucheruseguide.setminiappid("2021238412323412");
voucheruseguide.setofflinecodeuseguide(true);
list<string> servicecodes = new arraylist<string>();
servicecodes.add("2020030921000303380758");
voucheruseguide.setservicecodes(servicecodes);
voucheruseguide.setminiappuseguide(true);
voucheruseguide.setminiapppath("/index/path/path&query=xx=xx");
customerguide.setvoucheruseguide(voucheruseguide);
vouchersendguide vouchersendguide = new vouchersendguide();
vouchersendguide.setvoucherdetailurl("alipays://platformapi/startapp?appid=xxxx");
customerguide.setvouchersendguide(vouchersendguide);
model.setcustomerguide(customerguide);
voucherdeductinfo voucherdeductinfo = new voucherdeductinfo();
voucherdeductinfo.setvouchertype("fix_voucher");
specialvoucherinfo specialvoucherinfo = new specialvoucherinfo();
specialvoucherinfo.setflooramount("1000.00");
specialvoucherinfo.setspecialamount("10.00");
voucherdeductinfo.setspecialvoucherinfo(specialvoucherinfo);
exchangevoucherinfo exchangevoucherinfo = new exchangevoucherinfo();
exchangevoucherinfo.setflooramount("1000.00");
exchangevoucherinfo.setbiztype("group_buy_exchange_voucher");
exchangevoucherinfo.setamount("100.00");
voucherdeductinfo.setexchangevoucherinfo(exchangevoucherinfo);
discountvoucherinfo discountvoucherinfo = new discountvoucherinfo();
discountvoucherinfo.setflooramount("1000.00");
discountvoucherinfo.setceilingamount("50.00");
discountvoucherinfo.setdiscount("6.5");
voucherdeductinfo.setdiscountvoucherinfo(discountvoucherinfo);
fixvoucherinfo fixvoucherinfo = new fixvoucherinfo();
fixvoucherinfo.setflooramount("1000.00");
fixvoucherinfo.setamount("50.00");
voucherdeductinfo.setfixvoucherinfo(fixvoucherinfo);
model.setvoucherdeductinfo(voucherdeductinfo);
voucherdisplayinfo voucherdisplayinfo = new voucherdisplayinfo();
voucherdisplayinfo.setbrandlogo("adedsktiqo-u5vjuqvbcqwaaacmaaqed");
voucherdisplayinfo.setvoucherimage("adedsktiqo-u5vjuqvbcqwaaacmaaqed");
voucherdisplayinfo.setcustomerservicemobile("81xxxxxxx");
voucherdisplayinfo.setcustomerserviceurl("alipay://xxxx");
voucherdisplayinfo.setvouchercomment("食材新鲜,品质之选");
list<string> voucherdetailimages = new arraylist<string>();
voucherdetailimages.add("adedsktiqo-u5vjuqvbcqwaaacmaaqe1");
voucherdetailimages.add("adedsktiqo-u5vjuqvbcqwaaacmaaqe2");
voucherdetailimages.add("adedsktiqo-u5vjuqvbcqwaaacmaaqe3");
voucherdisplayinfo.setvoucherdetailimages(voucherdetailimages);
voucherdisplayinfo.setvoucherdescription("1、本券不可兑换现金,不可找零。2、每个用户最多可以领取1张。3、如果订单发生退款,优惠券无法退还。");
voucherdisplayinfo.setbrandname("商家优惠");
model.setvoucherdisplayinfo(voucherdisplayinfo);
belongmerchantinfo belongmerchantinfogckky = new belongmerchantinfo();
belongmerchantinfogckky.setmerchantidtype("smid");
belongmerchantinfogckky.setmerchantid("2088102111111111");
belongmerchantinfogckky.setbusinesstype("isv_for_merchant");
model.setbelongmerchantinfo(belongmerchantinfogckky);
model.setactivityname("满10减1活动");
activitybaseinfo activitybaseinfo = new activitybaseinfo();
activitybaseinfo.setcodemode("merchant_upload");
activitybaseinfo.setactivityoperationstatus("modifying");
activitybaseinfo.setactivityid("2016042700826004508401111111");
belongmerchantinfo belongmerchantinfobffmt = new belongmerchantinfo();
belongmerchantinfobffmt.setmerchantidtype("smid");
belongmerchantinfobffmt.setmerchantid("2088102111111111");
belongmerchantinfobffmt.setbusinesstype("isv_for_merchant");
activitybaseinfo.setbelongmerchantinfo(belongmerchantinfobffmt);
activitybaseinfo.setactivityname("满10减1活动");
activitybaseinfo.setactivitystatus("active");
model.setactivitybaseinfo(activitybaseinfo);
model.setpublishstarttime(sdf.parse("2017-01-01 00:00:01"));
request.setbizmodel(model);
alipaymarketingactivityordervouchercreateresponse response = alipayclient.execute(request);
system.out.println(response.getbody());
if (response.issuccess()) {
system.out.println("调用成功");
} else {
system.out.println("调用失败");
}
}
}
6 响应示例
{
"alipay_marketing_activity_ordervoucher_create_response": {
"activity_id": "2016042700826004508401111111",
"voucher_use_rule_result": {
"voucher_available_scope_result": {
"voucher_available_type": "shop",
"order_voucher_available_shop_result": {
"success_shop_ids": [
"2018051000502000000011111111",
"2018040200502000000011111111",
"2018062800502000000022271997"
],
"shop_fail_infos": [
{
"shop_id": "2018051000502000000011111111",
"fail_reasons": [
"shop_not_exist"
],
"fail_message": "门店不存在"
}
],
"success_real_shop_ids": [
"2018051000502000000011111111",
"2018040200502000000011111111",
"2018062800502000000022271997"
],
"real_shop_fail_infos": [
{
"real_shop_id": "2018051000502000000011111111",
"fail_reasons": [
"shop_not_exist"
],
"fail_message": "门店不存在"
}
],
"order_voucher_merchant_all_shop_result": {
"success_exclude_shop_ids": [
"2018051000502000000011111111",
"2018040200502000000011111111",
"2018062800502000000022271997"
],
"exclude_shop_fail_infos": [
{
"shop_id": "2018051000502000000011111111",
"fail_reasons": [
"shop_not_exist"
],
"fail_message": "门店不存在"
}
]
}
}
}
},
"voucher_available_scope_result_info": {
"voucher_available_geography_scope_result_info": {
"available_geography_shop_result_info": {
"success_available_shop_ids": [
"2018051000502000000011111111",
"2018040200502000000011111111",
"2018062800502000000022271997"
],
"fail_available_shop_infos": [
{
"shop_id": "2018051000502000000011111111",
"real_shop_id": "1",
"fail_reasons": [
"shop_not_exist"
],
"fail_message": "门店不存在"
}
],
"success_available_real_shop_ids": [
"2018051000502000000011111111",
"2018040200502000000011111111",
"2018062800502000000022271997"
],
"fail_available_real_shop_infos": [
{
"shop_id": "2018051000502000000011111111",
"real_shop_id": "1",
"fail_reasons": [
"shop_not_exist"
],
"fail_message": "门店不存在"
}
],
"available_geography_all_shop_result_info": {
"success_exclude_shop_ids": [
"2018051000502000000011111111",
"2018040200502000000011111111",
"2018062800502000000022271997"
],
"fail_exclude_shop_infos": [
{
"shop_id": "2018051000502000000011111111",
"real_shop_id": "1",
"fail_reasons": [
"shop_not_exist"
],
"fail_message": "门店不存在"
}
]
}
}
}
}
}
}
说明:
本示例仅供参考。
7 异常示例
{
"alipay_marketing_activity_ordervoucher_create_response": {
"code": "20000",
"msg": "service currently unavailable",
"sub_code": "isp.unknow-error",
"sub_msg": "系统繁忙"
},
"sign": "eritjkeijkjhkkkkkkkhjereeeeeeeeeee"
}
8 业务错误码
错误码 | 错误描述 | 凯发app官方网站的解决方案 |
---|---|---|
system_error | 服务器异常 | 可能发生了网络或者系统异常,导致服务调用失败,商户可以用同样的请求发起重试 |
system_error | 未知异常 | 可能发生了网络或者系统异常,导致服务调用失败,商户可以用同样的请求发起重试 |
system_error | db异常 | 可能发生了网络或者系统异常,导致服务调用失败,商户可以用同样的请求发起重试 |
system_error | 限流异常 | 可能发生了网络或者系统异常,导致服务调用失败,商户可以用同样的请求发起重试 |
system_error | 下游系统调用异常 | 可能发生了网络或者系统异常,导致服务调用失败,商户可以用同样的请求发起重试 |
invalid_parameter | 参数有误参数非法 | 请根据接口返回的参数非法的具体错误信息,修改参数后进行重试 |
biz_error | 业务异常门店无效.请检查门店是否存在,并且门店属于该商户pid | 检查传入的门店id在支付宝体系中是否存在。同时门店id要归属于商户pid 或 pid所关联的smid。 |
biz_error | 业务异常小程序无效.请检查小程序是否存在,并且小程序属于该商户pid | 检查传入的小程序id在支付宝体系中是否存在。同时小程序id要归属于商户pid。 |
biz_error | 业务异常缺少代运营关系 | isv与商户进行代运营关系的授权 |
invalid_parameter | 参数有误券有效属于绝对时间情况下:活动开始时间晚于券有效时间 | 请确认券有效期是否满足创建接口规范 |
invalid_parameter | 参数有误券有效属于绝对时间情况下:券过期时间早于活动结束时间 | 请确认券有效期是否满足创建接口规范 |
biz_error | 业务异常业务异常活动存在正在进行中的其他操作 | 活动的创建、修改、追加等操作都是异步进行的。因此如在活动修改中时,发出追加操作,会提示活动存在正在进行中的其他操作。 |
discount_amount_insufficient | 最高优惠金额小于下限 | 请提高优惠金额后重新发起请求 |
invalid_parameter | 参数有误商户设置的相对时间不允许为0 | 当 voucher_use_rule--voucher_valid_period--type 选择relative相对时间模式时,valid_days_after_receive必须大于0 |
business_has_risk | 请求存在风险 | 请检查参数传入是否正确 |