查询商户资料
更新时间:2025.11.20查询最新商户资料
接口限频:单商户号10次/分钟
接口说明
支持商户:【普通商户】
请求方式:【GET】/v3/aggracct-bc/wb-channel/account/mch_archives
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Wechatpay-Serial 必填 string
【微信支付公钥ID】或【微信支付平台证书序列号】 请求参数中的敏感字段,需要使用微信支付公钥加密(推荐),请参考获取微信支付公钥ID说明以及微信支付公钥加密敏感信息指引;也可以使用微信支付平台证书公钥加密,参考获取平台证书序列号、平台证书加密敏感信息指引
query 查询参数
mchid 必填 string(32)
【微信支付商户号】 微信支付商户号
bal_account_no 必填 string(1024)
【额度台账号】 【加密】额度台账号
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/aggracct-bc/wb-channel/account/mch_archives?mchid=1900016681&bal_account_no=8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Wechatpay-Serial: 5157F09EFDC096DE15EBE81A47057A7232F1B8E1" 6
需配合微信支付工具库 WXPayUtility 使用,请参考Java
1package com.java.demo; 2 3import com.java.utils.WXPayUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/v3/merchant/4014931831 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 GetMchArchive { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/aggracct-bc/wb-channel/account/mch_archives"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/merchant/4013070756 32 GetMchArchive client = new GetMchArchive( 33 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756 34 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053 35 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 36 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 GetMchArchiveRequest request = new GetMchArchiveRequest(); 41 request.mchid = "1900016681"; 42 request.balAccountNo = "8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f"; 43 try { 44 MchArchive 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 MchArchive run(GetMchArchiveRequest request) { 54 String uri = PATH; 55 Map<String, Object> args = new HashMap<>(); 56 args.put("mchid", request.mchid); 57 args.put("bal_account_no", request.balAccountNo); 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, MchArchive.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 GetMchArchive(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 String encrypt(String plainText) { 104 return WXPayUtility.encrypt(this.wechatPayPublicKey, plainText); 105 } 106 107 public static class GetMchArchiveRequest { 108 @SerializedName("mchid") 109 @Expose(serialize = false) 110 public String mchid; 111 112 @SerializedName("bal_account_no") 113 @Expose(serialize = false) 114 public String balAccountNo; 115 } 116 117 public static class MchArchive { 118 @SerializedName("mchid") 119 public String mchid; 120 121 @SerializedName("bal_account_no") 122 public String balAccountNo; 123 124 @SerializedName("merchant_type") 125 public String merchantType; 126 127 @SerializedName("merchant_id_type") 128 public String merchantIdType; 129 130 @SerializedName("merchant_name") 131 public String merchantName; 132 133 @SerializedName("merchant_id_no") 134 public String merchantIdNo; 135 136 @SerializedName("effective_date") 137 public String effectiveDate; 138 139 @SerializedName("expire_date") 140 public String expireDate; 141 142 @SerializedName("merchant_img_front_id") 143 public String merchantImgFrontId; 144 145 @SerializedName("register_address") 146 public String registerAddress; 147 148 @SerializedName("business_scope") 149 public String businessScope; 150 151 @SerializedName("legal_representative") 152 public LegalRepresentative legalRepresentative; 153 154 @SerializedName("beneficial_owner") 155 public List<BeneficialOwner> beneficialOwner = new ArrayList<BeneficialOwner>(); 156 } 157 158 public static class LegalRepresentative { 159 @SerializedName("legal_representative_id_type") 160 public String legalRepresentativeIdType; 161 162 @SerializedName("legal_representative_name") 163 public String legalRepresentativeName; 164 165 @SerializedName("legal_representative_id_no") 166 public String legalRepresentativeIdNo; 167 168 @SerializedName("legal_representative_effective_date") 169 public String legalRepresentativeEffectiveDate; 170 171 @SerializedName("legal_representative_expire_date") 172 public String legalRepresentativeExpireDate; 173 174 @SerializedName("legal_representative_img_front_id") 175 public String legalRepresentativeImgFrontId; 176 177 @SerializedName("legal_representative_img_back_id") 178 public String legalRepresentativeImgBackId; 179 180 @SerializedName("legal_representative_address") 181 public String legalRepresentativeAddress; 182 } 183 184 public static class BeneficialOwner { 185 @SerializedName("beneficial_owner_no") 186 public String beneficialOwnerNo; 187 188 @SerializedName("beneficial_owner_id_type") 189 public String beneficialOwnerIdType; 190 191 @SerializedName("beneficial_owner_name") 192 public String beneficialOwnerName; 193 194 @SerializedName("beneficial_owner_id_no") 195 public String beneficialOwnerIdNo; 196 197 @SerializedName("beneficial_owner_effective_date") 198 public String beneficialOwnerEffectiveDate; 199 200 @SerializedName("beneficial_owner_expire_date") 201 public String beneficialOwnerExpireDate; 202 203 @SerializedName("beneficial_owner_img_front_id") 204 public String beneficialOwnerImgFrontId; 205 206 @SerializedName("beneficial_owner_img_back_id") 207 public String beneficialOwnerImgBackId; 208 209 @SerializedName("beneficial_owner_address") 210 public String beneficialOwnerAddress; 211 } 212 213} 214
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/merchant/4015119334 5 "encoding/json" 6 "fmt" 7 "net/http" 8 "net/url" 9) 10 11func main() { 12 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/merchant/4013070756 13 config, err := wxpay_utility.CreateMchConfig( 14 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756 15 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053 16 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 17 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816 18 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 19 ) 20 if err != nil { 21 fmt.Println(err) 22 return 23 } 24 25 request := &GetMchArchiveRequest{ 26 Mchid: wxpay_utility.String("1900016681"), 27 BalAccountNo: wxpay_utility.String("8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f"), 28 } 29 30 response, err := GetMchArchive(config, request) 31 if err != nil { 32 fmt.Printf("请求失败: %+v\n", err) 33 // TODO: 请求失败,根据状态码执行不同的处理 34 return 35 } 36 37 // TODO: 请求成功,继续业务逻辑 38 fmt.Printf("请求成功: %+v\n", response) 39} 40 41func GetMchArchive(config *wxpay_utility.MchConfig, request *GetMchArchiveRequest) (response *MchArchive, err error) { 42 const ( 43 host = "https://api.mch.weixin.qq.com" 44 method = "GET" 45 path = "/v3/aggracct-bc/wb-channel/account/mch_archives" 46 ) 47 48 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 49 if err != nil { 50 return nil, err 51 } 52 query := reqUrl.Query() 53 if request.Mchid != nil { 54 query.Add("mchid", *request.Mchid) 55 } 56 if request.BalAccountNo != nil { 57 query.Add("bal_account_no", *request.BalAccountNo) 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 := &MchArchive{} 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 GetMchArchiveRequest struct { 108 Mchid *string `json:"mchid,omitempty"` 109 BalAccountNo *string `json:"bal_account_no,omitempty"` 110} 111 112func (o *GetMchArchiveRequest) MarshalJSON() ([]byte, error) { 113 type Alias GetMchArchiveRequest 114 a := &struct { 115 Mchid *string `json:"mchid,omitempty"` 116 BalAccountNo *string `json:"bal_account_no,omitempty"` 117 *Alias 118 }{ 119 // 序列化时移除非 Body 字段 120 Mchid: nil, 121 BalAccountNo: nil, 122 Alias: (*Alias)(o), 123 } 124 return json.Marshal(a) 125} 126 127type MchArchive struct { 128 Mchid *string `json:"mchid,omitempty"` 129 BalAccountNo *string `json:"bal_account_no,omitempty"` 130 MerchantType *string `json:"merchant_type,omitempty"` 131 MerchantIdType *string `json:"merchant_id_type,omitempty"` 132 MerchantName *string `json:"merchant_name,omitempty"` 133 MerchantIdNo *string `json:"merchant_id_no,omitempty"` 134 EffectiveDate *string `json:"effective_date,omitempty"` 135 ExpireDate *string `json:"expire_date,omitempty"` 136 MerchantImgFrontId *string `json:"merchant_img_front_id,omitempty"` 137 RegisterAddress *string `json:"register_address,omitempty"` 138 BusinessScope *string `json:"business_scope,omitempty"` 139 LegalRepresentative *LegalRepresentative `json:"legal_representative,omitempty"` 140 BeneficialOwner []BeneficialOwner `json:"beneficial_owner,omitempty"` 141} 142 143type LegalRepresentative struct { 144 LegalRepresentativeIdType *string `json:"legal_representative_id_type,omitempty"` 145 LegalRepresentativeName *string `json:"legal_representative_name,omitempty"` 146 LegalRepresentativeIdNo *string `json:"legal_representative_id_no,omitempty"` 147 LegalRepresentativeEffectiveDate *string `json:"legal_representative_effective_date,omitempty"` 148 LegalRepresentativeExpireDate *string `json:"legal_representative_expire_date,omitempty"` 149 LegalRepresentativeImgFrontId *string `json:"legal_representative_img_front_id,omitempty"` 150 LegalRepresentativeImgBackId *string `json:"legal_representative_img_back_id,omitempty"` 151 LegalRepresentativeAddress *string `json:"legal_representative_address,omitempty"` 152} 153 154type BeneficialOwner struct { 155 BeneficialOwnerNo *string `json:"beneficial_owner_no,omitempty"` 156 BeneficialOwnerIdType *string `json:"beneficial_owner_id_type,omitempty"` 157 BeneficialOwnerName *string `json:"beneficial_owner_name,omitempty"` 158 BeneficialOwnerIdNo *string `json:"beneficial_owner_id_no,omitempty"` 159 BeneficialOwnerEffectiveDate *string `json:"beneficial_owner_effective_date,omitempty"` 160 BeneficialOwnerExpireDate *string `json:"beneficial_owner_expire_date,omitempty"` 161 BeneficialOwnerImgFrontId *string `json:"beneficial_owner_img_front_id,omitempty"` 162 BeneficialOwnerImgBackId *string `json:"beneficial_owner_img_back_id,omitempty"` 163 BeneficialOwnerAddress *string `json:"beneficial_owner_address,omitempty"` 164} 165
应答参数
200 OK
mchid 必填 string
【微信支付商户号】 微信支付商户号
bal_account_no 必填 string
【额度台账号】 【加密】额度台账号
merchant_type 必填 string
【主体类型】 主体类型
1-个体工商户
2-企业
merchant_id_type 必填 string
【主体证件类型】 主体证件类型
12-营业执照
merchant_name 必填 string
【主体证件登记名称】 【加密】主体证件登记名称
merchant_id_no 必填 string
【主体证件号码】 【加密】主体证件号码
effective_date 必填 string
【主体证件有效期起始日】 主体证件有效期起始日
日期格式:yyyy-MM-dd
expire_date 必填 string
【主体证件有效期结束日】 主体证件有效期结束日
日期格式:yyyy-MM-dd 或 长期(9999-12-31)
merchant_img_front_id 必填 string
【主体证件正面影像ID】 主体证件正面影像ID(微众影像文件上传接口返回)
register_address 必填 string
【主体注册地址】 主体注册地址
business_scope 必填 string
【主体经营范围】 主体经营范围
legal_representative 必填 object
【法定代表人信息】 法定代表人信息
| 属性 | |
legal_representative_id_type 必填 string 【法定代表人证件类型】 法定代表人证件类型(一期只支持身份证)
legal_representative_name 必填 string 【法定代表人姓名】 【加密】法定代表人姓名 legal_representative_id_no 必填 string 【法定代表人证件号码】 【加密】法定代表人证件号码 legal_representative_effective_date 必填 string 【法定代表人证件有效期起始日】 法定代表人证件有效期起始日 legal_representative_expire_date 必填 string 【法定代表人证件有效期结束日】 法定代表人证件有效期结束日 legal_representative_img_front_id 必填 string 【法定代表人证件正面影像ID】 法定代表人证件正面影像ID(微众影像文件上传接口返回) legal_representative_img_back_id 必填 string 【法定代表人证件反面影像ID】 法定代表人证件反面影像ID(微众影像文件上传接口返回) legal_representative_address 必填 string 【法定代表人居住地址】 【加密】法定代表人居住地址 |
beneficial_owner 必填 array[object]
【受益所有人信息列表】 受益所有人信息组(1-4组)
| 属性 | |
beneficial_owner_no 必填 string 【受益所有人编号】 受益所有人编号,从1开始,依次递增编号,不保证不同请求返回顺序一致 beneficial_owner_id_type 必填 string 【受益所有人证件类型】 受益所有人证件类型(一期只支持身份证)
beneficial_owner_name 必填 string 【受益所有人姓名】 【加密】受益所有人姓名 beneficial_owner_id_no 必填 string 【受益所有人证件号码】 【加密】受益所有人证件号码 beneficial_owner_effective_date 必填 string 【受益所有人证件有效期起始日】 受益所有人证件有效期起始日 beneficial_owner_expire_date 必填 string 【受益所有人证件有效期结束日】 受益所有人证件有效期结束日 beneficial_owner_img_front_id 必填 string 【受益所有人证件正面影像ID】 受益所有人证件正面影像ID(微众影像文件上传接口返回) beneficial_owner_img_back_id 必填 string 【受益所有人证件反面影像ID】 受益所有人证件反面影像ID(微众影像文件上传接口返回) beneficial_owner_address 必填 string 【受益所有人居住地址】 【加密】受益所有人居住地址 |
应答示例
200 OK
1{ 2 "mchid" : "1900016681", 3 "bal_account_no" : "8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f", 4 "merchant_type" : "2", 5 "merchant_id_type" : "12", 6 "merchant_name" : "江西米高文化传媒有限测试公司", 7 "merchant_id_no" : "91360735MA35RDY220", 8 "effective_date" : "2025-10-01", 9 "expire_date" : "9999-12-31", 10 "merchant_img_front_id" : "25102811A94212141615335094943740", 11 "register_address" : "江西省赣州市石城县琴江镇东南路山河馨城7-401室", 12 "business_scope" : "食品销售(仅销售预包装食品);保健食品(预包装)销售", 13 "legal_representative" : { 14 "legal_representative_id_type" : "01", 15 "legal_representative_name" : "张三", 16 "legal_representative_id_no" : "362137196601100023", 17 "legal_representative_effective_date" : "2000-10-01", 18 "legal_representative_expire_date" : "9999-12-31", 19 "legal_representative_img_front_id" : "25102811A94212141615335094943741", 20 "legal_representative_img_back_id" : "25102811A94212141615335094943742", 21 "legal_representative_address" : "江西省赣州市石城县琴江镇东南路山河馨城7-401室" 22 }, 23 "beneficial_owner" : [ 24 { 25 "beneficial_owner_no" : "1", 26 "beneficial_owner_id_type" : "01", 27 "beneficial_owner_name" : "李四", 28 "beneficial_owner_id_no" : "362137196601100023", 29 "beneficial_owner_effective_date" : "2000-01-01", 30 "beneficial_owner_expire_date" : "9999-12-31", 31 "beneficial_owner_img_front_id" : "25102811A94212141615335094943741", 32 "beneficial_owner_img_back_id" : "25102811A94212141615335094943741", 33 "beneficial_owner_address" : "江西省赣州市石城县琴江镇东南路山河馨城7-401室" 34 } 35 ] 36} 37
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示

