我正在为 PayPal 使用 RefundTransaction API。虽然我使用签名没有困难,但我不知道如何使用证书。我从网站 (.txt) 下载了证书并获得了用户名和密码。我正在使用以下代码:
$this->API_UserName = urlencode("xxx");
$this->API_Password = urlencode("xxx");
$this->API_Signature = urlencode($this->API_Signature);
$this->version = urlencode("104.0");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->API_Endpoint); // https://api.paypal.com/nvp
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "\cert_key_pem.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$reqStr = "METHOD=RefundTransaction&VERSION={$this->version}&PWD={$this->API_Password}&USER={$this->API_UserName}$requestString";
//$requeststring has refund specific fields
curl_setopt($ch, CURLOPT_POSTFIELDS, $reqStr);
// Get response from the server.
$curlResponse = curl_exec($ch);
if(!$curlResponse)
return array("ERROR_MESSAGE"=>"RefundTransaction failed ".curl_error($ch)." (".curl_errno($ch).")");
我收到以下错误:
[ERROR_MESSAGE] => RefundTransaction failedSSL read:
error:00000000:lib(0):func(0):reason(0), errno 0(56)
我究竟做错了什么?