prgrm
prgrm

Reputation: 3833

Laravel 5.5 Sessions not saving after using Paypal

I have checked several questions already and tried everything but it did not help.

I want to use Laravel Sessions to store some data but they don't persist.

The code is something like this:

public function payment (Request $request)
{
$data = "somedata";
$provider = new Provider();

       $request->session()->put("data",$data);
       $request->session()->put("provider",$provider);

       $response = $provider->setExpressCheckout($data);

       return redirect($response['paypal_link']);
}

This happens when I open, let's say www.mypage.com/pay

When I use dd($request->sesion()->all()); here, the session has been saved.

Now the user gets redirected to Paypal, does the check out and it gets redirected somewhere in my application.

public function aferpay(Request $request)
{
dd($request->sesion()->all());
}

When this function gets called, the previous url is fine "url" => "www.mypage.com/pay" even though it comes from Paypal, but the rest of the data is not there anymore.

Any help?

Upvotes: 2

Views: 376

Answers (1)

Tudor
Tudor

Reputation: 1898

Check your session config for any oversights, especially the session domain.

Make sure the session driver is working, and if you are using file sessions make sure the session directory is writable and there's enough free disk space.

Finally, msure you are not accessing mypage.com/pay without www first, and paypal redirects to www.mypage.com/pay and the session doesn't stick because of that - setting .mypage.com as the session domain will fix this.

If all else fails, please attach the set-cookie response headers of your mypage.com/pay page.

Upvotes: 2

Related Questions