#jm-applepay-paymentelement

1 messages · Page 1 of 1 (latest)

ember thunder
#

hello, ah interesting, can you share your code for how you are initializing PaymentElement?

Testing something on the side too

dusky garnet
#

const paymentElement = elements.create('payment', { paymentMethodOrder: ['apple_pay', 'google_pay', 'card'], terms: { card: 'never', }, fields: { billingDetails: { address: { city: 'auto', country: 'never', line1: 'auto', line2: 'auto', postalCode: 'never', state: 'auto', } } } }) paymentElement.mount(elementContainer)

#

const elements = stripe.elements({ clientSecret: setupIntent.client_secret, appearance: { variables: { borderRadius: '0.1rem', fontSizeBase: '16px' }, theme: 'none', rules: { '.Label': { fontSize: '1rem', }, '.Input': { color: '#3b4351', border: '0.07rem solid #bcc3ce', padding: '0.27rem 0.6rem', boxShadow: 'none', fontSize: '1rem', lineHeight: '1.4rem' }, '.Tab': { width: '500px', border: '0.07rem solid #bcc3ce', boxShadow: 'none', }, '.TabIcon': { fill: 'red' }, } } })

ember thunder
#

thanks, that is helpful

and what were your repro steps? Just select and try to pay with Apple Pay?

#

from the PaymentElement?

dusky garnet
#

Exactly

#

Domain is configured, I can see the Apple option, Google Pay is working fine

ember thunder
#

yep the domain side would be fine if you're seeing the Apple Pay button

let me try to repro, spinning up my samples, give me a bit

dusky garnet
#

?

ember thunder
#

still looking, my PaymentElement isn't showing Apple Pay so just reverting from the last changes I had made to it to test something different days ago

dusky garnet
#

Got it, I will wait, thank you

ember thunder
#

ah one more thing while I work with a colleague on why my PaymentElement isn't showing Apple Pay

#

where are you calling confirmPayment() in your code

dusky garnet
#

For this case is a confirmSetup

#

` const btnSubmit = document.getElementById('btn-add-card')
btnSubmit.addEventListener('click', submitCard)
async function submitCard () {
const confirmIntent = await stripe.confirmSetup({
elements,
redirect: 'if_required',
confirmParams: {
payment_method_data: {
billing_details: {
address: newAddress
}
}
}
})

...`

ember thunder
#

gotcha, try removing async on that submitCard() function and trying?

dusky garnet
#

Ok I will try it

#

Nope, it didn't work

ember thunder
#

where are you calling submitCard(), immediately invoking it after declaring it? or somewhere else?

dusky garnet
#

I execute some UI functions

#

I think your "remove async" solution gave me an idea, I removed the await and just called the confirmSetup() and seems it worked

ember thunder
#

yeah I'm no JS expert but it had something to do with the Apple Pay button expecting to be synchronously having .show() called on an on-click handler and the async stuff was presumably having it happen later and Apple Pay button was complaining as a result

so moving confirmSetup() immediately within the on-click handler without any async-await's was gonna be my suggestion

dusky garnet
#

Got it

#

My only complain right now that Apple dialog says "amount pending" (I like it) but Google dialgs says "amount: $0" and I can't modify it, that is not good

ember thunder
#

yeah that is expected

#

that is the way Apple does it really