#vinicius-zaramella_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1291399230987960341
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- vinicius_link-address, 5 days ago, 46 messages
- vinicius-zaramella_api, 5 days ago, 34 messages
Hello
Taking a look
Can you clarify why you want to prefill a past PaymentMethod when using a SetupIntent?
SetupIntents are meant to collect new PaymentMethods
So this doesn't really make sense that it would re-setup the previous PaymentMethod...
Our checkout flow is a little bit different in the sense that we initialize the page we don't know yet the amount and lines items that will be purchased
It was suggested to us that we could use Setup Intent in that case
But only confirm the SetupIntent when a new payment method was added during checkout
On page submition we create a confirmationToken that we use to generate an Invoice and confirm the payment intent from the invoice
The problem that I am facing is that I have to either start the elements with a Payment Intent or a Setup Intent and neither fits well our use case
Is there a way to initialize the elements only with a customerSession that I missed?
Yeah you want the deferred intent flow: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment
Then you don't need a PaymentIntent or SetupIntent up front
But in that doc it says that I need to initialize the payment element with a amount
Can I use a fake amount like 0 and then change it later on the server?
You can call elements.update to change the amount on the frontend when you know the proper amount: https://docs.stripe.com/js/elements_object/update#elements_update-options-amount
But it has to match whatever you create the payment intent with
ok, so the value passe to elements.update has to match the invoice amount