Paypal Express – Skip Order Review Step in Magento 1

Magento has the option to skip the review step upon returning from Paypal (System > Configuration > Payment Methods > Paypal Express Checkout > Advanced Settings > Skip Order Review Step). There are a couple of caveats to the way this functionality works:

1. Using the Paypal button from the cart page

If the button from the checkout/cart page is used rather than following the flow through the one step checkout then the review step becomes compulsory.

We can see this by the URL which the buttons links to the paypal express controller, which has the parameter button/1 on it. In Mage_Paypal_Controller_Express_Abstract, the following is passed into the start method of the checkout (Mage_Paypal_Model_Express_Checkout) object:

<?php
$button = (bool)$this->getRequest()->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_BUTTON);
$token = $this->_checkout->start(Mage::getUrl('*/*/return'), Mage::getUrl('*/*/cancel'), $button);

This is then set and saved on the payment object:

<?php
$this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_BUTTON, 1);

This option is used when the user returns from Paypal in Mage_Paypal_Controller_Express_Abstract‘s returnAction method:

<?php
if ($this->_checkout->canSkipOrderReviewStep()) {
    $this->_forward('placeOrder');
} else {
    $this->_redirect('*/*/review');
}

Where the canSkipOrderReviewStep() method uses the PAYMENT_INFO_BUTTON option which was set earlier to decide wither the user should be sent to the review page or have their order placed straight away.

2. Using Paypal’s Incontext Module

If this module from Magento Connect has been installed, then the function referenced above which sets the button parameter when starting the checkout process is commented out:

<?php
//$button = (bool)$this->getRequest()->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_BUTTON);
...
$token = $this->_checkout->start(Mage::getUrl($type . '/return'), Mage::getUrl($type . '/cancel'), true);

This means that Magento will always assume the user came from clicking one of the cart buttons in this scenario, and never from the one page checkout. This line is found in Paypal_InContext_Controller_Express_Action‘s startAction method, which supersedes the one found in Core Magento’s Mage_Paypal_Controller_Express_Abstract.

The reason the InContext module requires the review step is for the user experience. When using the InContext module, the user is not redirected to Paypal on a device where it’s enabled, so would never get chance to review their order from the point they chose to pay either from the cart or checkout page.