Open benrolfe opened 7 years ago
Normally returnUrl
is used for that purpose. I haven't looked into whether the WorldPay driver uses that though, but it's something to look at.
After a few days trying to get this to work. I don't think there is a way to acheive a redirect I've tried using the confirm method within CompletePurchaseResponse however I believe FF disables meta redirects by default so not much use. You could add a custom message to add a link to the message.
I've opted for a simple view though you need to edit PurchaseRequest to send the users session ID to pick it back up again within Worldpay as it's obvioulsy not avaiable.
I managed to implement a redirect by using a meta tag. Change {{ $url }} to your desired URL.
<!DOCTYPE html>
<html>
<head>
<title>Redirect</title>
<meta http-equiv="refresh" content="0; URL={{ $url }}">
</head>
<body>
<p>If your browser does not automatically redirect you, please use the link below.</p>
<a href="{{ $url }}">Click here to continue.</a>
</body>
</html>
In the WorldPay settings, you'll need set the "Payment Response URL" to this page. After a successful payment, WorldPay will POST data to this page.
With PHP you could verify the payment, mark the transaction as complete, then redirect.
This tool can help you debug exactly what POST data WorldPay send to you: http://webhookinbox.com/
See https://handcodedstudio.co.uk/tips/worldpay-redirect-with-select-junior/
Authorise.Net DPM uses the same technique - you return a page that the gateway will display to the end user. The key is that it is a complete page. Whether rightly or wrongly, this driver only returns the meta tag and nothing else, which I would not expect to work reliably on any browser.
In the example linked above is a belt and braces approach - a meta refresh AND some JavaScript to do the redirect. I am wondering if this should go into Omnipay Common as a third redirect type? We have GET
(a Location
header redirect) POST
(a form auto-submitted with JavaScript) and now perhaps HTML
(a page returned to the gateway to pass on to the user's browser).
Does anyone know how to do a redirect from WorldPay to a success/error page?
The
notifyUrl
only seems to be a webhook URL.