查询会员卡模板信息
更新时间:2025.08.01通过此接口可查询指定会员卡模板的所有信息
接口限频:按服务商商户号维度 5次/秒
接口说明
支持商户:【普通服务商】
请求方式:【GET】/v3/brand/partner/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
path 路径参数
card_id 必填 string(32)
【会员卡模板 ID】 商家创建会员卡模板成功后系统返回的会员卡模板ID
query 查询参数
brand_id 必填 string(32)
【品牌ID】 商家进驻微信支付品牌商家后获得的品牌ID(灰度期间联系微信支付运营获取),用于标记该会员卡的归属方
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/brand/partner/card-member/cards/pbLatjvWOibDc5-TBnbUk1pD1?brand_id=1004 \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" 5
需配合微信支付工具库 WXPayUtility 使用,请参考Java
1package com.java.demo; 2 3import com.java.utils.WXPayUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/v3/partner/4014985777 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 GetCard { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/brand/partner/card-member/cards/{card_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 GetCard client = new GetCard( 33 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 34 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 35 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 36 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 GetCardRequest request = new GetCardRequest(); 41 request.cardId = "pbLatjvWOibDc5-TBnbUk1pD1"; 42 request.brandId = "1004"; 43 try { 44 Card response = client.run(request); 45 // TODO: 请求成功,继续业务逻辑 46 System.out.println(response); 47 } catch (WXPayUtility.ApiException e) { 48 // TODO: 请求失败,根据状态码执行不同的逻辑 49 e.printStackTrace(); 50 } 51 } 52 53 public Card run(GetCardRequest request) { 54 String uri = PATH; 55 uri = uri.replace("{card_id}", WXPayUtility.urlEncode(request.cardId)); 56 Map<String, Object> args = new HashMap<>(); 57 args.put("brand_id", request.brandId); 58 String queryString = WXPayUtility.urlEncode(args); 59 if (!queryString.isEmpty()) { 60 uri = uri + "?" + queryString; 61 } 62 63 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 64 reqBuilder.addHeader("Accept", "application/json"); 65 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 66 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 67 reqBuilder.method(METHOD, null); 68 Request httpRequest = reqBuilder.build(); 69 70 // 发送HTTP请求 71 OkHttpClient client = new OkHttpClient.Builder().build(); 72 try (Response httpResponse = client.newCall(httpRequest).execute()) { 73 String respBody = WXPayUtility.extractBody(httpResponse); 74 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 75 // 2XX 成功,验证应答签名 76 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 77 httpResponse.headers(), respBody); 78 79 // 从HTTP应答报文构建返回数据 80 return WXPayUtility.fromJson(respBody, Card.class); 81 } else { 82 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 83 } 84 } catch (IOException e) { 85 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 86 } 87 } 88 89 private final String mchid; 90 private final String certificateSerialNo; 91 private final PrivateKey privateKey; 92 private final String wechatPayPublicKeyId; 93 private final PublicKey wechatPayPublicKey; 94 95 public GetCard(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 96 this.mchid = mchid; 97 this.certificateSerialNo = certificateSerialNo; 98 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 99 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 100 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 101 } 102 103 public static class GetCardRequest { 104 @SerializedName("brand_id") 105 @Expose(serialize = false) 106 public String brandId; 107 108 @SerializedName("card_id") 109 @Expose(serialize = false) 110 public String cardId; 111 } 112 113 public static class Card { 114 @SerializedName("out_request_no") 115 public String outRequestNo; 116 117 @SerializedName("card_id") 118 public String cardId; 119 120 @SerializedName("brand_id") 121 public String brandId; 122 123 @SerializedName("appid") 124 public String appid; 125 126 @SerializedName("card_type") 127 public CardType cardType; 128 129 @SerializedName("card_title") 130 public String cardTitle; 131 132 @SerializedName("card_color") 133 public String cardColor; 134 135 @SerializedName("card_picture_url") 136 public String cardPictureUrl; 137 138 @SerializedName("code_mode") 139 public CodeMode codeMode; 140 141 @SerializedName("code_type") 142 public CodeType codeType; 143 144 @SerializedName("code_jump_information") 145 public CodeJumpInfo codeJumpInformation; 146 147 @SerializedName("benefits") 148 public String benefits; 149 150 @SerializedName("notify_url") 151 public String notifyUrl; 152 153 @SerializedName("need_pinned") 154 public Boolean needPinned; 155 156 @SerializedName("need_display_level") 157 public Boolean needDisplayLevel; 158 159 @SerializedName("init_level") 160 public String initLevel; 161 162 @SerializedName("service_phone") 163 public String servicePhone; 164 165 @SerializedName("legal_agreement") 166 public String legalAgreement; 167 168 @SerializedName("valid_date_information") 169 public DateInfo validDateInformation; 170 171 @SerializedName("member_information") 172 public MemberInfo memberInformation; 173 174 @SerializedName("points_information") 175 public PointsInfo pointsInformation; 176 177 @SerializedName("balance_information") 178 public BalanceInfo balanceInformation; 179 180 @SerializedName("purchase_information") 181 public PurchaseInfo purchaseInformation; 182 183 @SerializedName("user_information") 184 public UserInfoForm userInformation; 185 186 @SerializedName("state") 187 public CardState state; 188 189 @SerializedName("create_time") 190 public String createTime; 191 192 @SerializedName("modify_time") 193 public String modifyTime; 194 } 195 196 public enum CardType { 197 @SerializedName("PURCHASE") 198 PURCHASE, 199 @SerializedName("NORMAL") 200 NORMAL, 201 @SerializedName("BALANCE") 202 BALANCE 203 } 204 205 public enum CodeMode { 206 @SerializedName("SYSTEM_ALLOCATE") 207 SYSTEM_ALLOCATE, 208 @SerializedName("MERCHANT_ALLOCATE") 209 MERCHANT_ALLOCATE 210 } 211 212 public enum CodeType { 213 @SerializedName("NONE_CODE") 214 NONE_CODE, 215 @SerializedName("BAR_CODE") 216 BAR_CODE, 217 @SerializedName("QR_CODE") 218 QR_CODE, 219 @SerializedName("BAR_CODE_AND_QR_CODE") 220 BAR_CODE_AND_QR_CODE, 221 @SerializedName("JUMP_MINI_PROGRAM") 222 JUMP_MINI_PROGRAM 223 } 224 225 public static class CodeJumpInfo { 226 @SerializedName("jump_appid") 227 public String jumpAppid; 228 229 @SerializedName("jump_path") 230 public String jumpPath; 231 } 232 233 public static class DateInfo { 234 @SerializedName("type") 235 public DateType type; 236 237 @SerializedName("available_begin_time") 238 public String availableBeginTime; 239 240 @SerializedName("available_end_time") 241 public String availableEndTime; 242 243 @SerializedName("available_day_after_receive") 244 public Long availableDayAfterReceive; 245 } 246 247 public static class MemberInfo { 248 @SerializedName("jump_appid") 249 public String jumpAppid; 250 251 @SerializedName("jump_path") 252 public String jumpPath; 253 } 254 255 public static class PointsInfo { 256 @SerializedName("jump_appid") 257 public String jumpAppid; 258 259 @SerializedName("jump_path") 260 public String jumpPath; 261 } 262 263 public static class BalanceInfo { 264 @SerializedName("jump_appid") 265 public String jumpAppid; 266 267 @SerializedName("jump_path") 268 public String jumpPath; 269 } 270 271 public static class PurchaseInfo { 272 @SerializedName("price") 273 public Long price; 274 275 @SerializedName("jump_appid") 276 public String jumpAppid; 277 278 @SerializedName("jump_path") 279 public String jumpPath; 280 } 281 282 public static class UserInfoForm { 283 @SerializedName("common_field_list") 284 public List<CommonFieldFlag> commonFieldList; 285 286 @SerializedName("custom_field_list") 287 public List<UserCustomFieldForm> customFieldList; 288 } 289 290 public enum CardState { 291 @SerializedName("CARD_EFFECTIVE") 292 CARD_EFFECTIVE, 293 @SerializedName("CARD_INVALID") 294 CARD_INVALID 295 } 296 297 public enum DateType { 298 @SerializedName("FIX_TIME_RANGE") 299 FIX_TIME_RANGE, 300 @SerializedName("FIX_TERM") 301 FIX_TERM, 302 @SerializedName("PERMANENT") 303 PERMANENT 304 } 305 306 public enum CommonFieldFlag { 307 @SerializedName("USER_FORM_FLAG_SEX") 308 USER_FORM_FLAG_SEX, 309 @SerializedName("USER_FORM_FLAG_NAME") 310 USER_FORM_FLAG_NAME, 311 @SerializedName("USER_FORM_FLAG_BIRTHDAY") 312 USER_FORM_FLAG_BIRTHDAY, 313 @SerializedName("USER_FORM_FLAG_ADDRESS") 314 USER_FORM_FLAG_ADDRESS, 315 @SerializedName("USER_FORM_FLAG_EMAIL") 316 USER_FORM_FLAG_EMAIL, 317 @SerializedName("USER_FORM_FLAG_CITY") 318 USER_FORM_FLAG_CITY 319 } 320 321 public static class UserCustomFieldForm { 322 @SerializedName("type") 323 public CustomFieldType type; 324 325 @SerializedName("name") 326 public String name; 327 328 @SerializedName("values") 329 public List<String> values; 330 } 331 332 public enum CustomFieldType { 333 @SerializedName("CHECK_BOX") 334 CHECK_BOX, 335 @SerializedName("RADIO") 336 RADIO 337 } 338 339} 340
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446 5 "encoding/json" 6 "fmt" 7 "net/http" 8 "net/url" 9 "strings" 10 "time" 11) 12 13func main() { 14 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 15 config, err := wxpay_utility.CreateMchConfig( 16 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 17 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 18 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 19 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 20 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 21 ) 22 if err != nil { 23 fmt.Println(err) 24 return 25 } 26 27 request := &GetCardRequest{ 28 BrandId: wxpay_utility.String("1004"), 29 CardId: wxpay_utility.String("pbLatjvWOibDc5-TBnbUk1pD1"), 30 } 31 32 response, err := GetCard(config, request) 33 if err != nil { 34 fmt.Printf("请求失败: %+v\n", err) 35 // TODO: 请求失败,根据状态码执行不同的处理 36 return 37 } 38 39 // TODO: 请求成功,继续业务逻辑 40 fmt.Printf("请求成功: %+v\n", response) 41} 42 43func GetCard(config *wxpay_utility.MchConfig, request *GetCardRequest) (response *Card, err error) { 44 const ( 45 host = "https://api.mch.weixin.qq.com" 46 method = "GET" 47 path = "/v3/brand/partner/card-member/cards/{card_id}" 48 ) 49 50 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 51 if err != nil { 52 return nil, err 53 } 54 reqUrl.Path = strings.Replace(reqUrl.Path, "{card_id}", url.PathEscape(*request.CardId), -1) 55 query := reqUrl.Query() 56 if request.BrandId != nil { 57 query.Add("brand_id", *request.BrandId) 58 } 59 reqUrl.RawQuery = query.Encode() 60 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 61 if err != nil { 62 return nil, err 63 } 64 httpRequest.Header.Set("Accept", "application/json") 65 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 66 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 67 if err != nil { 68 return nil, err 69 } 70 httpRequest.Header.Set("Authorization", authorization) 71 72 client := &http.Client{} 73 httpResponse, err := client.Do(httpRequest) 74 if err != nil { 75 return nil, err 76 } 77 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 78 if err != nil { 79 return nil, err 80 } 81 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 82 // 2XX 成功,验证应答签名 83 err = wxpay_utility.ValidateResponse( 84 config.WechatPayPublicKeyId(), 85 config.WechatPayPublicKey(), 86 &httpResponse.Header, 87 respBody, 88 ) 89 if err != nil { 90 return nil, err 91 } 92 response := &Card{} 93 if err := json.Unmarshal(respBody, response); err != nil { 94 return nil, err 95 } 96 97 return response, nil 98 } else { 99 return nil, wxpay_utility.NewApiException( 100 httpResponse.StatusCode, 101 httpResponse.Header, 102 respBody, 103 ) 104 } 105} 106 107type GetCardRequest struct { 108 BrandId *string `json:"brand_id,omitempty"` 109 CardId *string `json:"card_id,omitempty"` 110} 111 112func (o *GetCardRequest) MarshalJSON() ([]byte, error) { 113 type Alias GetCardRequest 114 a := &struct { 115 BrandId *string `json:"brand_id,omitempty"` 116 CardId *string `json:"card_id,omitempty"` 117 *Alias 118 }{ 119 // 序列化时移除非 Body 字段 120 BrandId: nil, 121 CardId: nil, 122 Alias: (*Alias)(o), 123 } 124 return json.Marshal(a) 125} 126 127type Card struct { 128 OutRequestNo *string `json:"out_request_no,omitempty"` 129 CardId *string `json:"card_id,omitempty"` 130 BrandId *string `json:"brand_id,omitempty"` 131 Appid *string `json:"appid,omitempty"` 132 CardType *CardType `json:"card_type,omitempty"` 133 CardTitle *string `json:"card_title,omitempty"` 134 CardColor *string `json:"card_color,omitempty"` 135 CardPictureUrl *string `json:"card_picture_url,omitempty"` 136 CodeMode *CodeMode `json:"code_mode,omitempty"` 137 CodeType *CodeType `json:"code_type,omitempty"` 138 CodeJumpInformation *CodeJumpInfo `json:"code_jump_information,omitempty"` 139 Benefits *string `json:"benefits,omitempty"` 140 NotifyUrl *string `json:"notify_url,omitempty"` 141 NeedPinned *bool `json:"need_pinned,omitempty"` 142 NeedDisplayLevel *bool `json:"need_display_level,omitempty"` 143 InitLevel *string `json:"init_level,omitempty"` 144 ServicePhone *string `json:"service_phone,omitempty"` 145 LegalAgreement *string `json:"legal_agreement,omitempty"` 146 ValidDateInformation *DateInfo `json:"valid_date_information,omitempty"` 147 MemberInformation *MemberInfo `json:"member_information,omitempty"` 148 PointsInformation *PointsInfo `json:"points_information,omitempty"` 149 BalanceInformation *BalanceInfo `json:"balance_information,omitempty"` 150 PurchaseInformation *PurchaseInfo `json:"purchase_information,omitempty"` 151 UserInformation *UserInfoForm `json:"user_information,omitempty"` 152 State *CardState `json:"state,omitempty"` 153 CreateTime *time.Time `json:"create_time,omitempty"` 154 ModifyTime *time.Time `json:"modify_time,omitempty"` 155} 156 157type CardType string 158 159func (e CardType) Ptr() *CardType { 160 return &e 161} 162 163const ( 164 CARDTYPE_PURCHASE CardType = "PURCHASE" 165 CARDTYPE_NORMAL CardType = "NORMAL" 166 CARDTYPE_BALANCE CardType = "BALANCE" 167) 168 169type CodeMode string 170 171func (e CodeMode) Ptr() *CodeMode { 172 return &e 173} 174 175const ( 176 CODEMODE_SYSTEM_ALLOCATE CodeMode = "SYSTEM_ALLOCATE" 177 CODEMODE_MERCHANT_ALLOCATE CodeMode = "MERCHANT_ALLOCATE" 178) 179 180type CodeType string 181 182func (e CodeType) Ptr() *CodeType { 183 return &e 184} 185 186const ( 187 CODETYPE_NONE_CODE CodeType = "NONE_CODE" 188 CODETYPE_BAR_CODE CodeType = "BAR_CODE" 189 CODETYPE_QR_CODE CodeType = "QR_CODE" 190 CODETYPE_BAR_CODE_AND_QR_CODE CodeType = "BAR_CODE_AND_QR_CODE" 191 CODETYPE_JUMP_MINI_PROGRAM CodeType = "JUMP_MINI_PROGRAM" 192) 193 194type CodeJumpInfo struct { 195 JumpAppid *string `json:"jump_appid,omitempty"` 196 JumpPath *string `json:"jump_path,omitempty"` 197} 198 199type DateInfo struct { 200 Type *DateType `json:"type,omitempty"` 201 AvailableBeginTime *time.Time `json:"available_begin_time,omitempty"` 202 AvailableEndTime *time.Time `json:"available_end_time,omitempty"` 203 AvailableDayAfterReceive *int64 `json:"available_day_after_receive,omitempty"` 204} 205 206type MemberInfo struct { 207 JumpAppid *string `json:"jump_appid,omitempty"` 208 JumpPath *string `json:"jump_path,omitempty"` 209} 210 211type PointsInfo struct { 212 JumpAppid *string `json:"jump_appid,omitempty"` 213 JumpPath *string `json:"jump_path,omitempty"` 214} 215 216type BalanceInfo struct { 217 JumpAppid *string `json:"jump_appid,omitempty"` 218 JumpPath *string `json:"jump_path,omitempty"` 219} 220 221type PurchaseInfo struct { 222 Price *int64 `json:"price,omitempty"` 223 JumpAppid *string `json:"jump_appid,omitempty"` 224 JumpPath *string `json:"jump_path,omitempty"` 225} 226 227type UserInfoForm struct { 228 CommonFieldList []CommonFieldFlag `json:"common_field_list,omitempty"` 229 CustomFieldList []UserCustomFieldForm `json:"custom_field_list,omitempty"` 230} 231 232type CardState string 233 234func (e CardState) Ptr() *CardState { 235 return &e 236} 237 238const ( 239 CARDSTATE_CARD_EFFECTIVE CardState = "CARD_EFFECTIVE" 240 CARDSTATE_CARD_INVALID CardState = "CARD_INVALID" 241) 242 243type DateType string 244 245func (e DateType) Ptr() *DateType { 246 return &e 247} 248 249const ( 250 DATETYPE_FIX_TIME_RANGE DateType = "FIX_TIME_RANGE" 251 DATETYPE_FIX_TERM DateType = "FIX_TERM" 252 DATETYPE_PERMANENT DateType = "PERMANENT" 253) 254 255type CommonFieldFlag string 256 257func (e CommonFieldFlag) Ptr() *CommonFieldFlag { 258 return &e 259} 260 261const ( 262 COMMONFIELDFLAG_USER_FORM_FLAG_SEX CommonFieldFlag = "USER_FORM_FLAG_SEX" 263 COMMONFIELDFLAG_USER_FORM_FLAG_NAME CommonFieldFlag = "USER_FORM_FLAG_NAME" 264 COMMONFIELDFLAG_USER_FORM_FLAG_BIRTHDAY CommonFieldFlag = "USER_FORM_FLAG_BIRTHDAY" 265 COMMONFIELDFLAG_USER_FORM_FLAG_ADDRESS CommonFieldFlag = "USER_FORM_FLAG_ADDRESS" 266 COMMONFIELDFLAG_USER_FORM_FLAG_EMAIL CommonFieldFlag = "USER_FORM_FLAG_EMAIL" 267 COMMONFIELDFLAG_USER_FORM_FLAG_CITY CommonFieldFlag = "USER_FORM_FLAG_CITY" 268) 269 270type UserCustomFieldForm struct { 271 Type *CustomFieldType `json:"type,omitempty"` 272 Name *string `json:"name,omitempty"` 273 Values []string `json:"values,omitempty"` 274} 275 276type CustomFieldType string 277 278func (e CustomFieldType) Ptr() *CustomFieldType { 279 return &e 280} 281 282const ( 283 CUSTOMFIELDTYPE_CHECK_BOX CustomFieldType = "CHECK_BOX" 284 CUSTOMFIELDTYPE_RADIO CustomFieldType = "RADIO" 285) 286
应答参数
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 【有效期开始时间】 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 【有效期结束时间】 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
【创建时间】 创建会员卡的时间,需遵循 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
【更新时间】 更新会员卡的时间,需遵循 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
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示

