Skip to main content

Where Apple Pay Works

Context | Apple Pay Available?

Safari (iOS / macOS) | Yes

WKWebView in your own app with Apple Pay entitlement | Yes

Where Apple Pay Does Not Work

Context | Why

SFSafariViewController | Apple explicitly blocks ApplePaySession.

Chrome / Firefox on iOS | Uses WKWebView internally, but the Apple Pay entitlement is not passed through to web content.

In-app browsers (Facebook, Instagram and so on.) | Third-party apps do not expose Apple Pay to embedded web content.

UIWebView (deprecated) | No Apple Pay support.

Cross-origin iframes (without allow="payment") | ApplePaySession is unavailable unless the iframe has the allow="payment" attribute.

Requirements for WKWebView

For Apple Pay to work in your app’s WKWebView, ensure the following:
  • Apple Pay entitlement: The host app must have com.apple.developer.apple-pay capability enabled in Xcode. Without this, ApplePaySession will be undefined in the WebView’s JavaScript context.
  • iOS 11.3+: Minimum OS version for Apple Pay JS API version 3 in WKWebView.
  • HTTPS: The page loaded in the WebView must be served over HTTPS.
  • Domain verification: The domain served in the WebView must be registered and verified. Refer to the Apple Pay Web Component Integration guide.
  • Card in Apple Wallet: The user must have at least one card added to Apple Wallet with face id, touch id or passcode enabled.
Handy TipThere are no WebView-specific restrictions in this SDK. The same eligibility checks the device support, business configuration and card network availability, apply in both Safari and WKWebView. If all prerequisites above are met, Apple Pay will work in a WKWebView exactly as it does in Safari.

Integrate in a Native iOS Checkout

If your app has a native checkout screen and you want to embed the Apple Pay button at a specific position and size, follow the steps given below.

Step 1: Add Apple Pay Capability

In Xcode, select your target → Signing & Capabilities+ CapabilityApple Pay. Add your business identifier.

Step 2: Host the Payment Page on Your Verified Domain

Create a lightweight HTML page on the same domain you registered for Apple Pay verification. The app’s WKWebView will load this URL directly, this ensures window.location.hostname matches your verified domain, which is required for business validation.
HTML
JavaScript
The page reads key, order_id, contact, width and height from query parameters, so the native app controls all configuration without changing the hosted HTML.

Step 3: Create a WKWebView and Load the Hosted Page

Bash

Sizing

The button size is controlled in two places, keep them in sync:

Where | What to Set

Native side | WKWebView frame (for example, CGRect(x:y:width:300, height:44))

Query params | width and height (for example, 300px, 44px) applied to button-width and button-height attributes The WebView acts as a transparent window into your native layout. Set isOpaque = false and backgroundColor = .clear so only the Apple Pay button is visible.

Why Host the Page Instead of Using Inline HTML?

The SDK sends window.location.hostname as the initiativeContextUrl during Apple Pay business validation. When HTML is loaded via loadHTMLString, the hostname may not match your verified domain, causing business validation to fail. Loading a real URL on your verified domain avoids this entirely. Apple Pay Web Component Integration