#tarantino_payment-flow
1 messages ยท Page 1 of 1 (latest)
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.
- tarantino-47_api, 2 hours ago, 6 messages
๐ 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/1229468679469531198
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
Setup Intents are only used to save payment methods without charging them
Payment Intents are the only Intent you can use to collect funds
can't I create payment method using payment element and setup intent and then use that new payment method for future payments and for immediate payment?
You can but it's an anti-pattern
You make extra API requests
And can incur more fees due to repeated authentication
Instead you could save the Payment Method details when you collect payment and set them up for future payments: https://docs.stripe.com/payments/save-during-payment
hm
on another note
on the regular payment element flow. I created client secret and rendered payment element. now what if amount got changed after I created a payment intent, I assume I need to update it. how to do that?
As long as it is before the customer has comfirmed their payment, you can use the elements.fetchUpdates() function to retrieve updated details from the Payment Intent. https://docs.stripe.com/js/elements_object/fetch_updates
Yes
You can only update the payment intent on the backend
After it is updated, you then use the fetchUpdates() function to refresh the Payment Element with the new data
Otherwise your Payment Intent and your Payment Element will not be in sync
good to know ,thanks
I'm gonna describe my whole stripe payment flow right now and would like you to review
tarantino_payment-flow
sending ping to keep the thread opened
If you need long running 1:1 help it would likely be better handled by our support team: https://support.stripe.com/contact
no, just one question
so once user opens my chekout page I make reques to the BE, BE creates payment intent and returns client secret in the response. Then FE renders stripe Payment Element using client secret. Then user can select paid shiiping options and amount may be changed - if so FE makes a request to the BE for updating Payment Intent, then FE uses fetchUpdates() in order to refresh Payment Element. Then once user clicks on the submit -> FE confirms Payment Intent.
yes
how does it look like to you?
You can also alternatively switch to https://docs.stripe.com/payments/accept-a-payment-deferred which allows you to defer the creation of the PaymentIntent to later in your flow to avoid the roundtrip with the BE
just a minute
ok, so when I call confirmPayment clientSecret already contains order amount in it, right?
// Confirm the PaymentIntent using the details collected by the Payment Element const {error} = await stripe.confirmPayment({ elements, clientSecret, confirmParams: { return_url: 'https://example.com/order/123/complete', }, });
sorry I don't really get your question. What is the exact issue you are hitting while trying to do that? I gave you 2 different integration paths which work completely differently
Sure but that's a brand new doc you just read right? I don't really get what you were asking but maybe it's just confusion. So yes you use confirmPayment() after the PaymentIntent is created
sure!
how can I make sure the payment went through from the client side?
since webhooks are only for the BE
do I need to make a request to stripe every 1-3 sec (retrieve payment intent) and check the status?
Have you tried the flow yet? You likely should to fully understand how this all works. PaymentElement will redirect after the payment is complete
this thread will stay open for a bit, so once you have tried, let me know if you have a follow up question!