2

I am getting below error in FireFox. I have integrated Google Pay with Braintree.

Uncaught ReferenceError: PaymentRequest is not defined
    <anonymous> https://pay.google.com/gp/p/js/pay.js:250
    <anonymous> https://pay.google.com/gp/p/js/pay.js:250
pay.js:250:400
    <anonymous> https://pay.google.com/gp/p/js/pay.js:250
    <anonymous> https://pay.google.com/gp/p/js/pay.js:250
4
  • You need to provide some further information - what are you doing, when does it happen etc. Commented Jul 13, 2021 at 15:23
  • I'm having same issue. Did you resolved it ?
    – anonymous
    Commented Jul 25, 2021 at 6:39
  • @anonymous Not Yet. Post an answer if you could find one. Commented Jul 26, 2021 at 7:03
  • If I had answer. I would've post here!!
    – anonymous
    Commented Jul 26, 2021 at 11:22

1 Answer 1

2

First, you need to understand that PaymentRequest is a constructor for Payment Request API which is built-in modern browsers. Payment Request APIs let customers quickly fill up payment forms including card details. More can be found here: https://developer.mozilla.org/en-US/docs/Web/API/Payment_Request_API

In your case, it can either be your browser version not supporting Payment Request API or your site being served without SSL (Often the case with localhost).

If you look into Google Pay integration within braintree module (src/vendor/paypal/module-braintree-core/view/frontend/web/js/googlepay/button.js) on line 109 onwards:

deviceSupported: function() {
    return !!(window.PaymentRequest);
}

It looks for device support for Payment Request API. If that fails it throws the error you shared in your question. I told the possible reasons above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.