Skip to content
Advertisement

Stripe – adding new customers to an existing plan?

I have a simple form that registers users. The form also uses Stripe to process payments. Stripe’s API is super clean but for some reason I can’t seem to figure this out. Please tell me if i’m doing something wrong here.

Right now I’m in a test account with Stripe, but every time I register a user in stripe it keeps creating a new plan. I know in my code below I have “StripePlan::create” that’s because I don’t know how to add a new customer to an existing plan. Is this normal the way I’m doing this currently?

In the screenshot below you will see that it will create a new plan for that customer and assign them to it. Is it possible to just keep adding new customers to an existing plan?

enter image description here

JavaScript

Advertisement

Answer

To create a subscription with an existing plan, simply pass in that older plan’s ID when creating the subscription instead of creating a new plan for each customer. In your // Create a plan block, either retrieve an existing plan and use that to create the subscription or create a new plan if needed. Or better yet, store the plan ID’s in your own database for easier retrieval.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement