The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information."
而且文档https://gitee.com/TheNorthMemory/wechatpay-php/blob/v1.1/README.md中说的用
'mchid' => '1900000109',// 注意这个商户号,key是`mchid`非`mch_id`
我用mchid,报错,加上了mch_id又报上面的错误了, 麻烦解答一下这个问题,感谢
问题就在于,企业付款到零钱是需要加载商户rsa私钥及证书,未加载到的时候请求就会失败,进而引发重试失败,所以你需要排查Builder::factory([‘merchant’ => []]) 中的 cert 及 key 文件路径是否可以访问到。
另外建议使用一个Linux环境做开发调试,在Windows上也可以尝试docker,已知在windows上跑php有许多莫名其妙的问题无法解决。
<?php
/**
* This function ensures that a response was set on a transaction. If one
* was not set, then the request is retried if possible. This error
* typically means you are sending a payload, curl encountered a
* "Connection died, retrying a fresh connect" error, tried to rewind the
* stream, and then encountered a "necessary data rewind wasn't possible"
* error, causing the request to be sent through curl_multi_info_read()
* without an error status.
*
* @param callable(RequestInterface, array): PromiseInterface $handler
*/
$ctx['error'] = 'The cURL request was retried 3 times '
. 'and did not succeed. The most likely reason for the failure '
. 'is that cURL was unable to rewind the body of the request '
. 'and subsequent retries resulted in the same error. Turn on '
. 'the debug option to see what went wrong. See '
. 'https://bugs.php.net/bug.php?id=47204 for more information.';
<?php
->postAsync([
//...
'xml' => [/**/],
'security' => true,
'retries' => 0,//关闭Guzzle重试
]);