#red_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/1383178259604308188
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
https://docs.stripe.com/js/element/events/on_change?type=paymentElement
Yes we do emit events. You'll want make use of the Payment Element on change event. It will return a value containing the currently selected Payment Method type. You can then update your Payment Intent and or UI accordingly.
ok great!
appreciate the quick reply
is the element always embedded as an Iframe?
also, did I hear somewhere that surcharging for online payments in currently in beta?
lastly, what is the best way to check if I am dealing with a debit or credit card via the api?
Yes the Payment Element is always loaded in an Iframe.
Not that I have heard but we're not always aware of what is currently in Beta in this channel. I'd suggest following up with our Support team. https://support.stripe.com/?contact=true
To confirm, you want to know the card type before you process payment?
Hi there ๐ if you're referring to the error messages that get shown directly within the our Payment Element UI, no, those cannot be intercepted and customized.
The errors that are surfaced by confirmPayment or confirmSetup, which aren't automatically surfaced to the Payment Element, are returned to your code and you do have the ability to choose what to show in those cases.
https://docs.stripe.com/payments/build-a-two-step-confirmation
This Payment flow should allow you to retrieve the card type prior to charging. The Key here is the Confirmation Token Step. The ConfirmationToken will have a payment_method_preview which is essentially a Payment Method Object. You can then inspect the card.funding field to determine if it is a credit or debit card. https://docs.stripe.com/api/payment_methods/object#payment_method_object-card-funding
Hopefully this information helped unblock you. We do need to close channel for the weekend. Please do feel free to reach back out on Monday if any follow-up questions or concerns present themselves.
perfect, thanks!