Sage Pay IP Address Error in Magento
A very short post today folks, but one which has caught a lot of people out in recent times (including a few of my colleagues). Those of you who have seen this error when testing your Magento Sage Pay checkout integration, will probably not be sure what the problem is:
Error in payment. Sagepay says: 4020 : Information received from an Invalid IP address.
Presumably at this point you’ve already entered your IP address into the appropriate area in your Sage Pay administration settings. But the problem occurs if you haven’t entered your server’s IP address. If you’ve only entered the IP address of your domain, which is often different to your server IP address, the Sage Pay server will treat the information received as from an invalid source.
So in summary – find out your server’s IP address and log into your Sage Pay account. Go to Settings > Valid IPs

Click ‘Add’ in the bottom-right corner and enter your server’s IP address. That’s all there is to it. Thanks for reading the Magento Blog at Ecommerce Web Design.
Adam is Ecommerce Manager and a PHP developer at Creare Group. Adam is responsible for training Magento development within the company. Follow Adam on Twitter: http://twitter.com/adampmoss. - Read my other posts.

[...] have blogged about a solution to this error in the past (clicky), however I’ve since learned a nice little trick for discovering your Server’s IP [...]
I also had the same problem here… I’d like to thank you for taking your time to post about this. I may also add that you can use SagePay in simulator mode to find out the external IP address of your server. Because, you are right… sometimes the IP address can differ from the IP address of the domain. Most people would just ping the domain to get the IP… http://atomiku.com/2012/01/oscommerce-v2-3-1-and-sagepay-direct-error-4020-invalid-ip-address/
Thank you!
Xml<