修改会员卡模板信息
更新时间:2025.08.01更新会员卡的信息,包括基本信息、储值信息、开卡信息等
接口限频:按品牌商户品牌 ID 维度 5 次/秒
接口说明
支持商户:【品牌商户】
请求方式:【PATCH】/brand/card-member/cards/{card_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Content-Type 必填 string
请设置为application/json
Wechatpay-Serial 必填 string
【微信支付公钥ID】 请传入brand_id对应的微信支付公钥ID,接口将会校验两者的关联关系,参考微信支付公钥产品简介及使用说明获取微信支付公钥ID和相关的介绍。以下两种场景将使用到微信支付公钥: 1、接收到接口的返回内容,需要使用微信支付公钥进行验签; 2、调用含有敏感信息参数(如姓名、身份证号码)的接口时,需要使用微信支付公钥加密敏感信息后再传输参数,加密指引请参考微信支付公钥加密敏感信息指引。
path 路径参数
card_id 必填 string(32)
【会员卡模板 ID】 商家创建会员卡模板成功后系统返回的会员卡模板ID
body 包体参数
card_title 选填 string(10)
【卡名称】 1.可用于展示在卡面的名称 2.支持最长10个中文字 3.支持中文字、英文字符、标点
card_color 选填 string(7)
【卡背景颜色】 用于卡片正面设计的RGB颜色编码,仅支持十六进制
card_picture_url 选填 string(256)
【卡图片】 商家自定义会员卡背景图。仅支持通过图片上传API接口获取的图片URL地址。支持JPG/JPEG/PNG格式,建议尺寸716px*320px,且图片小于1M。请查看以下链接后传入:图片要求示例,图片上传API指引
code_jump_information 选填 object
【会员码跳转信息】 会员码跳转的小程序信息,当会员码展示类型为跳转商家小程序时必填。
| 属性 | |
jump_appid 选填 string(32) 【会员码跳转AppID】 会员码跳转的小程序AppID jump_path 选填 string(128) 【会员码跳转路径】 会员码跳转的小程序路径 |
benefits 选填 string(32)
【会员权益】 会员权益是指平台、品牌或服务机构为付费会员(或等级会员)提供的专属优惠、服务或特权。
notify_url 选填 string(256)
【回调地址】 商家接收开卡成功回调通知的地址,需按照notify_url填写注意事项规范填写。
need_pinned 选填 boolean
【是否置顶】 置顶卡是界面中的一种特殊展示模块,通过人工设置,使其固定在内容列表的顶部位置,确保用户优先看到。默认为false。同一个品牌下允许存在多张置顶卡,按照更新时间倒序排序。
need_display_level 选填 boolean
【是否展示会员等级】 是否在会员卡面向用户展示等级信息,默认不展示(false)
service_phone 选填 string(32)
【服务电话】 展示在会员卡详情内,建议填写商家固定电话
valid_date_information 选填 object
【会员卡有效期】 会员卡有效期
| 属性 | |
type 选填 string 【有效期类型】 1.该有效期为会员卡激活后的有效期 2.支持绝对有效期&相对有效期设置 3.绝对有效期:固定过期时间,需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。 4.相对有效期:用户激活后x天后有效,x为天数。最多支持10,957天(30年) 5.永久有效 6.过期后卡状态变为“已过期” 7.过期后不再出现服务项,且无法给用户发送会员服务消息通知 可选取值
available_begin_time 选填 string(32) 【有效期开始时间】 type为FIX_TIME_RANGE时专用, 表示有效期开始时间。需需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。 available_end_time 选填 string(32) 【有效期结束时间】 type为FIX_TERM_RANGE时专用,表示有效期结束时间。需需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。 available_day_after_receive 选填 integer 【领取后N天内有效】 type为FIX_TERM时专用,表示领取后N个自然天内有效。最长不超过30年(10958 天) |
member_information 选填 object
【会员中心信息】 用户点击会员卡卡面的跳转信息
| 属性 | |
jump_appid 必填 string(32) 【会员中心跳转AppID】 用户点击会员卡卡面后跳转的小程序AppID jump_path 必填 string(128) 【会员中心跳转路径】 用户点击会员卡卡面后跳转的小程序路径 |
points_information 选填 object
【积分信息】 若商家名片会员卡使用该功能,需传入跳转商家小程序的信息。否则不启动该功能。
| 属性 | |
jump_appid 选填 string(32) 【积分跳转AppID】 会员积分跳转的小程序AppID jump_path 选填 string(128) 【积分跳转路径】 会员积分跳转的小程序路径 |
balance_information 选填 object
【储值信息】 若商家名片会员卡使用该功能,需传入跳转商家小程序的信息。否则不启动该功能。
| 属性 | |
jump_appid 选填 string(32) 【储值小程序AppID】 点击储值额跳转的小程序AppID jump_path 选填 string(128) 【储值小程序路径】 点击储值额跳转的小程序页面路径,建议为储值充值页面 |
purchase_information 选填 object
【付费会员信息】 若商家名片会员卡使用该功能,需传入跳转商家小程序的信息及会员价格。否则不启动该功能。
| 属性 | |
price 选填 integer 【付费会员价格】 指用户为获取特定商家提供的会员权益而需支付的费用金额。(单位:分) jump_appid 选填 string(32) 【付费会员跳转AppID】 用户购买付费会员时跳转的付费会员的AppID jump_path 选填 string(128) 【付费会员跳转路径】 用户购买付费会员时购买跳转的路径 |
user_information 选填 object
【用户开卡信息】 要求用户在开通会员卡时必须填写的信息。若用户不填写则不允许开通会员卡。
| 属性 | |||||
common_field_list 选填 array[string] 【平台提供的通用开卡信息字段】 平台提供的通用开卡信息字段。若商户在会员卡模板中设置该值,则查询结果中会返回给商户。 可选取值
custom_field_list 选填 array[object] 【商家自定义的开卡信息字段】 商家自定义的开卡信息字段。若商户在会员卡模板中设置该值,则查询结果中会返回给商户。当前最多只允许传入1项。
|
请求示例
PATCH
1curl -X PATCH \ 2 https://api.mch.weixin.qq.com/brand/card-member/cards/pbLatjvWOibDc5-TBnbUk1pD1 \ 3 -H "Authorization: WECHATPAY-BRAND-SHA256-RSA2048 brand_id=\"XXXX\",..." \ 4 -H "Accept: application/json" \ 5 -H "Wechatpay-Serial: PUB_KEY_ID_XXXX" \ 6 -H "Content-Type: application/json" \ 7 -d '{ 8 "card_title" : "测试卡", 9 "card_color" : "#FFFF00", 10 "card_picture_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/0", 11 "code_jump_information" : { 12 "jump_appid" : "wxea9c30a90fs8d3fe", 13 "jump_path" : "/pages/code/code" 14 }, 15 "benefits" : "会员折扣、专属价", 16 "notify_url" : "https://www.weixin.qq.com/wxpay/notify.php", 17 "need_pinned" : true, 18 "need_display_level" : true, 19 "service_phone" : "010-8877xxxx", 20 "valid_date_information" : { 21 "type" : "PERMANENT", 22 "available_begin_time" : "2020-05-20T13:29:35.120+08:00", 23 "available_end_time" : "2020-05-20T13:29:35.120+08:00", 24 "available_day_after_receive" : 30 25 }, 26 "member_information" : { 27 "jump_appid" : "wxea9c30a90fs8d3fe", 28 "jump_path" : "/pages/points/points" 29 }, 30 "points_information" : { 31 "jump_appid" : "wxea9c30a90fs8d3fe", 32 "jump_path" : "/pages/points/points" 33 }, 34 "balance_information" : { 35 "jump_appid" : "wxea9c30a90fs8d3fe", 36 "jump_path" : "/pages/balance/balance" 37 }, 38 "purchase_information" : { 39 "price" : 100, 40 "jump_appid" : "wxea9c30a90fs8d3fe", 41 "jump_path" : "/pages/purchase/purchase" 42 }, 43 "user_information" : { 44 "common_field_list" : [ 45 "USER_FORM_FLAG_SEX" 46 ], 47 "custom_field_list" : [ 48 { 49 "type" : "CHECK_BOX", 50 "name" : "喜欢的运动", 51 "values" : [ 52 "篮球" 53 ] 54 } 55 ] 56 } 57 }' 58
需配合微信支付工具库 WXPayUtility 使用,请参考Java
1package com.java.demo; 2 3import com.java.utils.WXPayBrandUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/brand/4015826861 4 5import com.google.gson.annotations.SerializedName; 6import com.google.gson.annotations.Expose; 7import okhttp3.MediaType; 8import okhttp3.OkHttpClient; 9import okhttp3.Request; 10import okhttp3.RequestBody; 11import okhttp3.Response; 12 13import java.io.IOException; 14import java.io.UncheckedIOException; 15import java.security.PrivateKey; 16import java.security.PublicKey; 17import java.util.ArrayList; 18import java.util.HashMap; 19import java.util.List; 20import java.util.Map; 21 22/** 23 * 修改会员卡模板信息 24 */ 25public class UpdateCard { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "PATCH"; 28 private static String PATH = "/brand/card-member/cards/{card_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 32 UpdateCard client = new UpdateCard( 33 "xxxxxxxx", // 品牌ID,是由微信支付系统生成并分配给每个品牌方的唯一标识符,品牌ID获取方式参考 https://pay.weixin.qq.com/doc/brand/4015415289 34 "1DDE55AD98Exxxxxxxxxx", // 品牌API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015407570 35 "/path/to/apiclient_key.pem", // 品牌API证书私钥文件路径,本地文件路径 36 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015453439 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 UpdateCardRequest request = new UpdateCardRequest(); 41 request.cardId = "pbLatjvWOibDc5-TBnbUk1pD1"; 42 request.cardTitle = "测试卡"; 43 request.cardColor = "#FFFF00"; 44 request.cardPictureUrl = "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/0"; 45 request.codeJumpInformation = new CodeJumpInfo(); 46 request.codeJumpInformation.jumpAppid = "wxea9c30a90fs8d3fe"; 47 request.codeJumpInformation.jumpPath = "/pages/code/code"; 48 request.benefits = "会员折扣、专属价"; 49 request.notifyUrl = "https://www.weixin.qq.com/wxpay/notify.php"; 50 request.needPinned = true; 51 request.needDisplayLevel = true; 52 request.servicePhone = "010-8877xxxx"; 53 request.validDateInformation = new DateInfo(); 54 request.validDateInformation.type = DateType.PERMANENT; 55 request.validDateInformation.availableBeginTime = "2020-05-20T13:29:35.120+08:00"; 56 request.validDateInformation.availableEndTime = "2020-05-20T13:29:35.120+08:00"; 57 request.validDateInformation.availableDayAfterReceive = 30L; 58 request.memberInformation = new MemberInfo(); 59 request.memberInformation.jumpAppid = "wxea9c30a90fs8d3fe"; 60 request.memberInformation.jumpPath = "/pages/points/points"; 61 request.pointsInformation = new PointsInfo(); 62 request.pointsInformation.jumpAppid = "wxea9c30a90fs8d3fe"; 63 request.pointsInformation.jumpPath = "/pages/points/points"; 64 request.balanceInformation = new BalanceInfo(); 65 request.balanceInformation.jumpAppid = "wxea9c30a90fs8d3fe"; 66 request.balanceInformation.jumpPath = "/pages/balance/balance"; 67 request.purchaseInformation = new PurchaseInfo(); 68 request.purchaseInformation.price = 100L; 69 request.purchaseInformation.jumpAppid = "wxea9c30a90fs8d3fe"; 70 request.purchaseInformation.jumpPath = "/pages/purchase/purchase"; 71 request.userInformation = new UserInfoForm(); 72 request.userInformation.commonFieldList = new ArrayList<>(); 73 { 74 request.userInformation.commonFieldList.add(CommonFieldFlag.USER_FORM_FLAG_SEX); 75 }; 76 request.userInformation.customFieldList = new ArrayList<>(); 77 { 78 UserCustomFieldForm customFieldListItem = new UserCustomFieldForm(); 79 customFieldListItem.type = CustomFieldType.CHECK_BOX; 80 customFieldListItem.name = "喜欢的运动"; 81 customFieldListItem.values = new ArrayList<>(); 82 { 83 customFieldListItem.values.add("篮球"); 84 }; 85 request.userInformation.customFieldList.add(customFieldListItem); 86 }; 87 try { 88 Card response = client.run(request); 89 // TODO: 请求成功,继续业务逻辑 90 System.out.println(response); 91 } catch (WXPayBrandUtility.ApiException e) { 92 // TODO: 请求失败,根据状态码执行不同的逻辑 93 e.printStackTrace(); 94 } 95 } 96 97 public Card run(UpdateCardRequest request) { 98 String uri = PATH; 99 uri = uri.replace("{card_id}", WXPayBrandUtility.urlEncode(request.cardId)); 100 String reqBody = WXPayBrandUtility.toJson(request); 101 102 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 103 reqBuilder.addHeader("Accept", "application/json"); 104 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 105 reqBuilder.addHeader("Authorization", WXPayBrandUtility.buildAuthorization(brand_id, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 106 reqBuilder.addHeader("Content-Type", "application/json"); 107 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 108 reqBuilder.method(METHOD, requestBody); 109 Request httpRequest = reqBuilder.build(); 110 111 // 发送HTTP请求 112 OkHttpClient client = new OkHttpClient.Builder().build(); 113 try (Response httpResponse = client.newCall(httpRequest).execute()) { 114 String respBody = WXPayBrandUtility.extractBody(httpResponse); 115 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 116 // 2XX 成功,验证应答签名 117 WXPayBrandUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 118 httpResponse.headers(), respBody); 119 120 // 从HTTP应答报文构建返回数据 121 return WXPayBrandUtility.fromJson(respBody, Card.class); 122 } else { 123 throw new WXPayBrandUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 124 } 125 } catch (IOException e) { 126 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 127 } 128 } 129 130 private final String brand_id; 131 private final String certificateSerialNo; 132 private final PrivateKey privateKey; 133 private final String wechatPayPublicKeyId; 134 private final PublicKey wechatPayPublicKey; 135 136 public UpdateCard(String brand_id, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 137 this.brand_id = brand_id; 138 this.certificateSerialNo = certificateSerialNo; 139 this.privateKey = WXPayBrandUtility.loadPrivateKeyFromPath(privateKeyFilePath); 140 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 141 this.wechatPayPublicKey = WXPayBrandUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 142 } 143 144 public static class UpdateCardRequest { 145 @SerializedName("card_id") 146 @Expose(serialize = false) 147 public String cardId; 148 149 @SerializedName("card_title") 150 public String cardTitle; 151 152 @SerializedName("card_color") 153 public String cardColor; 154 155 @SerializedName("card_picture_url") 156 public String cardPictureUrl; 157 158 @SerializedName("code_jump_information") 159 public CodeJumpInfo codeJumpInformation; 160 161 @SerializedName("benefits") 162 public String benefits; 163 164 @SerializedName("notify_url") 165 public String notifyUrl; 166 167 @SerializedName("need_pinned") 168 public Boolean needPinned; 169 170 @SerializedName("need_display_level") 171 public Boolean needDisplayLevel; 172 173 @SerializedName("service_phone") 174 public String servicePhone; 175 176 @SerializedName("valid_date_information") 177 public DateInfo validDateInformation; 178 179 @SerializedName("member_information") 180 public MemberInfo memberInformation; 181 182 @SerializedName("points_information") 183 public PointsInfo pointsInformation; 184 185 @SerializedName("balance_information") 186 public BalanceInfo balanceInformation; 187 188 @SerializedName("purchase_information") 189 public PurchaseInfo purchaseInformation; 190 191 @SerializedName("user_information") 192 public UserInfoForm userInformation; 193 } 194 195 public static class Card { 196 @SerializedName("out_request_no") 197 public String outRequestNo; 198 199 @SerializedName("card_id") 200 public String cardId; 201 202 @SerializedName("brand_id") 203 public String brandId; 204 205 @SerializedName("appid") 206 public String appid; 207 208 @SerializedName("card_type") 209 public CardType cardType; 210 211 @SerializedName("card_title") 212 public String cardTitle; 213 214 @SerializedName("card_color") 215 public String cardColor; 216 217 @SerializedName("card_picture_url") 218 public String cardPictureUrl; 219 220 @SerializedName("code_mode") 221 public CodeMode codeMode; 222 223 @SerializedName("code_type") 224 public CodeType codeType; 225 226 @SerializedName("code_jump_information") 227 public CodeJumpInfo codeJumpInformation; 228 229 @SerializedName("benefits") 230 public String benefits; 231 232 @SerializedName("notify_url") 233 public String notifyUrl; 234 235 @SerializedName("need_pinned") 236 public Boolean needPinned; 237 238 @SerializedName("need_display_level") 239 public Boolean needDisplayLevel; 240 241 @SerializedName("init_level") 242 public String initLevel; 243 244 @SerializedName("service_phone") 245 public String servicePhone; 246 247 @SerializedName("legal_agreement") 248 public String legalAgreement; 249 250 @SerializedName("valid_date_information") 251 public DateInfo validDateInformation; 252 253 @SerializedName("member_information") 254 public MemberInfo memberInformation; 255 256 @SerializedName("points_information") 257 public PointsInfo pointsInformation; 258 259 @SerializedName("balance_information") 260 public BalanceInfo balanceInformation; 261 262 @SerializedName("purchase_information") 263 public PurchaseInfo purchaseInformation; 264 265 @SerializedName("user_information") 266 public UserInfoForm userInformation; 267 268 @SerializedName("state") 269 public CardState state; 270 271 @SerializedName("create_time") 272 public String createTime; 273 274 @SerializedName("modify_time") 275 public String modifyTime; 276 } 277 278 public static class CodeJumpInfo { 279 @SerializedName("jump_appid") 280 public String jumpAppid; 281 282 @SerializedName("jump_path") 283 public String jumpPath; 284 } 285 286 public static class DateInfo { 287 @SerializedName("type") 288 public DateType type; 289 290 @SerializedName("available_begin_time") 291 public String availableBeginTime; 292 293 @SerializedName("available_end_time") 294 public String availableEndTime; 295 296 @SerializedName("available_day_after_receive") 297 public Long availableDayAfterReceive; 298 } 299 300 public static class MemberInfo { 301 @SerializedName("jump_appid") 302 public String jumpAppid; 303 304 @SerializedName("jump_path") 305 public String jumpPath; 306 } 307 308 public static class PointsInfo { 309 @SerializedName("jump_appid") 310 public String jumpAppid; 311 312 @SerializedName("jump_path") 313 public String jumpPath; 314 } 315 316 public static class BalanceInfo { 317 @SerializedName("jump_appid") 318 public String jumpAppid; 319 320 @SerializedName("jump_path") 321 public String jumpPath; 322 } 323 324 public static class PurchaseInfo { 325 @SerializedName("price") 326 public Long price; 327 328 @SerializedName("jump_appid") 329 public String jumpAppid; 330 331 @SerializedName("jump_path") 332 public String jumpPath; 333 } 334 335 public static class UserInfoForm { 336 @SerializedName("common_field_list") 337 public List<CommonFieldFlag> commonFieldList; 338 339 @SerializedName("custom_field_list") 340 public List<UserCustomFieldForm> customFieldList; 341 } 342 343 public enum CardType { 344 @SerializedName("PURCHASE") 345 PURCHASE, 346 @SerializedName("NORMAL") 347 NORMAL, 348 @SerializedName("BALANCE") 349 BALANCE 350 } 351 352 public enum CodeMode { 353 @SerializedName("SYSTEM_ALLOCATE") 354 SYSTEM_ALLOCATE, 355 @SerializedName("MERCHANT_ALLOCATE") 356 MERCHANT_ALLOCATE 357 } 358 359 public enum CodeType { 360 @SerializedName("NONE_CODE") 361 NONE_CODE, 362 @SerializedName("BAR_CODE") 363 BAR_CODE, 364 @SerializedName("QR_CODE") 365 QR_CODE, 366 @SerializedName("BAR_CODE_AND_QR_CODE") 367 BAR_CODE_AND_QR_CODE, 368 @SerializedName("JUMP_MINI_PROGRAM") 369 JUMP_MINI_PROGRAM 370 } 371 372 public enum CardState { 373 @SerializedName("CARD_EFFECTIVE") 374 CARD_EFFECTIVE, 375 @SerializedName("CARD_INVALID") 376 CARD_INVALID 377 } 378 379 public enum DateType { 380 @SerializedName("FIX_TIME_RANGE") 381 FIX_TIME_RANGE, 382 @SerializedName("FIX_TERM") 383 FIX_TERM, 384 @SerializedName("PERMANENT") 385 PERMANENT 386 } 387 388 public enum CommonFieldFlag { 389 @SerializedName("USER_FORM_FLAG_SEX") 390 USER_FORM_FLAG_SEX, 391 @SerializedName("USER_FORM_FLAG_NAME") 392 USER_FORM_FLAG_NAME, 393 @SerializedName("USER_FORM_FLAG_BIRTHDAY") 394 USER_FORM_FLAG_BIRTHDAY, 395 @SerializedName("USER_FORM_FLAG_ADDRESS") 396 USER_FORM_FLAG_ADDRESS, 397 @SerializedName("USER_FORM_FLAG_EMAIL") 398 USER_FORM_FLAG_EMAIL, 399 @SerializedName("USER_FORM_FLAG_CITY") 400 USER_FORM_FLAG_CITY 401 } 402 403 public static class UserCustomFieldForm { 404 @SerializedName("type") 405 public CustomFieldType type; 406 407 @SerializedName("name") 408 public String name; 409 410 @SerializedName("values") 411 public List<String> values; 412 } 413 414 public enum CustomFieldType { 415 @SerializedName("CHECK_BOX") 416 CHECK_BOX, 417 @SerializedName("RADIO") 418 RADIO 419 } 420 421} 422
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "bytes" 5 "demo/wxpay_brand_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/brand/4015826866 6 "encoding/json" 7 "fmt" 8 "net/http" 9 "net/url" 10 "strings" 11) 12 13func main() { 14 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 15 config, err := wxpay_brand_utility.CreateBrandConfig( 16 "xxxxxxxx", // 品牌ID,是由微信支付系统生成并分配给每个品牌方的唯一标识符,品牌ID获取方式参考 https://pay.weixin.qq.com/doc/brand/4015415289 17 "1DDE55AD98Exxxxxxxxxx", // 品牌API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015407570 18 "/path/to/apiclient_key.pem", // 品牌API证书私钥文件路径,本地文件路径 19 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015453439 20 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 21 ) 22 if err != nil { 23 fmt.Println(err) 24 return 25 } 26 27 request := &UpdateCardRequest{ 28 CardId: wxpay_brand_utility.String("pbLatjvWOibDc5-TBnbUk1pD1"), 29 CardTitle: wxpay_brand_utility.String("测试卡"), 30 CardColor: wxpay_brand_utility.String("#FFFF00"), 31 CardPictureUrl: wxpay_brand_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/0"), 32 CodeJumpInformation: &CodeJumpInfo{ 33 JumpAppid: wxpay_brand_utility.String("wxea9c30a90fs8d3fe"), 34 JumpPath: wxpay_brand_utility.String("/pages/code/code"), 35 }, 36 Benefits: wxpay_brand_utility.String("会员折扣、专属价"), 37 NotifyUrl: wxpay_brand_utility.String("https://www.weixin.qq.com/wxpay/notify.php"), 38 NeedPinned: wxpay_brand_utility.Bool(true), 39 NeedDisplayLevel: wxpay_brand_utility.Bool(true), 40 ServicePhone: wxpay_brand_utility.String("010-8877xxxx"), 41 ValidDateInformation: &DateInfo{ 42 Type: DATETYPE_PERMANENT.Ptr(), 43 AvailableBeginTime: wxpay_brand_utility.String("2020-05-20T13:29:35.120+08:00"), 44 AvailableEndTime: wxpay_brand_utility.String("2020-05-20T13:29:35.120+08:00"), 45 AvailableDayAfterReceive: wxpay_brand_utility.Int64(30), 46 }, 47 MemberInformation: &MemberInfo{ 48 JumpAppid: wxpay_brand_utility.String("wxea9c30a90fs8d3fe"), 49 JumpPath: wxpay_brand_utility.String("/pages/points/points"), 50 }, 51 PointsInformation: &PointsInfo{ 52 JumpAppid: wxpay_brand_utility.String("wxea9c30a90fs8d3fe"), 53 JumpPath: wxpay_brand_utility.String("/pages/points/points"), 54 }, 55 BalanceInformation: &BalanceInfo{ 56 JumpAppid: wxpay_brand_utility.String("wxea9c30a90fs8d3fe"), 57 JumpPath: wxpay_brand_utility.String("/pages/balance/balance"), 58 }, 59 PurchaseInformation: &PurchaseInfo{ 60 Price: wxpay_brand_utility.Int64(100), 61 JumpAppid: wxpay_brand_utility.String("wxea9c30a90fs8d3fe"), 62 JumpPath: wxpay_brand_utility.String("/pages/purchase/purchase"), 63 }, 64 UserInformation: &UserInfoForm{ 65 CommonFieldList: []CommonFieldFlag{COMMONFIELDFLAG_USER_FORM_FLAG_SEX}, 66 CustomFieldList: []UserCustomFieldForm{UserCustomFieldForm{ 67 Type: CUSTOMFIELDTYPE_CHECK_BOX.Ptr(), 68 Name: wxpay_brand_utility.String("喜欢的运动"), 69 Values: []string{"篮球"}, 70 }}, 71 }, 72 } 73 74 response, err := UpdateCard(config, request) 75 if err != nil { 76 fmt.Printf("请求失败: %+v\n", err) 77 // TODO: 请求失败,根据状态码执行不同的处理 78 return 79 } 80 81 // TODO: 请求成功,继续业务逻辑 82 fmt.Printf("请求成功: %+v\n", response) 83} 84 85func UpdateCard(config *wxpay_brand_utility.BrandConfig, request *UpdateCardRequest) (response *Card, err error) { 86 const ( 87 host = "https://api.mch.weixin.qq.com" 88 method = "PATCH" 89 path = "/brand/card-member/cards/{card_id}" 90 ) 91 92 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 93 if err != nil { 94 return nil, err 95 } 96 reqUrl.Path = strings.Replace(reqUrl.Path, "{card_id}", url.PathEscape(*request.CardId), -1) 97 reqBody, err := json.Marshal(request) 98 if err != nil { 99 return nil, err 100 } 101 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 102 if err != nil { 103 return nil, err 104 } 105 httpRequest.Header.Set("Accept", "application/json") 106 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 107 httpRequest.Header.Set("Content-Type", "application/json") 108 authorization, err := wxpay_brand_utility.BuildAuthorization(config.BrandId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 109 if err != nil { 110 return nil, err 111 } 112 httpRequest.Header.Set("Authorization", authorization) 113 114 client := &http.Client{} 115 httpResponse, err := client.Do(httpRequest) 116 if err != nil { 117 return nil, err 118 } 119 respBody, err := wxpay_brand_utility.ExtractResponseBody(httpResponse) 120 if err != nil { 121 return nil, err 122 } 123 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 124 // 2XX 成功,验证应答签名 125 err = wxpay_brand_utility.ValidateResponse( 126 config.WechatPayPublicKeyId(), 127 config.WechatPayPublicKey(), 128 &httpResponse.Header, 129 respBody, 130 ) 131 if err != nil { 132 return nil, err 133 } 134 response := &Card{} 135 if err := json.Unmarshal(respBody, response); err != nil { 136 return nil, err 137 } 138 139 return response, nil 140 } else { 141 return nil, wxpay_brand_utility.NewApiException( 142 httpResponse.StatusCode, 143 httpResponse.Header, 144 respBody, 145 ) 146 } 147} 148 149type UpdateCardRequest struct { 150 CardId *string `json:"card_id,omitempty"` 151 CardTitle *string `json:"card_title,omitempty"` 152 CardColor *string `json:"card_color,omitempty"` 153 CardPictureUrl *string `json:"card_picture_url,omitempty"` 154 CodeJumpInformation *CodeJumpInfo `json:"code_jump_information,omitempty"` 155 Benefits *string `json:"benefits,omitempty"` 156 NotifyUrl *string `json:"notify_url,omitempty"` 157 NeedPinned *bool `json:"need_pinned,omitempty"` 158 NeedDisplayLevel *bool `json:"need_display_level,omitempty"` 159 ServicePhone *string `json:"service_phone,omitempty"` 160 ValidDateInformation *DateInfo `json:"valid_date_information,omitempty"` 161 MemberInformation *MemberInfo `json:"member_information,omitempty"` 162 PointsInformation *PointsInfo `json:"points_information,omitempty"` 163 BalanceInformation *BalanceInfo `json:"balance_information,omitempty"` 164 PurchaseInformation *PurchaseInfo `json:"purchase_information,omitempty"` 165 UserInformation *UserInfoForm `json:"user_information,omitempty"` 166} 167 168func (o *UpdateCardRequest) MarshalJSON() ([]byte, error) { 169 type Alias UpdateCardRequest 170 a := &struct { 171 CardId *string `json:"card_id,omitempty"` 172 *Alias 173 }{ 174 // 序列化时移除非 Body 字段 175 CardId: nil, 176 Alias: (*Alias)(o), 177 } 178 return json.Marshal(a) 179} 180 181type Card struct { 182 OutRequestNo *string `json:"out_request_no,omitempty"` 183 CardId *string `json:"card_id,omitempty"` 184 BrandId *string `json:"brand_id,omitempty"` 185 Appid *string `json:"appid,omitempty"` 186 CardType *CardType `json:"card_type,omitempty"` 187 CardTitle *string `json:"card_title,omitempty"` 188 CardColor *string `json:"card_color,omitempty"` 189 CardPictureUrl *string `json:"card_picture_url,omitempty"` 190 CodeMode *CodeMode `json:"code_mode,omitempty"` 191 CodeType *CodeType `json:"code_type,omitempty"` 192 CodeJumpInformation *CodeJumpInfo `json:"code_jump_information,omitempty"` 193 Benefits *string `json:"benefits,omitempty"` 194 NotifyUrl *string `json:"notify_url,omitempty"` 195 NeedPinned *bool `json:"need_pinned,omitempty"` 196 NeedDisplayLevel *bool `json:"need_display_level,omitempty"` 197 InitLevel *string `json:"init_level,omitempty"` 198 ServicePhone *string `json:"service_phone,omitempty"` 199 LegalAgreement *string `json:"legal_agreement,omitempty"` 200 ValidDateInformation *DateInfo `json:"valid_date_information,omitempty"` 201 MemberInformation *MemberInfo `json:"member_information,omitempty"` 202 PointsInformation *PointsInfo `json:"points_information,omitempty"` 203 BalanceInformation *BalanceInfo `json:"balance_information,omitempty"` 204 PurchaseInformation *PurchaseInfo `json:"purchase_information,omitempty"` 205 UserInformation *UserInfoForm `json:"user_information,omitempty"` 206 State *CardState `json:"state,omitempty"` 207 CreateTime *string `json:"create_time,omitempty"` 208 ModifyTime *string `json:"modify_time,omitempty"` 209} 210 211type CodeJumpInfo struct { 212 JumpAppid *string `json:"jump_appid,omitempty"` 213 JumpPath *string `json:"jump_path,omitempty"` 214} 215 216type DateInfo struct { 217 Type *DateType `json:"type,omitempty"` 218 AvailableBeginTime *string `json:"available_begin_time,omitempty"` 219 AvailableEndTime *string `json:"available_end_time,omitempty"` 220 AvailableDayAfterReceive *int64 `json:"available_day_after_receive,omitempty"` 221} 222 223type MemberInfo struct { 224 JumpAppid *string `json:"jump_appid,omitempty"` 225 JumpPath *string `json:"jump_path,omitempty"` 226} 227 228type PointsInfo struct { 229 JumpAppid *string `json:"jump_appid,omitempty"` 230 JumpPath *string `json:"jump_path,omitempty"` 231} 232 233type BalanceInfo struct { 234 JumpAppid *string `json:"jump_appid,omitempty"` 235 JumpPath *string `json:"jump_path,omitempty"` 236} 237 238type PurchaseInfo struct { 239 Price *int64 `json:"price,omitempty"` 240 JumpAppid *string `json:"jump_appid,omitempty"` 241 JumpPath *string `json:"jump_path,omitempty"` 242} 243 244type UserInfoForm struct { 245 CommonFieldList []CommonFieldFlag `json:"common_field_list,omitempty"` 246 CustomFieldList []UserCustomFieldForm `json:"custom_field_list,omitempty"` 247} 248 249type CardType string 250 251func (e CardType) Ptr() *CardType { 252 return &e 253} 254 255const ( 256 CARDTYPE_PURCHASE CardType = "PURCHASE" 257 CARDTYPE_NORMAL CardType = "NORMAL" 258 CARDTYPE_BALANCE CardType = "BALANCE" 259) 260 261type CodeMode string 262 263func (e CodeMode) Ptr() *CodeMode { 264 return &e 265} 266 267const ( 268 CODEMODE_SYSTEM_ALLOCATE CodeMode = "SYSTEM_ALLOCATE" 269 CODEMODE_MERCHANT_ALLOCATE CodeMode = "MERCHANT_ALLOCATE" 270) 271 272type CodeType string 273 274func (e CodeType) Ptr() *CodeType { 275 return &e 276} 277 278const ( 279 CODETYPE_NONE_CODE CodeType = "NONE_CODE" 280 CODETYPE_BAR_CODE CodeType = "BAR_CODE" 281 CODETYPE_QR_CODE CodeType = "QR_CODE" 282 CODETYPE_BAR_CODE_AND_QR_CODE CodeType = "BAR_CODE_AND_QR_CODE" 283 CODETYPE_JUMP_MINI_PROGRAM CodeType = "JUMP_MINI_PROGRAM" 284) 285 286type CardState string 287 288func (e CardState) Ptr() *CardState { 289 return &e 290} 291 292const ( 293 CARDSTATE_CARD_EFFECTIVE CardState = "CARD_EFFECTIVE" 294 CARDSTATE_CARD_INVALID CardState = "CARD_INVALID" 295) 296 297type DateType string 298 299func (e DateType) Ptr() *DateType { 300 return &e 301} 302 303const ( 304 DATETYPE_FIX_TIME_RANGE DateType = "FIX_TIME_RANGE" 305 DATETYPE_FIX_TERM DateType = "FIX_TERM" 306 DATETYPE_PERMANENT DateType = "PERMANENT" 307) 308 309type CommonFieldFlag string 310 311func (e CommonFieldFlag) Ptr() *CommonFieldFlag { 312 return &e 313} 314 315const ( 316 COMMONFIELDFLAG_USER_FORM_FLAG_SEX CommonFieldFlag = "USER_FORM_FLAG_SEX" 317 COMMONFIELDFLAG_USER_FORM_FLAG_NAME CommonFieldFlag = "USER_FORM_FLAG_NAME" 318 COMMONFIELDFLAG_USER_FORM_FLAG_BIRTHDAY CommonFieldFlag = "USER_FORM_FLAG_BIRTHDAY" 319 COMMONFIELDFLAG_USER_FORM_FLAG_ADDRESS CommonFieldFlag = "USER_FORM_FLAG_ADDRESS" 320 COMMONFIELDFLAG_USER_FORM_FLAG_EMAIL CommonFieldFlag = "USER_FORM_FLAG_EMAIL" 321 COMMONFIELDFLAG_USER_FORM_FLAG_CITY CommonFieldFlag = "USER_FORM_FLAG_CITY" 322) 323 324type UserCustomFieldForm struct { 325 Type *CustomFieldType `json:"type,omitempty"` 326 Name *string `json:"name,omitempty"` 327 Values []string `json:"values,omitempty"` 328} 329 330type CustomFieldType string 331 332func (e CustomFieldType) Ptr() *CustomFieldType { 333 return &e 334} 335 336const ( 337 CUSTOMFIELDTYPE_CHECK_BOX CustomFieldType = "CHECK_BOX" 338 CUSTOMFIELDTYPE_RADIO CustomFieldType = "RADIO" 339) 340
应答参数
200 OK
out_request_no 必填 string(128)
【商家请求单号】 商家创建会员卡模板凭据号。商家自定义,注意保持唯一性,仅供参考的格式:品牌ID+时间戳+流水号。字符仅允许包含英文半角的数字、字母、连接线-和下划线_。
card_id 必填 string(32)
【会员卡模板 ID】 商家创建会员卡模板成功后系统返回的会员卡模板ID
brand_id 必填 string(32)
【品牌ID】 商家进驻微信支付品牌商家后获得的品牌ID(灰度期间联系微信支付运营获取),用于标记该会员卡的归属方
appid 必填 string
【商家AppID】 商家的AppID,可以是服务号、订阅号、公众号、小程序的AppID。1、该AppID用于获取会员OpenID。2、该AppID需要与会员卡归属品牌有B-A关系。
card_type 必填 string
【会员卡类型】 支持付费、普通、储值 3 种类型。目前仅支持普通会员卡,填写付费和储值类型时会返回错误。
可选取值
PURCHASE: 付费NORMAL: 普通BALANCE: 储值
card_title 必填 string(10)
【卡名称】 1.可用于展示在卡面的名称 2.支持最长10个中文字 3.支持中文字、英文字符、标点
card_color 必填 string(7)
【卡背景颜色】 用于卡片正面设计的RGB颜色编码,仅支持十六进制
card_picture_url 必填 string(256)
【卡图片】 商家自定义会员卡背景图。仅支持通过图片上传API接口获取的图片URL地址。支持JPG/JPEG/PNG格式,建议尺寸716px*320px,且图片小于1M。请查看以下链接后传入:图片要求示例,图片上传API指引
code_mode 必填 string
【会员卡code分配类型】 1、会员卡code是会员在一个会员卡模板下唯一身份标识,平台支持2种分配类型:(1)SYSTEM_ALLOCATE 微信支付系统分配,用户领取会员卡时从微信系统分配24位数字作为会员code;(2)MERCHANT_ALLOCATE 商家分配,商家同步会员开通结果时传入,用户开卡成功或失败都以商家传入的code作为会员卡code。 2、会员卡code分配模式若为“系统分配”,不支持修改为“商家分配”。
可选取值
SYSTEM_ALLOCATE: 系统分配MERCHANT_ALLOCATE: 商家分配
code_type 必填 string
【会员码展示类型】 会员码支持不展示码/二维码/条形码/二维码+条形码/跳转商家小程序5种设置。
可选取值
NONE_CODE: 不显示任何码型BAR_CODE: 条形码QR_CODE: 二维码BAR_CODE_AND_QR_CODE: 条形码和二维码JUMP_MINI_PROGRAM: 跳转商家小程序
code_jump_information 选填 object
【会员码跳转信息】 会员码跳转的小程序信息,当会员码展示类型为跳转商家小程序时必填。
| 属性 | |
jump_appid 选填 string(32) 【会员码跳转AppID】 会员码跳转的小程序AppID jump_path 选填 string(128) 【会员码跳转路径】 会员码跳转的小程序路径 |
benefits 必填 string(32)
【会员权益】 会员权益是指平台、品牌或服务机构为付费会员(或等级会员)提供的专属优惠、服务或特权。
notify_url 必填 string(256)
【回调地址】 商家接收开卡成功回调通知的地址,需按照notify_url填写注意事项规范填写。
need_pinned 选填 boolean
【是否置顶】 置顶卡是界面中的一种特殊展示模块,通过人工设置,使其固定在内容列表的顶部位置,确保用户优先看到。默认为false。同一个品牌下允许存在多张置顶卡,按照更新时间倒序排序。
need_display_level 选填 boolean
【是否展示会员等级】 是否在会员卡面向用户展示等级信息,默认不展示(false)
init_level 选填 string(10)
【会员初始等级】 展示字段,商家可以自定义填写内容。如果选择了展示会员等级,必填init_level,作为新用户开卡后的初始等级。如因商家业务规则需要变更某会员等级,可通过更新用户会员卡接口更新等级信息。
service_phone 选填 string(32)
【服务电话】 展示在会员卡详情内,建议填写商家固定电话
legal_agreement 必填 string(20480)
【商家法务协议】 商家法务协议是用户与商家之间签订的具有法律效力的合同文件,旨在明确双方在交易、服务提供、权利义务等方面的规则,以保障交易安全、规范商业行为,并在纠纷发生时提供法律依据。不支持换行和链接跳转,只支持纯文本展示。
valid_date_information 必填 object
【会员卡有效期】 会员卡有效期
| 属性 | |
type 选填 string 【有效期类型】 1.该有效期为会员卡激活后的有效期 2.支持绝对有效期&相对有效期设置 3.绝对有效期:固定过期时间,需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。 4.相对有效期:用户激活后x天后有效,x为天数。最多支持10,957天(30年) 5.永久有效 6.过期后卡状态变为“已过期” 7.过期后不再出现服务项,且无法给用户发送会员服务消息通知 可选取值
available_begin_time 选填 string(32) 【有效期开始时间】 type为FIX_TIME_RANGE时专用, 表示有效期开始时间。需需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。 available_end_time 选填 string(32) 【有效期结束时间】 type为FIX_TERM_RANGE时专用,表示有效期结束时间。需需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。 available_day_after_receive 选填 integer 【领取后N天内有效】 type为FIX_TERM时专用,表示领取后N个自然天内有效。最长不超过30年(10958 天) |
member_information 必填 object
【会员中心信息】 用户点击会员卡卡面的跳转信息
| 属性 | |
jump_appid 必填 string(32) 【会员中心跳转AppID】 用户点击会员卡卡面后跳转的小程序AppID jump_path 必填 string(128) 【会员中心跳转路径】 用户点击会员卡卡面后跳转的小程序路径 |
points_information 选填 object
【积分信息】 若商家名片会员卡使用该功能,需传入跳转商家小程序的信息。否则不启动该功能。
| 属性 | |
jump_appid 选填 string(32) 【积分跳转AppID】 会员积分跳转的小程序AppID jump_path 选填 string(128) 【积分跳转路径】 会员积分跳转的小程序路径 |
balance_information 选填 object
【储值信息】 若商家名片会员卡使用该功能,需传入跳转商家小程序的信息。否则不启动该功能。
| 属性 | |
jump_appid 选填 string(32) 【储值小程序AppID】 点击储值额跳转的小程序AppID jump_path 选填 string(128) 【储值小程序路径】 点击储值额跳转的小程序页面路径,建议为储值充值页面 |
purchase_information 选填 object
【付费会员信息】 若商家名片会员卡使用该功能,需传入跳转商家小程序的信息及会员价格。否则不启动该功能。
| 属性 | |
price 选填 integer 【付费会员价格】 指用户为获取特定商家提供的会员权益而需支付的费用金额。(单位:分) jump_appid 选填 string(32) 【付费会员跳转AppID】 用户购买付费会员时跳转的付费会员的AppID jump_path 选填 string(128) 【付费会员跳转路径】 用户购买付费会员时购买跳转的路径 |
user_information 选填 object
【用户开卡信息】 要求用户在开通会员卡时必须填写的信息。若用户不填写则不允许开通会员卡。
| 属性 | |||||
common_field_list 选填 array[string] 【平台提供的通用开卡信息字段】 平台提供的通用开卡信息字段。若商户在会员卡模板中设置该值,则查询结果中会返回给商户。 可选取值
custom_field_list 选填 array[object] 【商家自定义的开卡信息字段】 商家自定义的开卡信息字段。若商户在会员卡模板中设置该值,则查询结果中会返回给商户。当前最多只允许传入1项。
|
state 必填 string
【状态】 会员卡状态信息
可选取值
CARD_EFFECTIVE: 生效中CARD_INVALID: 已失效
create_time 必填 string(32)
【创建时间】 创建会员卡的时间,需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。
modify_time 必填 string(32)
【更新时间】 更新会员卡的时间,需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。
应答示例
200 OK
1{ 2 "out_request_no" : "100002322019090134234sfdf", 3 "card_id" : "pbLatjvWOibDc5-TBnbUk1pD12o0", 4 "brand_id" : "1004", 5 "appid" : "wxea9c30890f48d5ae", 6 "card_type" : "NORMAL", 7 "card_title" : "测试卡", 8 "card_color" : "#FFFF00", 9 "card_picture_url" : "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/0", 10 "code_mode" : "SYSTEM_ALLOCATE", 11 "code_type" : "BAR_CODE", 12 "code_jump_information" : { 13 "jump_appid" : "wxea9c30a90fs8d3fe", 14 "jump_path" : "/pages/code/code" 15 }, 16 "benefits" : "会员折扣、专属价", 17 "notify_url" : "https://www.weixin.qq.com/wxpay/notify.php", 18 "need_pinned" : true, 19 "need_display_level" : true, 20 "init_level" : "白银会员", 21 "service_phone" : "010-8877xxxx", 22 "legal_agreement" : "商家需在 48 小时内发货,若商品存在质量问题,用户可在 7 天内申请退货。", 23 "valid_date_information" : { 24 "type" : "PERMANENT", 25 "available_begin_time" : "2020-05-20T13:29:35.120+08:00", 26 "available_end_time" : "2020-05-20T13:29:35.120+08:00", 27 "available_day_after_receive" : 30 28 }, 29 "member_information" : { 30 "jump_appid" : "wxea9c30a90fs8d3fe", 31 "jump_path" : "/pages/points/points" 32 }, 33 "points_information" : { 34 "jump_appid" : "wxea9c30a90fs8d3fe", 35 "jump_path" : "/pages/points/points" 36 }, 37 "balance_information" : { 38 "jump_appid" : "wxea9c30a90fs8d3fe", 39 "jump_path" : "/pages/balance/balance" 40 }, 41 "purchase_information" : { 42 "price" : 100, 43 "jump_appid" : "wxea9c30a90fs8d3fe", 44 "jump_path" : "/pages/purchase/purchase" 45 }, 46 "user_information" : { 47 "common_field_list" : [ 48 "USER_FORM_FLAG_SEX" 49 ], 50 "custom_field_list" : [ 51 { 52 "type" : "CHECK_BOX", 53 "name" : "喜欢的运动", 54 "values" : [ 55 "篮球" 56 ] 57 } 58 ] 59 }, 60 "state" : "CARD_EFFECTIVE", 61 "create_time" : "2020-05-20T13:29:35.120+08:00", 62 "modify_time" : "2020-05-20T13:29:35.120+08:00" 63} 64
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示

