Q:

Laravel session variables get Null, once redirect to Payment Gateway and return back

I found some related questions, but they don't have enough explanations/solutions for my problem. I'm integrating Paycorp payment gateway with an existing project. In PaymentController.php I put all the hotel IPG settings in an array and put in session. Once I put it in session, I try to print it with vardump, it is working, it is in the session! Then I initiate the payment and redirect to generated url. It redirects to Paycorp payment, I provide the card details and submit. When it returns to PaymentCompleteController.php I need to complete the payment and I Need the Hotel IPG settings which I've put in session. When I tried to get it, there is nothing and it is NULL.
PaymentController.php
    $params['something1'] = $something1;
    $params['something2'] = $something2;
    $params['something3'] = $something3;
    $params['something4'] = $something4;

    Session::put(SampleModel::PARAMS, $params);
    //At this point Params are in the session
    //var_dump(Session::get(SampleModel::PARAMS)); exit();

    //Initiate Payment and Redirect to URL

Once the card details are given and submitted, it will redirect back to 
PaymentCompleteController.php
    vardump(Session::get(SampleModel::PARAMS)); exit();

In PaymentCompleteController.php session variable is null. But the variable put before the PaymentController.php are still there.

A:

When a Laravel application lifecycle starts, any value put in Session are not yet stored until the application lifecycle ends. The redirect is preventing that.
Persist the session values right after you call put():
Session::put(SampleModel::PARAMS, $params);
Session::save();

