13
votes

When ordering using paypal in magento, it takes you to paypal, paypal already displays a confirmation, you confirm, you get redirected to another confirmation page (/paypal/express/review), it is an extra step that is unnecessary for user experience, I would like to remove it and make the order automatically placed when user confirm on paypal page, once leave paypal if order successful the customer should see the success page.

is there any easy solution to this I might have overlooked or at least if you can point me to the right direction to remove that step.

8
don't use paypal express and use paypal standard if you don't need this feature. paypal express is a checkout method and not a payment methodAnton S
thanks! I didn't notice that. now I do.Dreaded semicolon
yep, you can post it as an answer and I will pick it. thanks again.Dreaded semicolon

8 Answers

9
votes

don't use paypal express and use paypal standard if you don't need this feature. paypal express is a checkout method and not a payment method

edit: this is now configurable in 1.9, still retarded but doable.

13
votes

Actually, Express Checkout can handle this no problem, and I would personally recommend sticking with it.

After the SetExpressCheckout request you redirect the user over to PayPal. You can append useraction=commit to this URL in order to trigger the confirmation from PayPal pages.

This causes the "Continue" button on PayPal to switch to a "Pay" button and informs the user that this is their final confirmation...clicking Pay will submit the payment.

You still have to call DoExpressCheckoutPayment on your server to complete the process, but GetExpressCheckoutDetails is optional at this point. When using useraction=commit you'll get the PayerID back as a URL parameter in your ReturnURL so you don't have to call GECD if you don't want/need to.

You can take this all a setup farther and use the callback API (also known as instant update API) to feed shipping and sales tax information to the PayPal review page. This allows you to populate the drop down values on PayPal's review page with your own shipping data based on the user's shipping address selected on the PayPal review page.

The introduction of those features was to do exactly what you specified...eliminate the additional review process.

All of that said, if the Magento module for Express Checkout doesn't provide options for all of this you'll need to extend it and build them in yourself. I'm pretty it does, though.

11
votes

Actually all the solutions mentioned here required to edit the Magento core. This is known as bad practise and does not keep your shop updateable.

What you need to do for a clean solution:

  1. Create a module (in my exampe: Avoe_Paypal) to include the changes
  2. Rewrite Paypal Config
  3. Redirect on paypal express review step which is http://yourdomain.com/paypal/express/review/

1) Create your module

Avoe/Paypal/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Avoe_Paypal>
            <version>0.1.0</version>
        </Avoe_Paypal>
    </modules>

    <global>
        <models>
            <Avoe_Paypal>
                <class>Avoe_Paypal_Model</class>
            </Avoe_Paypal>
            <paypal>
                <rewrite>
                    <config>Avoe_Paypal_Model_Config</config>
                </rewrite>
            </paypal>
        </models>
        <events>
            <controller_action_predispatch_paypal_express_review>
                <observers>
                    <avoe_paypal_predispatch>
                        <type>singleton</type>
                        <class>Avoe_Paypal_Model_Observer</class>
                        <method>paypalExpressReturnPredispatch</method>
                    </avoe_paypal_predispatch>
                </observers>
            </controller_action_predispatch_paypal_express_review>
        </events>
    </global>
</config>

app/etc/Avoe_Paypal.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Avoe_Paypal>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Paypal />
            </depends>
        </Avoe_Paypal>
    </modules>
</config>

2) Rewrite config, add useraction 'commit':

<?php
class Avoe_Paypal_Model_Config extends Mage_Paypal_Model_Config {

    /**
     * Get url for dispatching customer to express checkout start
     * Added useraction 'commit' to remove PayPal Express Checkout review page
     *
     * @param string $token
     * @return string
     */
    public function getExpressCheckoutStartUrl($token)
    {
        return $this->getPaypalUrl(array(
            'cmd'   => '_express-checkout',
            'useraction' => 'commit',
            'token' => $token,
        ));
    }
}

3) Create observer to redirect:

<?php

class Avoe_Paypal_Model_Observer {

    function paypalExpressReturnPredispatch($observer) {
        Mage::app()->getResponse()->setRedirect(Mage::getUrl('*/*/placeOrder'));
    }
}

There is also a small Magento extension which was just released yesterday, to remove the review step:

https://github.com/tim-bezhashvyly/Sandfox_RemovePaypalExpressReviewStep

9
votes

So the right deal there, that works perfectly (for me ) is a sum up from the above :

