#thebeard_best-practices

1 messages ¡ Page 1 of 1 (latest)

vivid fogBOT
#

👋 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/1283529302029238366

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

pastel tiger
#

Hello

gusty ridge
#

hey

pastel tiger
#

Yeah if you aren't going to create the Subscription while your customer is in your checkout flow, but instead want to do this later on, then using a SetupIntent to collect their PaymentMethod is the correct way to go.

gusty ridge
#

ok, that sorts out my second flow where user user will add a payment method but will subscribe later.

but what about the case, where user is on checkout page and as soon as they complete checkout, they should be subscribed. would setup intent with webhooks the best way to do it?

pastel tiger
#

No you just create the Subscription to do this

#

Are you using Stripe Checkout here?

#

Or a Custom flow?

gusty ridge
pastel tiger
#

Yes

#

That allows you to confirm on the frontend so that 3DS is handled if it is required

gusty ridge
pastel tiger
#

Oh okay well then Stripe Checkout handles everything for you

#

You just create a Checkout Session with mode: subscription

gusty ridge
#

nvm, our client is still poc. was trying to figure out from servers perspective

gusty ridge
pastel tiger
#

Yep

#

There is always a chance an issuer requests 3DS on a future payment as that is their prerogative. But this is generally unlikely and the PaymentMethod will be properly set up for future payments in this flow.

gusty ridge
#

i just want to re iterate the checkout method so if i understand correcly

  1. the client creates a payment method with some card details
  2. the client calls this endpoint with payment method id and customer. the server attaches that payment method to customer and create a subscription for that customer

but again this becomes a 2 step process, client adding the payment mthod to stripe and getting payment method id and then calling subscribe. could this one step where client enter card details and hit subscribe?

pastel tiger
#

If you are using Stripe Checkout all you do is create a Checkout Session with the proper mode

#

You do this on your backend

#

Then you redirect your client to the session.url

#

That is an example with mode: subscription which collects a payment method and starts a Subscription

#

If you use mode: setup then only a payment method will be collected and later on you create a Subscription from your backend for that Customer and use that previously collected payment method