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

fix(router): [stripe_connect] prevent calling connector for stripe split payments when it is an ntid flow (#13491)

Akshaya Shankarf9a6f0f849e5
diff --git a/crates/hyperswitch_domain_models/src/mandates.rs b/crates/hyperswitch_domain_models/src/mandates.rs
index c0e7bd9f9f..14985bbf1d 100644
--- a/crates/hyperswitch_domain_models/src/mandates.rs
+++ b/crates/hyperswitch_domain_models/src/mandates.rs
@@ -660,6 +660,12 @@ pub enum MandateReferenceId {
CardWithLimitedData(CardWithLimitedDataRef), // indicates the recurring transaction is done by card data only
}
+impl MandateReferenceId {
+ pub fn is_network_mandate_id(&self) -> bool {
+ matches!(self, Self::NetworkMandateId(_))
+ }
+}
+
/// Scheme-level identifiers for PSP-agnostic MIT flows (raw card path).
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, Eq, PartialEq)]
pub struct NetworkMandateIdRef {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 880c41cc88..e6343d44ef 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -9130,11 +9130,13 @@ async fn decide_payment_method_tokenize_action(
payment_intent_data: payments::PaymentIntent,
pm_parent_token: Option<&str>,
is_connector_tokenization_enabled: bool,
+ is_network_transaction_id_flow: bool,
) -> RouterResult<TokenizationAction> {
if matches!(
payment_intent_data.split_payments,
Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(_))
- ) {
+ ) && !is_network_transaction_id_flow
+ {
match pm_parent_token {
None => Ok(TokenizationAction::TokenizeInConnector),
Some(_) => Ok(TokenizationAction::TokenizeInConnectorAndRouter),
@@ -9280,6 +9282,13 @@ where
payment_data.get_payment_attempt().authentication_type,
)?;
+ let is_network_transaction_id_flow = payment_data
+ .get_mandate_id()
+ .as_ref()
+ .and_then(|inner| inner.mandate_reference_id.as_ref())
+ .map(|mandate_reference| mandate_reference.is_network_mandate_id())
+ .unwrap_or(false);
+
let payment_method_action = decide_payment_method_tokenize_action(
state,
&connector,
@@ -9287,6 +9296,7 @@ where
payment_data.get_payment_intent().clone(),
payment_data.get_token(),
is_connector_tokenization_enabled,
+ is_network_transaction_id_flow,
)
.await?;