电商收付通(二级商户进件)开发指引

1. 接口规则

为了在保证支付安全的前提下,带给商户简单、一致且易用的开发体验,我们推出了全新的微信支付APIv3。该版本API的具体规则请参考“APIv3接口规则

2. 开发准备

2.1. 搭建和配置开发环境

为了帮助开发者调用开放接口,我们提供了JAVA、PHP两种语言版本的开发库,封装了签名生成、签名验证、敏感信息加/解密、媒体文件上传等基础功(更多语言版本的开发库将在近期陆续提供

测试步骤

1、根据自身开发语言,选择对应的开发库并构建项目,具体配置请参考下面链接的详细说明:

    • wechatpay-apache-httpclient,适用于使用Apache HttpClient处理HTTP的Java开发者

    • wechatpay-guzzle-middleware,适用于PHP开发者

2、创建加载商户私钥、加载平台证书、初始化httpClient的通用方法


@Before
public void setup() throws IOException {
    // 加载商户私钥(privateKey:私钥字符串)
    PrivateKey merchantPrivateKey = PemUtil
            .loadPrivateKey(new ByteArrayInputStream(privateKey.getBytes("utf-8")));
 
    // 加载平台证书(mchId:商户号,mchSerialNo:商户证书序列号,apiV3Key:V3秘钥)
    AutoUpdateCertificatesVerifier verifier = new AutoUpdateCertificatesVerifier(
            new WechatPay2Credentials(mchId, new PrivateKeySigner(mchSerialNo, merchantPrivateKey)),apiV3Key.getBytes("utf-8"));
 
    // 初始化httpClient
    httpClient = WechatPayHttpClientBuilder.create()
            .withMerchant(mchId, mchSerialNo, merchantPrivateKey)
            .withValidator(new WechatPay2Validator(verifier)).build();
}
 
@After
public void after() throws IOException {
    httpClient.close();
}

use GuzzleHttp\Exception\RequestException;
use WechatPay\GuzzleMiddleware\WechatPayMiddleware;
use WechatPay\GuzzleMiddleware\Util\PemUtil;
use GuzzleHttp\HandlerStack;
 
// 商户相关配置,
$merchantId = '1000100'; // 商户号
$merchantSerialNumber = 'XXXXXXXXXX'; // 商户API证书序列号
$merchantPrivateKey = PemUtil::loadPrivateKey('./path/to/mch/private/key.pem'); // 商户私钥文件路径
 
// 微信支付平台配置
$wechatpayCertificate = PemUtil::loadCertificate('./path/to/wechatpay/cert.pem'); // 微信支付平台证书文件路径
 
// 构造一个WechatPayMiddleware
$wechatpayMiddleware = WechatPayMiddleware::builder()
    ->withMerchant($merchantId, $merchantSerialNumber, $merchantPrivateKey) // 传入商户相关配置
    ->withWechatPay([ $wechatpayCertificate ]) // 可传入多个微信支付平台证书,参数类型为array
    ->build();
 
// 将WechatPayMiddleware添加到Guzzle的HandlerStack中
$stack = GuzzleHttp\HandlerStack::create();
$stack->push($wechatpayMiddleware, 'wechatpay');
 
// 创建Guzzle HTTP Client时,将HandlerStack传入,接下来,正常使用Guzzle发起API请求,WechatPayMiddleware会自动地处理签名和验签
$client = new GuzzleHttp\Client(['handler' => $stack]);

3、基于接口的示例代码,替换请求参数后可发起测试

说明:

• 上面的开发库为微信支付官方开发库,其它没有审核或者控制下的第三方工具和库,微信支付不保证它们的安全性和可靠性

通过包管理工具引入SDK后,可根据下面每个接口的示例代码替换相关参数后进行快速测试

开发者如果想详细了解签名生成、签名验证、敏感信息加/解密、媒体文件上传等常用方法的具体代码实现,可阅读下面的详细说明:

    1.签名生成

    2.签名验证

    3.敏感信息加解密

    4.merchantPrivateKey(私钥)

    5.wechatpayCertificates(平台证书)

    6.APIV3Key(V3 key)

如想更详细的了解我们的接口规则,可查看我们的接口规则指引文档

2.2. 业务开发配置-二级商户进件

1、 电商平台需确认是否已开通电商工具箱,详细可前往电商收付通介绍查看。

2、待进件的二级商户是否符合进件要求,相关要求可以前往电商二级商户入驻介绍查看。


3. 快速接入

3.1. 业务流程图-二级商户进件

重要步骤说明:

步骤一: 电商平台通过请求二级商户进件接口帮助二级商户提交商户进件资料。进件参数中包含了敏感信息参数,此类参数要求进行加密,详见 接口规则

步骤二: 提交进件资料后,电商平台需通过微信支付返回的“微信支付申请单号”和“业务申请编号”来请求查询申请状态API接口查询二级商户进件状态。

步骤三: 进件成功后,若二级商户需修改结算帐号时,电商平台可通过请求修改商户结算账号API接口来帮助二级商户修改账号信息。

步骤四: 电商平台通过请求查询商户结算账号API接口来查询修改情况。

3.2. API接入-二级商户进件

本文档展示了如何使用微信支付服务端 SDK 快速接入电商收付通产品,完成与微信支付对接的部分。

注意:

  • 文档中的代码示例是用来阐述 API 基本使用方法,代码中的示例参数需替换成商户自己账号及请求参数才能跑通。
  • 以下接入步骤仅提供参考,请商户结合自身业务需求进行评估、修改。
3.2.1. 【服务端】二级商户进件申请

步骤说明:电商平台,可使用该接口,帮助其二级商户进件成为微信支付商户。

示例代码

public void Applyments() throws Exception{

  //请求URL
  HttpPost httpPost = new HttpPost("https://api.mch.weixin.qq.com/v3/ecommerce/applyments/");
  // 请求body参数
  String reqdata = "{"
          + "\"organization_type\":\"2\","
          + "\"business_license_info\": {"
          + "\"business_license_copy\":\"47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4\","
          + "\"business_license_number\":\"123456789012345678\","
          + "\"merchant_name\":\"腾讯科技有限公司\","
          + "\"legal_person\":\"张三\""
          + "},"
          + "\"organization_cert_info\": {"
          + "\"organization_copy\":\"47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4\","
          + "\"organization_time\":\"["2014-01-01","长期"]\","
          + "\"organization_number\":\"12345679-A\""
          + "},"
          + "\"id_card_info\": {"
          + "\"id_card_copy\":\"jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ\","
          + "\"id_card_national\":\"47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4\","
          + "\"id_card_name\":\"pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPROvwia4ibL+F6mfjbzQIzfb3HHLEjZ4YiR/cJiCrZxnAqi+pjeKIEdkwzXRAI7FUhrfPK3SNjaBTEu9GmsugMIA9r3x887Q+ODuC8HH2nzAn7NGpE/e3yiHgWhk0ps5k5DP/2qIdGdONoDzZelrxCl/NWWNUyB93K9F+C1JX2IMttdY+aQ6zBlw0xnOiNW6Hzy7UtC+xriudjD5APomty7/mYNxLMpRSvWKIjOv/69bDnuC4EL5Kz4jBHLiCyOb+tI0m2qhZ9evAM+Jv1z0NVa8MRtelw/wDa4SzfeespQO/0kjiwfqdfg==\","
          + "\"id_card_number\":\"UZFETyabYFFlgvGh6R4vTzDELiPas3jC94/srAbSaPaWSM+1rhGLcsybPLeJdVOpCeDxNBMDK+/N0nOiZZ4ka9+5RgzvA2rJx+NztYUbN209rq0Y/NP50T9yk0m6A4xUoFWgk/8qteRHtP5VHahNhSh8nHo31V33t8edSlN9HJG6diRj7p5JPImDyM1q56+p25edl3+cOtuZtj8TJDl/hB+GaWve9X1WUpkZbKlJgBxp+XhaW707k9XrILvfD+rSGTOeU/ev4/OiEb5W4WPGJ+3iLoQvhnz3+aQZX9+gn9uRzWcHu2Kr17fhsM+MRkgVcwzI2UqhR9iuGTunRPRVFg==\","
          + "\"id_card_valid_time\":\"2026-06-06\""
          + "},"
          + "\"need_account_info\":true,"
          + "\"account_info\": {"
          + "\"bank_account_type\":\"74\","
          + "\"account_name\":\"fTA4TXc8yMOwFCYeGPktOOSbOBei3KA8RAMO9h/5Y0ZMR46viedrDurCbQTC/sCC9BWuG5oeR8flymK/Z4dN0/7XDSDfqT5Nggq9WwTL+OZdMorqTE6Z0G3f3Bi3c+GVvYOCZyVdoinksPEUwyosEtwupM3ufXSZT36DvsS8K9jOBnIXjGaQtP94FFlh58WR0GuEkMt9KT2NuA+fE4KDScRzSZn3TL5Izdt+7anPS6Uh4K7wPnUWHGxCQdZu0G4B4YjP7ync8UeLu4jAkCziq4lngnU3rKfFiqwMtyOA179x15za7+kWmo2hfaC7xumTqXR7/NyRHpFKXURQFcmmw==\","
          + "\"account_bank\":\"工商银行\","
          + "\"bank_address_code\":\"110000\","
          + "\"bank_branch_id\":\"402713354941\","
          + "\"bank_name\":\"施秉县农村信用合作联社城关信用社\","
          + "\"account_number\":\"d+xT+MQCvrLHUVDWv/8MR/dB7TkXM2YYZlokmXzFsWs35NXUot7C0NcxIrUF5FnxqCJHkNgKtxa6RxEYyba1+VBRLnqKG2fSy/Y5qDN08Ej9zHCwJjq52Wg1VG8MRugli9YMI1fI83KGBxhuXyemgS/hqFKsfYGiOkJqjTUpgY5VqjtL2N4l4z11T0ECB/aSyVXUysOFGLVfSrUxMPZy6jWWYGvT1+4P633f+R+ki1gT4WF/2KxZOYmli385ZgVhcR30mr4/G3HBcxi13zp7FnEeOsLlvBmI1PHN4C7Rsu3WL8sPndjXTd75kPkyjqnoMRrEEaYQE8ZRGYoeorwC+w==\""
          + "},"
          + "\"contact_info\": {"
          + "\"contact_type\":\"65\","
          + "\"contact_name\":\"pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPROvwia4ibL+F6mfjbzQIzfb3HHLEjZ4YiR/cJiCrZxnAqi+pjeKIEdkwzXRAI7FUhrfPK3SNjaBTEu9GmsugMIA9r3x887Q+ODuC8HH2nzAn7NGpE/e3yiHgWhk0ps5k5DP/2qIdGdONoDzZelrxCl/NWWNUyB93K9F+jC1JX2IMttdY+aQ6zBlw0xnOiNW6Hzy7UtC+xriudjD5APomty7/mYNxLMpRSvWKIjOv/69bDnuC4EL5Kz4jBHLiCyOb+tI0m2qhZ9evAM+Jv1z0NVa8MRtelw/wDa4SzfeespQO/0kjiwfqdfg==\","
          + "\"contact_id_card_number\":\"UZFETyabYFFlgvGh6R4vTzDELiPas3jC94/srAbSaPaWSM+1rhGLcsybPLeJdVOpCeDxNBMDK+/N0nOiZZ4ka9+5RgzvA2rJx+NztYUbN209rq0Y/NP50T9yk0m6A4xUoFWgk/8qteRHtP5VHahNhSh8nHo31V33t8edSlN9HJG6diRj7p5JPImDyM1q56+p25edl3+cOtuZtj8TJDl/hB+GaWve9X1WUpkZbKlJgBxp+XhaW707k9XrILvfD+rSGTOeU/ev4/OiEb5W4WPGJ+3iLoQvhnz3+aQZX9+gn9uRzWcHu2Kr17fhsM+MRkgVcwzI2UqhR9iuGTunRPRVFg==\","
          + "\"mobile_phone\":\"Uy5Hb0c5Se/orEbrWze/ROHu9EPAs/CigDlJ2fnyzC1ppJNBOYGyc89xUgZZoPIRnPWsvJ5oevXNdBK3IUz9WHs9iQKpeUksvoLQMsykc8LDu7MMpayKWNVozldcRugH++MltTBKWTkv/oOcwkZattMGgP4CtpbN6djDK1PcAmIDgdFD2ZvCIDCtJg1V/YafUBJdBTvNLXa/jNzjZaypsUn1BRO6fx8aaNn7XyTv7JrfQZE4UDH4gfMFOj8YDqQ+IvDbkuNhaLZExOEz/UcnxeN5mfGr2MdkPrOzF+xJmUZUn1nafZxENrqcBszhYQUlu5zn6o2uZpBhAsQwd3QAjw==\","
          + "\"contact_email\":\"Uy5Hb0c5Se/orEbrWze/ROHu9EPAs/CigDlJ2fnyzC1ppJNBOYGyc89xUgZZoPIRnPWsvJ5oevXNdBK3IUz9WHs9iQKpeUksvoLQMsykc8LDu7MMpayKWNVozldcRugH++MltTBKWTkv/oOcwkZattMGgP4CtpbN6djDK1PcAmIDgdFD2ZvCIDCtJg1V/YafUBJdBTvNLXa/jNzjZaypsUn1BRO6fx8aaNn7XyTv7JrfQZE4UDH4gfMFOj8YDqQ+IvDbkuNhaLZExOEz/UcnxeN5mfGr2MdkPrOzF+xJmUZUn1nafZxENrqcBszhYQUlu5zn6o2uZpBhAsQwd3QAjw==\""
          + "},"
          + "\"sales_scene_info\": {"
          + "\"store_name\":\"爱烧烤\","
          + "\"store_url\":\"http://www.qq.com\","
          + "\"store_qr_code\":\"jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ\""
          + "},"
          + "\"merchant_shortname\":\"爱烧烤\","
          + "\"out_request_no\":\"APPLYMENT_00000000001\","
          + "\"qualifications\":\"["jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ","47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4"]\","
          + "\"business_addition_pics\":\"["jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ","47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4"]\","
          + "\"business_addition_desc\":\"特殊情况,说明原因\""
          + "}";
  StringEntity entity = new StringEntity(reqdata);
  entity.setContentType("application/json");
  httpPost.setEntity(entity);
  httpPost.setHeader("Accept", "application/json");

  //完成签名并执行请求
  CloseableHttpResponse response = httpClient.execute(httpPost);

  try {
      int statusCode = response.getStatusLine().getStatusCode();
      if (statusCode == 200) { //处理成功
          System.out.println("success,return body = " + EntityUtils.toString(response.getEntity()));
      } else if (statusCode == 204) { //处理成功,无返回Body
          System.out.println("success");
      } else {
          System.out.println("failed,resp code = " + statusCode+ ",return body = " + EntityUtils.toString(response.getEntity()));
          throw new IOException("request failed");
      }
  } finally {
      response.close();
  }
}
  try {
    $resp = $client->request(
        'POST',
        'https://api.mch.weixin.qq.com/v3/ecommerce/applyments/', //请求URL
        [
            // JSON请求体
            'json' => [
                "organization_type" => "2",
                "business_license_info" => [
                    "business_license_copy" => "47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2
XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4",
                    "business_license_number" => "123456789012345678",
                    "merchant_name" => "腾讯科技有限公司",
                    "legal_person" => "张三",
                ],
                "organization_cert_info" => [
                    "organization_copy" => "47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4K
GprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4",
                    "organization_time" => [
                        "0" => "2014-01-01",
                        "1" => "长期",
                    ],
                    "organization_number" => "12345679-A",
                ],
                "id_card_info" => [
                    "id_card_copy" => "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-eh
Euo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ",
                    "id_card_national" => "47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGpr
rKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4",
                    "id_card_name" => "pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPROvwia4ibL+F6mfjb
zQIzfb3HHLEjZ4YiR/cJiCrZxnAqi+pjeKIEdkwzXRAI7FUhr
fPK3SNjaBTEu9GmsugMIA9r3x887Q+ODuC8HH2nzAn7NGpE/e3yiHgWhk0ps5k5DP/2qIdG
dONoDzZelrxCl/NWWNUyB93K9F+jC1JX2IMttdY+aQ6zBlw0
xnOiNW6Hzy7UtC+xriudjD5APomty7/mYNxLMpRSvWKIjOv/69bDnuC4EL5Kz4jBHLiCyOb+t
I0m2qhZ9evAM+Jv1z0NVa8MRtelw/wDa4SzfeespQO/0kjiwfqdfg==",
                    "id_card_number" => "UZFETyabYFFlgvGh6R4vTzDELiPas3jC94/srAbSaPaWSM+1rh
GLcsybPLeJdVOpCeDxNBMDK+/N0nOiZZ4ka9+5RgzvA2rJx+NztYUbN
209rq0Y/NP50T9yk0m6A4xUoFWgk/8qteRHtP5VHahNhSh8nHo31V33t8edSlN9HJG6diRj7
p5JPImDyM1q56+p25edl3+cOtuZtj8TJDl/hB+GaWve9X1WUpkZbKlJgB
xp+XhaW707k9XrILvfD+rSGTOeU/ev4/OiEb5W4WPGJ+3iLoQvhnz3+aQZX9+gn9uRz
WcHu2Kr17fhsM+MRkgVcwzI2UqhR9iuGTunRPRVFg==",
                    "id_card_valid_time" => "2026-06-06",
                ],
                "need_account_info" => true,
                "account_info" => [
                    "bank_account_type" => "74",
                    "account_name" => "fTA4TXc8yMOwFCYeGPktOOSbOBei3KA8RAMO9h/5Y0ZM
R46viedrDurCbQTC/sCC9BWuG5oeR8flymK/Z4dN0/7XDSDfqT5Nggq9WwTL+O
ZdMorqTE6Z0G3f3Bi3c+GVvYOCZyVdoinksPEUwyosEtwupM3ufXSZT36DvsS8K9jOBnI
XjGaQtP94FFlh58WR0GuEkMt9KT2NuA+fE4KDScRzSZn3TL5Izdt+7anPS6
Uh4K7wPnUWHGxCQdZu0G4B4YjP7ync8UeLu4jAkCziq4lngnU3rKfFiqwMtyOA1
79x15za7+kWmo2hfaC7xumTqXR7/NyRHpFKXURQFcmmw==",
                    "account_bank" => "工商银行",
                    "bank_address_code" => "110000",
                    "bank_branch_id" => "402713354941",
                    "bank_name" => "施秉县农村信用合作联社城关信用社",
                    "account_number" => "d+xT+MQCvrLHUVDWv/8MR/dB7TkXM2YYZlokmXzFsWs35NXUot7C0N
cxIrUF5FnxqCJHkNgKtxa6RxEYyba1+VBRLnqKG2fSy/Y5qDN08Ej9zHCwJjq52Wg1VG8MR
ugli9YMI1fI83KGBxhuXyemgS/hqFKsfYGiOkJqjTUpgY5VqjtL2N4l4z11T0E
CB/aSyVXUysOFGLVfSrUxMPZy6jWWYGvT1+4P633f+R+ki1gT4WF/2KxZOYmli38
5ZgVhcR30mr4/G3HBcxi13zp7FnEeOsLlvBmI1PHN4C7Rsu3WL8sPndjXTd75kPkyjqnoMRrEEaYQE8ZRGYoeorwC+w==",
                ],
                "contact_info" => [
                    "contact_type" => "65",
                    "contact_name" => "pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPROvwia4ibL+F6mfjbzQIzfb3HHL
EjZ4YiR/cJiCrZxnAqi+pjeKIEdkwzXRAI7FUhrfPK3SNjaBTEu9GmsugMIA9r3x8
87Q+ODuC8HH2nzAn7NGpE/e3yiHgWhk0ps5k5DP/2qIdGdONoDzZelrxCl/NWWNUyB93K9F+
jC1JX2IMttdY+aQ6zBlw0xnOiNW6Hzy7UtC+xriudjD5APomty7 /mYNxLMpRSvWKIjO
v/69bDnuC4EL5Kz4jBHLiCyOb+tI0m2qhZ9evAM+Jv1z0NVa8MRtelw/wDa4SzfeespQO/0kjiwfqdfg==",
                    "contact_id_card_number" => "UZFETyabYFFlgvGh6R4vTzDELiPas3jC94/srAbSaPa
WSM+1rhGLcsybPLeJdVOpCeDxNBMDK+/N0nOiZZ4ka9+5RgzvA2rJx+NztYUb
N209rq0Y/NP50T9yk0m6A4xUoFWgk/8qteRHtP5VHahNhSh8nHo31V33t8edSlN9HJG6diRj7p
5JPImDyM1q56+p25edl3+cOtuZtj8TJDl/hB+GaWve9X1WUpkZbKlJgBxp+Xha
W707k9XrILvfD+rSGTOeU/ev4/OiEb5W4WPGJ+3iLoQvhnz3+aQZX9+gn9uR
zWcHu2Kr17fhsM+MRkgVcwzI2UqhR9iuGTunRPRVFg==",
                    "mobile_phone" => "Uy5Hb0c5Se/orEbrWze/ROHu9EPAs/CigDlJ2fnyzC1ppJNBOYGyc
89xUgZZoPIRnPWsvJ5oevXNdBK3IUz9WHs9iQKpeUksvoLQMsykc8LDu
7MMpayKWNVozldcRugH++MltTBKWTkv/oOcwkZattMGgP4CtpbN6djDK1PcAmIDgdFD2ZvCIDCtJ
g1V/YafUBJdBTvNLXa/jNzjZaypsUn1BRO6fx8aaNn7XyTv7JrfQZE4
UDH4gfMFOj8YDqQ+IvDbkuNhaLZExOEz/UcnxeN5mfGr2MdkPr
OzF+xJmUZUn1nafZxENrqcBszhYQUlu5zn6o2uZpBhAsQwd3QAjw==",
                    "contact_email" => "Uy5Hb0c5Se/orEbrWze/ROHu9EPAs/CigDlJ2fnyzC1ppJNBOY
Gyc89xUgZZoPIRnPWsvJ5oevXNdBK3IUz9WHs9iQKpeUksvoLQMsykc8LDu7MMpay
KWNVozldcRugH++MltTBKWTkv/oOcwkZattMGgP4CtpbN6djDK1PcAmIDgdFD2ZvCIDCtJg1V
/YafUBJdBTvNLXa/jNzjZaypsUn1BRO6fx8aaNn7XyTv7JrfQZE4UDH4gfMFOj8YD
qQ+IvDbkuNhaLZExOEz/UcnxeN5mfGr2MdkPrOzF+xJmUZUn1nafZxENrqcBszhYQUlu5zn6o2uZpBhAsQwd3QAjw==",
                ],
                "sales_scene_info" => [
                    "store_name" => "爱烧烤",
                    "store_url" => "http://www.qq.com",
                    "store_qr_code" => "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3z
VIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ",
                ],
                "merchant_shortname" => "爱烧烤",
                "out_request_no" => "APPLYMENT_00000000001",
                "qualifications" => [
                    "0" => "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zV
In001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ","47
ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-
4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4",
                ],
                "business_addition_pics" => [
                    "0" => "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_Pv
WkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ","47ZC6
GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4
KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4",
                ],
                "business_addition_desc" => "特殊情况,说明原因",
            ],
            'headers' => [ 'Accept' => 'application/json' ]
        ]
    );
    $statusCode = $resp->getStatusCode();
    if ($statusCode == 200) { //处理成功
        echo "success,return body = " . $resp->getReasonPhrase()."\n";
    } else if ($statusCode == 204) { //处理成功,无返回Body
        echo "success";
    }
} catch (RequestException $e) {
    // 进行错误处理
    echo $e->getMessage()."\n";
    if ($e->hasResponse()) {
        echo "failed,resp code = " . $e->getResponse()->getStatusCode() . " return body = " . $e->getResponse()->getBody() . "\n";
    }
    return;
}

更多参数、响应详情及错误码请参见二级商户进件申请API接口文档

3.2.2.【服务端】查询进件申请状态

步骤说明:电商平台,可使用该接口,帮助其二级商户查询进件状态。

示例代码

public void QueryApplyments() throws Exception{

  //请求URL
  HttpGet httpGet = new HttpGet("https://api.mch.weixin.qq.com/v3/ecommerce/applyments/out-request-no/APPLYMENT_00000000001");
  HttpGet.setHeader("Accept", "application/json");

  //完成签名并执行请求
  CloseableHttpResponse response = httpClient.execute(HttpGet);

  try {
      int statusCode = response.getStatusLine().getStatusCode();
      if (statusCode == 200) { //处理成功
          System.out.println("success,return body = " + EntityUtils.toString(response.getEntity()));
      } else if (statusCode == 204) { //处理成功,无返回Body
          System.out.println("success");
      } else {
          System.out.println("failed,resp code = " + statusCode+ ",return body = " + EntityUtils.toString(response.getEntity()));
          throw new IOException("request failed");
      }
  } finally {
      response.close();
  }
}
try {
    $resp = $client->request(
        'GET',
        'https://api.mch.weixin.qq.com/v3/ecommerce/applyments/out-request-no/APPLYMENT_00000000001', //请求URL
        [
            'headers' => [ 'Accept' => 'application/json']
        ]
    );
    $statusCode = $resp->getStatusCode();
    if ($statusCode == 200) { //处理成功
        echo "success,return body = " . $resp->getReasonPhrase()."\n";
    } else if ($statusCode == 204) { //处理成功,无返回Body
        echo "success";
    }
} catch (RequestException $e) {
    // 进行错误处理
    echo $e->getMessage()."\n";
    if ($e->hasResponse()) {
        echo "failed,resp code = " . $e->getResponse()->getStatusCode() . " return body = " . $e->getResponse()->getBody() . "\n";
    }
    return;
}

更多参数、响应详情及错误码请参见查询进件申请状态API接口文档

3.2.3.【服务端】修改结算帐号

步骤说明:二级商户结算账号错误或者变更,电商平台可通过该接口进行修改。

示例代码

public void UpdataSettlement() throws Exception{

  //请求URL
  HttpPost httpPost = new HttpPost("https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/modify-settlement");
  // 请求body参数
  String reqdata = "{"
          + "\"account_type\":\"ACCOUNT_TYPE_BUSINESS\","
          + "\"account_bank\":\"工商银行\","
          + "\"bank_address_code\":\"110000\","
          + "\"bank_name\":\"施秉县农村信用合作联社城关信用社\","
          + "\"bank_branch_id\":\"402713354941\","
          + "\"account_number\":\"d+xT+MQCvrLHUVDWv/8MR/dB7TkXM2YYZlokmXzFsWs35NXUot7C0NcxIrUF5FnxqCJHkNg
Ktxa6RxEYyba1+VBRLnqKG2fSy/Y5qDN08Ej9zHCwJjq52Wg1VG8MRugli9YMI1fI83KGBxhuXyemgS/hqFKsfYGiO
kJqjTUpgY5VqjtL2N4l4z11T0ECB/aSyVXUysOFGLVfSrUxMPZy6jWWYGvT1+4P633f+R+ki1gT4WF/2KxZOYm
li385ZgVhcR30mr4/G3HBcxi13zp7FnEeOsLlvBmI1PHN4C7Rsu3WL8sPndjXTd75kPkyjqnoMRrEEa
YQE8ZRGYoeorwC+w==\""
          + "}";
  StringEntity entity = new StringEntity(reqdata);
  entity.setContentType("application/json");
  httpPost.setEntity(entity);
  httpPost.setHeader("Accept", "application/json");

  //完成签名并执行请求
  CloseableHttpResponse response = httpClient.execute(httpPost);

  try {
      int statusCode = response.getStatusLine().getStatusCode();
      if (statusCode == 200) { //处理成功
          System.out.println("success,return body = " + EntityUtils.toString(response.getEntity()));
      } else if (statusCode == 204) { //处理成功,无返回Body
          System.out.println("success");
      } else {
          System.out.println("failed,resp code = " + statusCode+ ",return body = " + EntityUtils.toString(response.getEntity()));
          throw new IOException("request failed");
      }
  } finally {
      response.close();
  }
}
try {
    $resp = $client->request(
        'POST',
        'https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/modify-settlement', //请求URL
        [
            // JSON请求体
            'json' => [
                "account_type" => "ACCOUNT_TYPE_BUSINESS",
                "account_bank" => "工商银行",
                "bank_address_code" => "110000",
                "bank_name" => "施秉县农村信用合作联社城关信用社",
                "bank_branch_id" => "402713354941",
                "account_number" => "d+xT+MQCvrLHUVDWv/8MR/dB7TkXM2YYZlokmXzFsWs35NXUot7C0NcxIrUF5FnxqCJHkNg
Ktxa6RxEYyba1+VBRLnqKG2fSy/Y5qDN08Ej9zHCwJjq52Wg1VG8MRugli9YMI1fI83KGBxhuXyemgS/hqFKsfYGiO
kJqjTUpgY5VqjtL2N4l4z11T0ECB/aSyVXUysOFGLVfSrUxMPZy6jWWYGvT1+4P633f+R+ki1gT4WF/2KxZOYm
li385ZgVhcR30mr4/G3HBcxi13zp7FnEeOsLlvBmI1PHN4C7Rsu3WL8sPndjXTd75kPkyjqnoMRrEEa
YQE8ZRGYoeorwC+w==",
            ],
            'headers' => [ 'Accept' => 'application/json' ]
        ]
    );
    $statusCode = $resp->getStatusCode();
    if ($statusCode == 200) { //处理成功
        echo "success,return body = " . $resp->getReasonPhrase()."\n";
    } else if ($statusCode == 204) { //处理成功,无返回Body
        echo "success";
    }
} catch (RequestException $e) {
    // 进行错误处理
    echo $e->getMessage()."\n";
    if ($e->hasResponse()) {
        echo "failed,resp code = " . $e->getResponse()->getStatusCode() . " return body = " . $e->getResponse()->getBody() . "\n";
    }
    return;
}

更多参数、响应详情及错误码请参见修改结算账号API接口文档

3.2.4. 【服务端】查询结算账号

步骤说明:电商平台可使用该接口,帮助其二级商户查询结算账号。

示例代码

public void GetSettlement() throws Exception{

  //请求URL
  HttpGet httpGet = new HttpGet("https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/1900006491/settlement");
  HttpGet.setHeader("Accept", "application/json");

  //完成签名并执行请求
  CloseableHttpResponse response = httpClient.execute(HttpGet);

  try {
      int statusCode = response.getStatusLine().getStatusCode();
      if (statusCode == 200) { //处理成功
          System.out.println("success,return body = " + EntityUtils.toString(response.getEntity()));
      } else if (statusCode == 204) { //处理成功,无返回Body
          System.out.println("success");
      } else {
          System.out.println("failed,resp code = " + statusCode+ ",return body = " + EntityUtils.toString(response.getEntity()));
          throw new IOException("request failed");
      }
  } finally {
      response.close();
  }
}
try {
    $resp = $client->request(
        'GET',
        'https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/1900006491/settlement', //请求URL
        [
            'headers' => [ 'Accept' => 'application/json']
        ]
    );
    $statusCode = $resp->getStatusCode();
    if ($statusCode == 200) { //处理成功
        echo "success,return body = " . $resp->getReasonPhrase()."\n";
    } else if ($statusCode == 204) { //处理成功,无返回Body
        echo "success";
    }
} catch (RequestException $e) {
    // 进行错误处理
    echo $e->getMessage()."\n";
    if ($e->hasResponse()) {
        echo "failed,resp code = " . $e->getResponse()->getStatusCode() . " return body = " . $e->getResponse()->getBody() . "\n";
    }
    return;
}

更多参数、响应详情及错误码请参见查询结算账号API接口文档


4. 常见问题

Q:电商收付通进件调用“二级商户进件接口”返回:贵司涉及保险业务并提供《经营保险业务许可证》/《保险业务法人等级证书》等,其他公司提供相关资质

A:返回这个报错,请求参数中请上传“特殊资质(qualifications)”字段

Q:电商收付通进件调用“查询进件申请状态接口”没有返回“法人验证链接legal_validation_url”

A:主体类型为“党政、机关及事业单位 /其他组织”时,只能汇款验证,是不会返回法人验证链接的。接入流程说明文档中的第4点也有说明

Q:电商收付通进件“查询申请状态接口”:开户状态为“已冻结”是在什么情况下出现? 开户成功之后会出现冻结情况吗

A:申请状态“已冻结”是审核人员认为有风险时候,会冻结。开户成功后,基本不会出现“已冻结”

Q:电商收付通进件调用“二级商户进件接口”返回:商户简称取值有误,你输入的商户简称称涉及敏感字段,不符合相关规定,请检查后重新输入

A:参数merchant_shortname命中敏感字段,请更换一个新的简称重新提交

Q:电商收付通进件调用“二级商户进件接口”返回:身份证结束日期有误,结束日期必须晚于当前60天

A:参数id_card_valid_time错误,请严格按照文档要求传参,这个参数的规则如下:

1)请填写身份证有效期的结束时间,注意参照示例中的格式

2)若证件有效期为长期,请填写:长期

3)证件有效期需大于60天



技术咨询

反馈有奖