Repository navigation
fix: fire onpaymentmethodselected in the Apple Pay wrapper - #293
Draft
roshan-gorasia-cko wants to merge 1 commit into
Draft
roshan-gorasia-cko wants to merge 1 commit into
roshan-gorasia-cko wants to merge 1 commit into
Conversation
The constructor never bound session.onpaymentmethodselected, so a merchant's handler never ran. Bind it in tokenize(), and only when a handler is set, so integrations that don't handle it keep their current sheet behaviour. Bump version to 1.9.22. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
ApplePayexposes a publiconpaymentmethodselectedhandler, but the constructor never assignssession.onpaymentmethodselected. The handler never runs when the user changes card on the payment sheet.Fix
tokenize()bindssession.onpaymentmethodselectedjust beforesession.begin(), and only when the merchant has set a handler. Once the session has this handler, Apple waits forcompletePaymentMethodSelectionon each card change. Binding it unconditionally would stall the sheet for integrations that never call it, Dynamic Checkout included.Testing
test/processout/applepay.test.ts: the handler fires when set, and the session handler stays unset otherwise. The first fails onmasterwithsession.onpaymentmethodselected is not a function.yarn lint,yarn build,yarn test(275 passed).Version bumped to 1.9.22.
🤖 Generated with Claude Code