Paypal连接Timedout

时间:2016-07-27 01:51:08

标签: php laravel paypal

我试图通过composer设置paypal checkout,当我运行它时,它在我们的实时站点中运行它时给了我一个连接超时异常,但它在我的localhost中完美运行。我现在正在使用Laravel框架。 Exception message

以下是用于它的代码

$ payer = PayPal :: Payer();         $ payer-> setPaymentMethod( '贝宝');

    $amount = PayPal:: Amount();
    $amount->setCurrency('EUR');
    $amount->setTotal(42); // This is the simple way,
    // you can alternatively describe everything in the order separately;
    // Reference the PayPal PHP REST SDK for details.

    $transaction = PayPal::Transaction();
    $transaction->setAmount($amount);
    $transaction->setDescription('What are you selling?');

    $redirectUrls = PayPal:: RedirectUrls();
    $redirectUrls->setReturnUrl(action('PaypalController@getDone'));
    $redirectUrls->setCancelUrl(action('PaypalController@getCancel'));

    $payment = PayPal::Payment();
    $payment->setIntent('sale');
    $payment->setPayer($payer);
    $payment->setRedirectUrls($redirectUrls);
    $payment->setTransactions(array($transaction));

    $response = $payment->create($this->_apiContext);
    $redirectUrl = $response->links[1]->href;

    return Redirect::to( $redirectUrl );

0 个答案:

没有答案