1、第一次需要先用工具下载证书
用微信官网推荐的工具下载:https://github.com/wechatpay-apiv3/wechatpay-php/tree/main/bin
2、配置easyWeChat 6.x,请求证书
use EasyWeChat\Pay\Application;
$config = [
'mch_id' => '',
// 商户证书
'private_key' => __DIR__ . '/certs/apiclient_key.pem',
'certificate' => __DIR__ . '/certs/apiclient_cert.pem',
// v3 API 秘钥
'secret_key' => '32二位密钥',
'platform_certs' => [
'/path/to/wechatpay/cert.pem',
],
'http' => [
'throw' => true,
'timeout' => 5.0,
],
];
$app = new Application($config);
$api = $app->getClient();
$response