My first question on codeigniter. I have integrated paypal in codeigniter using paypal library. everything working fine but when I return to success page then it gave me “An Error Occurred : The action you performed is not valid”. But the same success page is accessible directly from the url (I mean when I put it in the browser directly).
Controller
function form()
{
$this->paypal_lib->add_field('business', 'xxxxxxx@ymail.com');
$this->paypal_lib->add_field('return', site_url('checkout/paypal/success'));
$this->paypal_lib->add_field('cancel_return', site_url('checkout/paypal/cancel'));
$this->paypal_lib->add_field('notify_url', site_url('checkout/paypal/ipn'));
$this->paypal_lib->
add_field($this->security->csrf_token_name, $this->security->csrf_hash);
}
function success()
{
echo "success";
}
Routes
$route['checkout/paypal'] = 'checkout/paypal/index';
$route['checkout/paypal/(:any)'] = "checkout/paypal/$1";
Success page is diretly accessible and prints “success” but when I return from paypal , it gave me “An Error Occurred”
In the apache log..getting 500 572. I am not pretty much sure what it reflects.
Thanks
Open your site’s main configuration file and check your CSRF settings. I had a similar problem once, and it was solved by disabling CSRF protection.
Does that make any difference?