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 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?