0

I have set up PayPal Sandbox to test my PayPal Express integration, but whenever I log in to the sandbox from the payment page, I get greeted by the following error message; "Sorry, we can’t complete your purchase at this time"

I am using laravel-omnipay and omnipay-paypal with the PayPal_Express gateway.

I think this is likely to be a configuration issue (or a bug..? Although I'm hoping it's not.) in PayPal, but this is the piece of code I am using to initiate the payment:

public function checkout ()
{
    $cart = Cart::forSession ();

    $response = Omnipay::purchase
    (
        [
            'amount' => $cart->getPrice (),
            'currency' => preferred_currency ()->name,
            'description' => (string) $cart,
            'returnUrl' => URL::action ('OrderController@checkoutReturn'),
            'cancelUrl' => URL::action ('OrderController@checkoutCancel')
        ]
    )->send ();

    if ($response->isSuccessful ())
        dd ('successful', $response);
    else if ($response->isRedirect ())
        return $response->getRedirectResponse ();
    else
        return Redirect::to ('/cart')->with ('alerts', [new Alert ('An error occurred while attempting to process your order: ' . $response->getMessage (), Alert::TYPE_ALERT)]);
}

And the omnipay.php configuration file:

return array(
    'gateway' => 'PayPal_Express',
    'defaults' => array(
        'testMode' => true,
    ),
    'gateways' => array(
        'PayPal_Express' => array(
            'username' => '<>',
            'password' => '<>',
            'signature' => '<>',
            'landingPage' => array('billing', 'login'), 
        ),
    ),
);

The username, password and signature I am using are the ones I created in the PayPal Sandbox for my account.

The sandbox account I am using to test this is a "personal"/buyer account, with funding sources and "Payment Review" disabled. The Sandbox Accounts overview on the PayPal Developer website indicates the sandbox account's status as "complete".

I'm hoping I didn't miss something obvious. I checked out some of the other answers on Stack Overflow but none of those seemed to offer a solution for this exact problem.

RobinJ
  • 5,022
  • 7
  • 32
  • 61
  • Have you found a solution for this problem, I am having the same exact issue, and it's driving me insane. I hate PayPal API, why it have to be so complicated! – Dewan159 May 15 '19 at 20:41
  • In my case something was wrong on PayPal's end, and I had to go through support to get it fixed. – RobinJ May 16 '19 at 07:09
  • I just got it to work! In my case I just needed to "Upgrade to Business-Pro" account! – Dewan159 May 16 '19 at 11:11

1 Answers1

0

Contact PayPal support, as there is something wrong on their end.

RobinJ
  • 5,022
  • 7
  • 32
  • 61