**可以使用postman去测试创建,之后有需求写进程序。**
1.获取 AccessToken
示例:get方式
http://wechatopen.herdsric.com/wecopen/getWecAuthAccesstoken.do?appid=wxa4dd*********
返回值取到AccessToken
2.创建卡券
示例 post方式
https://api.weixin.qq.com/card/create?access_token=AccessToken
json参数
{
"card": {
"card_type": "GENERAL_COUPON",
"general_coupon": {
"base_info": {
"logo_url": "http://m*******5B45KA/0",
"code_type": "CO***RCODE",
"brand_name": "****方",
"title": "2****试券",
"color": "Color060",
"notice": "使用时向店员出示此券",
"description": "*****",
"sku": {
"quantity": 0
},
"date_info": {
"type": "DATE_TYPE_FIX_TIME_RANGE",
"begin_timestamp": 1571037998,
"end_timestamp": 1572537599
},
"get_limit":1,
"use_custom_code":true, //这行和下面一行 自定义code一定要填上
"get_custom_code_mode":"GET_CUSTOM_CODE_MODE_DEPOSIT",
"can_share":false,
"can_give_friend":false,
"service_phone":"400-828-8355",
"custom_url_name":"附近门店",
"custom_url":"http://www.ovv.cn/shop/forward"
},
"advanced_info": {
"abstract": {
"abstract": "200元羊绒类测试券",
"icon_url_list": [
"http://m******HvOhPOlg/0"
]
},
"time_limit": [{
"type": "MONDAY",
"begin_hour":0,
"end_hour":24
},
{
"type": "TUESDAY",
"begin_hour":0,
"end_hour":24
},
{
"type": "WEDNESDAY",
"begin_hour":0,
"end_hour":24
},
{
"type": "THURSDAY",
"begin_hour":0,
"end_hour":24
},
{
"type": "FRIDAY",
"begin_hour":0,
"end_hour":24
},
{
"type": "SATURDAY",
"begin_hour":0,
"end_hour":24
},
{
"type": "SUNDAY",
"begin_hour":0,
"end_hour":24
}
]
},
"default_detail":"价值2*****他优惠共享"
}
}
}
返回值获取cardid
3.导入code
示例 POSTURL:http://api.weixin.qq.com/card/code/deposit?access_token=ACCESS_TOKEN
{
"card_id": "pDF3iY****96qvA",
"code": [
"11111",
"22222",
"33333",
"44444",
"55555" code单次上限为100个//如果需要大批量导入,写一个main方法循环向微信发送http请求循环导入
]
}
返回值成功或是失败个数详情
4. 查询导入code数目接口
示例 POSTURL:http://api.weixin.qq.com/card/code/getdepositcount?access_token=ACCESS_TOKEN
json参数
{
"card_id" : " pDF3***ewA96qvA "
}
返回count为导入总数
5.核查code接口
示例 POSTURL:http://api.weixin.qq.com/card/code/checkcode?access_token=ACCESS_TOKEN
json参数
{
"card_id": "prbeexKVSdevIR3JvgYCsp9vHQr0",
"code": [
"O***000001",
"O***KLF000002",
"O****X9000003"
]
}
6.查询code是否可用(card库存)
示例 POSTURL:https://api.weixin.qq.com/card/get?access_token=25_Uei****AHG
json参数
{
"card_id": "******"
}
返回字段带中
"sku": {
"quantity": 6, 卡券现有库存的数量
"total_quantity": 6 卡券全部库存的数量,上限为100000000。
}
7.修改卡券库存
示例 POSTURL:https://api.weixin.qq.com/card/modifystock?access_token=TOKEN
json参数
{
"card_id": "prbeexK****YCsp9vHQr0",
"increase_stock_value": 10000, 加多少不能超过导入code数量
"reduce_stock_value": 0 减多少
}
8.核销卡券
示例
1.先查询该code是否可以被核销 POSTURL:https://api.weixin.qq.com/card/code/get?access_token=TOKEN
{
"card_id" : "card_id_123+",
"code" : "123456789",
"check_consume" : true
}
2.核销Code
POSTURL:https://api.weixin.qq.com/card/code/consume?access_token=TOKEN
{
"code": "12312313",
"card_id": "pFS7F****IdDz01r4SQwMkuCKc"
}
微信创建自定义卡券支持导入code 的流程整理
最新推荐文章于 2021-08-17 07:09:33 发布