Answers for "Yii2 Stripe Webhook testing: "[ERROR] Failed to Post""

PHP
1

Yii2 Stripe Webhook testing: "[ERROR] Failed to Post"

class CreditCardController extends Controller
{
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                     'webhook' => ['post'],
                ],
            ],
        ];
    }

    public function beforeAction($action)
    {
        if ($action->id == 'webhook')
            $this->enableCsrfValidation = false;
        return parent::beforeAction($action);
    }
  
    public function actionWebhook()
    {
        $payload = file_get_contents('php://input');
        ob_start();
        var_dump($payload);
        error_log(ob_get_clean(), 4);

        echo json_encode(['status' => 'success']);
    }
Posted by: Guest on March-19-2022

Code answers related to "Yii2 Stripe Webhook testing: "[ERROR] Failed to Post""

Browse Popular Code Answers by Language