3

I'm looking into integrating Apple Pay into my checkout page. How to check whether the Apple Pay JS API is available in the browser by verifying that the ApplePaySession class exists.

When I gave the condition,

if (window.ApplePaySession && ApplePaySession.canMakePayments()){}

it shows the error, ie; "Property 'ApplePaySession' does not exist on type 'Window & typeof globalThis'".

Shankar Ganesh Jayaraman
  • 1,401
  • 1
  • 16
  • 22

2 Answers2

0

Above the @component add following:

declare var ApplePaySession: any;
Eray T
  • 739
  • 6
  • 13
0

If anyone is still looking for a working solution, I use this in my project.

  get isAppleBrowser() {
    if ((window as any).ApplePaySession) {
      return true;
    } else {
      return false;
    }
  }

,