fix: fix amex card payments in dc#267
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Dynamic Checkout card scheme restrictions so multi-word schemes (e.g., American Express) are not incorrectly rejected when restrict_to_schemes is configured using the platform’s space-separated naming.
Changes:
- Added a
schemeRestrictionAliasesmap to translate SDK-detected hyphenated scheme codes to the platform’s space-separated scheme names. - Updated the card restriction logic to match detected schemes against both the raw detected code and its platform alias.
- Made scheme restriction matching case-insensitive to mirror backend behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/dynamic-checkout/payment-methods/card.ts | Updates scheme allowlist matching to be case-insensitive and to consider platform aliases for multi-word schemes. |
| src/dynamic-checkout/config/card-networks-map.ts | Adds the schemeRestrictionAliases mapping from hyphenated SDK scheme codes to space-separated platform scheme names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
roshan-gorasia-cko
approved these changes
Jul 1, 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
Fix Amex (and other multi-word scheme) card payments being incorrectly blocked in Dynamic Checkout when
restrict_to_schemesis set.Changes
schemeRestrictionAliasesmap translating the SDK's hyphenated scheme codes (american-express,union-pay,diners-club) to the platform's space-separated equivalents (american express,china union pay,diners club).EqualFoldmatching.Additional Context
Card.getPossibleSchemes()returns hyphenated codes, butrestrict_to_schemes(dashboard/router/API) uses space-separated values, so multi-word schemes never matched and valid cards were rejected. Single-word schemes already align and need no alias.