#sl_best-practices
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/1231979966212739183
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Hi
You want the two step confirmation flow: https://docs.stripe.com/payments/build-a-two-step-confirmation
So you would update the amount you show that is going to be charged based upon the PaymentMethod. That said, if you aren't concerned about debit vs. credit you could also just use the onChange Event: https://docs.stripe.com/js/element/events/on_change?type=paymentElement
We wouldn't update for debit/credit but would need to re-calculate for something like EFT/ACH - I presume the two step is the best approach for that?
Ah okay then the onChange Event should work fine and is much simpler
You can just check the value returned which is the type of payment method that is currently selected
Then update your UI based on that
How do I update the value being charged on the payment intent?
Ah yes, sorry. You do want to use the two step flow to be able to update server-side here once they actually confirm.
Otherwise you are going to be calling your server repeatedly to make the update every time they change their payment method selection
(You would update amount via: https://docs.stripe.com/api/payment_intents/update#update_payment_intent-amount )
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
super thanks - I'll give that a go