![](/img/trans.png)
[英]cURL unable to use client certificate (no key found or wrong pass phrase?)
[英]Paypal(PHP): unable to use client certificate (no key found or wrong pass phrase?)
我正在將Paypal Express Checkout用於我的購物圖表。 我創建了我的API證書文件,如下所示。
我下載了api證書文件cert_key_pem.txt
並用於api憑據,如下所示。
$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;
但我收到以下錯誤消息。
unable to use client certificate (no key found or wrong pass phrase?)
如果您有解決此類錯誤的想法,請幫助我。 謝謝
如果您使用證書來認證API,則可能需要將端點更改為https://api.sandbox.paypal.com/nvp
https://api-3t.sandbox.paypal.com/nvp和所有“ -3t”后綴的終結點均用於簽名Auth API調用(3T表示3個令牌:用戶名/密碼/簽名)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.