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: return currency in payment methods list response (#3516)

Hrithikesha9c0d0c55492
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 173272e25d..0540d470a9 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -641,6 +641,10 @@ pub struct PaymentMethodListResponse {
#[schema(example = "https://www.google.com")]
pub redirect_url: Option<String>,
+ /// currency of the Payment to be done
+ #[schema(example = "USD")]
+ pub currency: Option<api_enums::Currency>,
+
/// Information about the payment method
#[schema(value_type = Vec<PaymentMethodList>,example = json!(
[
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 4bc0490e7d..ea0df63320 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1803,6 +1803,7 @@ pub async fn list_payment_methods(
payment_method_types: bank_transfer_payment_method_types,
});
}
+ let currency = payment_intent.as_ref().and_then(|pi| pi.currency);
let merchant_surcharge_configs =
if let Some((payment_attempt, payment_intent, business_profile)) = payment_attempt
.as_ref()
@@ -1865,6 +1866,7 @@ pub async fn list_payment_methods(
show_surcharge_breakup_screen: merchant_surcharge_configs
.show_surcharge_breakup_screen
.unwrap_or_default(),
+ currency,
},
))
}