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?
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问