Payment Module - Redirects to Login

I’m developing a payment module for CS-Cart, and everything appears to be working perfectly, except for one small glitch. The credit card details are taken on our processing gateway’s server, and it’s then redirected back to our cart upon successful completion of the transaction. Some data is being passed in a querystring, and some is in an HTTP post. The page:


Is called, and I’m using a print_r($_POST) to dump out all of the post data, all variables are as they should be. This page in turn calls:


However, instead of going straight to the appropriate page, the customer is then required to login again. After logging in again, the customer is taken to the order confirmation screen, where the order is flagged as processed, as expected. However, the items still remain in the cart.

Before I was using a post to pass back data from our processor, the additional login was not required, and the cart was emptied.

Does anyone know why this might be happening, or how to resolve it?

Thanks in advance for any advice.