Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

codebullet's avatar

Laravel Cashier (Stripe) Custom Webhook not firing

Good day, please not sure what i missed tying to use custom webhook for some reason it is not firing.

// web.php
    use App\Http\Controllers\WebhookController;

    Route::post('/stripe/webhook', [WebhookController::class, 'handleWebhook']);

My custom webhook

<?php

namespace App\Http\Controllers;


use Laravel\Cashier\Http\Controllers\WebhookController as CashierWebhookController;

class WebhookController extends CashierWebHookController
{
    //
    public function handleCheckoutSessionCompleted($payload)
    {
        dd('hello');
 
    }
}

I have on my local server

STRIPE_WEBHOOK_SECRET=******************* in my .env file

if i test the webhook from stripe dashboard i get 200 response

I am not sure what i missed please any heads up is appreciated

thanks a lot

0 likes
5 replies
Snapey's avatar

did you add the route to csrf exceptions?

do you have any routes earlier in your routes file that could be greedily grabbing the route? Try moving this route to the top of your routes

does the name of your function match the stripe event code?

codebullet's avatar

Yes i have that

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        //
        'stripe/*'
    ];
}

I cleared cache, config and routes

 $checkout = $request->user()->checkout($stripeItems, [
            'success_url' => route('account.order'),
            'cancel_url' => route('cart.index'),
        ]);

after payment success it redirects me to success url without going through the custom webhook

Snapey's avatar
Snapey
Best Answer
Level 122

You didn't answer two of my questions.

Also, what webhook event is firing? Look in Stripe dashboard for the event type for your webhook.

codebullet's avatar

This is the event i am firing from stripe dashboard checkout.session.completed i move this to the top of the route list

I will try another approach.

Please or to participate in this conversation.