Magento SagePay Server Integration

Thought it would be worth posting about this. I’m just polishing off a site, they are using SagePay as their payment processor so I’m using the Server-Server integration method to do it. How frustrating, could not get the order to process, every time I got to the final stage it returned;

HTTP Status Code:  500 
HTTP Status Message:  The request was unsuccessful due to an unexpected condition encountered by the server. 
Error Code :  5006 
Error Description :  Unable to redirect to Vendor’s web site. The Vendor failed to provide a RedirectionURL.

Tearing my hair out – “This doesn’t even make sense!” thought I. A RedirectionURL? There’s no section for including a redirection url in the My SagePay admin panel. Worldpay works like that, you have to manually enter the return url for it to use, but there’s nothing like that in SagePay.

D’Oh. Couldn’t have been simpler. In fact so simple I’m slightly embarrassed by the fact I got caught out. It’s a dev site so I had an .htpasswd file in the root, the Sagepay server couldn’t return the order status to Magento because my dev server was password protected. What a dumpling – mind you, it’s easy to forget that, you logged on in the morning and your session has been open all day….. OK, I’m making excuses, I’m a dumpling. Hope this helps someone.

Just another point while I’m on it – The Ebizmarts Magento SagePay suite does not play nice at all with jQuery. Even though I’ve loaded it in in no conflict mode, when you get to the end of the checkout process the credit card input form fails to load whether your are firing it up in a modal window or in an iframe below the order review panel. It just won’t load at all if jQuery has been loaded in the head of the one page checkout page. Thankfully it’s not too difficult to sort out, mainly because whatever reason you had to use jQuery in the site, you are probably not using it in the one page checkout. So just remove it on that page.

Create a local.xml layout file (the one file to rule them all, and in the darkness bind them) in your theme’s layout directory and add this to it (adjusting for your jQuery version of course);

<?xml version="1.0"?>
<layout version="0.1.0">
<default>

</default>

<checkout_onepage_index translate="label">
    <reference name="head">
        <action method="removeItem">
            <type>js</type>
            <name>jquery1.4.2.js</name>
        </action>
        <action method="removeItem">
            <type>js</type>
            <name>jquery.nivo.slider.js</name>
        </action>
        <action method="removeItem">
            <type>js</type>
            <name>jquery.prettyPhoto.js</name>
        </action>		
    </reference>
</checkout_onepage_index>

</layout>

Leave a Comment