Reputation: 203
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.
Upvotes: 4
Views: 10827
Reputation: 339
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
Upvotes: 8
Reputation: 5693
I have the some error because of mismatch type of price object.
I put the float
value in totalPrice
.
After update
data class TransactionInfo(
@SerializedName("totalPrice") val price: String,
@SerializedName("totalPriceStatus") val priceStatus: String,
@SerializedName("currencyCode") val currency: String
)
This is works fine on ENVIRONMENT_TEST
case.
Upvotes: 2
Reputation: 203
Turns out I was not able to do this with React-Native because 'React Native Payments' did not fully support Google Pay which in turn did not fully support Braintree & didn't support Payeezy at all.
I had to resort to native code(Java) and then link React-Native to that native module. It was pretty simple.
I used this demo on Github to guide me through it. I was using Braintree as the payment processor but looks like I will be switching to Payeezy.
I was getting the error in the title because like I said Google Pay wasn't supported fully by 'React-Native-Payments' which in turn didn't support Braintree and when the error was accuring because I was only giving this info -
parameters: {
gateway: 'braintree',
'braintree:tokenizationKey': 'sandbox_TOKEN-HERE'
}
But looks like I needed to use this(In the Java Module) -
.put("gateway", "braintree")
.put("braintree:apiVersion", "v1")
.put("braintree:sdkVersion", "BETA")
.put("braintree:clientKey", "sandbox_TOKEN-HERE")
.put("braintree:merchantId", "TOKEN-HERE"));
Upvotes: 4
Reputation: 6250
Use https://google.com/pay
under supportedMethods
to leverage Google Pay through Payment Request API.
Check these couple of examples for further reference: official docs, sample from the Chrome team.
Upvotes: 0