0

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?

  • finally it worked. By writing the following code. `if (window.ApplePaySession) { if (window.ApplePaySession.canMakePayments) { alert('hi, I can do ApplePay.....') }` Just make sure, you are running the app on secure environment i.e on HTTPS. Apple pay documention is worst. – Vikas Hiran Feb 15 '21 at 11:14

0 Answers0