diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 48e931989f02..85bc51a09a7f 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -2615,7 +2615,10 @@ impl TryFrom> for types::PaymentsAuthoriz payment_method_data: (payment_method_data.get_required_value("payment_method_data")?), setup_future_usage: payment_data.payment_intent.setup_future_usage, mandate_id: payment_data.mandate_id.clone(), - off_session: payment_data.mandate_id.as_ref().map(|_| true), + off_session: payment_data + .mandate_id + .as_ref() + .and(payment_data.payment_intent.off_session), setup_mandate_details: payment_data.setup_mandate.clone(), confirm: payment_data.payment_attempt.confirm, statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix, @@ -3218,7 +3221,10 @@ impl TryFrom> for types::SetupMandateRequ .get_required_value("payment_method_data")?), statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix, setup_future_usage: payment_data.payment_intent.setup_future_usage, - off_session: payment_data.mandate_id.as_ref().map(|_| true), + off_session: payment_data + .mandate_id + .as_ref() + .and(payment_data.payment_intent.off_session), mandate_id: payment_data.mandate_id.clone(), setup_mandate_details: payment_data.setup_mandate, customer_acceptance: payment_data.customer_acceptance, @@ -3333,7 +3339,10 @@ impl TryFrom> for types::CompleteAuthoriz Ok(Self { setup_future_usage: payment_data.payment_intent.setup_future_usage, mandate_id: payment_data.mandate_id.clone(), - off_session: payment_data.mandate_id.as_ref().map(|_| true), + off_session: payment_data + .mandate_id + .as_ref() + .and(payment_data.payment_intent.off_session), setup_mandate_details: payment_data.setup_mandate.clone(), confirm: payment_data.payment_attempt.confirm, statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js b/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js index fdc1926ae077..d75fcf6877b9 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js @@ -721,9 +721,7 @@ export const connectorDetails = { Response: { status: 200, body: { - error_code: "No error code", - error_message: - "You cannot confirm with `off_session=true` when `setup_future_usage` is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage. Please confirm this PaymentIntent with your customer on-session.", + status: "succeeded", }, }, }, @@ -734,9 +732,7 @@ export const connectorDetails = { Response: { status: 200, body: { - error_code: "No error code", - error_message: - "You cannot confirm with `off_session=true` when `setup_future_usage` is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage. Please confirm this PaymentIntent with your customer on-session.", + status: "requires_capture", }, }, }, @@ -748,9 +744,7 @@ export const connectorDetails = { Response: { status: 200, body: { - status: "failed", - error_message: - "You cannot confirm with `off_session=true` when `setup_future_usage` is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage. Please confirm this PaymentIntent with your customer on-session.", + status: "succeeded", }, }, },