This is a PHP (Zend Framework 1.11) site, not using an off-the-shelf package. When the request to:
4020 : Information received from an Invalid IP address.
After getting a response from SagePay I have found the following important notes:
The issue here was that the IP address of the web server (www.mysite.com), being on a VPS, turned out to not be the same address as the one used when
curl requests were made. I made a test PHP page that mailed the IP in
$_SERVER['REMOTE_ADDR'] to myself and put it on another server. I then used
curl to grab that script and low and behold it was a different IP. Putting (a zero padded version of) this in to the
Valid IPs section in My SagePay control panel (logged in with the admin account) it sprung to life immediately.
You can use:
[user@host ~]# curl icanhazip.com 220.127.116.11
to display the correct IP to use, from the command line of the server you're hosting the web site on, instead of uploading files and all that malarkey. More information and usage here.