Magento v1.x.x.x

When using the Paypal Express Checkout with Magento you’ll find, by default, the page flow looks like this:

  1. Checkout page
  2. Redirect to Paypal website
  3. Redirect to Paypal Express Review page on our website
  4. Order success page

The Paypal Express Review page (3.) is essentially unnecessary. We already have all the information we need from the customer, so it’s just adding another opportunity for the customer to bail out of the order.

So, let’s skip it…


Create a copy of the following file in your local code directory (if you need explanation of this, ask me):

app/code/core/Mage/Paypal/Controller/Express/Abstract.php

Search in function ‘returnAction()’ for the following line of code:

1
$this->_redirect('*/*/review');

Change it to:

1
$this->_redirect('*/*/placeOrder');

This essentially just says, “when we return from Paypal website, redirect to the ‘placeOrder()’ function instead.”


Next, create a copy of the following file in your local code directory:

app/code/core/Mage/Paypal/Model/Config.php

Find function ‘getExpressCheckoutStartUrl()’, and add a URL parameter to the list. So, from:

1
2
3
4
5
6
7
public function getExpressCheckoutStartUrl($token)
{
    return $this->getPaypalUrl(array(
        'cmd'   => '_express-checkout',
        'token' => $token,
    ));
}

To:

1
2
3
4
5
6
7
8
public function getExpressCheckoutStartUrl($token)
{
    return $this->getPaypalUrl(array(
        'cmd'   => '_express-checkout',
        'useraction' => 'commit',
        'token' => $token,
    ));
}

This adds a parameter to the Paypal URL that the customer visits. It tells Paypal to consider this a final step in payment, instead of verification only. This will just change the Paypal complete button from “Complete” (I think), to “Pay”

Done. This should save your business an abandoned cart, or two..

Note: There are reasons why this could fail. In those circumstances, the customer will be redirected automatically to the review page. For example, if you don’t have something set up that checks the customer has chosen a delivery option before they proceed to Paypal, it’ll throw an error (you can debug this from ‘placeOrderAction()’) and send the customer to the Paypal Express review page, instead of completing the order.