查询品牌门店列表
更新时间:2025.12.08查询品牌门店列表。
频率限制:5/s
接口说明
支持商户:【品牌商户】
请求方式:【GET】/brand/store/brandstores
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Wechatpay-Serial 必填 string
【微信支付公钥ID】 请传入brand_id对应的微信支付公钥ID,接口将会校验两者的关联关系,参考微信支付公钥产品简介及使用说明获取微信支付公钥ID和相关的介绍。以下两种场景将使用到微信支付公钥: 1、接收到接口的返回内容,需要使用微信支付公钥进行验签; 2、调用含有敏感信息参数(如姓名、身份证号码)的接口时,需要使用微信支付公钥加密敏感信息后再传输参数,加密指引请参考微信支付公钥加密敏感信息指引。
query 查询参数
store_state 选填 string
【门店状态】 若不填,则查询所有门店。
可选取值
OPEN: 门店生效中。门店审核通过创建成功后即为生效中,后续更新门店信息只会影响审核状态,不会改变门店状态,如门店暂停营业可调用“暂停门店营业 API”,如门店关闭可调用“删除品牌门店 API”。门店营业时间不影响门店状态。CREATING: 门店创建中。在创建门店后,门店资料正在审核。审核详情请查看审核状态。CLOSED: 门店停业中。不可用于微信支付生态中的其他业务,可删除该门店,删除后将无法恢复,请谨慎操作。
offset 选填 integer
【分页起始位置】 从第几条开始查询,默认从第0条开始查询。
limit 选填 integer
【分页条数】 一次查询的最大门店条数,默认值为20,取值范围[1,200]。
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/brand/store/brandstores?store_state=OPEN&offset=100&limit=20 \ 3 -H "Authorization: WECHATPAY-BRAND-SHA256-RSA2048 brand_id=\"XXXX\",..." \ 4 -H "Accept: application/json" \ 5 -H "Wechatpay-Serial: PUB_KEY_ID_XXXX" 6
需配合微信支付工具库 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 ListBrandStores { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/brand/store/brandstores"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 32 ListBrandStores client = new ListBrandStores( 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 ListBrandStoresRequest request = new ListBrandStoresRequest(); 41 request.storeState = StoreState.OPEN; 42 request.offset = 100L; 43 request.limit = 20L; 44 try { 45 BrandStoresListResponse response = client.run(request); 46 // TODO: 请求成功,继续业务逻辑 47 System.out.println(response); 48 } catch (WXPayBrandUtility.ApiException e) { 49 // TODO: 请求失败,根据状态码执行不同的逻辑 50 e.printStackTrace(); 51 } 52 } 53 54 public BrandStoresListResponse run(ListBrandStoresRequest request) { 55 String uri = PATH; 56 Map<String, Object> args = new HashMap<>(); 57 args.put("store_state", request.storeState); 58 args.put("offset", request.offset); 59 args.put("limit", request.limit); 60 String queryString = WXPayBrandUtility.urlEncode(args); 61 if (!queryString.isEmpty()) { 62 uri = uri + "?" + queryString; 63 } 64 65 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 66 reqBuilder.addHeader("Accept", "application/json"); 67 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 68 reqBuilder.addHeader("Authorization", WXPayBrandUtility.buildAuthorization(brand_id, certificateSerialNo, privateKey, METHOD, uri, null)); 69 reqBuilder.method(METHOD, null); 70 Request httpRequest = reqBuilder.build(); 71 72 // 发送HTTP请求 73 OkHttpClient client = new OkHttpClient.Builder().build(); 74 try (Response httpResponse = client.newCall(httpRequest).execute()) { 75 String respBody = WXPayBrandUtility.extractBody(httpResponse); 76 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 77 // 2XX 成功,验证应答签名 78 WXPayBrandUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 79 httpResponse.headers(), respBody); 80 81 // 从HTTP应答报文构建返回数据 82 return WXPayBrandUtility.fromJson(respBody, BrandStoresListResponse.class); 83 } else { 84 throw new WXPayBrandUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 85 } 86 } catch (IOException e) { 87 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 88 } 89 } 90 91 private final String brand_id; 92 private final String certificateSerialNo; 93 private final PrivateKey privateKey; 94 private final String wechatPayPublicKeyId; 95 private final PublicKey wechatPayPublicKey; 96 97 public ListBrandStores(String brand_id, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 98 this.brand_id = brand_id; 99 this.certificateSerialNo = certificateSerialNo; 100 this.privateKey = WXPayBrandUtility.loadPrivateKeyFromPath(privateKeyFilePath); 101 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 102 this.wechatPayPublicKey = WXPayBrandUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 103 } 104 105 public static class ListBrandStoresRequest { 106 @SerializedName("offset") 107 @Expose(serialize = false) 108 public Long offset; 109 110 @SerializedName("limit") 111 @Expose(serialize = false) 112 public Long limit; 113 114 @SerializedName("store_state") 115 @Expose(serialize = false) 116 public StoreState storeState; 117 } 118 119 public static class BrandStoresListResponse { 120 @SerializedName("data") 121 public List<BrandStoresEntity> data; 122 123 @SerializedName("offset") 124 public Long offset; 125 126 @SerializedName("limit") 127 public Long limit; 128 129 @SerializedName("total_count") 130 public Long totalCount; 131 } 132 133 public enum StoreState { 134 @SerializedName("OPEN") 135 OPEN, 136 @SerializedName("CREATING") 137 CREATING, 138 @SerializedName("CLOSED") 139 CLOSED 140 } 141 142 public static class BrandStoresEntity { 143 @SerializedName("store_id") 144 public String storeId; 145 146 @SerializedName("store_state") 147 public StoreState storeState; 148 149 @SerializedName("audit_state") 150 public AuditState auditState; 151 152 @SerializedName("review_reject_reason") 153 public String reviewRejectReason; 154 155 @SerializedName("store_basics") 156 public StoreBase storeBasics; 157 158 @SerializedName("store_address") 159 public StoreLocation storeAddress; 160 161 @SerializedName("store_business") 162 public StoreBusiness storeBusiness; 163 164 @SerializedName("store_recipient") 165 public List<StoreRecipient> storeRecipient; 166 } 167 168 public enum AuditState { 169 @SerializedName("SUCCESS") 170 SUCCESS, 171 @SerializedName("PROCESSING") 172 PROCESSING, 173 @SerializedName("REJECTED") 174 REJECTED 175 } 176 177 public static class StoreBase { 178 @SerializedName("store_reference_id") 179 public String storeReferenceId; 180 181 @SerializedName("branch_name") 182 public String branchName; 183 } 184 185 public static class StoreLocation { 186 @SerializedName("address_code") 187 public String addressCode; 188 189 @SerializedName("address_detail") 190 public String addressDetail; 191 192 @SerializedName("address_complements") 193 public String addressComplements; 194 195 @SerializedName("longitude") 196 public String longitude; 197 198 @SerializedName("latitude") 199 public String latitude; 200 } 201 202 public static class StoreBusiness { 203 @SerializedName("service_phone") 204 public String servicePhone; 205 206 @SerializedName("business_hours") 207 public String businessHours; 208 } 209 210 public static class StoreRecipient { 211 @SerializedName("mchid") 212 public String mchid; 213 214 @SerializedName("company_name") 215 public String companyName; 216 217 @SerializedName("recipient_state") 218 public RecipientState recipientState; 219 } 220 221 public enum RecipientState { 222 @SerializedName("CONFIRMED") 223 CONFIRMED, 224 @SerializedName("ADMIN_REJECTED") 225 ADMIN_REJECTED, 226 @SerializedName("CONFIRMING") 227 CONFIRMING, 228 @SerializedName("TIMEOUT_REJECTED") 229 TIMEOUT_REJECTED 230 } 231 232} 233
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "demo/wxpay_brand_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/brand/4015826866 5 "encoding/json" 6 "fmt" 7 "net/http" 8 "net/url" 9) 10 11func main() { 12 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/brand/4015415289 13 config, err := wxpay_brand_utility.CreateBrandConfig( 14 "xxxxxxxx", // 品牌ID,是由微信支付系统生成并分配给每个品牌方的唯一标识符,品牌ID获取方式参考 https://pay.weixin.qq.com/doc/brand/4015415289 15 "1DDE55AD98Exxxxxxxxxx", // 品牌API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015407570 16 "/path/to/apiclient_key.pem", // 品牌API证书私钥文件路径,本地文件路径 17 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/brand/4015453439 18 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 19 ) 20 if err != nil { 21 fmt.Println(err) 22 return 23 } 24 25 request := &ListBrandStoresRequest{ 26 StoreState: STORESTATE_OPEN.Ptr(), 27 Offset: wxpay_brand_utility.Int64(100), 28 Limit: wxpay_brand_utility.Int64(20), 29 } 30 31 response, err := ListBrandStores(config, request) 32 if err != nil { 33 fmt.Printf("请求失败: %+v\n", err) 34 // TODO: 请求失败,根据状态码执行不同的处理 35 return 36 } 37 38 // TODO: 请求成功,继续业务逻辑 39 fmt.Printf("请求成功: %+v\n", response) 40} 41 42func ListBrandStores(config *wxpay_brand_utility.BrandConfig, request *ListBrandStoresRequest) (response *BrandStoresListResponse, err error) { 43 const ( 44 host = "https://api.mch.weixin.qq.com" 45 method = "GET" 46 path = "/brand/store/brandstores" 47 ) 48 49 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 50 if err != nil { 51 return nil, err 52 } 53 query := reqUrl.Query() 54 if request.StoreState != nil { 55 query.Add("store_state", fmt.Sprintf("%v", *request.StoreState)) 56 } 57 if request.Offset != nil { 58 query.Add("offset", fmt.Sprintf("%v", *request.Offset)) 59 } 60 if request.Limit != nil { 61 query.Add("limit", fmt.Sprintf("%v", *request.Limit)) 62 } 63 reqUrl.RawQuery = query.Encode() 64 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 65 if err != nil { 66 return nil, err 67 } 68 httpRequest.Header.Set("Accept", "application/json") 69 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 70 authorization, err := wxpay_brand_utility.BuildAuthorization(config.BrandId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 71 if err != nil { 72 return nil, err 73 } 74 httpRequest.Header.Set("Authorization", authorization) 75 76 client := &http.Client{} 77 httpResponse, err := client.Do(httpRequest) 78 if err != nil { 79 return nil, err 80 } 81 respBody, err := wxpay_brand_utility.ExtractResponseBody(httpResponse) 82 if err != nil { 83 return nil, err 84 } 85 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 86 // 2XX 成功,验证应答签名 87 err = wxpay_brand_utility.ValidateResponse( 88 config.WechatPayPublicKeyId(), 89 config.WechatPayPublicKey(), 90 &httpResponse.Header, 91 respBody, 92 ) 93 if err != nil { 94 return nil, err 95 } 96 response := &BrandStoresListResponse{} 97 if err := json.Unmarshal(respBody, response); err != nil { 98 return nil, err 99 } 100 101 return response, nil 102 } else { 103 return nil, wxpay_brand_utility.NewApiException( 104 httpResponse.StatusCode, 105 httpResponse.Header, 106 respBody, 107 ) 108 } 109} 110 111type ListBrandStoresRequest struct { 112 Offset *int64 `json:"offset,omitempty"` 113 Limit *int64 `json:"limit,omitempty"` 114 StoreState *StoreState `json:"store_state,omitempty"` 115} 116 117func (o *ListBrandStoresRequest) MarshalJSON() ([]byte, error) { 118 type Alias ListBrandStoresRequest 119 a := &struct { 120 Offset *int64 `json:"offset,omitempty"` 121 Limit *int64 `json:"limit,omitempty"` 122 StoreState *StoreState `json:"store_state,omitempty"` 123 *Alias 124 }{ 125 // 序列化时移除非 Body 字段 126 Offset: nil, 127 Limit: nil, 128 StoreState: nil, 129 Alias: (*Alias)(o), 130 } 131 return json.Marshal(a) 132} 133 134type BrandStoresListResponse struct { 135 Data []BrandStoresEntity `json:"data,omitempty"` 136 Offset *int64 `json:"offset,omitempty"` 137 Limit *int64 `json:"limit,omitempty"` 138 TotalCount *int64 `json:"total_count,omitempty"` 139} 140 141type StoreState string 142 143func (e StoreState) Ptr() *StoreState { 144 return &e 145} 146 147const ( 148 STORESTATE_OPEN StoreState = "OPEN" 149 STORESTATE_CREATING StoreState = "CREATING" 150 STORESTATE_CLOSED StoreState = "CLOSED" 151) 152 153type BrandStoresEntity struct { 154 StoreId *string `json:"store_id,omitempty"` 155 StoreState *StoreState `json:"store_state,omitempty"` 156 AuditState *AuditState `json:"audit_state,omitempty"` 157 ReviewRejectReason *string `json:"review_reject_reason,omitempty"` 158 StoreBasics *StoreBase `json:"store_basics,omitempty"` 159 StoreAddress *StoreLocation `json:"store_address,omitempty"` 160 StoreBusiness *StoreBusiness `json:"store_business,omitempty"` 161 StoreRecipient []StoreRecipient `json:"store_recipient,omitempty"` 162} 163 164type AuditState string 165 166func (e AuditState) Ptr() *AuditState { 167 return &e 168} 169 170const ( 171 AUDITSTATE_SUCCESS AuditState = "SUCCESS" 172 AUDITSTATE_PROCESSING AuditState = "PROCESSING" 173 AUDITSTATE_REJECTED AuditState = "REJECTED" 174) 175 176type StoreBase struct { 177 StoreReferenceId *string `json:"store_reference_id,omitempty"` 178 BranchName *string `json:"branch_name,omitempty"` 179} 180 181type StoreLocation struct { 182 AddressCode *string `json:"address_code,omitempty"` 183 AddressDetail *string `json:"address_detail,omitempty"` 184 AddressComplements *string `json:"address_complements,omitempty"` 185 Longitude *string `json:"longitude,omitempty"` 186 Latitude *string `json:"latitude,omitempty"` 187} 188 189type StoreBusiness struct { 190 ServicePhone *string `json:"service_phone,omitempty"` 191 BusinessHours *string `json:"business_hours,omitempty"` 192} 193 194type StoreRecipient struct { 195 Mchid *string `json:"mchid,omitempty"` 196 CompanyName *string `json:"company_name,omitempty"` 197 RecipientState *RecipientState `json:"recipient_state,omitempty"` 198} 199 200type RecipientState string 201 202func (e RecipientState) Ptr() *RecipientState { 203 return &e 204} 205 206const ( 207 RECIPIENTSTATE_CONFIRMED RecipientState = "CONFIRMED" 208 RECIPIENTSTATE_ADMIN_REJECTED RecipientState = "ADMIN_REJECTED" 209 RECIPIENTSTATE_CONFIRMING RecipientState = "CONFIRMING" 210 RECIPIENTSTATE_TIMEOUT_REJECTED RecipientState = "TIMEOUT_REJECTED" 211) 212
应答参数
200 OK
data 选填 array[object]
【品牌门店列表】 查询到的门店列表。
| 属性 | |||||||||||||||||
store_id 选填 string 【品牌门店ID】 创建品牌门店后,系统为该门店分配的唯一ID。 store_state 选填 string 【门店状态】 用于描述门店当前状态 可选取值
audit_state 选填 string 【审核状态】 创建、修改门店时,通过此字段可得知当前审核状态 可选取值
review_reject_reason 选填 string 【审核失败原因】 门店资料审核失败的原因 store_basics 选填 object 【门店基础信息】 用于描述门店编码,名称等基本情况。
store_address 选填 object 【门店地址信息】 用于描述门店地址,经纬度等地理位置相关情况。
store_business 选填 object 【门店经营信息】 用于描述门店联系电话,经营时间等经营状况。
store_recipient 选填 array[object] 【门店收款信息】 门店收款商户列表。
|
offset 选填 integer
【分页起始位置】 默认从0开始查询。
limit 选填 integer
【分页条数】 查询的门店数量。
total_count 选填 integer
【门店总数】 符合条件的门店总数。
应答示例
200 OK
1{ 2 "data" : [ 3 { 4 "store_id" : "1234567890123456", 5 "store_state" : "OPEN", 6 "audit_state" : "SUCCESS", 7 "review_reject_reason" : "通过核实,您提交的电话错误,请核实手机号码或座机号码是否正确", 8 "store_basics" : { 9 "store_reference_id" : "MDL001", 10 "branch_name" : "海岸城店" 11 }, 12 "store_address" : { 13 "address_code" : "440305", 14 "address_detail" : "深南大道10000号腾讯大厦1楼", 15 "address_complements" : "地铁A口右侧100米", 16 "longitude" : "112.63484", 17 "latitude" : "37.75464" 18 }, 19 "store_business" : { 20 "service_phone" : "0755-86013388|0755-86013399", 21 "business_hours" : "周一至周五 09:00-20:00|周六至周日 10:00-次日22:00" 22 }, 23 "store_recipient" : [ 24 { 25 "mchid" : "1230000109", 26 "company_name" : "腾讯科技(深圳)有限公司", 27 "recipient_state" : "CONFIRMED" 28 } 29 ] 30 } 31 ], 32 "offset" : 100, 33 "limit" : 20, 34 "total_count" : 230 35} 36
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示

