Welcome Guest, Not a member yet? Register   Sign In
how do i store some value to use after redirected from Payment gateway
#1

i want to store some value to use later when the page is being redirected back from payment gateway. 
for ex. i want customer name, address later after the payment is successful.
i have tried using session for that but the session value got destroyed after redicted from another domain or server.
i am new to this so please explain properly. 
i am using Codeigniter 4.
Reply
#2

not sure but when i integrated paypay they had a " if successful post payment url" you could set yourself and there was the means to get info. So it was only a matter of extracting that info , putting in a database, before the client sees something .like "payment successful" .
CMS CI4     I use Arch Linux by the way 

Reply
#3

In order to keep your session you should check CORS subject. There are lots of threads about it including mine here

And in order to trigger anything on a page,  like sending data to the database,   you can use JavaScript (Jquery or whatever your know) on the page load
Reply
#4

Or save the info in an encrypted cookie.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(10-12-2023, 09:25 PM)InsiteFX Wrote: Or save the info in an encrypted cookie.

can you please explain how can I use an encrypted cookie?

I tried using cookie but it is not working.

PHP Code:
helper('cookie');
 
set_cookie('username'$data['billing_name'], time() + 60*60*24*30);
return 
redirect('testing'); exit; 


PHP Code:
public function testing(){
  helper('cookie');
  echo "page is working";
  echo get_cookie('username'false'');

Reply
#6

Set a secure PHP cookie for an encrypted connection
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

@anuragk Never use exit().
Reply
#8

@InsiteFX The cookie is not encrypted, but for an encrypted connection (HTTPS).
Reply
#9

Right, but he would need to encrypted the cookie data then store it in the cookie.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

ok but first it needs to work, set_cookie is not working is CI4
and using the mentioned way is not working for storing the cookie


PHP Code:
helper('cookie');
set_cookie('username'$data['billing_name'], time() + 60*60*24*30);
return 
redirect('testing'); 



PHP Code:
public function testing(){
  helper('cookie');
  echo "page is working";
  echo get_cookie('username'false'');


The above code does not give me any output, it only prints page is working, not the cookie value
whereas the conventional PHP way of using cookie is working fine.

I tried
PHP Code:
setcookie('name''this is cookie'); 



PHP Code:
echo $COOKIE['name']; 

this code worked.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB