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

cschoeni's avatar

Laravel Cashier (Billing)

Hello everybody I have a problem with Laravel Cashier. Here's what I've done

  1. I Installed laravel/cashier with composer require (controll in composer.json file its installed)
  2. I updated my composer file
  3. I registred Laravel\Cashier\CashierServiceProvider in my config file.
  4. I Copyied all of migration in my users_table an migrate that
  5. I setup my Model with "use Laravel\Cashier\Billable;" and with "use Billable;" in my User Class
  6. I copy the empedet Form from Stripe and paste that in my test page

My Problem: When i write the Code like this in the documentation

$user = Auth::id(); $user->newSubscription('main', 'monthly')->create($creditCardToken);

But with this code became a failre Call to a member function newSubscription() on integer

I can change the variable creditCardToken with the _token, but its not work. What i make false?

I hope you can Help my

Best regards Christoph

0 likes
2 replies
martinbean's avatar
Level 80

@cschoeni It’s because you’re fetching the user’s ID, and not the User model instance.

It should be:

$user = Auth::user();

Not:

$user = Auth::id();

Also be sure to check you actually have an authenticated user first, using the auth middleware on your route.

1 like

Please or to participate in this conversation.