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

garrettmassey's avatar

Is there a method to check if a user is an existing Stripe customer?

Using Laravel Cashier, we can create a stripe customer from a user object:

$customer = $user->createStripeCustomer();

But the way my onboarding process currently works is that when a user signs up, they can leave the application at any point and middleware will take them back to the last step they did NOT complete in the onboarding process.

Right now, what I do is this: when a user reaches the payment method step, the OnboardingController creates a stripe customer from the authenticated user. But if a user were to leave this page and attempt to go back at another point, I will get the error that the user is already a stripe customer.

So is there a method to check if a user is already a stripe customer? Or is the easiest way to just check for the stripe_id on the user object, and if it is null, create the customer, if not null, just pass the customer ID through to the view?

Something like this would be ideal:

public function customerPaymentMethod()
{
    $user = Auth::user();
    if(!$user->isStripeCustomer()) {
		$customer = $user->createStripeCustomer();
    } else { 
		$customer = Cashier::findBillable($user->stripe_id);
	}
    $user->createStripeCustomer();
    $onboardingSteps = Auth::user()->onboarding()->steps;
    $currentStep = function ($onboardingSteps) {
        foreach ($onboardingSteps as $step) {
            if (!$step->complete()) {
                return $step->title;
            }
        }
    };
    return Inertia::render('App/Customer/Pages/Onboarding/PaymentMethod', [
        'step' => $currentStep($onboardingSteps),
		'customer' => $customer,
    ]);
}
0 likes
1 reply
TRonin81's avatar

I think this should work.

$user->hasStripeId()

Please or to participate in this conversation.