Jan 23rd, 2012, 8:26 AM
Hello,
I'm trying to integrate WorldPay into my website and I have hit a bit of a snag. I had previously set up paypal successfully but the issue I'm having with WorldPay is trying to clear the sessions on the result page presented to the customer after they either process a payment or cancel the transaction. With PayPal it was easy to redirect to a specific page on my site and clear sessions with no problem. But WorldPay doesn't allow you to redirect at all. They require you to show certain information to the customer and in order to prevent people bypassing that info they make you stay on their own result page.
Using the payment response feature, I have a php file which pulls the form ID and submission ID from WorldPay (previously submitted to their site via a custom variable on my order form pages) and it successfully finalizes the submission in form tools if the customer completes the purchase. However, I can't seem to find a way to clear the sessions. I'm thinking it's because at that point the customer is on the WorldPay website and not my own so clearing the sessions doesn't really do anything.
Is there a way to send a clear sessions message to my site from the WorldPay site without redirecting? Strange question I know, but WorldPay really makes it difficult to customize anything and the documentation is horrendous.
A code snippet from my php file which WorldPay includes on their result page:
Thanks.
I'm trying to integrate WorldPay into my website and I have hit a bit of a snag. I had previously set up paypal successfully but the issue I'm having with WorldPay is trying to clear the sessions on the result page presented to the customer after they either process a payment or cancel the transaction. With PayPal it was easy to redirect to a specific page on my site and clear sessions with no problem. But WorldPay doesn't allow you to redirect at all. They require you to show certain information to the customer and in order to prevent people bypassing that info they make you stay on their own result page.
Using the payment response feature, I have a php file which pulls the form ID and submission ID from WorldPay (previously submitted to their site via a custom variable on my order form pages) and it successfully finalizes the submission in form tools if the customer completes the purchase. However, I can't seem to find a way to clear the sessions. I'm thinking it's because at that point the customer is on the WorldPay website and not my own so clearing the sessions doesn't really do anything.
Is there a way to send a clear sessions message to my site from the WorldPay site without redirecting? Strange question I know, but WorldPay really makes it difficult to customize anything and the documentation is horrendous.
A code snippet from my php file which WorldPay includes on their result page:
PHP Code:
<?php
require_once("../../form_tools/global/api/api.php");
$fields = ft_api_init_form_page(8);
?>
<html><title></title><head>
</head><WPDISPLAY FILE=header.html DEFAULT="<body bgcolor=#ffffff>">
<?php
// successful payment! finalize the submission in the database
if ($_POST['transStatus'] == "Y")
{
ft_finalize_submission($_POST['MC_formID'], $_POST['MC_subID']);
ft_api_clear_form_sessions();
}
else
{
ft_api_clear_form_sessions();
}
?>
<p>
<WPDISPLAY ITEM=banner></p>
<p>
<a class="one" href="http://sandbox.mtncamps.com"><strong>Click here to return to the Mountain Adventure Camps website</strong></a></p>
<WPDISPLAY FILE=footer.html DEFAULT="</body>"></html>
Thanks.