提交商家名片配置申请
更新时间:2025.11.13本接口面向服务商(不包括银行、支付机构、电商平台),用于提交商家名片配置申请,支持配置商家服务列表(用户可点击跳转至小程序或网页)和多渠道客服信息(包括自研客服、客服电话等),配置提交后返回名片预览二维码链接供商家验证跳转路径是否符合预期。
注意:接口采用全量覆盖机制,每次提交均视为完整配置。最新提交将完全覆盖历史配置,不支持多轮次增量更新,请确保每次请求包含完整的配置信息。
接口说明
支持商户:【普通服务商】
请求方式:【POST】/v3/brand/card/card-configs
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
接口限频:1/秒(商户号维度)
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Content-Type 必填 string
请设置为application/json
body 包体参数
business_code 必填 string(128)
【业务申请编号】 1、只能由数字、字母或下划线组成;
2、服务商自定义的商户唯一编号,每个编号对应一个申请单;
3、若申请被驳回,可填写相同的“业务申请编号”,即可覆盖修改原申请信息。
brand_id 必填 string(20)
【品牌ID】 商家进驻微信支付品牌商家后获得的品牌ID,作为品牌唯一标识符。
brand_mini_program_info 选填 object
【品牌小程序信息】 用于配置商家名片头部跳转的小程序,建议配置用户在品牌发起交易的小程序。
| 属性 | |
appid 必填 string(50) 【公众账号ID】 1、公众账号ID也称 AppID,是(微信开放平台、微信公众平台)为开发者提供的一个唯一标识,用于识别开发者的应用程序(APP、小程序、公众号);开发者需要在微信开放平台或微信公众平台中申请ID。 default_jump_path 选填 string(512) 【小程序默认跳转路径】 商家名片头部跳转小程序的默认路径,不填写则默认跳转小程序首页。 button_text 选填 string(10) 【小程序跳转按钮文案】 商家可自定义小程序跳转按钮的显示文案,如未设置则默认显示"前往小程序"。 |
brand_customer_service 必填 object
【品牌客服信息】 1、品牌客服信息配置,用于在商家名片中展示客服信息;
2、根据客服类型不同,需要填写对应的配置信息。
| 属性 | |
customer_service_type 必填 string 【客服类型】 客服类型枚举,用于配置商家名片中的客服信息。 可选取值
customer_service_phone 选填 string(20) 【客服电话】 1、品牌官方客服电话,需确保电话号码真实有效; customer_service_path 选填 string(1024) 【客服路径】 1、客服页面的具体路径,需确保路径真实存在; appid 选填 string(50) 【公众账号ID】 1、公众账号ID也称 AppID,是(微信开放平台、微信公众平台)为开发者提供的一个唯一标识,用于识别开发者的应用程序(APP、小程序、公众号);开发者需要在微信开放平台或微信公众平台中申请ID。 |
service_list 选填 array[object]
【服务列表】 1、用于在商家名片中展示品牌提供的各项服务;
2、条件:如需要配置服务,则至少填写2项,最多15项;如无需配置服务,则保持列表为空;
3、列表排序:列表顺序即为最终展示顺序,系统将按输入顺序对服务进行分类和排序,相同服务分类的项会自动归组,组内顺序保持数组中的原始排列。
| 属性 | |
service_classify_name 必填 string(6) 【服务分类名称】 商家名片服务列表中的服务分类名称,多个服务可以归属为一个服务分类,最多可创建三个服务分类。 service_name 必填 string(8) 【服务名称】 商家名片服务列表中的服务名称,一个服务分类下最多可配置5个服务名称,整个服务列表最多可配置15个服务名称。 service_jump_type 必填 string 【服务跳转类型】 决定了用户点击服务后的跳转方式。 可选取值
service_jump_path 必填 string(1024) 【服务跳转路径】 服务跳转路径,根据服务跳转类型不同,格式要求不同。 appid 选填 string(50) 【公众账号ID】 1、公众账号ID也称 AppID,是(微信开放平台、微信公众平台)为开发者提供的一个唯一标识,用于识别开发者的应用程序(APP、小程序、公众号);开发者需要在微信开放平台或微信公众平台中申请ID。 |
请求示例
POST
1curl -X POST \ 2 https://api.mch.weixin.qq.com/v3/brand/card/card-configs \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Content-Type: application/json" \ 6 -d '{ 7 "business_code" : "1900013511_10000", 8 "brand_id" : "1234567", 9 "brand_mini_program_info" : { 10 "appid" : "wx1234567890abcdef", 11 "default_jump_path" : "pages/shop/index", 12 "button_text" : "前往小程序" 13 }, 14 "brand_customer_service" : { 15 "customer_service_type" : "MINI_PROGRAM", 16 "customer_service_phone" : "12345678900", 17 "customer_service_path" : "pages/service/index", 18 "appid" : "wx1234567890abcdef" 19 }, 20 "service_list" : [ 21 { 22 "service_classify_name" : "会员服务", 23 "service_name" : "会员中心", 24 "service_jump_type" : "JUMP_MINI_PROGRAM", 25 "service_jump_path" : "pages/shop/index", 26 "appid" : "wx1234567890abcdef" 27 } 28 ] 29 }' 30
需配合微信支付工具库 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 SubmitMchCardConfig { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "POST"; 28 private static String PATH = "/v3/brand/card/card-configs"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 SubmitMchCardConfig client = new SubmitMchCardConfig( 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 SubmitMchCardConfigRequest request = new SubmitMchCardConfigRequest(); 41 request.businessCode = "1900013511_10000"; 42 request.brandId = "1234567"; 43 request.brandMiniProgramInfo = new MiniProgramInfo(); 44 request.brandMiniProgramInfo.appid = "wx1234567890abcdef"; 45 request.brandMiniProgramInfo.defaultJumpPath = "pages/shop/index"; 46 request.brandMiniProgramInfo.buttonText = "前往小程序"; 47 request.brandCustomerService = new MerchantCardCustomerService(); 48 request.brandCustomerService.customerServiceType = CustomerServiceType.MINI_PROGRAM; 49 request.brandCustomerService.customerServicePhone = "12345678900"; 50 request.brandCustomerService.customerServicePath = "pages/service/index"; 51 request.brandCustomerService.appid = "wx1234567890abcdef"; 52 request.serviceList = new ArrayList<>(); 53 { 54 MerchantCardService serviceListItem = new MerchantCardService(); 55 serviceListItem.serviceClassifyName = "会员服务"; 56 serviceListItem.serviceName = "会员中心"; 57 serviceListItem.serviceJumpType = ServiceJumpType.JUMP_MINI_PROGRAM; 58 serviceListItem.serviceJumpPath = "pages/shop/index"; 59 serviceListItem.appid = "wx1234567890abcdef"; 60 request.serviceList.add(serviceListItem); 61 }; 62 try { 63 SubmitMchCardConfigResponse response = client.run(request); 64 // TODO: 请求成功,继续业务逻辑 65 System.out.println(response); 66 } catch (WXPayUtility.ApiException e) { 67 // TODO: 请求失败,根据状态码执行不同的逻辑 68 e.printStackTrace(); 69 } 70 } 71 72 public SubmitMchCardConfigResponse run(SubmitMchCardConfigRequest request) { 73 String uri = PATH; 74 String reqBody = WXPayUtility.toJson(request); 75 76 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 77 reqBuilder.addHeader("Accept", "application/json"); 78 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 79 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 80 reqBuilder.addHeader("Content-Type", "application/json"); 81 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 82 reqBuilder.method(METHOD, requestBody); 83 Request httpRequest = reqBuilder.build(); 84 85 // 发送HTTP请求 86 OkHttpClient client = new OkHttpClient.Builder().build(); 87 try (Response httpResponse = client.newCall(httpRequest).execute()) { 88 String respBody = WXPayUtility.extractBody(httpResponse); 89 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 90 // 2XX 成功,验证应答签名 91 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 92 httpResponse.headers(), respBody); 93 94 // 从HTTP应答报文构建返回数据 95 return WXPayUtility.fromJson(respBody, SubmitMchCardConfigResponse.class); 96 } else { 97 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 98 } 99 } catch (IOException e) { 100 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 101 } 102 } 103 104 private final String mchid; 105 private final String certificateSerialNo; 106 private final PrivateKey privateKey; 107 private final String wechatPayPublicKeyId; 108 private final PublicKey wechatPayPublicKey; 109 110 public SubmitMchCardConfig(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 111 this.mchid = mchid; 112 this.certificateSerialNo = certificateSerialNo; 113 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 114 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 115 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 116 } 117 118 public static class SubmitMchCardConfigRequest { 119 @SerializedName("business_code") 120 public String businessCode; 121 122 @SerializedName("brand_id") 123 public String brandId; 124 125 @SerializedName("brand_mini_program_info") 126 public MiniProgramInfo brandMiniProgramInfo; 127 128 @SerializedName("brand_customer_service") 129 public MerchantCardCustomerService brandCustomerService; 130 131 @SerializedName("service_list") 132 public List<MerchantCardService> serviceList; 133 } 134 135 public static class SubmitMchCardConfigResponse { 136 @SerializedName("business_code") 137 public String businessCode; 138 139 @SerializedName("applyment_id") 140 public String applymentId; 141 142 @SerializedName("brand_id") 143 public String brandId; 144 145 @SerializedName("card_preview_url") 146 public String cardPreviewUrl; 147 148 @SerializedName("url_expired_time") 149 public String urlExpiredTime; 150 } 151 152 public static class MiniProgramInfo { 153 @SerializedName("appid") 154 public String appid; 155 156 @SerializedName("default_jump_path") 157 public String defaultJumpPath; 158 159 @SerializedName("button_text") 160 public String buttonText; 161 } 162 163 public static class MerchantCardCustomerService { 164 @SerializedName("customer_service_type") 165 public CustomerServiceType customerServiceType; 166 167 @SerializedName("customer_service_phone") 168 public String customerServicePhone; 169 170 @SerializedName("customer_service_path") 171 public String customerServicePath; 172 173 @SerializedName("appid") 174 public String appid; 175 } 176 177 public static class MerchantCardService { 178 @SerializedName("service_classify_name") 179 public String serviceClassifyName; 180 181 @SerializedName("service_name") 182 public String serviceName; 183 184 @SerializedName("service_jump_type") 185 public ServiceJumpType serviceJumpType; 186 187 @SerializedName("service_jump_path") 188 public String serviceJumpPath; 189 190 @SerializedName("appid") 191 public String appid; 192 } 193 194 public enum CustomerServiceType { 195 @SerializedName("MINI_PROGRAM") 196 MINI_PROGRAM, 197 @SerializedName("WECOM") 198 WECOM, 199 @SerializedName("CUSTOMIZE_WEB") 200 CUSTOMIZE_WEB, 201 @SerializedName("CUSTOMIZE_MP") 202 CUSTOMIZE_MP, 203 @SerializedName("SERVICE_PHONE") 204 SERVICE_PHONE 205 } 206 207 public enum ServiceJumpType { 208 @SerializedName("JUMP_MINI_PROGRAM") 209 JUMP_MINI_PROGRAM, 210 @SerializedName("JUMP_WEB_PAGE") 211 JUMP_WEB_PAGE 212 } 213 214} 215
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "bytes" 5 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446 6 "encoding/json" 7 "fmt" 8 "net/http" 9 "net/url" 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 := &SubmitMchCardConfigRequest{ 28 BusinessCode: wxpay_utility.String("1900013511_10000"), 29 BrandId: wxpay_utility.String("1234567"), 30 BrandMiniProgramInfo: &MiniProgramInfo{ 31 Appid: wxpay_utility.String("wx1234567890abcdef"), 32 DefaultJumpPath: wxpay_utility.String("pages/shop/index"), 33 ButtonText: wxpay_utility.String("前往小程序"), 34 }, 35 BrandCustomerService: &MerchantCardCustomerService{ 36 CustomerServiceType: CUSTOMERSERVICETYPE_MINI_PROGRAM.Ptr(), 37 CustomerServicePhone: wxpay_utility.String("12345678900"), 38 CustomerServicePath: wxpay_utility.String("pages/service/index"), 39 Appid: wxpay_utility.String("wx1234567890abcdef"), 40 }, 41 ServiceList: []MerchantCardService{MerchantCardService{ 42 ServiceClassifyName: wxpay_utility.String("会员服务"), 43 ServiceName: wxpay_utility.String("会员中心"), 44 ServiceJumpType: SERVICEJUMPTYPE_JUMP_MINI_PROGRAM.Ptr(), 45 ServiceJumpPath: wxpay_utility.String("pages/shop/index"), 46 Appid: wxpay_utility.String("wx1234567890abcdef"), 47 }}, 48 } 49 50 response, err := SubmitMchCardConfig(config, request) 51 if err != nil { 52 fmt.Printf("请求失败: %+v\n", err) 53 // TODO: 请求失败,根据状态码执行不同的处理 54 return 55 } 56 57 // TODO: 请求成功,继续业务逻辑 58 fmt.Printf("请求成功: %+v\n", response) 59} 60 61func SubmitMchCardConfig(config *wxpay_utility.MchConfig, request *SubmitMchCardConfigRequest) (response *SubmitMchCardConfigResponse, err error) { 62 const ( 63 host = "https://api.mch.weixin.qq.com" 64 method = "POST" 65 path = "/v3/brand/card/card-configs" 66 ) 67 68 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 69 if err != nil { 70 return nil, err 71 } 72 reqBody, err := json.Marshal(request) 73 if err != nil { 74 return nil, err 75 } 76 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 77 if err != nil { 78 return nil, err 79 } 80 httpRequest.Header.Set("Accept", "application/json") 81 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 82 httpRequest.Header.Set("Content-Type", "application/json") 83 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 84 if err != nil { 85 return nil, err 86 } 87 httpRequest.Header.Set("Authorization", authorization) 88 89 client := &http.Client{} 90 httpResponse, err := client.Do(httpRequest) 91 if err != nil { 92 return nil, err 93 } 94 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 95 if err != nil { 96 return nil, err 97 } 98 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 99 // 2XX 成功,验证应答签名 100 err = wxpay_utility.ValidateResponse( 101 config.WechatPayPublicKeyId(), 102 config.WechatPayPublicKey(), 103 &httpResponse.Header, 104 respBody, 105 ) 106 if err != nil { 107 return nil, err 108 } 109 response := &SubmitMchCardConfigResponse{} 110 if err := json.Unmarshal(respBody, response); err != nil { 111 return nil, err 112 } 113 114 return response, nil 115 } else { 116 return nil, wxpay_utility.NewApiException( 117 httpResponse.StatusCode, 118 httpResponse.Header, 119 respBody, 120 ) 121 } 122} 123 124type SubmitMchCardConfigRequest struct { 125 BusinessCode *string `json:"business_code,omitempty"` 126 BrandId *string `json:"brand_id,omitempty"` 127 BrandMiniProgramInfo *MiniProgramInfo `json:"brand_mini_program_info,omitempty"` 128 BrandCustomerService *MerchantCardCustomerService `json:"brand_customer_service,omitempty"` 129 ServiceList []MerchantCardService `json:"service_list,omitempty"` 130} 131 132type SubmitMchCardConfigResponse struct { 133 BusinessCode *string `json:"business_code,omitempty"` 134 ApplymentId *string `json:"applyment_id,omitempty"` 135 BrandId *string `json:"brand_id,omitempty"` 136 CardPreviewUrl *string `json:"card_preview_url,omitempty"` 137 UrlExpiredTime *time.Time `json:"url_expired_time,omitempty"` 138} 139 140type MiniProgramInfo struct { 141 Appid *string `json:"appid,omitempty"` 142 DefaultJumpPath *string `json:"default_jump_path,omitempty"` 143 ButtonText *string `json:"button_text,omitempty"` 144} 145 146type MerchantCardCustomerService struct { 147 CustomerServiceType *CustomerServiceType `json:"customer_service_type,omitempty"` 148 CustomerServicePhone *string `json:"customer_service_phone,omitempty"` 149 CustomerServicePath *string `json:"customer_service_path,omitempty"` 150 Appid *string `json:"appid,omitempty"` 151} 152 153type MerchantCardService struct { 154 ServiceClassifyName *string `json:"service_classify_name,omitempty"` 155 ServiceName *string `json:"service_name,omitempty"` 156 ServiceJumpType *ServiceJumpType `json:"service_jump_type,omitempty"` 157 ServiceJumpPath *string `json:"service_jump_path,omitempty"` 158 Appid *string `json:"appid,omitempty"` 159} 160 161type CustomerServiceType string 162 163func (e CustomerServiceType) Ptr() *CustomerServiceType { 164 return &e 165} 166 167const ( 168 CUSTOMERSERVICETYPE_MINI_PROGRAM CustomerServiceType = "MINI_PROGRAM" 169 CUSTOMERSERVICETYPE_WECOM CustomerServiceType = "WECOM" 170 CUSTOMERSERVICETYPE_CUSTOMIZE_WEB CustomerServiceType = "CUSTOMIZE_WEB" 171 CUSTOMERSERVICETYPE_CUSTOMIZE_MP CustomerServiceType = "CUSTOMIZE_MP" 172 CUSTOMERSERVICETYPE_SERVICE_PHONE CustomerServiceType = "SERVICE_PHONE" 173) 174 175type ServiceJumpType string 176 177func (e ServiceJumpType) Ptr() *ServiceJumpType { 178 return &e 179} 180 181const ( 182 SERVICEJUMPTYPE_JUMP_MINI_PROGRAM ServiceJumpType = "JUMP_MINI_PROGRAM" 183 SERVICEJUMPTYPE_JUMP_WEB_PAGE ServiceJumpType = "JUMP_WEB_PAGE" 184) 185
应答参数
200 OK
business_code 必填 string(128)
【业务申请编号】 1、只能由数字、字母或下划线组成;
2、服务商自定义的商户唯一编号,每个编号对应一个申请单。
applyment_id 必填 string(25)
【微信支付申请单号】 申请单的唯一标识,由微信支付生成。
brand_id 必填 string(20)
【品牌ID】 商家进驻微信支付品牌商家后获得的品牌ID,作为品牌唯一标识符。
card_preview_url 必填 string(512)
【商家名片预览二维码链接】 商家名片配置申请提交成功后,将返回可供商家预览的二维码链接,商家可查看各跳转路径是否正常,符合预期。
url_expired_time 必填 string(64)
【预览二维码链接过期时间】 1、商家名片配置申请提交成功后,系统将返回预览二维码链接的有效截止时间。商家需在此时间点前完成预览确认,逾期链接将自动失效。
2、格式:遵循rfc3339标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。
示例:2025-05-20T13:29:35+08:00 表示北京时间2025年5月20日13点29分35秒。
应答示例
200 OK
1{ 2 "business_code" : "1900013511_10000", 3 "applyment_id" : "1111111111", 4 "brand_id" : "1234567", 5 "card_preview_url" : "https://pay.weixin.qq.com/xdc/mchcardinfomgrweb/miniapp?link_id=12345", 6 "url_expired_time" : "2025-05-20T13:29:35+08:00" 7} 8
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示

