#-_best-practices

1 messages ¡ Page 1 of 1 (latest)

tribal crestBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1242927270675615855

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

hearty quest
#

The flow you're describing is not recommended. The card could require 3ds authentication, so if you don't accept the payment info from the customer the right way, first, then you could have issues on creating the subscription and on subsequent payments. Really recommend you follow our recommended flow: https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements. You can add the processing that you need on the server when you receive webhook events indicating payment was successful.

Create and manage subscriptions to accept recurring payments.

misty blade
#

That flow makes sense and should work. Thank you

hearty quest
#

No problem

misty blade
#

One question about the guide. It looks like they do the following with two api calls

  1. Create Customer
  2. Create Subscription

Is there any reason that can't be done in one API call? So have the user pick their subscription, fill in their information, and then click checkout (which would make the one API call and return the client_secret which can be used to complete the payment on the front end)?

hearty quest
#

Unfortunately not

misty blade
#

Sorry, unfortunately not what? I shouldn't do those in one api call?

hearty quest
#

You can't do it in 1 api call

#

Needs to be 2

misty blade
#

Not 1 API call to stripe. I mean 1 API call to my server (where I would create the customer and subscription and then pass the client_secret to my front end)

hearty quest
#

Yeah I mean that's fine

misty blade
#

Thank you