I have a strange problem with a callback. I have a route called back by a payment provider and there are several strange things happening.
The same application on another server had none of these problems. There was a migration I made and all parameters are set the same, so configuration for Laravel and Php is identical but still randomly some customers don't have a session when they get redirected back by the provider.
I managed to handle the callbacks even without a session until I figure out the reason of this problem but the strange thing also happening is that the translations too of some blade / pdf that gets sent via mail are showing just as keys and not their value.
I have tried messing with the session.php config about samesite, lifetime, etc, even though the previous server didn't gave me any of these problems, with same values; but nothing helped.
Another thing I haven't tried is to set the web middleware to this route, but as I said I am trying to manipulate things that never were a problem.
php.ini
Session Support => enabled
session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => no value => no value
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_samesite => no value => no value
session.cookie_secure => 0 => 0
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 0 => 0
session.lazy_write => On => On
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => /var/lib/php/sessions => /var/lib/php/sessions
session.serialize_handler => php => php
session.sid_bits_per_character => 5 => 5
session.sid_length => 26 => 26
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_
session.use_cookies => 1 => 1
session.use_only_cookies => 1 => 1
session.use_strict_mode => 0 => 0
session.use_trans_sid => 0 => 0
session.trans_sid_hosts => no value => no value
session.trans_sid_tags => a=href,area=href,frame=src,form= => a=href,area=href,frame=src,form=
XDG_SESSION_TYPE => tty
XDG_SESSION_CLASS => user
XDG_SESSION_ID => 4663
DBUS_SESSION_BUS_ADDRESS => unix:path=/run/user/1000/bus
$_SERVER['XDG_SESSION_TYPE'] => tty
$_SERVER['XDG_SESSION_CLASS'] => user
$_SERVER['XDG_SESSION_ID'] => 4663
$_SERVER['DBUS_SESSION_BUS_ADDRESS'] => unix:path=/run/user/1000/bus
config/session.php
...
'driver' => 'file',
'lifetime' => 1200,
'path' => '/',
'secure' => false,
'samesite' => null,
'expire_on_close' => false,
What could be the reason of this? What am I missing?
In order to accomplish a reliable communication, without relying on finding or understanding what is messing with the session, as so many things could have or will some day; I managed this in different ways, but being in production adopted the third one, with the idea to switch to the second one when I am on more calm waters:
Set some middleware and it will ask user to login then redirected to theconfirmation route
Set another pre-landing page where the customer confirms the operation then from your page redirect to theconfirmation route
and the session will be attached again
Resolve this internally without involving user interaction: when theconfirmation route
gets called by the provider, use some pre-exchange hashed keys so that when you get called back you use these keys to find who is the user connected to that payment, login that user and set whatever Session data you might need generally for theconfirmation route
to work. [communication must be secure]
The most important rule I've learned:
Never expect a payment provider won't mess your session
Hope these help someone else.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Laravel is a free open source PHP framework that came out in 2011. Since then, it has been able to become the framework of choice for web developers. One of the main reasons for this is that Laravel makes it easier, faster, and safer to develop complex web applications than any other framework.
https://laravel.com/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.