#lam_code

1 messages ¡ Page 1 of 1 (latest)

mint caveBOT
#

👋 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.

near shellBOT
keen bear
#

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.

halcyon flower
#

but i can collect from PaymentRequestButtonElement

#

pr.on('paymentmethod', async (e: PaymentRequestPaymentMethodEvent) => {
try {
debugger
const payerEmail = e.payerEmail || '';

#

not sure what is the diff

keen bear
#

Using the same test Card/wallet ?

halcyon flower
#

yes

keen bear
#

You were collecting the payer email from the paymentmethod object

#

To do something simular using Express Checkout Element, you need ot use confirmation token

halcyon flower
#

can you share the guide to do that?

#

how to do for Express Checkout Element

halcyon flower
#

ok. I got it. Thank you

keen bear
#

Np!

halcyon flower
#

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

keen bear
halcyon flower
#

yes. I tried it's ok

keen bear
#

Cool!

halcyon flower
#

Hi

#

can i ask more question?

keen bear
#

Yes please

halcyon flower
#

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

keen bear
#

No you can't close it or trigger it programatically, it need user gesture event (e.g. click)

halcyon flower
#

you meant that user need to be click the close button?

keen bear
#

yes

near shellBOT
halcyon flower
#

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

dusky linden
#

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.

halcyon flower
#

ok