微信支付V3示例代码相关问题
1、通过下面命令安装
composer require wechatpay/wechatpay
2、需要手动修改代码
在\vendor\wechatpay\wechatpay\src\ClientJsonTrait.php文件大概222行加个!
if (!array_key_exists($config['serial'], $config['certs'])) {
throw new Exception\InvalidArgumentException(sprintf(
Exception\ERR_INIT_CERTS_EXCLUDE_MCHSERIAL, implode(',', array_keys($config['certs'])), $config['serial']
));
}
3、Native支付下单示例不知为啥总是报错
Cannot found the serial(`61520B383*******B274DE9463F130`)'s configuration, which's from the response(header:Wechatpay-Serial), your's 708D0B7D*****
但其实是成功的,最后在try catch里才能获取到
catch (\Exception $e) {
// 进行错误处理
echo $e->getMessage(), PHP_EOL;
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$r = $e->getResponse();
echo $r->getStatusCode() . ' ' . $r->getReasonPhrase(), PHP_EOL;
echo $r->getBody(), PHP_EOL, PHP_EOL, PHP_EOL;
}
echo $e->getTraceAsString(), PHP_EOL;
}
上面的问题3不知哪位大神指点下