#laurentluce_api

1 messages ¡ Page 1 of 1 (latest)

proven crystalBOT
#

👋 Welcome to your new thread!

⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!

🔗 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/1212163094172934265

📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.

⏲️ 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. Thank you for your patience!

night jewelBOT
rapid cedar
#

Request IDs:
req_xqbfLL7KkXObvK
req_tjTlN144qQQbJi
req_lKa3gPhuBJ9EgQ
req_DJXVgYnxeJij6o

brazen obsidian
#

I read through the flow you described but I'm a bit confused. When are you creating a subscription?

#

Also, what are you trying to show me with the list of request IDs?

rapid cedar
#

I first set the payment method as the default one and then i create the subscription.

#

The list of request IDs matches the flow I described above: SetupIntent with mandate (server) -> PaymentElement (client) -> confirmSetup (client) -> Set payment method as default (server) -> Create subscription.

brazen obsidian
#

req_xqbfLL7KkXObvK - creating a SetupIntent
req_tjTlN144qQQbJi - confirming a SetupIntent
req_lKa3gPhuBJ9EgQ - creating a SetupIntent
req_DJXVgYnxeJij6o - detaching a PaymentMethod

#

But let's take a step back first. Is there a specific reason why you're creating a SetupIntent and collecting payment details instead of creating a Subscription from the start?

rapid cedar
#

That is how our UI works. The user inputs a payment method and we run those steps.

#

Here is the request ID for subscription create: req_pGSnBllJDrgpGM

#

and here is the one to set the default payment method: req_GXRhS6aMDthKiV

#

I cleaned up the list of requests, here it should match the flow above:
req_o4H3EZeg2QdgZ3
req_gn8axdvrB3griV
req_SmpN6rwCx1TcXl
req_pGSnBllJDrgpGM

#

Apologies for the earlier incorrect list.

brazen obsidian
#

When you create the Subscription, use payment_behavior=default_incomplete, and render the PaymentElement using latest_invoice.payment_intent.client_secret

rapid cedar
#

Thanks for the link. The thing is that I don't know the customer state before they enter their payment method. I vaguely remember that you cannot create a subscription if the user does not have a state. Or would the payment_behavior=default_incomplete help with that?

brazen obsidian
#

I'm not sure what you mean by customer state

#

Could you clarify?

rapid cedar
#

Customer address, the state is used for tax collection.

brazen obsidian
#

Ah, gotcha. A PaymentMethod's billing address is totally separate from customer.address though

rapid cedar
#

Got it. I probably got confused. I thought the address was updated based on the first payment method added.

#

I am going through the link you sent me.

#

and I would need to pass the mandate info as part of the Subscription create request.

brazen obsidian
rapid cedar
#

and that is because you have the price / product info as part of the subscription request?

brazen obsidian
#

Mandates would be created if a customer tries to pay with a supported India-issued card and if the subscription attempts to charge automatically

rapid cedar
#

I will try that flow out. Thank you for your help!