Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

test(cypress): add Extended Card Info coverage (#12095)

HS-QUALIBOT9d7bec06b344
diff --git a/.github/data/cards_info.csv b/.github/data/cards_info.csv
index 623434389e..b9edea26a5 100644
--- a/.github/data/cards_info.csv
+++ b/.github/data/cards_info.csv
@@ -3,8 +3,10 @@ card_iin,card_issuer,card_network,card_type,card_subtype,card_issuing_country,ba
400000,INTL HDQTRS CENTER OWNED,Visa,CREDIT,,UNITED STATES OF AMERICA,,,US,2015-08-04 08:50:42,2026-01-13 09:58:15,pagos
401200,VISA PRODUCTION SUPPORT CLIENT BID 1,Visa,DEBIT,CLASSIC,UNITEDSTATES,,,US,2015-07-27 12:04:10,2025-11-04 15:23:24,Visa
411111,CONOTOXIA SP Z O.O.,Visa,DEBIT,,POLAND,131,JP_JPM,PL,2015-07-22 23:36:35,2026-01-13 09:33:48,pagos
+41111111,CONOTOXIA SP Z O.O.,Visa,DEBIT,,POLAND,131,JP_JPM,PL,2015-07-22 23:36:35,2026-01-13 09:33:48,pagos
420000,JP Morgan,Visa,CREDIT,,UNITEDSTATES,131,JP_JPM,US,2016-05-12 18:37:38,2025-11-04 15:23:24,
424242,STRIPE PAYMENTS UK LIMITED,Visa,CREDIT,,UNITEDKINGDOM,,,GB,2015-07-22 16:41:32,2025-11-04 15:23:24,Visa
+42424242,STRIPE PAYMENTS UK LIMITED,Visa,CREDIT,,UNITEDKINGDOM,,,GB,2015-07-22 16:41:32,2025-11-04 15:23:24,Visa
434994,INTESA SANPAOLO S.P.A.,Visa,CREDIT,CLASSIC,ITALY,,,IT,2015-12-30 17:01:46,2025-11-04 15:23:24,Visa
444409,SELECT SEVEN FEDERAL CREDIT UNION,Visa,DEBIT,CLASSIC,UNITEDSTATES,,,US,2016-05-12 18:41:09,2025-11-04 15:23:24,Visa
486871,America First Federal CREDIT Union,Visa,CREDIT,BUSINESS,UNITED STATES OF AMERICA,,,US,2016-05-12 18:47:21,2026-01-13 08:40:30,pagos
@@ -12,6 +14,7 @@ card_iin,card_issuer,card_network,card_type,card_subtype,card_issuing_country,ba
510510,BANKOFHAWAII,Mastercard,CREDIT,,UNITEDSTATES,,,US,2015-07-30 05:18:28,2025-11-04 15:23:24,
520474,MASTERCARD INTERNATIONAL,Visa,DEBIT,,UNITEDSTATES,,,US,2016-05-12 18:51:16,2025-11-04 15:23:24,Visa
378282,AMERICAN EXPRESS US CARS,AmericanExpress,CREDIT,SMALLCORPORATE,UNITED STATES OF AMERICA,107,JP_AMEX,US,2015-07-25 06:22:06,2026-01-13 11:36:56,pagos
+37828224,AMERICAN EXPRESS US CARS,AmericanExpress,CREDIT,SMALLCORPORATE,UNITED STATES OF AMERICA,107,JP_AMEX,US,2015-07-25 06:22:06,2026-01-13 11:36:56,pagos
400934,PT BANK HSBC INDONESIA,Visa,CREDIT,CORPORATET&E,INDONESIA,125,JP_HSBC,ID,2016-05-12 18:34:51,2022-12-12 13:15:35,Visa
372688,American Express US Consumer,AmericanExpress,CREDIT,,UNITED STATES OF AMERICA,107,JP_AMEX,US,2016-05-12 18:30:42,2026-01-13 11:35:27.20,pagos
453211,Banco Bradesco SA,Visa,CREDIT,PREMIER,BRAZIL,,,BR,2015-11-05 16:41:53,2026-01-13 09:14:24.35,pagos
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 60d5a6a42d..98f3ac70c8 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1571,6 +1571,23 @@ export const connectorDetails = {
setup_future_usage: "on_session",
},
}),
+ ExtendedCardInfo: getCustomExchange({
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ }),
No3DSFailPayment: getCustomExchange({
Request: {
payment_method: "card",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 278b267c71..519f902970 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -594,6 +594,7 @@ export const CONNECTOR_LISTS = {
MULTIPLE_CAPTURE: ["adyen", "checkout"],
USE_BILLING_AS_PAYMENT_METHOD_BILLING: ["bankofamerica"],
MIT_WITH_LIMITED_CARD_DATA: ["peachpayments"],
+ EXTENDED_CARD_INFO: ["stripe"],
PAYMENT_LINK_CARD: ["stripe"],
ORDER_DETAILS: [
"stripe",
diff --git a/cypress-tests/cypress/e2e/spec/Payment/51-ExtendedCardInfo.cy.js b/cypress-tests/cypress/e2e/spec/Payment/51-ExtendedCardInfo.cy.js
new file mode 100644
index 0000000000..0c054020c5
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/51-ExtendedCardInfo.cy.js
@@ -0,0 +1,286 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+
+let globalState;
+let specShouldSkip = false;
+
+describe("Extended Card Info Tests", () => {
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ const connectorId = globalState.get("connectorId");
+ specShouldSkip = utils.shouldIncludeConnector(
+ connectorId,
+ utils.CONNECTOR_LISTS.INCLUDE.EXTENDED_CARD_INFO
+ );
+ });
+ });
+
+ beforeEach(function () {
+ if (specShouldSkip) {
+ this.skip();
+ }
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context(
+ "Extended Card Info - Enable feature, make card payment, retrieve encrypted card data",
+ () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ // Note: Connector is already created by prerequisite spec (03-ConnectorCreate.cy.js)
+ // This spec focuses on Extended Card Info functionality only
+
+ it("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("Set Extended Card Info config with RSA public key", () => {
+ cy.setExtendedCardInfoConfigTest(globalState);
+ });
+
+ it("Enable Extended Card Info on business profile", () => {
+ cy.toggleExtendedCardInfoTest(true, globalState);
+ });
+
+ it("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Payment Methods Call", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm Payment with card (No3DS auto capture)", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["ExtendedCardInfo"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Retrieve Extended Card Info - expect 200 with encrypted payload", () => {
+ cy.retrieveExtendedCardInfoTest(200, globalState);
+ });
+ }
+ );
+
+ context(
+ "Extended Card Info - Disable feature, confirm payment, verify info is not retrievable",
+ () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("Disable Extended Card Info on business profile", () => {
+ cy.toggleExtendedCardInfoTest(false, globalState);
+ });
+
+ it("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Payment Methods Call", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm Payment with card (No3DS auto capture)", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["ExtendedCardInfo"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Retrieve Extended Card Info - expect 404 (feature disabled, no data stored)", () => {
+ cy.retrieveExtendedCardInfoTest(404, globalState);
+ });
+ }
+ );
+
+ context(
+ "Extended Card BIN - Enable config, confirm payment, verify BIN is null",
+ () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ after("Cleanup Extended Card BIN config", () => {
+ const profileId = globalState.get("profileId");
+ if (profileId && globalState.get("extendedCardBinEnabled")) {
+ const configKey = `${profileId}_enable_extended_card_bin`;
+ cy.setConfigs(globalState, configKey, "true", "DELETE");
+ }
+ });
+
+ it("Enable Extended Card BIN via configs API", () => {
+ const profileId = globalState.get("profileId");
+ const configKey = `${profileId}_enable_extended_card_bin`;
+ cy.setConfigs(globalState, configKey, "true", "CREATE");
+ });
+
+ it("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Payment Methods Call", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm Payment with card (No3DS auto capture)", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["ExtendedCardInfo"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Retrieve Payment and verify extended BIN is null", () => {
+ cy.retrievePaymentCallTest({
+ globalState,
+ data: getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "ExtendedCardInfo"
+ ],
+ }).then((response) => {
+ expect(
+ response.body.payment_method_data.card.card_extended_bin,
+ "card_extended_bin should be null"
+ ).to.be.null;
+ });
+ });
+ }
+ );
+
+ context(
+ "Extended Card BIN - Without config, confirm payment, verify extended BIN is absent",
+ () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Payment Methods Call", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm Payment with card (No3DS auto capture)", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["ExtendedCardInfo"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ it("Retrieve Payment and verify extended BIN is absent", () => {
+ cy.retrievePaymentCallTest({
+ globalState,
+ data: getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "ExtendedCardInfo"
+ ],
+ }).then((response) => {
+ expect(
+ response.body.payment_method_data.card.card_extended_bin,
+ "card_extended_bin should be null"
+ ).to.be.null;
+ });
+ });
+ }
+ );
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 906abf8697..5b38228e71 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -9383,3 +9383,116 @@ Cypress.Commands.add("retrieveNonExistentPaymentLinkTest", (globalState) => {
});
});
});
+
+// ============================================
+// Extended Card Info Commands
+// ============================================
+
+Cypress.Commands.add("toggleExtendedCardInfoTest", (enabled, globalState) => {
+ const adminApiKey = globalState.get("adminApiKey");
+ const baseUrl = globalState.get("baseUrl");
+ const merchantId = globalState.get("merchantId");
+ const profileId = globalState.get("profileId");
+
+ cy.request({
+ method: "POST",
+ url: `${baseUrl}/account/${merchantId}/business_profile/${profileId}/toggle_extended_card_info`,
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/json",
+ "api-key": adminApiKey,
+ },
+ body: { enabled },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status, "status_code").to.equal(200);
+ expect(response.body.enabled, "extended_card_info_enabled").to.equal(
+ enabled
+ );
+ globalState.set("extendedCardInfoEnabled", enabled);
+ });
+ });
+});
+
+Cypress.Commands.add(
+ "retrieveExtendedCardInfoTest",
+ (expectedStatus, globalState) => {
+ const apiKey = globalState.get("apiKey");
+ const baseUrl = globalState.get("baseUrl");
+ const paymentId = globalState.get("paymentID");
+
+ cy.request({
+ method: "GET",
+ url: `${baseUrl}/payments/${paymentId}/extended_card_info`,
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/json",
+ "api-key": apiKey,
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status, "status_code").to.equal(expectedStatus);
+ if (response.status === 200) {
+ expect(response.body, "response body").to.have.property("payload");
+ expect(response.body.payload, "payload").to.be.a("string").and.to.not
+ .be.empty;
+ }
+ });
+ });
+ }
+);
+
+Cypress.Commands.add("setExtendedCardInfoConfigTest", (globalState) => {
+ const apiKey = globalState.get("apiKey");
+ const baseUrl = globalState.get("baseUrl");
+ const merchantId = globalState.get("merchantId");
+ const profileId = globalState.get("profileId");
+
+ // NOTE: This is a test RSA public key used for encrypting extended card info.
+ // In production, the merchant would provide their own public key (typically via dashboard/API).
+ // The corresponding private key is required to decrypt the encrypted card data.
+ // For testing purposes, we use a generated key pair that the test runner has access to.
+ const publicKey =
+ "-----BEGIN PUBLIC KEY-----\n" +
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwa6siKaSYqD1o4J3AbHq\n" +
+ "Km8oVTvep7GoN/C45qY60C7DO72H1O7Ujt6ZsSiK83EyI0CaUg3ORPS3ayobFNmu\n" +
+ "zR366ckK8GIf3BG7sVI6u/9751z4OvBHZMM9JFWa7Bx/RCPQ8aeM+iJoqf9auuQm\n" +
+ "3NCTlfaZJif45pShswR+xuZTR/bqnsOSP/MFROI9ch0NE7KRogy0tvrZe21lP24i\n" +
+ "Ro2LJJG+bYshxBddhxQf2ryJ85+/Trxdu16PunodGzCl6EMT3bvb4ZC41i15omqU\n" +
+ "aXXV1Z1wYUhlsO0jyd1bVvjyuE/KE1TbBS0gfR/RkacODmmE2zEdZ0EyyiXwqkmc\n" +
+ "oQIDAQAB\n" +
+ "-----END PUBLIC KEY-----";
+
+ cy.request({
+ method: "POST",
+ url: `${baseUrl}/account/${merchantId}/business_profile/${profileId}`,
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/json",
+ "api-key": apiKey,
+ },
+ body: {
+ extended_card_info_config: {
+ public_key: publicKey,
+ ttl_in_secs: 900,
+ },
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status, "status_code").to.equal(200);
+ expect(
+ response.body.extended_card_info_config,
+ "extended_card_info_config"
+ ).to.not.be.null;
+ });
+ });
+});