2023-03-02 18:24:40 +08:00

45 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Extend\Wechat;
/**
* 微信支付类
*/
class WechatPay
{
protected $app;
// 创建工厂类
public function createApp(){
$config = [
'mch_id' => config("we_chat.pay.mch_id"),
// 商户证书
'private_key' => __DIR__ . '/certs/1636644248/apiclient_key.pem',
'certificate' => __DIR__ . '/certs/1636644248/apiclient_cert.pem',
// v3 API 秘钥
'secret_key' => config("we_chat.pay.v3_api_secret"),
// v2 API 秘钥
'v2_secret_key' => '',
// 平台证书:微信支付 APIv3 平台证书,需要使用工具下载
// 下载工具https://github.com/wechatpay-apiv3/CertificateDownloader
'platform_certs' => [
// 请使用绝对路径
__DIR__ . '/certs/wechatpay_112FCCD1B9ECC8292703AB7363C73D74B6AFDC1A.pem',
],
/**
* 接口请求相关配置,超时时间等,具体可用参数请参考:
* https://github.com/symfony/symfony/blob/5.3/src/Symfony/Contracts/HttpClient/HttpClientInterface.php
*/
'http' => [
'throw' => false, // 状态码非 200、300 时是否抛出异常,默认为开启
'timeout' => 5.0,
// 'base_uri' => 'https://api.mch.weixin.qq.com/', // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
],
];
}
}