When I try to pay(on TEST environment) with Google Pay on a real device I get a the error in the title.
I have tried changing 'gateway' into a string like the google docs show it but so far nothing.
const DETAILS = {
id: 'COMPANY',
displayItems: [
{
label: 'Phone Bill',
amount: { currency: 'USD', value: compTotal }
}
],
total: {
label: 'COMPANY',
amount: { currency: 'USD', value: compTotal }
}
};
// GOOGLE PAY
const METHOD_DATA = [{
supportedMethods: ['android-pay'],
data: {
supportedNetworks: ['visa', 'mastercard', 'amex'],
currencyCode: 'USD',
environment: 'TEST', // defaults to production
paymentMethodTokenizationParameters: {
tokenizationType: 'GATEWAY_TOKEN',
parameters: {
gateway: 'braintree',
'braintree:tokenizationKey': 'sandbox_XXXXXXXXXXX'
}
}
}
}];
const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS);
paymentRequest.show()
.then(paymentResponse => {
const { getPaymentToken } = paymentResponse.details;
return getPaymentToken()
.then(paymentToken => {
const { ephemeralPublicKey, encryptedMessage, tag } = paymentToken.details;
return fetch('...', {
method: 'POST',
body: {
ephemeralPublicKey,
encryptedMessage,
tag
}
})
.then(res => res.json())
.then(paymentResponse.complete('success'), handleConfirm())
.catch(paymentResponse.complete('fail'), alert(1));
});
});
};
Expected result would be the payment going through.
To learn more about this error, follow these steps:
1- Make sure Android Debug Bridge (adb) is installed on your computer.. Make sure USB debugging is enabled on your device. For more information, see Debug Your App.
2- Connect your phone to the computer with a USB cable.
3- Run the following command in a terminal or command prompt on your computer:
adb -d logcat -s WalletMerchantError
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With