查询子商户强化尽调单信息
更新时间:2025.07.18查询子商户强化尽调单信息
接口说明
支持商户:【平台商户】
请求方式:【GET】/v3/mch-operation-manage/enhanced-due-diligence/{due_diligence_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
path 路径参数
due_diligence_id 必填 string(128)
【尽调单号】 尽调单的单号,从产品中心-支付拓展工具-合作伙伴订阅通知中得到。
query 查询参数
sub_mchid 必填 string(32)
【子商户号】 子商户的商户号
请求示例
需配合微信支付工具库 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 QueryEnhanceDueDiligence { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/mch-operation-manage/enhanced-due-diligence/{due_diligence_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 QueryEnhanceDueDiligence client = new QueryEnhanceDueDiligence( 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 QueryEnhanceDueDiligenceRequest request = new QueryEnhanceDueDiligenceRequest(); 41 request.dueDiligenceId = "123000110_2_2190381dakdajois1283i12jo"; 42 request.subMchid = "123000110"; 43 try { 44 EnhancedDueDiligence response = client.run(request); 45 46 // TODO: 请求成功,继续业务逻辑 47 System.out.println(response); 48 } catch (WXPayUtility.ApiException e) { 49 // TODO: 请求失败,根据状态码执行不同的逻辑 50 e.printStackTrace(); 51 } 52 } 53 54 public EnhancedDueDiligence run(QueryEnhanceDueDiligenceRequest request) { 55 String uri = PATH; 56 uri = uri.replace("{due_diligence_id}", WXPayUtility.urlEncode(request.dueDiligenceId)); 57 Map<String, Object> args = new HashMap<>(); 58 args.put("sub_mchid", request.subMchid); 59 uri = uri + "?" + WXPayUtility.urlEncode(args); 60 61 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 62 reqBuilder.addHeader("Accept", "application/json"); 63 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 64 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 65 reqBuilder.method(METHOD, null); 66 Request httpRequest = reqBuilder.build(); 67 68 // 发送HTTP请求 69 OkHttpClient client = new OkHttpClient.Builder().build(); 70 try (Response httpResponse = client.newCall(httpRequest).execute()) { 71 String respBody = WXPayUtility.extractBody(httpResponse); 72 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 73 // 2XX 成功,验证应答签名 74 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 75 httpResponse.headers(), respBody); 76 77 // 从HTTP应答报文构建返回数据 78 return WXPayUtility.fromJson(respBody, EnhancedDueDiligence.class); 79 } else { 80 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 81 } 82 } catch (IOException e) { 83 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 84 } 85 } 86 87 private final String mchid; 88 private final String certificateSerialNo; 89 private final PrivateKey privateKey; 90 private final String wechatPayPublicKeyId; 91 private final PublicKey wechatPayPublicKey; 92 93 public QueryEnhanceDueDiligence(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 94 this.mchid = mchid; 95 this.certificateSerialNo = certificateSerialNo; 96 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 97 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 98 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 99 } 100 101 public static class QueryEnhanceDueDiligenceRequest { 102 @SerializedName("sub_mchid") 103 @Expose(serialize = false) 104 public String subMchid; 105 106 @SerializedName("due_diligence_id") 107 @Expose(serialize = false) 108 public String dueDiligenceId; 109 } 110 111 public static class EnhancedDueDiligence { 112 @SerializedName("due_diligence_id") 113 public String dueDiligenceId; 114 115 @SerializedName("sub_mchid") 116 public String subMchid; 117 118 @SerializedName("due_diligence_state") 119 public EnumTypeDueDiligenceState dueDiligenceState; 120 121 @SerializedName("reject_reason") 122 public String rejectReason; 123 124 @SerializedName("deadline_time") 125 public String deadlineTime; 126 127 @SerializedName("terminal_time") 128 public String terminalTime; 129 130 @SerializedName("submit_time") 131 public String submitTime; 132 133 @SerializedName("reject_time") 134 public String rejectTime; 135 136 @SerializedName("complete_time") 137 public String completeTime; 138 139 @SerializedName("submission_template") 140 public String submissionTemplate; 141 142 @SerializedName("submission_data") 143 public String submissionData; 144 } 145 146 public enum EnumTypeDueDiligenceState { 147 @SerializedName("DUE_DILIGENCE_STATE_COLLECTING") 148 DUE_DILIGENCE_STATE_COLLECTING, 149 @SerializedName("DUE_DILIGENCE_STATE_AUDITING") 150 DUE_DILIGENCE_STATE_AUDITING, 151 @SerializedName("DUE_DILIGENCE_STATE_REJECTED") 152 DUE_DILIGENCE_STATE_REJECTED, 153 @SerializedName("DUE_DILIGENCE_STATE_EXPIRED") 154 DUE_DILIGENCE_STATE_EXPIRED, 155 @SerializedName("DUE_DILIGENCE_STATE_CANCELLED") 156 DUE_DILIGENCE_STATE_CANCELLED, 157 @SerializedName("DUE_DILIGENCE_STATE_FINISHED") 158 DUE_DILIGENCE_STATE_FINISHED 159 } 160 161} 162
需配合微信支付工具库 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 := &QueryEnhanceDueDiligenceRequest{ 28 SubMchid: wxpay_utility.String("123000110"), 29 DueDiligenceId: wxpay_utility.String("123000110_2_2190381dakdajois1283i12jo"), 30 } 31 32 response, err := QueryEnhanceDueDiligence(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 QueryEnhanceDueDiligence(config *wxpay_utility.MchConfig, request *QueryEnhanceDueDiligenceRequest) (response *EnhancedDueDiligence, err error) { 44 const ( 45 host = "https://api.mch.weixin.qq.com" 46 method = "GET" 47 path = "/v3/mch-operation-manage/enhanced-due-diligence/{due_diligence_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, "{due_diligence_id}", url.PathEscape(*request.DueDiligenceId), -1) 55 query := reqUrl.Query() 56 query.Add("sub_mchid", *request.SubMchid) 57 reqUrl.RawQuery = query.Encode() 58 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 59 if err != nil { 60 return nil, err 61 } 62 httpRequest.Header.Set("Accept", "application/json") 63 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 64 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 65 if err != nil { 66 return nil, err 67 } 68 httpRequest.Header.Set("Authorization", authorization) 69 70 client := &http.Client{} 71 httpResponse, err := client.Do(httpRequest) 72 if err != nil { 73 return nil, err 74 } 75 76 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 77 if err != nil { 78 return nil, err 79 } 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 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 QueryEnhanceDueDiligenceRequest struct { 108 SubMchid *string `json:"sub_mchid,omitempty"` 109 DueDiligenceId *string `json:"due_diligence_id,omitempty"` 110} 111 112func (o *QueryEnhanceDueDiligenceRequest) MarshalJSON() ([]byte, error) { 113 type Alias QueryEnhanceDueDiligenceRequest 114 a := &struct { 115 SubMchid *string `json:"sub_mchid,omitempty"` 116 DueDiligenceId *string `json:"due_diligence_id,omitempty"` 117 *Alias 118 }{ 119 // 序列化时移除非 Body 字段 120 SubMchid: nil, 121 DueDiligenceId: nil, 122 Alias: (*Alias)(o), 123 } 124 return json.Marshal(a) 125} 126 127type EnhancedDueDiligence struct { 128 DueDiligenceId *string `json:"due_diligence_id,omitempty"` 129 SubMchid *string `json:"sub_mchid,omitempty"` 130 DueDiligenceState *EnumTypeDueDiligenceState `json:"due_diligence_state,omitempty"` 131 RejectReason *string `json:"reject_reason,omitempty"` 132 DeadlineTime *time.Time `json:"deadline_time,omitempty"` 133 TerminalTime *time.Time `json:"terminal_time,omitempty"` 134 SubmitTime *time.Time `json:"submit_time,omitempty"` 135 RejectTime *time.Time `json:"reject_time,omitempty"` 136 CompleteTime *time.Time `json:"complete_time,omitempty"` 137 SubmissionTemplate *string `json:"submission_template,omitempty"` 138 SubmissionData *string `json:"submission_data,omitempty"` 139} 140 141type EnumTypeDueDiligenceState string 142 143func (e EnumTypeDueDiligenceState) Ptr() *EnumTypeDueDiligenceState { 144 return &e 145} 146 147const ( 148 ENUMTYPEDUEDILIGENCESTATE_DUE_DILIGENCE_STATE_COLLECTING EnumTypeDueDiligenceState = "DUE_DILIGENCE_STATE_COLLECTING" 149 ENUMTYPEDUEDILIGENCESTATE_DUE_DILIGENCE_STATE_AUDITING EnumTypeDueDiligenceState = "DUE_DILIGENCE_STATE_AUDITING" 150 ENUMTYPEDUEDILIGENCESTATE_DUE_DILIGENCE_STATE_REJECTED EnumTypeDueDiligenceState = "DUE_DILIGENCE_STATE_REJECTED" 151 ENUMTYPEDUEDILIGENCESTATE_DUE_DILIGENCE_STATE_EXPIRED EnumTypeDueDiligenceState = "DUE_DILIGENCE_STATE_EXPIRED" 152 ENUMTYPEDUEDILIGENCESTATE_DUE_DILIGENCE_STATE_CANCELLED EnumTypeDueDiligenceState = "DUE_DILIGENCE_STATE_CANCELLED" 153 ENUMTYPEDUEDILIGENCESTATE_DUE_DILIGENCE_STATE_FINISHED EnumTypeDueDiligenceState = "DUE_DILIGENCE_STATE_FINISHED" 154) 155
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/mch-operation-manage/enhanced-due-diligence/123000110_2_2190381dakdajois1283i12jo?sub_mchid=123000110 \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" 5
应答参数
200 OK
due_diligence_id 必填 string(128)
【尽调单号】 尽调单的单号。
sub_mchid 必填 string
【子商户号】 子商户的商户号
due_diligence_state 必填 string
【尽调单状态】 当前尽调单据所处状态。
状态扭转可以参考:商户尽职调查开发指引
可选取值
DUE_DILIGENCE_STATE_COLLECTING
: 待填写DUE_DILIGENCE_STATE_AUDITING
: 审核中DUE_DILIGENCE_STATE_REJECTED
: 已驳回DUE_DILIGENCE_STATE_EXPIRED
: 已过期DUE_DILIGENCE_STATE_CANCELLED
: 已终止DUE_DILIGENCE_STATE_FINISHED
: 已完成
reject_reason 选填 string(65536)
【驳回原因】 尽调审核驳回的原因,状态为驳回时会返回
deadline_time 必填 string
【截止时间】 尽调单填写的截止时间,遵循rfc3339标准格式:yyyy-MM-DDThh:mm:ss+TIMEZONE
terminal_time 选填 string
【终止时间】 尽调单被终止的时间,终止后返回,遵循rfc3339标准格式:yyyy-MM-DDThh:mm:ss+TIMEZONE
submit_time 选填 string
【提交时间】 提交尽调材料的时间,提交后返回,遵循rfc3339标准格式:yyyy-MM-DDThh:mm:ss+TIMEZONE
reject_time 选填 string
【驳回时间】 尽调单审核驳回的时间,驳回后返回,遵循rfc3339标准格式:yyyy-MM-DDThh:mm:ss+TIMEZONE
complete_time 选填 string
【完成时间】 完成尽调的时间,完成后返回,时间使用rfc3339所定义的格式,时区使用北京时间(+08:00)。
submission_template 必填 string(65536)
【尽调要求提交的资料】 要求商户提交的尽调资料,JSON 序列化后的字符串。
对于资料的说明,可以参考商户尽职调查开发指引
submission_data 选填 string(65536)
【尽调已经提交的资料】 已经提交的资料,仅审核中、审核驳回时返回
应答示例
200 OK
1{ 2 "due_diligence_id" : "1230dasda0011022190381dakdajois1283i12jo", 3 "sub_mchid" : "123000110", 4 "due_diligence_state" : "DUE_DILIGENCE_STATE_COLLECTING", 5 "reject_reason" : "{ \"audit_detail_by_item\": [ { \"item_id\": 130002, \"audit_result\": 2, \"reject_reason_to_merchant\": \"请将《营业执照》上传至营业执照影印件处,并根据上传证件填写相关信息\" }, { \"item_id\": 130005, \"audit_result\": 2, \"reject_reason_to_merchant\": \"1.请填写营业执照有效期开始时间;2.有效期开始日期填写有误,请填写与营业执照上一致的日期,如影印件上无开始日期请填写成立日期/注册日期\" }, { \"item_id\": 130006, \"audit_result\": 2, \"reject_reason_to_merchant\": \"1.请填写营业执照有效期结束时间;2.有效期结束日期填写有误,请填写与营业执照上一致的日期,如影印件上无结束日期请填写“长期”\" } ] }", 6 "deadline_time" : "2024-11-28T13:08:04+08:00", 7 "terminal_time" : "2024-11-28T13:08:04+08:00", 8 "submit_time" : "2024-11-28T13:08:04+08:00", 9 "reject_time" : "2024-11-28T13:08:04+08:00", 10 "complete_time" : "2024-11-28T13:08:04+08:00", 11 "submission_template" : "{ \"record_fields\": [ { \"item_id\": 130020, \"field_name\": \"ubo1_certificate_type\", \"name\": \"UBO1证件类型\", \"type\": 11, \"field_data\": \"\", \"tips\": \"\", \"required\": 1, \"use_permanently_date\": 0, \"check_rule\": { \"min_length\": 0, \"max_length\": 0, \"enum_keys\": [ \"68\", \"2416\", \"2417\", \"2418\", \"69\", \"2530\", \"2531\", \"2532\" ], \"enum_values\": [ \"身份证(中国大陆居民)\", \"来往内地通行证(中国香港居民)\", \"来往内地通行证(中国澳门居民)\", \"来往大陆通行证(中国台湾居民)\", \"护照(其他国家或地区居民)\", \"外国人居留证\", \"港澳居住证\", \"台湾居住证\" ] }, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\", \"need_encrypt\": false }, { \"item_id\": 130023, \"field_name\": \"ubo1_name\", \"name\": \"UBO1证件姓名\", \"type\": 1, \"field_data\": \"\", \"tips\": \"\", \"required\": 1, \"use_permanently_date\": 0, \"check_rule\": { \"min_length\": 2, \"max_length\": 100, \"max_file_size\": 0 }, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"请填写\", \"tooltip\": \"\", \"need_encrypt\": true }, { \"item_id\": 130068, \"field_name\": \"account_opening_purpose\", \"name\": \"开户目的\", \"type\": 11, \"field_data\": \"\", \"tips\": \"\", \"required\": 1, \"use_permanently_date\": 0, \"check_rule\": { \"min_length\": 1, \"max_length\": 5, \"enum_keys\": [ \"1\", \"3\", \"4\", \"5\", \"6\" ], \"enum_values\": [ \"使用收款功能,收取日常营业款项\", \"使用企业付款功能,付款给用户、雇员或合作伙伴\", \"使用分账功能,分账给服务商、合作伙伴\", \"使用分账功能,收取佣金、服务费、交易款等\", \"其他\" ], \"max_file_size\": 0 }, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\", \"need_encrypt\": false } ] }", 12 "submission_data" : "[ { \"item_id\": 130020, \"field_name\": \"ubo1_certificate_type\", \"name\": \"UBO1证件类型\", \"type\": 11, \"field_data\": \"68\", \"tips\": \"\", \"required\": 0, \"use_permanently_date\": 0, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\" }, { \"item_id\": 130021, \"field_name\": \"ubo1_front_photo\", \"name\": \"UBO1证件正面照片\", \"type\": 2, \"field_data\": \"V1_ld15ofRa7wJl6tkue-mCkB5HW7lfD2HZebch3ZVVmHUbqXDOhEw\", \"tips\": \"\", \"required\": 0, \"use_permanently_date\": 0, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\" }, { \"item_id\": 130022, \"field_name\": \"ubo1_back_photo\", \"name\": \"UBO1证件反面照片\", \"type\": 2, \"field_data\": \"V1_ld15ofRa7wJl6tkue-mCkB5HW7lfD2HZebch3ZVVmHUbqXDOhEwxD\", \"tips\": \"\", \"required\": 0, \"use_permanently_date\": 0, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\" }, { \"item_id\": 130023, \"field_name\": \"ubo1_name\", \"name\": \"UBO1证件姓名\", \"type\": 1, \"field_data\": \"123\", \"tips\": \"\", \"required\": 0, \"use_permanently_date\": 0, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\" }, { \"item_id\": 130024, \"field_name\": \"ubo1_certificate_number\", \"name\": \"UBO1证件号码\", \"type\": 1, \"field_data\": \"1222222222\", \"tips\": \"\", \"required\": 0, \"use_permanently_date\": 0, \"disabled\": 0, \"hidden\": 0, \"placeholder\": \"\", \"tooltip\": \"\" } ]" 13} 14
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
业务错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
404 | NOT_FOUND | 强化尽调单号不存在 | 确认尽调单号 |
500 | SYSTEM_ERROR | 系统错误 | 系统错误,请联系微信支付人员 |