The GooglePay react button sometimes doesn't render as visible on our staging/prod environment and I can't figure out why. What I know so far is:
My question is: is this a bug, a race condition of some kind with loading dependencies, or am I not aware of some reason why the button would decide the user is not readyToPay? I'll paste my full config below, but note that existingPaymentMethodRequired is explicitly set to false.
const locale = useLocale()
return <GooglePayButton
environment={APP_ENV === 'production' ? 'PRODUCTION' : 'TEST'}
buttonType='pay'
buttonColor={'white'}
buttonRadius={6}
buttonBorderType='no_border'
buttonSizeMode='fill'
style={{ width: '100%', height: '50px' }}
buttonLocale={locale}
onError={(error) => {
console.error('[GPAY] error', error)
}}
onClick={onClick}
onReadyToPayChange={(readyToPay) => {
console.log('[GPAY] onReadyToPayChange', readyToPay)
}}
existingPaymentMethodRequired={false}
paymentRequest={{
apiVersion: 2,
apiVersionMinor: 0,
allowedPaymentMethods: [
{
type: 'CARD',
parameters: {
allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
allowedCardNetworks: ['MASTERCARD', 'VISA'],
},
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
parameters: {
gateway: 'payu',
gatewayMerchantId: GATEWAY_MERCHANT_ID,
},
},
},
],
merchantInfo: {
merchantId: GOOGLE_MERCHANT_ID || '12345678901234567890',
merchantName: GOOGLE_MERCHANT_NAME || 'Demo Merchant',
},
transactionInfo: {
totalPriceStatus: 'FINAL',
totalPriceLabel: 'Total',
totalPrice: amountNumber.toString(),
CURRENCY_CODE,
COUNTRY_CODE,
},
}}
onLoadPaymentData={async (paymentRequest) => {
[...]
}}
/>
The GooglePay react button sometimes doesn't render as visible on our staging/prod environment and I can't figure out why. What I know so far is:
onReadyToPayChange, I see that a working button triggers that handler once withisReadyToPay: trueandisButtonVisible: true, but when the button doesn't render, it isn't triggered at all.My question is: is this a bug, a race condition of some kind with loading dependencies, or am I not aware of some reason why the button would decide the user is not readyToPay? I'll paste my full config below, but note that
existingPaymentMethodRequiredis explicitly set to false.This question is related to:
@google-pay/button-react)@google-pay/button-element)@google-pay/button-angular)