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

sparky1815's avatar

Cashier Webhooks not working

Working in Laravel 5.8, setting up subscriptions using Cashier and Stripe. Have setup my webhook endpoint and configured it on the Stripe side. When I send a test webhook, I get this error in my log:

[2021-11-03 21:59:33] local.ERROR: Class name must be a valid object or a string {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class name must be a valid object or a string at /opt/bitnami/frameworks/laravel/vendor/laravel/cashier/src/Cashier.php:69)

Have tried clearing the config cache with artisan. Also tried declaring the cashier model in my .env file. Neither worked.

0 likes
17 replies
sparky1815's avatar

That's part of my problem. I haven't really written any. Per the docs I added the webhook route:

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

I also added the CSRF token exception, and added my Stripe webhook secret to the .env. The way I understand the docs, Cashier should handle these webhooks out of the box.

sparky1815's avatar

Have tried a bunch of stuff to fix it, but this is the only thing that seems to work. I changed this:

$model = config('cashier.model');

To this:

$model = \App\User::Class;

In Cashier.php and the webhook works. Obviously editing things in the vendor folder isn't good, but I'm not sure what else to do.

Sinnbeck's avatar

@sparky1815 can you do the following. What does it output?

php artisan tinker
//in tinker
config('cashier.model'); 
Sinnbeck's avatar

Skip that. Seems you are using an older version. Just add this to your env file

CASHIER_MODEL=App\User

Please or to participate in this conversation.