Paypal curl错误:NSS:找不到客户端证书(未指定昵称)

时间:2017-10-26 09:12:46

标签: php ssl curl paypal

我正在尝试使用PayPal创建付款网址,并且我已经购买了符合PayPal要求的证书。

当我第一次调用curl时,它会返回错误

NSS: client certificate not found (nickname not specified)

但是当我尝试在几秒钟内重新加载页面时,卷曲返回成功。

我有什么方法可以在curl中设置证书吗?

  

我已经阅读了其他{​​{3}},但有些链接已经死了,答案对我不起作用。

 <?php
 $curl = curl_init();

 curl_setopt_array($curl, array(
   CURLOPT_URL => "https://api.paypal.com/v1/payments/payment",
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_ENCODING => "",
   CURLOPT_MAXREDIRS => 10,
   CURLOPT_TIMEOUT => 30,
   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
   CURLOPT_CUSTOMREQUEST => "POST",
   CURLOPT_POSTFIELDS => '{"intent":"sale","redirect_urls":{"return_url":"'.$return.'","cancel_url":"'.$cancel.'"},"payer":{"payment_method":"paypal"},"transactions":[{"amount":{"total":"'.$amount.'","currency":"HKD"}}]}',
   CURLOPT_HTTPHEADER => array(
     "authorization: Bearer $token",
     "cache-control: no-cache",
     "content-type: application/json",
     "postman-token: 7ca12352-aa45-2c4e-d87d-fdd09795121d"
   ),
 ));

 $response = curl_exec($curl);
 $err = curl_error($curl);

 curl_close($curl);

 // If I added this refresh code it works!?
 /*
 if ($err) {
     header("Refresh:0");
 }
 */

0 个答案:

没有答案