Skip to content

Commit

Permalink
Bail early if window is not defined (SSR, non-browser environments)
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-gr4vy committed Nov 20, 2024
1 parent baf356f commit 80e8895
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/embed/src/apple-pay/apple-pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ declare global {
export const loadApplePaySdk = () => {
return Promise.race([
new Promise<boolean>((resolve) => {
if (typeof window === 'undefined') {
return resolve(false)
}

if (window.ApplePaySession || document.getElementById('apple-pay-sdk')) {
return resolve(true)
}
Expand Down

0 comments on commit 80e8895

Please sign in to comment.