I've got it all working now. Here is what I did...
1.) Changed the user_id column in the subscriptions table to company_id
2.) Used createAsStripeCustomer() before creating the subscription.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've been through the Laracast video on Cashier, which is outdated, but some people had mentioned that not that much has changed since then. Anyhow, I'm getting an error when I try to create a subscription -- and I'm starting to think that I need to create a Stripe customer first, and use a customer token instead of the token from the check out. If that is the case, then... but I can't find anyone hinting that this is the case.
Here's my code to create the subscription, I didn't use User, but instead used the Company model for my project:
// https://laravel.com/docs/5.5/billing#stripe-configuration
$company->newSubscription('10 Users', '10-monthly')->create($stripeToken);
And here is the error message I see in the logs:
[2018-01-13 11:28:47] local.ERROR: No such customer: tok_1BjnBkLrP3RyeWsmPmbKc7Dn {"userId":21,"email":"[email protected]","exception":"[object] (Stripe\Error\InvalidRequest(code: 0): No such customer: tok_1BjnBkLrP3RyeWsmPmbKc7Dn at /vendor/stripe/stripe-php/lib/ApiRequestor.php:124)
[stacktrace]
I also changed the model references in services.php, to use Company instead of User.
'stripe' => [
'model' => App\Company::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
I've got it all working now. Here is what I did...
1.) Changed the user_id column in the subscriptions table to company_id
2.) Used createAsStripeCustomer() before creating the subscription.
Please or to participate in this conversation.