Magento Paypal: Email, Shipping Cost & Order Status issue in version 1.4.0.1

Magento version 1.4.0.1 has some issues with Paypal email, shipping cost and order status.

Note: All these issues occur when payment is done through Paypal

1. Order confirmation email is not sent

Fix:

– Open app/code/core/Mage/Checkout/Model/Type/Onepage.php
– Go to line 626
– Comment out the IF condition as below:


/**
 * we only want to send to customer about new order when there is no redirect to third party
 */
//if(!$redirectUrl){
	try {
		$order->sendNewOrderEmail();
	} catch (Exception $e) {
		Mage::logException($e);
	}
//}

– Now, order confirmation emails should be sent.

Note: This fix is not a better one. A hard coded fix. For a better fix regarding order confirmation email not sent, see #2 solution below.

2. Order status is always ‘Pending Payment’ + Order Email not sent

Order status is always set as ‘Pending Payment’ and not being changed to ‘Processing’. Also, order confirmation email is not sent.

Here is the fix: Payment problems in Magento Paypal Standard with IPN after upgrade from 1.3.x to 1.4.0.1

The 3 steps solution posted in the above link works like a charm. Here are they:

i) Change Instant Payment Notification (IPN) URL in Paypal

Starting with Magento 1.4.0.0, the ipn url is : http://www.yoursite.com/paypal/ipn/standard/. However, again from Magento 1.4.1.0 it has changed to http://www.yoursite.com/paypal/ipn/.

In developer paypal account, I see that the IPN settings is in My Account -> History -> IPN History

ii) Adjust settings for Paypal payment method in Magento admin

– Go to System -> Configuration -> Payment Methods -> PayPal Website Payments Standard
– Set, Payment Action = Sale
– Set, New Order Status = Processing

iii) Edit file: app/code/core/Mage/Paypal/Model/Ipn.php

Instead of editing the core file, it is recommended to create a copy of the core file inside local folder. So, the file you should be editing will be app/code/local/Mage/Paypal/Model/Ipn.php.


/**
 * IPN request data getter
 * @param string $key
 * @return array|string
 */
public function getIpnFormData($key = null)
{
	if (null === $key) {
		return $this->_ipnFormData;
	}
	//return isset($this->_ipnFormData[$key]) ? $this->_ipnFormData[$key] : null;
	return isset($this->_ipnFormData[$key]) ? urldecode($this->_ipnFormData[$key]) : null;
}

More detail: Payment problems in Magento Paypal Standard with IPN after upgrade from 1.3.x to 1.4.0.1

3. Shipping costs not pushed to PayPal resulting in a different paid total in PayPal

Here is the fix: Fix for Magento 1.4.0.1 Paypal and Shipping Costs

Detail description and fix about this issue is also present in this Magento Wiki article:-
Paypal Standard Payments Setup with IPN

Hope this helps. Thanks.