donglei3370 2019-04-27 08:29
浏览 216

Paypal日志:找不到或没有找到证书颁发机构 - 使用捆绑的CA证书文件重试

Everything works but it does not work.

My code is

<?php 
use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;

require __DIR__  . '/PayPal/vendor/autoload.php';

$api = new ApiContext(
        new OAuthTokenCredential(
            'ClientID',     // ClientID
            'ClientSecret'      // ClientSecret
        )
);          
//enabled live api
$api->setConfig(
            [
                'mode' => 'live',
                'http.ConnectionTimeOut' => 30,
                'log.LogEnabled' => true,
                'log.FileName' => 'PayPal.log',
                'log.LogLevel' => 'FINE',
                'validation.level' => 'log'

            ]
    );


use PayPal\Api\Payer;
use PayPal\Api\Details;
use PayPal\Api\Amount;
use PayPal\Api\Transaction;
use PayPal\Api\Payment;
use PayPal\Api\RedirectUrls;

$payer = new Payer();
$details = new Details();
$amount = new Amount();
$transaction = new Transaction();
$payment = new Payment();
$redirectUrls = new RedirectUrls();

$payer->setPaymentMethod('paypal');

$details->setShipping('2.00')
        ->setTax('2.00')
        ->setSubtotal('20.00');

$amount->setCurrency('PLN')
        ->setTotal('24.00')
        ->setDetails($details);

$transaction->setAmount($amount)
            ->setDescription("Payment Test");

$payment->setIntent('sale')
        ->setPayer($payer)
        ->setTransactions([$transaction]);

$redirectUrls->setReturnUrl("https://local/paypal?payment=true")
            ->setCancelUrl("https://local/paypal?payment=false");


$payment->setRedirectUrls($redirectUrls);           

// After Step 3
try {
    $payment->create($api);

    $payment_id=$payment->getId();
    $hash=md5($payment->getId());

    echo $payment;
    echo "

Redirect user to approval_url: " . $payment->getApprovalLink() . "
";



}
catch (\PayPal\Exception\PayPalConnectionException $ex) {
    // This will print the detailed information on the exception.
    //REALLY HELPFUL FOR DEBUGGING
    echo $ex->getData();    
}           
var_dump($payment->getLinks());
echo'<br />';
echo$hash;
echo'<br />';
echo$payment_id;
?>

response

{ "intent": "sale", "payer": { "payment_method": "paypal" }, "transactions": [ { "amount": { "total": "24.00", "currency": "PLN", "details": { "subtotal": "20.00", "tax": "2.00", "shipping": "2.00" } }, "description": "Payment Test", "related_resources": [] } ], "redirect_urls": { "return_url": "https://local/paypal?payment=true", "cancel_url": "https://local/paypal?payment=false" }, "id": "PAYID-LTCBAJI4S102048F8950560B", "state": "created", "create_time": "2019-04-27T08:17:41Z", "links": [ { "href": "https://api.paypal.com/v1/payments/payment/PAYID-LTCBAJI4S102048F8950560B", "rel": "self", "method": "GET" }, { "href": "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-23G84085D38052944", "rel": "approval_url", "method": "REDIRECT" }, { "href": "https://api.paypal.com/v1/payments/payment/PAYID-LTCBAJI4S102048F8950560B/execute", "rel": "execute", "method": "POST" } ] } Redirect user to approval_url: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-23G84085D38052944
D:\wamp\www\local\payment-paypal.ocg.php:89:
array (size=3)
  0 => 
    object(PayPal\Api\Links)[27]
      private '_propMap' (PayPal\Common\PayPalModel) => 
        array (size=3)
          'href' => string 'https://api.paypal.com/v1/payments/payment/PAYID-LTCBAJI4S102048F8950560B' (length=73)
          'rel' => string 'self' (length=4)
          'method' => string 'GET' (length=3)
  1 => 
    object(PayPal\Api\Links)[28]
      private '_propMap' (PayPal\Common\PayPalModel) => 
        array (size=3)
          'href' => string 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-23G84085D38052944' (length=86)
          'rel' => string 'approval_url' (length=12)
          'method' => string 'REDIRECT' (length=8)
  2 => 
    object(PayPal\Api\Links)[29]
      private '_propMap' (PayPal\Common\PayPalModel) => 
        array (size=3)
          'href' => string 'https://api.paypal.com/v1/payments/payment/PAYID-LTCBAJI4S102048F8950560B/execute' (length=81)
          'rel' => string 'execute' (length=7)
          'method' => string 'POST' (length=4)

f56c3d269cb9187db3cb96d4d2acfd3e
PAYID-LTCBAJI4S102048F8950560B

It looks like everything worked, but it does not work. 1. Errors appear in the logs,no matter if I set live or sandbox .

[27-04-2019 08:15:06] PayPal\Core\PayPalHttpConnection : INFO: POST https://api.sandbox.paypal.com/v1/oauth2/token
[27-04-2019 08:15:06] PayPal\Core\PayPalHttpConnection : INFO: Invalid or no certificate authority found - Retrying using bundled CA certs file
[27-04-2019 08:15:07] PayPal\Core\PayPalHttpConnection : INFO: Response Status  : 200
[27-04-2019 08:15:07] PayPal\Core\PayPalHttpConnection : INFO: POST https://api.sandbox.paypal.com/v1/payments/payment
[27-04-2019 08:15:07] PayPal\Core\PayPalHttpConnection : INFO: Invalid or no certificate authority found - Retrying using bundled CA certs file
[27-04-2019 08:15:09] PayPal\Core\PayPalHttpConnection : INFO: Response Status  : 201
[27-04-2019 08:17:41] PayPal\Core\PayPalHttpConnection : INFO: POST https://api.paypal.com/v1/oauth2/token
[27-04-2019 08:17:41] PayPal\Core\PayPalHttpConnection : INFO: Invalid or no certificate authority found - Retrying using bundled CA certs file
[27-04-2019 08:17:43] PayPal\Core\PayPalHttpConnection : INFO: Response Status  : 200
[27-04-2019 08:17:43] PayPal\Core\PayPalHttpConnection : INFO: POST https://api.paypal.com/v1/payments/payment
[27-04-2019 08:17:43] PayPal\Core\PayPalHttpConnection : INFO: Invalid or no certificate authority found - Retrying using bundled CA certs file
[27-04-2019 08:17:45] PayPal\Core\PayPalHttpConnection : INFO: Response Status  : 201
  1. The transactions do not exist, they are not accounted for. 3.At the opening you can not see the product name, price, nothing, only login. Can anyone help me with this matter?
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)