申请企业商户企业支付出资凭证

更新时间:2025.05.09

申请企业商户企业支付出资凭证。该接口允许服务商为指定出资子商户申请特定日期范围内的企业支付出资凭证,便于企业财务记账和报销管理。出资凭证包含企业支付交易的详细信息,可用于财务核对和税务申报。

接口说明

支持商户:【普通服务商】

请求方式:【POST】/v3/webizpay/bill/proof

请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点

     【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看

请求参数

Header  HTTP头参数

 Authorization  必填 string

请参考签名认证生成认证信息


 Accept  必填 string

请设置为application/json


 Content-Type  必填 string

请设置为application/json


body  包体参数

 sp_mchid  必填   string(32)

【服务商商户号】 是由微信支付系统生成并分配给每个服务商的唯一标识符,具体请参考服务商模式开发必要参数说明


 sub_mchid  必填   string(32)

【出资子商户号】 由服务商为子商户进件后获取,具体请参考服务商模式开发必要参数说明


 start_date  必填   string

【起始日期】 起始日期 格式yyyy-MM-DD,仅支持三个月内的账单下载申请。


 end_date  必填   string

【结束日期】 结束日期 格式yyyy-MM-DD,仅支持三个月内的账单下载申请。


 entity_name  选填   string(256)

【商户主体名称】 商户主体名称,传入指定商户主体名称时,则仅下载该主体下所有收单商户的企业支付订单,方便企业找对应收单商户开具发票


 out_operation_id  必填   string(32)

【商户操作流水号】 商户操作流水号,要求6-32个字符内,只能是数字、大小写字母_-|* 且在同一个商户号下唯一。

请求示例

Java
Go
curl

需配合微信支付工具库 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 ApplyProof {
26  private static String HOST = "https://api.mch.weixin.qq.com";
27  private static String METHOD = "POST";
28  private static String PATH = "/v3/webizpay/bill/proof";
29
30  public static void main(String[] args) {
31    // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340
32    ApplyProof client = new ApplyProof(
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    StoreApplyProofRequest request = new StoreApplyProofRequest();
41    request.spMchid = "12341234";
42    request.subMchid = "43214321";
43    request.startDate = "2025-04-23";
44    request.endDate = "2025-04-23";
45    request.entityName = "某某科技有限公司";
46    request.outOperationId = "operation12345678";
47    try {
48      StoreApplyProofResponse response = client.run(request);
49
50      // TODO: 请求成功,继续业务逻辑
51      System.out.println(response);
52    } catch (WXPayUtility.ApiException e) {
53      // TODO: 请求失败,根据状态码执行不同的逻辑
54      e.printStackTrace();
55    }
56  }
57
58  public StoreApplyProofResponse run(StoreApplyProofRequest request) {
59    String uri = PATH;
60    String reqBody = WXPayUtility.toJson(request);
61
62    Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
63    reqBuilder.addHeader("Accept", "application/json");
64    reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId);
65    reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody));
66    reqBuilder.addHeader("Content-Type", "application/json");
67    RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody);
68    reqBuilder.method(METHOD, requestBody);
69    Request httpRequest = reqBuilder.build();
70
71    // 发送HTTP请求
72    OkHttpClient client = new OkHttpClient.Builder().build();
73    try (Response httpResponse = client.newCall(httpRequest).execute()) {
74      String respBody = WXPayUtility.extractBody(httpResponse);
75      if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
76        // 2XX 成功,验证应答签名
77        WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey,
78            httpResponse.headers(), respBody);
79
80        // 从HTTP应答报文构建返回数据
81        return WXPayUtility.fromJson(respBody, StoreApplyProofResponse.class);
82      } else {
83        throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
84      }
85    } catch (IOException e) {
86      throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
87    }
88  }
89
90  private final String mchid;
91  private final String certificateSerialNo;
92  private final PrivateKey privateKey;
93  private final String wechatPayPublicKeyId;
94  private final PublicKey wechatPayPublicKey;
95
96  public ApplyProof(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) {
97    this.mchid = mchid;
98    this.certificateSerialNo = certificateSerialNo;
99    this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath);
100    this.wechatPayPublicKeyId = wechatPayPublicKeyId;
101    this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath);
102  }
103
104  public static class StoreApplyProofRequest {
105    @SerializedName("sp_mchid")
106    public String spMchid;
107  
108    @SerializedName("sub_mchid")
109    public String subMchid;
110  
111    @SerializedName("start_date")
112    public String startDate;
113  
114    @SerializedName("end_date")
115    public String endDate;
116  
117    @SerializedName("entity_name")
118    public String entityName;
119  
120    @SerializedName("out_operation_id")
121    public String outOperationId;
122  }
123  
124  public static class StoreApplyProofResponse {
125    @SerializedName("sp_mchid")
126    public String spMchid;
127  
128    @SerializedName("out_operation_id")
129    public String outOperationId;
130  
131    @SerializedName("operation_id")
132    public String operationId;
133  
134    @SerializedName("sub_mchid")
135    public String subMchid;
136  
137    @SerializedName("start_date")
138    public String startDate;
139  
140    @SerializedName("end_date")
141    public String endDate;
142  
143    @SerializedName("entity_name")
144    public String entityName;
145  
146    @SerializedName("proof_id")
147    public String proofId;
148  
149    @SerializedName("download_url")
150    public String downloadUrl;
151  
152    @SerializedName("created_time")
153    public String createdTime;
154  
155    @SerializedName("updated_time")
156    public String updatedTime;
157  }
158  
159}
160

