dongzhong9055 2015-08-04 05:36
浏览 68
已采纳

Paypal(PHP):无法使用客户端证书(找不到密钥或错误的密码?)

I'm using Paypal Express Checkout for my shopping chart. i have created my API certificate file as below. enter image description here

i have downloaed the api certificate file cert_key_pem.txt and used for api credential as below.

  $API_UserName = $paypal->username;
  $API_Password = $paypal->password;
  $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
  $PAYPAL_URL = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
  $version="64";
  $currencyCodeType = "USD";
  $paymentType = "Sale";
  $methodName = "DoExpressCheckoutPayment";
  $certFile = 'C:\xampp\htdocs\project-name\cert_key.txt';//forlocalhost
  //$certFile = '/home/cpanel-username/public_html/cert_key_pem.txt'; //for live server

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$API_Endpoint);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_POST, 1);

  $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

 $response = curl_exec($ch);
 if(curl_exec($ch) === false)
  {
     $message = curl_error($ch);
  }
  else
  {
     $message = 'Operation completed without any errors';
  }

 curl_close($ch);

 echo $message;

but i got the error message as below.

  unable to use client certificate (no key found or wrong pass phrase?)

if you have any idea on solving such type of errors then please help me. thanks

  • 写回答

1条回答 默认 最新

  • doujiaozhan2413 2015-08-04 06:16
    关注

    If you are using certificate to auth the API, you may want to change the endpoint to https://api.sandbox.paypal.com/nvp

    The https://api-3t.sandbox.paypal.com/nvp, and all "-3t" surffixed endpoints are for signature auth API calls (3T means 3 token: username/password/signature)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