Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
RhysAtBolt
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
modeprop to the<ApplePay />component with'webview'as the new default. In WebView mode, Apple Pay merchant validation and tokenization are handled server-side by the Bolt-hosted iframe, removing the need for an Apple Pay entitlement or merchant certificate in the consuming app. The existing native PassKit flow is preserved viamode="native". A newApplePayWebViewcomponent manages the iframe lifecycle, bridge messaging, height sizing, referrer injection, and telemetry. The README is updated to document both modes with the WebView-first default.Testing
<ApplePay />renders the WebView-based Apple Pay button by default on iOS (nomodeprop needed).mode="native"still triggers the native PKPaymentButton + PassKit sheet flow with a valid merchant entitlement.referrerprop is correctly injected intodocument.referrerinside the WebView and passed as theoriginquery param.onCompletefires withtoken,bin,expiration,boltReference, andbillingContactafter a successful WebView Apple Pay session.onErrorfires for non-cancellation errors; verify cancellation (error code 1006) is silently ignored.nullon Android or whencanMakePayments()returns false.handleShouldStartLoadallows sub-frame navigations (critical for 3DS flows within the iframe).SetIFrameHeight) update the WebView container height dynamically.Security Review
Important
A security review is required for every PR in this repository to comply with PCI requirements.
Security Impact Summary
This PR introduces a WebView that loads a Bolt-hosted Apple Pay iframe and processes payment tokens. Security considerations: (1) The WebView URL is constructed from
bolt.baseUrlwith the publishable key — no secrets are embedded. (2)document.referreris overridden via injected JS to provide the merchant origin for Apple's domain validation; this is limited to main-frame injection only (injectedJavaScriptBeforeContentLoadedForMainFrameOnly). (3) Navigation is restricted tobolt.baseUrlorigins for top-frame loads, with sub-frame navigations explicitly allowed for 3DS. (4) Payment token data flows through the existingparseBoltMessagebridge — no new external integrations or storage. (5) ThemerchantIdfield onApplePayConfigis now optional (only required for native mode), which is a type-level change with no runtime security impact.