WorldPay Response URL and Shopper Return for Thanks

fetchit-21

Update May 2011 – This may be against terms and conditions. See Martin Brown’s comment below

It took a while to get my head around it, so here it is incase I need it again.

Integrating with WorldPay is not the simplest of tasks. The documentation is poor at best.

I was integrating by using a form on my site, which posts the order total and an order id etc to WorldPay. WorldPay then deal with taking the money from the user. What I couldn’t understand was how to get the user back to my site for thanks after they had paid.

Turns out it’s quite simple.

In the WorldPay control panel, enable Payment Response and add a url to which Worldpay will ping information about the transaction (the user is not sent here, nore are they ever aware this url exists). Also Enable Shopper Response.

When WorldPay pings your Payment Response file with the details of the transaction, if you have enabled Shopper Response then you can send back some html which WorldPay shows to the user. I had a better solution for the thanks page on my own site and so simply sent a meta redirect tag back. Nothing more, nothing less.

So the user is redirected to a url of my choice, and because I send that url to them after the transaction completes, I can choose where to send the user at that moment using the data WorldPay have send me.

<meta http-equiv=”refresh” content=”0;url=http://www.example.com/thanks.html” />

5 comments.

  1. Hi there,

    I’m reading this post on your details about the redirect. But I really dont get it. I have been working on a website, and have now been using to much time on this. I have set up WP e-commerse, with the Worldpay merchant file this guy made. And it seems like payment is made in testmode, but I’m still stuck on the Worldpay payment page. And the shopping cart is not updated/reset on the e-commerse website.

    Could you give me a little help on this please?

  2. It may only be a matter of time before this stops working. To quote from the WorldPay manual:

    “Warning: Automatic redirection using the payment response server-side script, client-side coding or 301/302 server redirects are prohibited and will result in a failure being logged and a possible suspension of the feature.”

    I’m not quite sure why they have this restriction, but there it is.

    http://www.rbsworldpay.com/support/kb/bg/paymentresponse/payment_response.html

  3. Thank you, this meta refresh was very useful. Doesn’t seem like the MC_callback on the response URL supports Javascript or a PHP redirect, only this meta refresh worked for us during integration.

    We integrated it into our WordPress Shopping Cart plugin and will release it in the near future: https://tribulant.com/plugins/view/10/wordpress-shopping-cart-plugin

    All the best,
    Antonie

  4. It seems WorldPay are actually promoting the use of a META refresh now, rather than forbidding it as in Martin Brown’s comment.

    “If your system requires a full redirect to your own Webpage, you can include a META refresh (with a short delay) in the output of your payment response script (shopper response).”

    http://www.worldpay.com/support/kb/bg/paymentresponse/Payment_Response.html#pr5402.html

  5. Thanks! Been looking everywhere for a solution to this – who would have thought it was as simple as ticking a box.. Shopper Response!