收藏
回答

微信支付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不知哪位大神指点下



回答关注问题邀请回答
收藏

1 个回答

  • 花生o0O🍊
    花生o0O🍊
    2022-08-26
    Cannot found the serial(`61520B383*******B274DE9463F130`)'s configuration, w
    hich's from the response(header:Wechatpay-Serial), your's 708D0B7D*****
    y意思是接口返回的证书序列号和你发起请求的不一样。原因是微信更新证书了。调用下更新证书的接口把本地平台证书更新下。其实不影响,只是说你本地没办法校验微信返回的数据是否正确。
    


    2022-08-26
    有用
    回复
登录 后发表内容