laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.39k stars 679 forks source link

Class 'App\\Models\\Person' not found #1088

Closed JohnnyWalkerDigital closed 3 years ago

JohnnyWalkerDigital commented 3 years ago

I have a custom user model in Laravel. Everything is working as expected, including Cashier. The only problem I'm having is with Stripe's webhook. I'm sure I've configured everything correctly, but I'm getting a weird error on customer.subscription.deleted events (and possibly others, too).

The error is:

Class 'App\Models\Person' not found

I have added CASHIER_MODEL: App\Models\Person to my .env file. Obviously the webhook must be talking to Laravel and reading the .env successfully to even get this error message. (How else would it know the "Person" model?)

My question is: Why can't Cashier find the model?

My App/Models/Person.php is working perfectly fine with every other aspect of my app, including Cashier. I can register, create subscriptions, new Stripe users, etc. all fine. It's just the webhook.

I have use Laravel\Cashier\Billable; at the top of the class. I have added the following to VerifyCsrfToken.php:

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

This is the full error:

in /var/app/current/vendor/laravel/cashier/src/Cashier.php (line 69)

        `return;        
   }

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

   return (new $model)->where('stripe_id', $stripeId)->first();    
}`
driesvints commented 3 years ago

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to report back and I'll gladly help you out and re-open this issue.

Thanks!

JohnnyWalkerDigital commented 3 years ago

Actually was just about to delete. I think it's fine. I just compared the cus and sub IDs and the ones that are failing are deleted customers. Thanks.