#mathew

1 messages · Page 1 of 1 (latest)

fresh waveBOT
unique trellis
#

var paymentElement = elements.create('payment', {
layout: {
type: 'tabs',
defaultCollapsed: false
},
paymentMethodOrder: allowedPaymentMethods
});

            paymentElement.unmount();
            paymentElement.mount('#payment-element');
#

can i set paymentMethodOrder dynamically

#

var allowedPaymentMethods = ['card'];
if (isGpayorAPay) {
allowedPaymentMethods.push('google_pay', 'apple_pay');
} else {
// Exclude Apple Pay and Google Pay
}

#

so i only want ot see gpay and applepay based on a condition

celest quiver
unique trellis
#

oh okk

#

var paymentElement = elements.create('payment', {
layout: {
type: 'tabs',
defaultCollapsed: false
},
wallets:{
applePay:isGpayorAPay?'auto':'never',
googlePay: isGpayorAPay ? 'auto' : 'never'
}
@,paymentMethodOrder: allowedPaymentMethods@
});

#

so it should work with this

celest quiver
#

possibly, did you try it out?

unique trellis
#

i did but weirdly it displays inconsistently

celest quiver
#

what does that mean exactly?

unique trellis
#

sometimes it shows me card only sometimes even if isGpayorAPay =true

#

let me reconfirm this anyways

celest quiver
#

it will only show the buttons if you're in a browser that supports them and you saved cards in your Google/Apple account, and if the page is hosted on a https URL. There can also be 'rate limiting' from the browser function involved in displaying the buttons if you load the same page very often

unique trellis
#

currently im trying this in test mode, will it be same issue with live mode

#

even though im passing the wallets: it doesnt load on the screen , i need to refresh screen couple of times to get it displayed

celest quiver
#

it should just work, if you have concerns maybe ask a colleague to load your payment page fresh to confirm.

unique trellis
#

okk.im gonna try that, currently im trying this from India, (conected to VPN)

#

does this element mount get cached or something?

celest quiver
#

possibly, and like I said there is browser rate limiting sometimes

#

ultimately if your code looks correct that's it and all you can do