#lam_code
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/1235524697748144230
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi
I was tried to get email from evt?.billingDetails?.email from onConfirm event but it's undefined.
Actually you get it when it's available or sharebale by the payer
Otherwise, if you want to get the email in all cases, you need to collect it by your own form.
but i can collect from PaymentRequestButtonElement
pr.on('paymentmethod', async (e: PaymentRequestPaymentMethodEvent) => {
try {
debugger
const payerEmail = e.payerEmail || '';
not sure what is the diff
Using the same test Card/wallet ?
yes
You were collecting the payer email from the paymentmethod object
To do something simular using Express Checkout Element, you need ot use confirmation token
And see if you can fin the the email at the payment_method_preview level
https://docs.stripe.com/api/confirmation_tokens/object#confirmation_token_object-payment_method_preview
Once created the confirmation token you can retreive its details using this API:
https://docs.stripe.com/api/confirmation_tokens/retrieve
ok. I got it. Thank you
Np!
I just tried with another approach that for handle onClick event with resolve Set emailRequired: true to collect email
}}
onClick={(event) => {
event.resolve({
emailRequired: true
});
and i can collect billingDetails?.email in the onConfirm event
yes that's an option too:
https://docs.stripe.com/js/elements_object/express_checkout_element_click_event#express_checkout_element_on_click-handler-resolve
Nice catch!
Yes can you give it a try ?
yes. I tried it's ok
Cool!
Yes please
I want to close the gmail payment popup in the onConfirm event. DOnt know how to do
because i do some validation like email ... or bussiness validation before stripe.confirmPayment
No you can't close it or trigger it programatically, it need user gesture event (e.g. click)
you meant that user need to be click the close button?
yes
ok
i see i can use e.paymentFailed({
reason: 'fail',
}); to show the error message and remove the loading
and then let user close the popup and see the error on the payment page
all you can do is reject the Promise in that way(calling the paymentFailed function as you say), the way the browser handles that is up to them and we/you can't control it. GPay on Chrome I think just shows an error. Apple Pay will show the error and then closes the sheet after a second. It's platform-dependent.
ok