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): fix token fetch logic in complete authorize flow for three ds payments (#4052)

Shanksada000245522
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 4e38294d4d..0f08d14e43 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -131,8 +131,14 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
}
}
- let token_data = if let Some(token) = token.clone() {
- Some(helpers::retrieve_payment_token_data(state, token, payment_method).await?)
+ let token_data = if let Some((token, payment_method)) = token
+ .as_ref()
+ .zip(payment_method.or(payment_attempt.payment_method))
+ {
+ Some(
+ helpers::retrieve_payment_token_data(state, token.clone(), Some(payment_method))
+ .await?,
+ )
} else {
None
};