Update cookies preferences

Magento Sagepay Error: Unable to redirect to Vendor’s web site. The Vendor failed to provide a RedirectionURL.

Have you come across the Sagepay Error Code : 5006? Error Description : Unable to redirect to Vendor’s web site. The Vendor failed to provide a Redirection URL, we've found a solution!

Sagepay Error Code : 5006

Error Description : Unable to redirect to Vendor’s web site. The Vendor failed to provide a Redirection URL.

After many hours of debugging we managed to discover a fix for one of the many reasons this error can appear.

What made this difficult to debug was that there was No errors anywhere! No system.log, exception.log, apache/nginx or php errors that showed anything wrong.

The SagePaySuite log files all showed successful request and response data.

So why was Sagepay returning an error to the user?

Well it turns out Sagepay’s IPN was sending the data to the store, and the store was using a module from MageWorx called MageWorx Store Switcher

This module tries to work out where the user is using Geolocation, and redirects them to the correct store for their location.

So when the SagePay IPN came in it redirected them using a 302 back to the same store, so even though the response had the correct data, sagepay only looked at the 302 status and followed that, looping back until it quit.

The Solution

Solution is to disable the module, or apply a restriction based on incoming URL and prevent any redirects.

If you’re looking to find out why a redirect happens in Magento 1.9.x add the following code

Mage::log('Redirecting: '.mageDebugBacktrace(true, true, true), null, 'redirect-log.log');

Inside the setRedirect() function of app/code/core/Mage/Core/Controller/Response/Http.php

Then take a look at var/log/redirect-log.log to find the info.

If you enjoyed this article, read our other Learn articles to see more from our Magento developers or browse the site to see what else we do with Adobe Commerce, PunchOut Catalog and more.

Want to see how our team solves other Magento Issues?


...
Luke

share:

Ready to start your next project?

See how we can help you accelerate your business