Contact us on: +44 (0)1432 617 006

The Site Doctor Blog

Footprints in the snow of a warped mind

< Back to Blog

How To: Return the customer to your site after paying with WorldPay

Stripe is generally our go-to PCI compliant payment gateway but from time to time we're asked to use alternatives such as WorldPay. For the most this is fine but redirecting the shopping from WorldPay on a successful transaction is a bit of a pain and there are a lot of people online asking about how to get WorldPay to redirect you back to their store after completing the order.


Showing the shopper your store's custom order confirmation page is simple enough, you need to check the "Enable the Shopper Response" checkbox in the installation settings area:



That will then go to the url your site's callback specifies and grab the content -which is great, only because the customer is actually still on the WorldPay url you'll likely end up with some ugly unformatted version of your site at best:



You can work around that by adding a simple base url in the <head> tag of your page like this:

<base href="">

The issue with this though is the url in the address bar is still WorldPay's so to work around it properly and return the customer to your website after paying on WorldPay, we'll need to modify your Ucommerce order confirmation page a touch by adding a redirect:

@if (string.IsNullOrWhiteSpace(Request.QueryString["processed"]))
    <meta http-equiv="refresh" content="0;url=@Request.Url.ToString()&processed=yes" /">

This little snippet outputs a meta redirect tag if the url is from WorldPay (cheating by adding processed to the url) so when WorldPay output the page, you simply redirect the user to your site. Voila:


This is currently supported and documented by WorldPay if you're worried we've hacked around things too much:

Author: Tim on

Liked this post? Got a suggestion? Leave a comment