codeigniter ccavenue payment integration handle cancel button

448 Views Asked by At

I have created a CodeIgniter Web App with CCavenue Payment Gateway Integration. When the user clicks on the "ccavenue" button it takes us to the ccavenue payment gateway page. Case1: When the payment is done, it takes us back to the home page of the merchant website. This is fine. Case2: When the user clicks on "Cancel" on the ccavenue page, it takes us back to the page where "ccavenue" button is available. So far good! But when the user clicks the browser's back button, again we are landing in the ccavenue page (because that was our previous page). Now, the requirement is, it should not go back to the ccavenue page. Itstead it would go to the checkout page in the merchant's website

Thanks in advance!

1

There are 1 best solutions below

0
On

I think, this problem can be solved by Using Session. To prevent someone go back to the previous page.

Just add or Put this set_session as your trigger button or ETC, which pointing to your "Secure page". Therefore your process will only pass -> if and only if user click the specific trigger as I said using:

$this->session->set_userdata('your_previous_page',TRUE);

And add some if-else like so to prevent someone go back before set userdata, I dunno your controller, so please put this before you load the page inside your ccontroller:

if($this->session->userdata('your_previous_page') === TRUE){
// show your page
}else{
// redirect to somewhere page to prevent it happen
}

After you process is successful, just unset session :

$this->session->unset_userdata('your_previous_page');

SO, without any of 'your_previous_page' session, the user cannot go back to the previous page. Please provide your controller