Cs-Cart 4 Session Lost After Redirect

[color=#000000][font=Arial,]

I have a CS-Cart 4 installation that has the Credit Card payment method configured to use the Authorize.net gateway. I am working on an integration to make a call to cardinal commerce prior to the transaction going to authorize.net.[/font][/color][color=#000000][font=Arial,]

Once a user clicks “Submit” it makes a call through CS-Cart 4’s controllers and finds its way to a function called fn_start_payment(). Inside this function there’s an if() check to see if it’s a payment processor file being executed and if it is I set a $_SESSION[‘Cardinal’] = true so that my processor file will catch it.[/font][/color][color=#000000][font=Arial,]

Next CS-Cart 4 executes the processor script (authorizenet_aim.php), the top of that script looks like this:[/font][/color]

<?php

[color=#00008B]if[/color] ( $_SESSION[[color=#800000]'Cardinal'[/color]] ) {
[color=#808080]// Catches the first time through[/color]
[color=#808080]// If you log out session_id() here you get an id, let's say "f704321"[/color]
[color=#808080]// Redirects to Cardinal's Test Site[/color]
} [color=#00008B]else[/color] {
[color=#808080]// Catches when we are redirected back to from Cardinal[/color]
[color=#808080]// If you log out session_id() here you get an id different from above[/color]
}[color=#000000][font=Arial,]
That's a simple version of what is going on. In the else I've noticed that I cannot use any of the CS-Cart 4 functions or built in libraries so it almost seems like I need to hit something to reinitialize CS-Cart 4.[/font][/color]
[color=#000000][font=Arial,]
Your session_id()'s before and after redirect are always different, I've tried a session_write_close() and an exit() before and after the redirect. I've tried using the default php session functions, I've tried using the Session class from CS-Cart 4 which is database backed (MySQL). I've also tried having session_start() and Session::start() at the top of this script to no avail.[/font][/color][color=#000000][font=Arial,]
I've looked through several pages of results for php session issues after redirect and tried all the suggestions and nothing has worked. I also thought maybe it was an issue that my test system is http:// and the Cardinal test site is https:// but I've deployed my code out to a live system which runs https:// and I have the same issue.

I've also read in some of the KB docs that the default authorizenet payment processor entry in the database has 'Y' defined for Callback which means it doesn't redirect away from your store. Now that I am wanting to do a redirect prior to sending data to authorize.net maybe I need to create a new entry and select that as my payment processor along with setting the value for callback in the new entry to "N".[/font][/color][color=#000000][font=Arial,]
tl;dr - User clicks submit, redirected to cardinal, comes back from cardinal to my authorizeaim_net.php script and none of CS-Cart's internals work (nothing Tygh, etc).[/font][/color]