#jm-applepay-paymentelement
1 messages · Page 1 of 1 (latest)
hello, ah interesting, can you share your code for how you are initializing PaymentElement?
Testing something on the side too
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' }, } } })
thanks, that is helpful
and what were your repro steps? Just select and try to pay with Apple Pay?
from the PaymentElement?
Exactly
Domain is configured, I can see the Apple option, Google Pay is working fine
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
?
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
Got it, I will wait, thank you
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
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
}
}
}
})
...`
gotcha, try removing async on that submitCard() function and trying?
where are you calling submitCard(), immediately invoking it after declaring it? or somewhere else?
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
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