The issue of the session being destroyed and the 419 error page being displayed could be due to a CSRF token mismatch.
To solve this issue, you can try disabling CSRF protection for the return back URL by adding it to the $except array in the VerifyCsrfToken middleware.
Here's an example of how to do this:
- Open the
app/Http/Middleware/VerifyCsrfToken.phpfile. - Add the return back URL to the
$exceptarray. For example, if your return back URL ishttps://example.com/payment/return, you would add the following line to the$exceptarray:
protected $except = [
'payment/return',
];
- Save the file and test your payment integration again.
Note: Disabling CSRF protection for the return back URL may pose a security risk, so make sure to thoroughly test your payment integration and implement other security measures as necessary.