Evan
Evan

Reputation: 1082

Stripe configuration endpoint Laravel cashier

I have been some problems making webhooks of Stripe works with my application. So after being able to create, update, delete, resume subscriptions, and create my endpoint to my domain:

 www.domain.com

I always recieve 419 http code when a user interact with my application.

Why does it happen?

Upvotes: 1

Views: 1360

Answers (1)

Evan
Evan

Reputation: 1082

I write this in case helps someone:

My problem was I hadn't included a route for stripe in my web.php, like this:

 Route::post(
   'stripe/webhook',
   '\Laravel\Cashier\Http\Controllers\WebhookController@handleWebhook'
);

and you can't forget to include stripe in your verifycsrftoken middleware, like this:

 protected $except = [
   'stripe/*',
 ];

and once you have done it, you have to configure your endpoint in stripe dashboard to call to the previous route:

 www.domain.com/stripe/webhook

and include all the events you want to listen to.

To test it in local you can use stripe cli, that works perfectly: https://stripe.com/docs/stripe-cli

Upvotes: 2

Related Questions