question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google Pay button breaks with a stack trace when buttonType = (anything other than 'buy')

See original GitHub issue

Describe the bug

Sorry I’m not sure if this is the right repo to report this but it’s the closest I can find.

We use the Google Pay React button library in our project. Today we received reports our checkout was broken. Upon investigation we discovered that the “buttonType” property is causing an issue.

If a site specifies a buttonType that is anything other than “buy”, pay.js will throw an exception and cause an error. In our situation the page became stuck and unresponsive. Once I removed this property and allowed the default, it worked again.

I can reproduce this on the Google demo site.

To Reproduce

  1. Go to ‘https://developers.google.com/pay/api/web/guides/resources/customize
  2. Observe a Google Pay button is shown
  3. Click the “buttonType” and select some other value than “buy”
  4. Observe the button disappears and a stack trace is shown in the developer console

In this stack trace example I changed the buttonType to “donate” and it seems it is trying (and failing) to read a property of that string value.

pay.js:275 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'donate')
    at m.pa (pay.js:275:150)
    at m.pa (pay.js:286:382)
    at l.<anonymous> (index.umd.min.js:15:4764)
    at Generator.next (<anonymous>)
    at index.umd.min.js:15:692
    at new Promise (<anonymous>)
    at e (index.umd.min.js:15:437)
    at l.updateElement (index.umd.min.js:15:4150)
    at l.configure (index.umd.min.js:15:2849)
    at index.umd.min.js:15:8645

Expected behavior

It works as we would expect

Component information:

At least the pay.js component.

Environment:

Reproduced on Chrome for Windows, Chrome for Android and Chrome for iOS.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
debajitrcommented, Aug 23, 2022

Same here.

0reactions
dmengeltcommented, Nov 18, 2022

this was a temporary issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular6 - @google-pay/button-angular issue: Cannot read ...
While fixing, I found that 'pay' is not working in 'buttonType' option. So, I changed it to. buttonType: String = "short";.
Read more >
Brand guidelines | Google Pay API
The following guidelines show how to include the Google Pay brand within your websites. Google Pay payment buttons. The Google Pay payment button...
Read more >
Google Pay button not correct - WordPress.org
Hi, I enabled google pay but when I check on my Samsung note 9 the google pay button is just a line it...
Read more >
Google Wallet Is Back, for Some Reason - WIRED
Plus: Samsung's Galaxy Unpacked event returns, Amazon hoovers up some health care, and Facebook prizes growth above all else.
Read more >
@google-pay/button-element - npm
Start using @google-pay/button-element in your project by running `npm i ... There are 2 other projects in the npm registry using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found