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

lat4732's avatar
Level 12

Stripe is charging customers twice on subscription creation.

Hey everyone!

I just noticed that my code is charging customers twice on their subscription creation. That's my code:

payment page

$intent = auth()->user()->createSetupIntent();
if(!Auth::user()->stripe_id) {
      $user = Auth::user();
      $user->createAsStripeCustomer();
} else {
      $user = Cashier::findBillable(Auth::user()->stripe_id);
}

controller that handles the payment page form submission

$stripe=StripeProducts::where('plan_id',$setup->plan->id)->where('billing_cycle_months',$setup->selected_payment_plan_cycle)->first();
$user = Cashier::findBillable(Auth::user()->stripe_id);
$user->newSubscription($setup->plan->name,$stripe->stripe_price_id)->create($request->paymentMethod);

Any ideas why?

0 likes
5 replies
martinbean's avatar

@crypt.001111101 Payments are taken via a client-side approach such as Stripe Elements, and a subscription is created in your database via a webhook.

You’d do well to have a good read through of the Cashier docs until you understand them, as you’re started many threads around it where you’re asking questions that are covered in those docs.

lat4732's avatar
Level 12

@martinbean Maybe I didn't express myself correctly. My client-side code is literally copied from "Billing with Laravel Cashier" lesson. And what do you mean by "a subscription is created in your database via a webook"? I just opened a new NGROK tunnel and started Laravel cashier webooks pointing to my NGROK link so I can test what you've said and without the second code I posted above the subscription is not creating after "successful" payment.

lat4732's avatar
Level 12

@martinbean Following the Laravel Cashier documentation, a subscription is created with the following command:

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

There is nothing like "Subscription is being created by webhooks" in the documentation.

lat4732's avatar
Level 12

Still can't find where the problem is, so I assumed that if I add a condition which says:

if(!$user->subscribed($plan) {
 THEN SUBSCRIBE
}

it won't charge twice.. And it worked!

martinbean's avatar

@crypt.001111101 Stripe is an API. It’s only going to do what you tell it to. So if it’s charging customers twice, then that’s because you’re executing two requests to charge a customer somewhere.

Please or to participate in this conversation.