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

newtimes's avatar

Laravel Cashier (Stripe) Custom Webhook not receiving $payload

We are trying to create a custom webhook to handle Stripe Checkout with Laravel Cashier. The problem is that we are following Laravel Cashier docs, but we are not receiving the payload from Stripe.

We are trying to hook to checkout.session.completed.

namespace App\Http\Controllers;

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

class StripeWebhookController extends CashierController
{

    /**
     * Handle Checkout Session Completed.
     *
     * @param  array  $payload
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function handleCheckoutSessionCompleted(array $payload) // Line 12
    {
	// Code...
    }

// Error: ArgumentCountError: Too few arguments to function App\Http\Controllers\StripeWebhookController::handleCheckoutSessionCompleted(), 0 passed in /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php on line 54 and exactly 1 expected in file /var/www/html/app/Http/Controllers/StripeWebhookController.php on line 12

We also created the route in web.php

use App\Http\Controllers\StripeWebhookController;

Route::post('/stripe/webhook', [StripeWebhookController::class, 'handleCheckoutSessionCompleted']);

We did add inside App\Http\Middleware\VerifyCsrfToken

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

Finally we also added our webhook secret inside the .env file.

0 likes
1 reply
newtimes's avatar
newtimes
OP
Best Answer
Level 2

Solved web.php had the wrong action. It should be like this.

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

Please or to participate in this conversation.