Magento Paypal Express Bug
This post details how to fix a bug in Magento 1.4.* processing payments using PayPal Express.
The problem occurs when a customer selects PayPal Express, makes payment on the PayPal site, and then completes the transaction on your Magento store. The error the customer sees is “This payment cannot be processed using your PayPal account at this time.”, however the payment is processed successfully and shows up in your PayPal account.
To fix this, open up app/code/core/Mage/Paypal/Controller/Express/Abstract.php and comment out some code in the placeOrderAction function
(For a cleaner fix, copy the file to app/code/local/Mage/Paypal/Controller/Express/Abstract.php and then make changes to the new file)
public function placeOrderAction() { try { .... // if ($url = $this->_checkout->getRedirectUrl()) { // $this->getResponse()->setRedirect($url); // return; // } ... } }
The response object from PayPal is returning this on the final placeOrder step:
[SUCCESSPAGEREDIRECTREQUESTED] => true
This means that the Magento store thinks it should redirect back to PayPal to finalize the order, however it does not need to redirect.
This fix has been tested on Magento 1.4.0.1, Magento 1.4.1.1
It has also been confirmed to work with PayPal Pro accounts (Both PayPal USA and PayPal Canada Pro Accounts)
Comments
06 01 2011 at 12:18 AM
Sounds like a great solution to my current problem. I’m unsure though of what exactly should be commented out.
Can you be more specific? I’m using 1.4.1.1
Cheers
06 01 2011 at 12:42 AM
Hi Brisbane_em,
For Magento 1.4.1.1, open up the file app/code/core/Mage/Paypal/Controller/Express/Abstract.php and comment out lines 281, 282, 283, 284, 285
The 5 lines are:
$url = $this->_checkout->getRedirectUrl();
if ($url) {
$this->getResponse()->setRedirect($url);
return;
}
02 02 2011 at 05:33 PM
Does anyone have a solution for 1.4.2? Tried the above, but no luck
24 02 2011 at 02:47 PM
Doesn’t work for magento 1.4.2.0. Any other solution?
24 02 2011 at 02:55 PM
Regarding Magento 1.4.2 -
I haven’t personally tested this fix with 1.4.2 however. in Magento Bug Ticket linked below, someone has reported that the fix in this blog post works in 1.4.2
http://www.magentocommerce.com/bug-tracking/issue/?issue=9894
24 08 2011 at 06:41 AM
I’m not an expert so please take my input for what it’s worth:
I use Magento ver. 1.4.2.0 & Paypal Express, but card payment by non-Paypal custumer didn’t work.
The payment issues were solved as soon as I changed ‘Payment action’ in the Magento backend from ‘Authorization’ to ‘Sale’.
Card payments then became successful (so worth doublechecking/trying), but the error message remained.
The suggested fix above (and comment of guysmiley) solve the error message! Thank you very much.



12 12 2010 at 11:51 AM
Code is slightly different in 1.4.1.1:
// redirect if PayPal specified some URL (for example, to Giropay bank)
//$url = $this->_checkout->getRedirectUrl();
//if ($url) {
// $this->getResponse()->setRedirect($url);
// return;
//}