From e6b5fa0f8da621e61e84e5a761f113ab2faa52d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jasi=C5=84ski?= Date: Tue, 30 Jun 2026 22:40:12 +0200 Subject: [PATCH 1/2] fix: fix amex card payments in dc --- .../config/card-networks-map.ts | 12 ++++++++++++ src/dynamic-checkout/payment-methods/card.ts | 18 +++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/dynamic-checkout/config/card-networks-map.ts b/src/dynamic-checkout/config/card-networks-map.ts index c3d37511..2f2463c0 100644 --- a/src/dynamic-checkout/config/card-networks-map.ts +++ b/src/dynamic-checkout/config/card-networks-map.ts @@ -23,4 +23,16 @@ module ProcessOut { visa: "visa", vpay: "vpay", } + + // The card field detects schemes via Card.getPossibleSchemes(), which uses + // hyphenated codes (e.g. "american-express"). The rest of the platform + // (dashboard restrict_to_schemes, router, api) uses space-separated values + // (e.g. "american express"). This maps the SDK's multi-word codes to their + // platform equivalents so scheme restrictions match. Only schemes whose two + // spellings differ need an entry; single-word schemes already align. + export const schemeRestrictionAliases: { [key: string]: string } = { + "american-express": "american express", + "union-pay": "china union pay", + "diners-club": "diners club", + } } diff --git a/src/dynamic-checkout/payment-methods/card.ts b/src/dynamic-checkout/payment-methods/card.ts index 33d5968d..3e8c1995 100644 --- a/src/dynamic-checkout/payment-methods/card.ts +++ b/src/dynamic-checkout/payment-methods/card.ts @@ -917,12 +917,24 @@ module ProcessOut { return } + // The backend matches schemes case-insensitively (EqualFold), so we + // lowercase the allowlist to mirror that behaviour. + const allowedSchemes = restrictToSchemes.map(function (scheme) { + return scheme.toLowerCase() + }) + var hasAllowedScheme = false schemes.forEach(function (scheme) { - if (restrictToSchemes.indexOf(scheme) !== -1) { - hasAllowedScheme = true - } + // Compare both the detected (hyphenated) code and its platform alias + // (space-separated), e.g. "american-express" and "american express". + const candidates = [scheme, schemeRestrictionAliases[scheme]] + + candidates.forEach(function (candidate) { + if (candidate && allowedSchemes.indexOf(candidate.toLowerCase()) !== -1) { + hasAllowedScheme = true + } + }) }) this.setCardRestrictionState(!hasAllowedScheme) From 123d9c8b394ec1c54234b4c2d3f52171a65cc0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jasi=C5=84ski?= Date: Wed, 1 Jul 2026 07:58:46 +0200 Subject: [PATCH 2/2] bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f7c1ca12..01c213d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "processout.js", - "version": "1.9.6", + "version": "1.9.7", "description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.", "scripts": { "build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js",