查询申请单状态-使用申请单号
更新时间:2025.07.17使用申请单号查询超级管理员修改申请单的状态
接口说明
支持商户:【平台商户】
请求方式:【GET】/v3/mchalterapply/mchcontactalterapplyment/{apply_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
path 路径参数
apply_id 必填 string(64)
【微信支付申请单号】 微信支付分配的申请单号
请求示例
需配合微信支付工具库 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 GetContactApplyment { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/mchalterapply/mchcontactalterapplyment/{apply_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 GetContactApplyment client = new GetContactApplyment( 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 GetContactApplymentRequest request = new GetContactApplymentRequest(); 41 request.applyId = "20220617143306000013906025001"; 42 try { 43 GetMchContactAlterApplymentResponse response = client.run(request); 44 45 // TODO: 请求成功,继续业务逻辑 46 System.out.println(response); 47 } catch (WXPayUtility.ApiException e) { 48 // TODO: 请求失败,根据状态码执行不同的逻辑 49 e.printStackTrace(); 50 } 51 } 52 53 public GetMchContactAlterApplymentResponse run(GetContactApplymentRequest request) { 54 String uri = PATH; 55 uri = uri.replace("{apply_id}", WXPayUtility.urlEncode(request.applyId)); 56 57 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 58 reqBuilder.addHeader("Accept", "application/json"); 59 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 60 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 61 reqBuilder.method(METHOD, null); 62 Request httpRequest = reqBuilder.build(); 63 64 // 发送HTTP请求 65 OkHttpClient client = new OkHttpClient.Builder().build(); 66 try (Response httpResponse = client.newCall(httpRequest).execute()) { 67 String respBody = WXPayUtility.extractBody(httpResponse); 68 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 69 // 2XX 成功,验证应答签名 70 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 71 httpResponse.headers(), respBody); 72 73 // 从HTTP应答报文构建返回数据 74 return WXPayUtility.fromJson(respBody, GetMchContactAlterApplymentResponse.class); 75 } else { 76 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 77 } 78 } catch (IOException e) { 79 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 80 } 81 } 82 83 private final String mchid; 84 private final String certificateSerialNo; 85 private final PrivateKey privateKey; 86 private final String wechatPayPublicKeyId; 87 private final PublicKey wechatPayPublicKey; 88 89 public GetContactApplyment(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 90 this.mchid = mchid; 91 this.certificateSerialNo = certificateSerialNo; 92 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 93 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 94 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 95 } 96 97 public static class RejectInfo { 98 @SerializedName("param_name") 99 public String paramName; 100 101 @SerializedName("reject_reason") 102 public String rejectReason; 103 } 104 105 public static class GetMchContactAlterApplymentResponse { 106 @SerializedName("apply_id") 107 public String applyId; 108 109 @SerializedName("out_request_no") 110 public String outRequestNo; 111 112 @SerializedName("merchant_code") 113 public String merchantCode; 114 115 @SerializedName("state") 116 public ApplymentState state; 117 118 @SerializedName("audit_reject_reason") 119 public String auditRejectReason; 120 121 @SerializedName("audit_reject_detail") 122 public List<RejectInfo> auditRejectDetail; 123 } 124 125 public enum ApplymentState { 126 @SerializedName("APPLYMENT_STATE_AUDITING") 127 APPLYMENT_STATE_AUDITING, 128 @SerializedName("APPLYMENT_STATE_REJECTED") 129 APPLYMENT_STATE_REJECTED, 130 @SerializedName("APPLYMENT_STATE_MODIFING") 131 APPLYMENT_STATE_MODIFING, 132 @SerializedName("APPLYMENT_STATE_FINISHED") 133 APPLYMENT_STATE_FINISHED, 134 @SerializedName("APPLYMENT_STATE_CANCELED") 135 APPLYMENT_STATE_CANCELED 136 } 137 138 public static class GetContactApplymentRequest { 139 @SerializedName("apply_id") 140 @Expose(serialize = false) 141 public String applyId; 142 } 143 144} 145
需配合微信支付工具库 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) 11 12func main() { 13 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 14 config, err := wxpay_utility.CreateMchConfig( 15 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 16 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 17 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 18 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 19 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 20 ) 21 if err != nil { 22 fmt.Println(err) 23 return 24 } 25 26 request := &GetContactApplymentRequest{ 27 ApplyId: wxpay_utility.String("20220617143306000013906025001"), 28 } 29 30 response, err := GetContactApplyment(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 GetContactApplyment(config *wxpay_utility.MchConfig, request *GetContactApplymentRequest) (response *GetMchContactAlterApplymentResponse, err error) { 42 const ( 43 host = "https://api.mch.weixin.qq.com" 44 method = "GET" 45 path = "/v3/mchalterapply/mchcontactalterapplyment/{apply_id}" 46 ) 47 48 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 49 if err != nil { 50 return nil, err 51 } 52 reqUrl.Path = strings.Replace(reqUrl.Path, "{apply_id}", url.PathEscape(*request.ApplyId), -1) 53 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 54 if err != nil { 55 return nil, err 56 } 57 httpRequest.Header.Set("Accept", "application/json") 58 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 59 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 60 if err != nil { 61 return nil, err 62 } 63 httpRequest.Header.Set("Authorization", authorization) 64 65 client := &http.Client{} 66 httpResponse, err := client.Do(httpRequest) 67 if err != nil { 68 return nil, err 69 } 70 71 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 72 if err != nil { 73 return nil, err 74 } 75 76 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 77 // 2XX 成功,验证应答签名 78 err = wxpay_utility.ValidateResponse( 79 config.WechatPayPublicKeyId(), 80 config.WechatPayPublicKey(), 81 &httpResponse.Header, 82 respBody, 83 ) 84 if err != nil { 85 return nil, err 86 } 87 88 if err := json.Unmarshal(respBody, response); err != nil { 89 return nil, err 90 } 91 92 return response, nil 93 } else { 94 return nil, &wxpay_utility.ApiException{ 95 StatusCode: httpResponse.StatusCode, 96 Header: httpResponse.Header, 97 Body: respBody, 98 } 99 } 100} 101 102type RejectInfo struct { 103 ParamName *string `json:"param_name,omitempty"` 104 RejectReason *string `json:"reject_reason,omitempty"` 105} 106 107type GetMchContactAlterApplymentResponse struct { 108 ApplyId *string `json:"apply_id,omitempty"` 109 OutRequestNo *string `json:"out_request_no,omitempty"` 110 MerchantCode *string `json:"merchant_code,omitempty"` 111 State *ApplymentState `json:"state,omitempty"` 112 AuditRejectReason *string `json:"audit_reject_reason,omitempty"` 113 AuditRejectDetail []RejectInfo `json:"audit_reject_detail,omitempty"` 114} 115 116type ApplymentState string 117 118func (e ApplymentState) Ptr() *ApplymentState { 119 return &e 120} 121 122const ( 123 APPLYMENTSTATE_APPLYMENT_STATE_AUDITING ApplymentState = "APPLYMENT_STATE_AUDITING" 124 APPLYMENTSTATE_APPLYMENT_STATE_REJECTED ApplymentState = "APPLYMENT_STATE_REJECTED" 125 APPLYMENTSTATE_APPLYMENT_STATE_MODIFING ApplymentState = "APPLYMENT_STATE_MODIFING" 126 APPLYMENTSTATE_APPLYMENT_STATE_FINISHED ApplymentState = "APPLYMENT_STATE_FINISHED" 127 APPLYMENTSTATE_APPLYMENT_STATE_CANCELED ApplymentState = "APPLYMENT_STATE_CANCELED" 128) 129 130type GetContactApplymentRequest struct { 131 ApplyId *string `json:"apply_id,omitempty"` 132} 133 134func (o *GetContactApplymentRequest) MarshalJSON() ([]byte, error) { 135 type Alias GetContactApplymentRequest 136 a := &struct { 137 ApplyId *string `json:"apply_id,omitempty"` 138 *Alias 139 }{ 140 // 序列化时移除非 Body 字段 141 ApplyId: nil, 142 Alias: (*Alias)(o), 143 } 144 return json.Marshal(a) 145} 146
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/mchalterapply/mchcontactalterapplyment/20220617143306000013906025001 \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" 5
应答参数
200 OK
apply_id 必填 string(64)
【申请单号】 微信支付分配的申请单号
out_request_no 必填 string(64)
【业务申请编号】 1、只能由数字、字母或下划线组成,建议前缀为服务商商户号。
2、服务商自定义的唯一编号。
merchant_code 必填 string(32)
【微信支付商户号】 本服务商进件、已签约的特约商户/二级商户号。
state 必填 string
【申请单状态】 APPLYMENT_STATE_AUDITING - 审核中,申请单正在审核中。
APPLYMENT_STATE_REJECTED - 已驳回,请按照驳回原因修改申请资料。
APPLYMENT_STATE_MODIFING - 资料修改中,系统修改资料中,请耐心等待。
APPLYMENT_STATE_FINISHED - 已完成,商户资料修改申请已完成。
APPLYMENT_STATE_CANCELED - 已作废,申请单已被撤销。
可选取值
APPLYMENT_STATE_AUDITING
: 申请单正在审核中。APPLYMENT_STATE_REJECTED
: 请按照驳回原因修改申请资料。APPLYMENT_STATE_MODIFING
: 系统修改资料中,请耐心等待。APPLYMENT_STATE_FINISHED
: 商户资料修改申请已完成。APPLYMENT_STATE_CANCELED
: 申请单已被撤销。
audit_reject_reason 选填 string
【总体驳回原因】 总体驳回原因,当申请状态为APPLYMENT_STATE_REJECTED时才返回。
audit_reject_detail 选填 array[object]
【驳回原因详情】 各项资料的审核情况,当申请状态为APPLYMENT_STATE_REJECTED时才返回。
属性 | |
param_name 选填 string(128) 【参数名称】 提交申请单的资料项字段名称。 reject_reason 选填 string(1024) 【驳回原因】 提交资料项被驳回的原因。 |
应答示例
200 OK
1{ 2 "apply_id" : "20220617143306000013906025001", 3 "out_request_no" : "1900013511_10000", 4 "merchant_code" : "1900006491", 5 "state" : "APPLYMENT_STATE_AUDITING", 6 "audit_reject_reason" : "身份证背面识别失败,请上传更清晰的身份证图片。", 7 "audit_reject_detail" : [ 8 { 9 "param_name" : "ubo_info_list.card_number_0", 10 "reject_reason" : "身份证背面识别失败,请上传更清晰的身份证图片。" 11 } 12 ] 13} 14
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |