OMG :shocking: I think I've done it.
From your post of the following code I only just noticed the GET zenid will only be processed if its a SSL! I dont have a SSL so the session was not being recreated!
if (isset($_POST[zen_session_name()])) {
zen_session_id($_POST[zen_session_name()]);
} elseif ( ([B]$request_type == 'SSL'[/B]) && isset($_GET[zen_session_name()]) ) {
zen_session_id($_GET[zen_session_name()]);
}
Oh such a simple thing that was overlooked!!!
So I could not use header redirect anyway as this is GET not POST, and have now got the POST working OK via CURL.
So the callback file will first run the checks to make sure its come back from the payment gateway, and then use CURL to post the zenid to checkout_process. There are then some variables passed to this that the before_process() uses to check that its come from the gateway so you cant use checkpout_process to override the order.
Thanks a lot for your help. There are a couple of things I want to tidy up, but seems to work. The only thing is the $_SESSION['payment'] was not being set as the payment gateway on the Shopping Cart page, so if you went to checkout_process it would not call the before_process() as it didnt have a payment module loaded, so the order was processed anyway. I cannot see how to load the payment module in the session at the shopping cart stage (it does it as payment page) so in the meantime I have had to hard code the payment gateway to load into the session everytime. I dont suppose you know how the payment module gets loaded into the $_SESSION['payment'] on the main_page=shopping_cart do you so I dont have to hard code it? My code looks to be the same as all other gateways. V strange.