Closed glennweb closed 1 year ago
@glennweb Are you able to share your code on how you update the amount?
Regarding the error messages. They should not affect your integration. For Unable to download payment manifest
there is a Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1405229
Yeah, I saw that. Just strange the message occurs in the only problem platform.
I put together this basic component that is a more basic version of the implementation.
const GooglePayDeposits = (fiatCurrency: string, country: string) => {
const [amount, setAmount] = useState("");
const paymentRequest = useMemo(
() =>
({
apiVersion: 2,
apiVersionMinor: 0,
allowedPaymentMethods: [
{
type: "CARD",
parameters: {
allowedAuthMethods: ["PAN_ONLY", "CRYPTOGRAM_3DS"],
allowedCardNetworks: [
"AMEX",
"DISCOVER",
"JCB",
"MASTERCARD",
"VISA",
],
},
tokenizationSpecification: {
type: "PAYMENT_GATEWAY",
parameters: {
gateway: "gateway",
gatewayMerchantId: process.env.gatewayMerchantId,
},
},
},
],
merchantInfo: {
merchantId: process.env.merchantId,
merchantName: "company name",
},
transactionInfo: {
totalPriceStatus: "FINAL",
totalPriceLabel: "Total",
totalPrice: amount !== "" ? amount : "0",
currencyCode: fiatCurrency,
countryCode: country,
},
}) as google.payments.api.PaymentDataRequest,
[amount]
);
return (
<>
<input type={"text"} onChange={(e) => setAmount(e.target.value)} />
<GooglePayButton
environment={
appConfig.ENV === "production" ? "PRODUCTION" : "TEST"
}
buttonColor="white"
buttonSizeMode="fill"
buttonType={"plain"}
paymentRequest={paymentRequest}
onClick={() => {
//todo
}}
onError={(error) => {
console.log(error);
}}
onLoadPaymentData={(response) => {
const {
paymentMethodData: {
tokenizationData: { token },
},
} = response;
//todo - send token to backend
}}
/>
</>
);
};
any update?
Android
iOS
Windows Desktop
Mac
@glennweb could you create a re-producer on something like https://stackblitz.com and then share a link? - that would greatly help us to have a look at the issue.
Hi, is there already a fix for it? 🤔
@xiaomei-wu Do you mean for the "disappear and then reappear" problem?
@dmengelt Exactly, the button "disappear and reappear" only on android chrome and error
Unable to download payment manifest "https://pay.google.com/gp/p/payment_method_manifest.json"
shows infinitely in the console every few seconds (same frequency as the button "disappear and reappear")
@xiaomei-wu any chance you could share a reproducer with me?
@dmengelt I put the same code i am using in the project here expect the credentials: https://stackblitz.com/edit/stackblitz-starters-rdqmn8?file=src%2FGooglePayButton.tsx And you can open this page https://stackblitz-starters-rdqmn8.stackblitz.io on android chrome and inspect the console on chrome desktop: chrome://inspect/#devices. The same error occurs in the console but with less amount (10), and somehow the button is not flickering here 🤔
@xiaomei-wu I guess your example is missing some amount update logic? Or how do you trigger the flickering?
@dmengelt Yes you are right! I added a state for the amount, it is flickering when i update the amount.
thanks very much @xiaomei-wu - this helped. can you try this example: https://google-pay-react-fuexpj.stackblitz.io does it flicker for you?
@dmengelt You're welcome. Thank you very much for the quick response, i think my issue has been solved in this example - using plain button and black, changing amount doesn't flicker anymore. However, I've tested it on android chrome and android firefox for all the combinations. It still flickers in two scenarios when changing the amount:
Besides of that, the error unable to download payment manifest
occurs 500+ times in the console makes me a bit nervous...
G Pay | Card Info
to Buy with G Pay
See screenshots:
Is there going to be a fix released? I cannot really use the Black button, as I have a dark site.
version 3.0.10 should contain the fix. See #239
@glennweb / @xiaomei-wu could you update your dependency to "@google-pay/button-react": "3.0.10"
and try again here: https://google-pay-react-sfxj5f.stackblitz.io
@dmengelt I can confirm that the flickering issue is fixed after upgrading to "@google-pay/button-react": "3.0.10"
. Thank you very much! 🎉 💙
I can confirm the issue is resolved also..
Thank-you!
Unable to download payment manifest "https://pay.google.com/gp/p/payment_method_manifest.json" shows infinitely in the console every few seconds (same frequency as the button "disappear and reappear")
@xiaomei-wu this is now also fixed. This error should no longer occur when using Chrome on Android.
Summary:
The issue is specific to Android Chrome. Updating the payment request payload with an updated amount causes the Google Pay button to disappear and then reappear. Console logs show errors that are not present in other environments.
These are the console logs shown. 2 x
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 10
4 xUnable to download payment manifest "https://pay.google.com/gp/p/payment_method_manifest.json"
each time we update the paymentRequest payload.
The actual processing and display of card information work fine.
Steps to reproduce:
Programmatically update the amount in the payment request payload. The Google Pay button disappears and then reappears.
Expected behaviour:
The Google Pay button should remain visible while reloading payment data, and there should be no error console logs.
Screenshots:
A video attachment demonstrates the issue.
https://user-images.githubusercontent.com/9338759/236343163-863e7103-c77d-46b4-b6b1-96879d7758b4.mov
Component information:
Component: React component (@google-pay/button-react) Component versions: 3.0.0, 3.0.6, 3.0.9 Environment:
Device:
Moto G51 5G OS: Android Version 12 Browser: Chrome Country/region: Australia
Additional context:
The issue only occurs in Chrome Android and not in any other browser across various platforms.