0

When payment gateway like payumoney, ccavenue, paytm etc. redirect to callback url or redirect url or you can say that after payment success or failure we are able to collect data from gateway but unfortunately session destroy automatically sometimes. Sometimes i am able to collect session data and sometimes it destroy all the session data. As i check, session actually not destroy but it creates a new session file or regenerate a session id. There no white space, no special characters also i have tried to store session in database but not helpful.

Also changed the system/libraries/session/session.php

i have also tried this session destroying in codeigniter after redirecting

Silent Psycho
  • 21
  • 1
  • 3
  • what CI-3 version are you using? in case you don't use CI 3.1.11 maybe you find some help in my answer here: stackoverflow.com/a/63442735/2275490 it also depends a lot how your are setting up your session with CI: https://stackoverflow.com/a/46876622/2275490 – Vickel Oct 19 '20 at 21:15

3 Answers3

1

Add these lines to your code

ini_set('session.cookie_samesite', 'None');
ini_set('session.cookie_secure', true); 

Comment below line if you have in your code

ini_set('session.use_strict_mode', 1);

This solution worked for me in core PHP try this in CodeIgniter and check if it works

ChrisMM
  • 8,448
  • 13
  • 29
  • 48
Ganesh
  • 13
  • 1
  • 3
0

This issue is related to the SameSite Cookie Policy (Browser Policy), this is not related to payment gateway.

Please follow below step to fix it.

Use Cookie with SameSite None - https://github.com/GoogleChromeLabs/samesite-examples/blob/master/php.md

OR

add below in .Htaccess (It can be help

Header always edit Set-Cookie (.*) "$1; SameSite=None"
0
Header always edit Set-Cookie (.*) "$1; SameSite=None"

in .htaccess file in Apache server.

Previously it was working in the Old version on Chrome but now not working on the new updated version of Chrome. But it is perfectly working on Firefox.