PHP code example of ledc / wechat-custom-declare

1. Go to this page and download the library: Download ledc/wechat-custom-declare library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ledc / wechat-custom-declare example snippets


use Ledc\WechatPayProfitSharing\Config;
use Ledc\WechatCustomDeclare\WechatCustom;

$config = [
    'mch_id' => 1360649000,
    'appid' => 1360649000,

    // 商户证书
    'private_key' => __DIR__ . '/certs/apiclient_key.pem',
    'certificate' => __DIR__ . '/certs/apiclient_cert.pem',

     // v3 API 秘钥
    'secret_key' => '43A03299A3C3FED3D8CE7B820Fxxxxx',

    // v2 API 秘钥
    'v2_secret_key' => '26db3e15cfedb44abfbb5fe94fxxxxx',

    // 平台证书:微信支付 APIv3 平台证书,需要使用工具下载
    // 下载工具:https://github.com/wechatpay-apiv3/CertificateDownloader
    'platform_certs' => [
        // 请使用绝对路径
        // '/path/to/wechatpay/cert.pem',
    ],
];

$wechatCustom = new WechatCustom(new Config($config));

// 订单附加信息提交接口
$wechatCustom->order();
// 订单附加信息查询接口
$wechatCustom->query();
// 订单附加信息重推接口
$wechatCustom->redeclare();