7

I've tested a PayPal order (using standard One Page Checkout and core Paypal Payments Standard) when IPN is enabled and the statuses update fine so IPN seems to function.

However, PayPal sends through this email periodically:

Dear xxxx,

Please check your server that handles PayPal Instant Payment Notifications (IPN). Instant Payment Notifications sent to the following URL(s) are failing:

http:// xxxx /paypal/ipn/

If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account.

Thank you for your prompt attention to this issue.

Yours sincerely, PayPal

and then after about a week automatically disables IPN which stops PayPal orders from updating properly.

Checking system.log shows a bunch of notices

2014-02-12T20:29:54+00:00 ERR (3): Notice: Undefined index: invoice  in /var/www/windswept/app/code/core/Mage/Paypal/Model/Ipn.php on line 171

There are about 50 of these errors ( one every 15/20 min) while we had a small amount of Paypal orders recently.

Does anybody have any insight into this issue?

  • 2
    i think because your order place using other site like[ebay,amazon] and this order is not place in magento so it detect undefined index because magentop dosent know about third party order actually i have same problem before – Keyur Shah Feb 13 '14 at 5:06
7

If your URL is correct then it's what Keyur Shah already commented, but probably wasn't clear enough. If you have IPN enabled and receive payments from different sources (ebay, Magento and others) to the same PayPal account, PayPal unfortunately continues to try sending notifications related to these order to the Magento store, where these orders don't exist.

A possible solution is creating a centralized IPN reciever, see this URL for a very useful script to get you started. http://codeseekah.com/2012/02/11/how-to-setup-multiple-ipn-receivers-in-paypal/

4

As pointed out by @Keyur Shah, these orders has not been placed with Magento. (so probably they are imported by M2E in my case)

Magento doesn't know anything about them and expect the field invoice to be populated, so something like this happens:

  1. Ipn receive a request from Paypal without theinvoicefield.
  2. Mage_Paypal_Model_Ipn::_getOrder() expect the invoice field and produce an exception
  3. Mage_Paypal_IpnController sent back a 503 Service Unavailable to Paypal
  4. You got Paypal email ... Paypal continue to retry for sometime for the failing orders

Solution
Rewrite Mage_Paypal_Model_Ipn::processIpnRequest()
I'm not explaining the full procedure as there are a lot of tutorials showing how to create a module that rewrite a core file.

This mod:

  1. No cause exception if invoice field is not present and log those order id
  2. Will reply to Paypal a success so Paypal do not sent any email and will stop send this order info to the IPN again.

Here the class file:

class MyModule_Fix_Model_Paypal_Ipn extends Mage_Paypal_Model_Ipn
{
    public function processIpnRequest(array $request, Zend_Http_Client_Adapter_Interface $httpAdapter = null)
    {
        $this->_request = $request;
        $this->_debugData = array('ipn' => $request);
        ksort($this->_debugData['ipn']);

        try {
            if (!isset($this->_request['invoice'])) {
                if ($httpAdapter) {
                    $this->_config = Mage::getModel('paypal/config', array('', ''));
                    $this->_postBack($httpAdapter); // send reply to paypal
                }
                $this->_debugData['exception'] = 'Missing Invoice/Order Id (maybe Ebay/Amazon order ?)';
                return;
            }

            if (isset($this->_request['txn_type']) && 'recurring_payment' == $this->_request['txn_type']) {
                $this->_getRecurringProfile();
                if ($httpAdapter) {
                    $this->_postBack($httpAdapter);
                }
                $this->_processRecurringProfile();
            } else {
                $this->_getOrder();
                if ($httpAdapter) {
                    $this->_postBack($httpAdapter);
                }
                $this->_processOrder();
            }
        } catch (Exception $e) {
            $this->_debugData['exception'] = $e->getMessage();
            $this->_debug();
            throw $e;
        }
        $this->_debug();
    }
}
  • wouldn't it make more sense if there was a way to tell PayPal only to notify for Magento orders? – Haim Oct 27 '15 at 3:40
  • yes if there was one. – Fra Oct 28 '15 at 1:26
1

you have to connect to your paypal account, click to profile and set IPS url like this

YOUR_BASE_URL/index.php/paypal/ipn/index/

or, if it doesn't work

YOUR_BASE_URL/paypal/ipn/

see this link

1

You may try out the url as If using URL ReWrite (Search Engine Friendly URLs) our IPN Url will be: YOUR_BASE_URL/paypal/standard/ipn/

If your are not using URL rewrites your address should be: (I think this is correct, have not tried it fully) YOUR_BASE_URL/index.php/paypal/standard/ipn/

For further details see here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.