我的项目中包含以下代码行:

    $queryString = http_build_query($data);
    $hCurl = $this->_setApiEndpoint($queryString);

    $headers = array('Content-type: multipart/form-data');
    curl_setopt($hCurl, CURLOPT_HTTPHEADER, $headers);
    //turning off the server and peer verification(TrustManager Concept).
    curl_setopt($hCurl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($hCurl, CURLOPT_SSL_VERIFYHOST, false);

    curl_setopt($hCurl, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($curl);

    parse_str($response, $result);


这是我们的贝宝集成。我们正在使用不同的API端点,并且一切正常。该代码正在生产中并且正在运行。但是沙盒(DoExpressCheckoutPayment)中只有一种方法不起作用。我已经以为这是沙盒内的错误,但是curl_error和curl_errno会打印错误,我也尝试过使用Postman并成功。

curl_errno = 56
curl_error = SSL read: error:00000000:lib(0):func(0):reason(0), errno 104


该请求在docker机器内触发,我们使用https local。感谢大家的帮助。

最佳答案

我找到了解决方案。您应该使用POST而不是GET。当然,贝宝(PayPal)文档中的任何地方都没有提到这一点。该错误消息也很含糊。

关于php - Paypal 沙盒 curl NVP请求失败(DoExpressCheckoutPayment),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40406971/

10-09 18:12