feat: unify saved payment methods view#247
Merged
jakubjasinsky merged 3 commits intomasterfrom Mar 18, 2026
Merged
Conversation
tomasz-pazdziurek-cko
approved these changes
Mar 18, 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.
Summary
Refactors saved payment methods (saved cards and saved APMs) in Dynamic Checkout to act as direct click-to-pay buttons instead of the previous radio-button-select → expand → click-pay-button flow. Each saved method now renders as a standalone bordered card with centered logo and description that triggers payment immediately on click.
Changes
New base class
SavedPaymentMethodButtonabstract class (elements/saved-payment-method-button.ts) that creates a<button>element with centered logo + description badgesetLoading()that preserves button height while replacing content with a spinner<div>with a delete button insteadSaved Card & Saved APM refactors
SavedCardPaymentMethodandSavedApmPaymentMethodnow extendSavedPaymentMethodButtoninstead ofPaymentMethodButtonthemedependency (no longer needed without a separate pay button to style)View & layout changes
.dco-saved-payment-methods-wrapper(flex column, 8px gap) instead of the grouped.dco-express-checkout-payment-methods-wrapperrole="radiogroup"wrapper since saved methods are no longer radio inputsdeletePaymentMethodFromDomto query the new wrapper classType changes
PaymentMethodsManagernow accepts{ element: HTMLElement }[]instead ofPaymentMethodButton[]since saved methods no longer extendPaymentMethodButtonImpact
Testing Plan
Additional Context
The previous
PaymentMethodButtonbase class is architecturally designed around the radio-select → expand → interact pattern (uses a<label for="radio">with CSS:has(input:checked)to reveal children). Rather than adding conditional flags to support direct-click behavior, a new lightweightSavedPaymentMethodButtonbase class was created to keep both patterns simple and focused. The only shared contract needed byPaymentMethodsManageris{ element: HTMLElement }.