ApplePaySession is not defined no-undef error in React

3.3k Views Asked by At

I am just trying to validate whether apple pay is supported on browser or not with following code. But it gives error on safari (ipad) / macbook.

ApplePaySession' is not defined no-undef

Following code, I had written in ReactJs.

if (window.ApplePaySession) {
      if (ApplePaySession.canMakePayments) {
        alert('hi, I can do ApplePay.....')
      }

but gives undefined error!

If anyone can help? Why ApplePaySession is undefined? Do we need to import ApplePaySession? Or do we need to add any sdk?

0

There are 0 best solutions below