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

refactor(connector): [Stripe] add stripe-api-version in API-headers (#4109)

Swangi Kumaried6fdad73757
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 7718c2fc72..958867465f 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -7,6 +7,7 @@ use diesel_models::enums;
use error_stack::{IntoReport, ResultExt};
use masking::PeekInterface;
use router_env::{instrument, tracing};
+use stripe::auth_headers;
use self::transformers as stripe;
use super::utils::{self as connector_utils, RefundsRequestData};
@@ -55,10 +56,16 @@ impl ConnectorCommon for Stripe {
let auth: stripe::StripeAuthType = auth_type
.try_into()
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- format!("Bearer {}", auth.api_key.peek()).into_masked(),
- )])
+ Ok(vec![
+ (
+ headers::AUTHORIZATION.to_string(),
+ format!("Bearer {}", auth.api_key.peek()).into_masked(),
+ ),
+ (
+ auth_headers::STRIPE_API_VERSION.to_string(),
+ auth_headers::STRIPE_VERSION.to_string().into_masked(),
+ ),
+ ])
}
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 45e2c795a0..719710b602 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -32,6 +32,11 @@ use crate::{
utils::OptionExt,
};
+pub mod auth_headers {
+ pub const STRIPE_API_VERSION: &str = "stripe-version";
+ pub const STRIPE_VERSION: &str = "2023-10-16";
+}
+
pub struct StripeAuthType {
pub(super) api_key: Secret<String>,
}