Orders Stuck in Pending Payment in Magento Due to Paypal Disabling IPN

This is quite a common issue in Magento where some orders which were paid via Paypal get stuck in ‘Pending Payment’ status. After debugging the issue, often you’ll arrive at the problem of the IPN message delivery in Paypal keeps getting disabled.

Once the IPN message delivery is disabled, Paypal can’t communicate that payment was received (or failed) back to Magento so subsequently, the order status can’t progress past ‘Pending Payment’. Once this communication fails, you may see an error message similar to the below in your error logs:-

Notice: Undefined index: invoice  in /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Paypal/Model/Ipn.php on line 173

If you happen to speak to Paypal’s support team about the issue, they will likely report that the IPN keeps getting disabled because they keep receiving a server error 503 header response code back from their IPN communication (even though the actual IPN URL in Magento can be returning a 200 header response code).

So the cause of this is usually that you’re taking payments via Paypal for more than one sales channel (this will usually be Magento and eBay or Amazon). You will have already set your IPN notification URL in Paypal to the one that Magento requires:-

For Magento 1.7.x, 1.8.x, 1.9.x : http://www.domain.com/paypal/ipn/

For Magento 1.4.x, 1.5.x, 1.6.x: http://www.domain.com/paypal/ipn/standard/

For Magento 1.3.x: http://www.domain.com/paypal/standard/ipn/

When you sell an item via eBay or Amazon, PayPal tries to send an IPN message to your Magento IPN listener which fails as the order did not originate in Magento so Paypal receive an error back. Once a few errors are received, Paypal disable your IPN message delivery automatically and then any more orders paid for with Paypal in your Magento store cannot complete subsequently getting stuck as ‘Payment Pending’.

What you will need to do is create a centralised IPN listener which will allow you to receive IPN notifications for multiple channels. Simply create a file named null_ipn.php and place it in your Magento root. Then save the below in this file.

Then log in to your Paypal account and set your Paypal IPN Notification URL to the path to this file in your Magento root. For example: http://www.domain.com/null_ipn.php.

Geoff Jackson

Geoff Jackson (more commonly known by his online pseudonym zigojacko) is the founder of Design Haven and The Clubnet Group which hosts numerous agencies including the most widely recognised of them, Clubnet Digital, a full service digital marketing and creative design/development agency. He also has a personal blog but it doesn't get updated as much as he'd like.

Sponsored Links...

Subscribe to Design Haven UK

Enter your email address to subscribe and receive our new posts by email.

13 Responses

  1. Piers says:

    Hi Geoff,

    Thanks, that’s a great workaround to the problem. It’s working on PayPals IPN Simulator now using your script. Our PayPal IPN started failing, shortly after updating Magento to Before then it worked fine.

    Do you have ideas to why Magento won’t handle this external request correctly?

    • Thanks for stopping by and taking the time to leave a comment Piers.

      So are you saying that in your instance, you only take payments via Paypal for your Magento store (and not other channels such as eBay and Amazon)?

      Generally, this isn’t a Magento issue, Paypal should allow businesses to add multiple IPN URL’s. Once you set an IPN URL for Magento in Paypal and then you take a payment via another channel, it can’t match the data against the IPN listener because the order never originated there.

      • Piers says:

        Yes primarily through PayPal.

        Indeed you are correct, after many hours of pain I discovered that the IPN simulator was reporting a successful response through your script, but actually it was not working in Magento’s back-end. I think I was getting desperate at the point of reading your post and would try anything and had lost the capacity to think!

        I have tried so many tricks and none of them worked. It turned out (believe it or not) that despite reporting a successful Magento upgrade, I got so fed up that I overwrote all the files in the core PayPal directory, went off and had dinner. Voila it started working, sending through IPNs within hours… DESPITE the IPN simulator still reporting HTTP error the next day.

        • Thanks for leaving a comment with an update Piers.

          I think you are saying that now your Paypal IPN is working? If so, great news.

          Yes, the central IPN listener in my post above is only really needed if there are IPN notifications coming from multiple sales channels.

          Magento can sure make us all get like you’ve described. Sometimes taking a break and coming back half an hour later can make all the difference in fact 🙂

  2. Mike says:

    Looked around for quite a while for this solution, thanks a lot. We have Amazon and Ebay so that was causing the IPN issues, added the file and now it’s updating, great work.

  3. Mark says:


    I am having IPN issues with out website. We use Paypal with ebay and have another website which I will be needing to link in to paypal soon too and Amazon is on its way 🙂

    How does this file work?

    If this file is created and the IPN pointed to it, will eBay and Amazon still get payment updates? Can a second website be added to this too?

    I could not see directly from the code how this could be done. Thanks for nay help

    • Sorry for not replying sooner Mark.

      This script acts a centralised IPN listener so it can support multiple channels taking Paypal payments.

      You just simply need to point your IPN notification URL to the location of this script from within your Paypal account.

      By pointing it to the default Magento URL (as documented in the post above), this causes Paypal to look in Magento for payments coming into the account from any channel and when it can’t find them, it throws an error behind the scenes and so many of these errors will cause Paypal to disable the IPN on your account.

      Hope that helps.

  4. Haim says:

    Hi Geoff, Thanks for the script, I had seen something similar elsewhere but wasn’t sure how updated this was. Do you know if this would work for Magento EE

    • Hey Haim, sorry for the delayed reply. This has been used and tested, confirmed working up to Magento CE 1.9.x. I’d expect it to work in EE 1.12.x although I can’t say I have implemented it in EE to be sure though.

      Hope that helps 🙂


  5. Al says:

    Geoff, you have saved the day!

    Following a server move our transaction ID was empty. Spent (literally days on this issue) looking at the code, and playing ping pong support tickets with server technicians.
    As it had been associated with the move I was focussed on our new hosting environment or permissions, or code not working on new php version… rather than what seems so obvious now ive read your post!

    Thanks a million for taking the time to write your solution up for us all to benefit.


  1. May 15, 2015

    […] Orders Stuck in Pending Payment in Magento Due to Paypal Disabling IPN I found this article really useful creating a centralised IPN listener and it was working with the IPN simulator, sending/receiving a response. However, it did not solve the problem. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: