Difference between #2 and #3 of
Using PayPal IPN with Yii2

Changes

Title unchanged

Using PayPal IPN with Yii2

Category unchanged

Tips

Yii version unchanged

Tags unchanged

yii2 yii paypal ipn 400 bad request

Content changed

[...]
```php
public $enableCsrfValidation = false;
```

To my XYZController.
It's not safe to do it, but it worked, I'm using different controllers just for IPN, so it's fine.
 
 
Or just add this code in your controller so you can easily disable CSRF
 
 
 
 
```php 
public function beforeAction($action) 
 
{
 
if(Yii::$app->controller->action->id=="ipn")
 
$this->enableCsrfValidation = false;
 
return parent::beforeAction($action);
 
}
 
```
 
 
 
 

Read more here: [Yii Forum]( http://www.yiiframework.com/forum/index.php/topic/21146-yii-and-paypal-ipn-400-bad-request-via-ipn-simulator/page__gopid__268890#entry268890 " http://www.yiiframework.com/forum/index.php/topic/21146-yii-and-paypal-ipn-400-bad-request-via-ipn-simulator/page__gopid__268890#entry268890")
0 0
1 follower
Viewed: 13 513 times
Version: 2.0
Category: Tips
Written by: darioo
Last updated by: darioo
Created on: Feb 28, 2015
Last updated: 9 years ago
Update Article

Revisions

View all history