fix(apple-pay): forward last4 and network in webview onComplete#101
Merged
SanthoshCharanBolt merged 1 commit intoJul 3, 2026
Merged
Conversation
…mplete The add-card-from-apple-wallet iframe already includes last4 and network in its addCardFromApplePaySuccess token payload, but ApplePayWebView only picked out bin/expiration when building the ApplePayResult passed to the merchant's onComplete callback, silently dropping the rest.
Contributor
✅ 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. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Apple Pay webview mode callback payload forwarding by ensuring card metadata (last4, network) produced by the tokenizer iframe is not dropped before invoking the merchant onComplete callback.
Changes:
- Extend
ApplePayResultwith an optionallast4field (documented as webview-only). - Forward
last4andnetworkfrom the iframe success message inApplePayWebView. - Update the existing ApplePayWebView envelope-unwrapping unit test to assert the new fields are forwarded.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/payments/types.ts | Adds optional last4 to ApplePayResult with webview-only documentation. |
| src/payments/ApplePayWebView.tsx | Forwards last4/network from the iframe success payload into the onComplete result. |
| src/tests/ApplePayWebView.test.tsx | Updates the success-envelope test to include/expect last4 and network. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
higuptabolt
approved these changes
Jul 3, 2026
1 task
SanthoshCharanBolt
added a commit
that referenced
this pull request
Jul 8, 2026
### Description Follow-up to #101 (already merged), which forwards `last4`/`network` from the Apple Pay webview iframe to the merchant's `onComplete` callback. The README's documented `ApplePayResult` shape was stale — it never listed `network` (added in an earlier PR) and didn't get updated for `last4` in #101, so the public docs undersold what the SDK actually returns. Changes: - `ApplePayResult` type reference now lists `last4?` and `network?`, with a note that `last4` is webview-mode only (native mode's decrypted PassKit payload never carries it). - Updated the `ApplePay` props table's `onComplete` description to match. ### Testing Docs-only change, no code touched. ### Security Review > [!IMPORTANT] > A security review is required for every PR in this repository to comply with PCI requirements. - [x] I have considered and reviewed security implications of this PR and included the summary below. #### Security Impact Summary Docs-only change — no code, data handling, or security-relevant behavior touched.
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
ApplePayWebView's add-card-from-apple-wallet iframe already returnslast4andnetworkon the tokenized card (AddCardFromAppleWalletSuccess.token→TokenizeApplePayResult { token, expiry, last4, bin, network }), butApplePayWebView.tsxonly readbinandexpirationout of that payload when building theApplePayResulthanded to the merchant'sonCompletecallback.last4andnetworkwere silently dropped instead of being forwarded.This only affects Apple Pay in webview mode. Native mode is unaffected — Apple's decrypted PassKit payload never contains
last4at the source (see #64), so there's nothing to forward there. Webview mode goes through Bolt's own tokenizer/iframe, which already computeslast4, so the fix is purely to stop dropping it on the RN SDK side.Changes:
ApplePayResultgains an optionallast4field (webview-only; documented as such).ApplePayWebView.tsxnow forwardslast4andnetworkfrom the iframe's success message.ApplePayWebView.test.tsxto assert the new fields are forwarded.Testing
last4/networkin the mock iframe message and assert they reachonComplete.ApplePayWebView.test.tsx,ApplePay.test.tsx,WalletTypes.test.ts) plus typecheck/lint in CI before merging.Security Review
Important
A security review is required for every PR in this repository to comply with PCI requirements.
Security Impact Summary
this PR forwards additional cardholder metadata (
last4,network) that Bolt's tokenizer already computes and already sends to the RN app over the existing bridge channel; no new data is collected, transmitted, or stored, only an existing field is no longer dropped before reaching the merchant callback.