PHP code example of love-dj / wechatpay-v3
1. Go to this page and download the library: Download love-dj/wechatpay-v3 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/ */
love-dj / wechatpay-v3 example snippets
$options=[
'http' => [
'timeout' => 30.0,
'base_uri' => 'https://api.mch.weixin.qq.com/v3',
'max_retries' => 1,
'retry_delay' => 500,
],
//商户号
'mch_id' => '',
//商户API证书序列号
'serial_no' => '',
//商户私钥
'private_key' => '',
'aes_key' => '',
'redisClient' => null,
'log'=>[
'default' => '',
'channels' => ''
],
// 加密
'encode_params' => [
'id_card_info.id_card_name',
'id_card_info.id_card_number',
'account_info.account_name',
'account_info.account_number',
'contact_info.contact_name',
'contact_info.contact_id_card_number',
'contact_info.mobile_phone',
'contact_info.contact_email',
],
// 解密--根据自己调整字段,可以不传
'decode_params' => [
'account_validation.account_name',
'account_validation.pay_amount',
]
]
$app = new \Love\WeChatPayV3\Factory();
$app = $app->app($options);
$product = $app->transfer;
$outBatchNo=''//订单号
$product->queryByOutBatchNo($outBatchNo);