应答参数

200 OK

 sp_mchid  必填   string(32)

【服务商商户号】 服务商商户号


 out_operation_id  必填   string(32)

【商户操作流水号】 商户操作流水号,由商户发起本次请求时传入


 operation_id  必填   string(32)

【微信支付操作流水号】 微信支付操作流水号,微信支付系统唯一标识一次响应,在微信支付下唯一


 sub_mchid  必填   string(32)

【出资子商户号】 出资子商户号


 start_date  必填   string

【起始日期 】 起始日期 格式yyyy-MM-DD


 end_date  必填   string

【结束日期】 结束日期 格式yyyy-MM-DD


 entity_name  必填   string

【商户主体名称】 商户主体名称


 proof_id  必填   string

【出资凭证申请单单号】 出资凭证申请单单号


 download_url  必填   string(256)

【凭证下载地址】 凭证下载地址,地址5分钟内有效


 created_time  必填   string

【凭证申请创建时间】 凭证申请创建时间,表示商户发起凭证申请的时间。

遵循rfc3339标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONEyyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。

示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。


 updated_time  必填   string

【凭证状态更新时间】 凭证状态更新时间,表示微信支付处理凭证时最后更新时间。

遵循rfc3339标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONEyyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。

示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。

应答示例

200 OK

1{
2  "sp_mchid" : "12341234",
3  "out_operation_id" : "operation12345678",
4  "operation_id" : "1030000071201xxxxx",
5  "sub_mchid" : "43214321",
6  "start_date" : "2025-04-23",
7  "end_date" : "2025-04-23",
8  "entity_name" : "某某科技有限公司",
9  "proof_id" : "proof12345678",
10  "download_url" : "https://api.mch.weixin.qq.com/v3/billdownload/file?token=xxx",
11  "created_time" : "2023-06-08T10:34:56+08:00",
12  "updated_time" : "2023-06-08T10:34:56+08:00"
13}
14

 

错误码

公共错误码

状态码

错误码

描述

解决方案

400

PARAM_ERROR

参数错误

请根据错误提示正确传入参数

400

INVALID_REQUEST

HTTP 请求不符合微信支付 APIv3 接口规则

请参阅 接口规则

401

SIGN_ERROR

验证不通过

请参阅 签名常见问题

500

SYSTEM_ERROR

系统异常,请稍后重试

请稍后重试

 

 

更多技术问题
技术咨询
反馈
咨询
目录
置顶