1. Go to: \app\code\core\Mage\Paypal\Controller\Express\Abstract.php

and search in returnAction() for:

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

There you have to change:

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

to:

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

2. Go to: \app\code\core\Mage\Paypal\Model\Config.php and change the:

public function getExpressCheckoutStartUrl($token)
{
    return $this->getPaypalUrl(array(
        'cmd'   => '_express-checkout',
        'token' => $token,
    ));
}

to:

public function getExpressCheckoutStartUrl($token)
{
    return $this->getPaypalUrl(array(
        'cmd'   => '_express-checkout',
        'useraction' => 'commit',
        'token' => $token,
    ));
}

With the 2 changes above, i figure out how to Skip Review Page in Magento Paypal Express Checkout.

7
votes

Andrew Angel's answer really doesn't avoid the comfirmation page, it just changes button value to "Pay" rather to "Confirm", or something like that.

Anyway the correct way to do that is going to \app\code\core\Mage\Paypal\Model\Config.php, to getExpressCheckoutEditUrl($token) method and change

'useraction' => 'continue',

to

'useraction' => 'commit’.

To aviod confirmation user page in Paypal Express you only need to change one line in on controller action. Go to Mage/Paypal/Controller/Express/Abstract.php and search for $this->_redirect('*/*/review'); in returnAction(). There you have to change

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

to

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

That way when paypal returns to return action you avoid to show entire review page and payment was automatically confirmed. So, Paypal redirects again to success pages the same way like PayPal Standard method.

4
votes

@Toni The redirect url part works excellent, thanks! However changing the 'continue' to 'commit' did not change the buttons on PayPal's website. However, I was able to fix it by doing the following: Right above the getExpressCheckoutEditUrl function where Toni instructed to change the continue to commit, there is the funciton getExpressCheckoutStartUrl. If you add the useraction variable there, it will work. Original function:

public function getExpressCheckoutStartUrl($token)
{
'return $this->getPaypalUrl(array(
'cmd'   => '_express-checkout',
'token' => $token,
));
}

New function:

public function getExpressCheckoutStartUrl($token)
{
'return $this->getPaypalUrl(array(
'cmd'   => '_express-checkout',
'useraction' => 'commit',
'token' => $token,
));
}

Notice the 'useraction' => 'commit', was added at the new function. This should work!

2
votes

THere was one step missing let me summarize the entire process again.

1. Go to: \app\code\core\Mage\Paypal\Controller\Express\Abstract.php

and search in returnAction() for:

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

There you have to change:

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

to:

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

2. Go to: \app\code\core\Mage\Paypal\Model\Config.php and change the:

public function getExpressCheckoutStartUrl($token)
{
    return $this->getPaypalUrl(array(
        'cmd'   => '_express-checkout',
        'token' => $token,
    ));
}

to:

public function getExpressCheckoutStartUrl($token)
{
    return $this->getPaypalUrl(array(
        'cmd'   => '_express-checkout',
        'useraction' => 'commit',
        'token' => $token,
    ));
}

3. With the above two changes you will still be taken to the review page and have to agree to the terms and conditions, to avoid this go to:

/app/code/core/Mage/Paypal/Controller/Express/Abstract.php Search for :

public function placeOrderAction()
{
try {
$requiredAgreements = Mage::helper(‘checkout’)->getRequiredAgreementIds();
if ($requiredAgreements) {
$postedAgreements = array_keys($this->getRequest()->getPost(‘agreement’, array()));
if (array_diff($requiredAgreements, $postedAgreements)) {
Mage::throwException(Mage::helper(‘paypal’)->__(‘Please agree to all the terms and conditions before placing the order.’));
}
}

Comment out the following lines with a simple // at the beginning :

//if (array_diff($requiredAgreements, $postedAgreements)) {
// Mage::throwException(Mage::helper(‘paypal’)->__(‘Please agree to all the terms and conditions before placing the order.’));
// }

The only time you will every be take to the review page is if the customers paypal returns a declined error.

2
votes

Magento 1.9 has built-in support for this, the Skip Order Review Step option, but it has a subtle caveat. The feature doesn't work with the 'Shortcut' buttons you can display on the product detail and cart pages.

My suggestion, disable the shortcut buttons and enable the Skip Order Review Step option. For extra credit you can rearrange the Onepage Checkout flow so that customers won't have to enter billing information twice (once on Magento and again on PayPal).

More details available in this blog post.