Wrong order number in checkout_success page with RealEx payment module
Hi,
I'm having real trouble completing my transaction after re-directing to Realex for secure payment. (see Realex thread for details - http://www.zen-cart.com/forum/showth...115#post805115)
Anyway, I managed to successfuly complete the payment and return to the checkout_success page but the shopping cart still contains the items that the client bought and the order number is the order number the client last ordered.
Is it possible to get checkout_success to remove the cart items and add them to the database as a new order and then display the correct order number.
thanks.
Using Zencart v1.3.8a
Re: Wrong order number in checkout_success page
What you really need to do is figure out why the cart isn't completing the order as it should when the payment is made. It sounds like the response from your payent gateway isn't being processed correctly.
Re: Wrong order number in checkout_success page
Hi,
Well what I was doing initially was posting the response from my payment provider see code below, but this results in a blank page. However, if I post it to checkout_success instead I get a valid page on my website but the order is not added to the database as a new order even though the payment has been processed successfully.
thanks
include('includes/application_top.php');
//$orderid = $_POST['ORDER_ID'];
$process_button_string =
zen_draw_hidden_field('MERCHANT_ID', $_POST['MODULE_PAYMENT_REALEX_ID']) .
zen_draw_hidden_field('ORDER_ID', $_POST['ORDER_ID']) .
zen_draw_hidden_field('TIMESTAMP', $_POST['TIMESTAMP']) .
zen_draw_hidden_field('AUTHCODE', $_POST['AUTHCODE']) .
zen_draw_hidden_field('MESSAGE', $_POST['MESSAGE']) .
zen_draw_hidden_field('RESULT', $_POST['RESULT']) .
zen_draw_hidden_field('PASREF', $_POST['PASREF']) .
zen_draw_hidden_field('MD5HASH', $_POST['MD5HASH']);
echo "<form action='" . zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL') . "' method='post' name='completeprocess'>";
echo $process_button_string;
echo "</form>";
?>
<script>
document.completeprocess.submit();
</script>
Re: Wrong order number in checkout_success page
I should point out this code does work, in that it adds the order to the database and sends the customer an email, so something is being processed but for some reason it just displays a blank page with "equetriangifts" on it - so it looks to the customer like it has failed.
Re: Wrong order number in checkout_success page
What you need to be doing is initially processing the response from your payment provider - it the response is valid (payment successful), proceed to the checkout_process page (which creates the order, clears the cart and then redirects to the checkout_success page). If the response is invalid (ie payment not successful), go back to checkout_payment page and display appropriate payment errors. Perhaps the best way to achieve this is to create a new handler page for your payment provider to post the response to (similar to ipn_main_handler.php).
Re: Wrong order number in checkout_success page
Hi Stuart,
I'm wondering if you can help me, I am using realex myself and am hitting a wall with the payments side, I am using the test side of things with realex and after I put in the test card details I get an error saying that there was a problem connecting back to the merchant's web site. I'm just checking (since you also use the realex shipping module) if you could tell me if you have the before_process.php in your root folder, or is there somewhere else I should have it? If you don't know off hand, don't worry. Realex said today that they have added that URL so it should be working but I'll be getting on to them again tomorrow.
Thanks
Alex
PS love the site :)