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

EmilMoe's avatar
Level 10

Stripe: It seems I always need `->createAsStripeCustomer()`?

I'm creating a SaaS and it seems that it would work better if I call createAsStripeCustomer() in User boot method right after creating (created)? Otherwise methods suchs as this fails:

auth()->user()->subscribed('main')

However the documentation says the following, and that confuses me:

Occasionally, you may wish to create a Stripe customer without beginning a subscription. You may accomplish this using the createAsStripeCustomer method

So how do you handle it for SaaS? I thought about creating a ´isValidStripeCustomer` method, but it's gonna be a lot of checks or maybe I should override the methods such assubscribed` or simply make every user a Stripe user?

And also would you create free users in Stripe under a free plan?

0 likes
1 reply
fylzero's avatar

All you need is...

$user->newSubscription('default', 'premium')->create($paymentMethod);

https://laravel.com/docs/6.x/billing#creating-subscriptions

No, you do not need to create Stripe accounts, nor a plan for unsubscribed users. Just gate your app based on auth users and, if you want, make a middleware for stripe subscribed users.

23 likes

Please or to participate in this conversation.