| repo
				 stringclasses 1
				value | instance_id
				 stringlengths 22 24 | problem_statement
				 stringlengths 24 24.1k | patch
				 stringlengths 0 1.9M | test_patch
				 stringclasses 1
				value | created_at
				 stringdate 2022-11-25 05:12:07 2025-10-09 08:44:51 | hints_text
				 stringlengths 11 235k | base_commit
				 stringlengths 40 40 | test_instructions
				 stringlengths 0 232k | 
|---|---|---|---|---|---|---|---|---|
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9313 | 
	Bug: [BUG] Nuvei 3ds + psync fix
### Bug Description
- 3ds transaction done via hyperswitch was not marked as 3ds in nuvei system. Make a successful 3ds transaction and search the connector transaction id in nuvei dashboard , click `linkage` . InitAuth and Auth3d is not seen.
### Expected Behavior
Actual 3ds call should have have 3 calls in linkage 1, `InitAuth`  2. `Auth3d` and 3. `sale`
### Actual Behavior
- 
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
- Make a 3ds transaction and go to nuvei dashboard . 
- 
- Make a psync , you will see it as completed.
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 259495d0545..9c906abeefc 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -53,6 +53,7 @@ use masking::ExposeInterface;
 use transformers as nuvei;
 
 use crate::{
+    connectors::nuvei::transformers::{NuveiPaymentsResponse, NuveiTransactionSyncResponse},
     constants::headers,
     types::ResponseRouterData,
     utils::{self, is_mandate_supported, PaymentMethodDataType, RouterData as _},
@@ -211,7 +212,7 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
         RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
         errors::ConnectorError,
     > {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
@@ -234,72 +235,68 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
     }
 }
 
-impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>
-    for Nuvei
-{
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Nuvei {
     fn get_headers(
         &self,
-        req: &PaymentsCompleteAuthorizeRouterData,
+        req: &PaymentsCancelRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
+
     fn get_content_type(&self) -> &'static str {
         self.common_get_content_type()
     }
+
     fn get_url(
         &self,
-        _req: &PaymentsCompleteAuthorizeRouterData,
+        _req: &PaymentsCancelRouterData,
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
-            "{}ppp/api/v1/payment.do",
+            "{}ppp/api/v1/voidTransaction.do",
             ConnectorCommon::base_url(self, connectors)
         ))
     }
+
     fn get_request_body(
         &self,
-        req: &PaymentsCompleteAuthorizeRouterData,
+        req: &PaymentsCancelRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let meta: nuvei::NuveiMeta = utils::to_connector_meta(req.request.connector_meta.clone())?;
-        let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, meta.session_token))?;
+        let connector_req = nuvei::NuveiPaymentFlowRequest::try_from(req)?;
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
+
     fn build_request(
         &self,
-        req: &PaymentsCompleteAuthorizeRouterData,
+        req: &PaymentsCancelRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Ok(Some(
-            RequestBuilder::new()
-                .method(Method::Post)
-                .url(&types::PaymentsCompleteAuthorizeType::get_url(
-                    self, req, connectors,
-                )?)
-                .attach_default_headers()
-                .headers(types::PaymentsCompleteAuthorizeType::get_headers(
-                    self, req, connectors,
-                )?)
-                .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
-                    self, req, connectors,
-                )?)
-                .build(),
-        ))
+        let request = RequestBuilder::new()
+            .method(Method::Post)
+            .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+            .attach_default_headers()
+            .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+            .set_body(types::PaymentsVoidType::get_request_body(
+                self, req, connectors,
+            )?)
+            .build();
+        Ok(Some(request))
     }
+
     fn handle_response(
         &self,
-        data: &PaymentsCompleteAuthorizeRouterData,
+        data: &PaymentsCancelRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+    ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-
         RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
@@ -317,63 +314,66 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
     }
 }
 
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Nuvei {
+impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>
+    for Nuvei
+{
     fn get_headers(
         &self,
-        req: &PaymentsCancelRouterData,
+        req: &PaymentsCompleteAuthorizeRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
-
     fn get_content_type(&self) -> &'static str {
         self.common_get_content_type()
     }
-
     fn get_url(
         &self,
-        _req: &PaymentsCancelRouterData,
+        _req: &PaymentsCompleteAuthorizeRouterData,
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
-            "{}ppp/api/v1/voidTransaction.do",
+            "{}ppp/api/v1/payment.do",
             ConnectorCommon::base_url(self, connectors)
         ))
     }
-
     fn get_request_body(
         &self,
-        req: &PaymentsCancelRouterData,
+        req: &PaymentsCompleteAuthorizeRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let connector_req = nuvei::NuveiPaymentFlowRequest::try_from(req)?;
+        let meta: nuvei::NuveiMeta = utils::to_connector_meta(req.request.connector_meta.clone())?;
+        let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, meta.session_token))?;
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
-
     fn build_request(
         &self,
-        req: &PaymentsCancelRouterData,
+        req: &PaymentsCompleteAuthorizeRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        let request = RequestBuilder::new()
-            .method(Method::Post)
-            .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
-            .attach_default_headers()
-            .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
-            .set_body(types::PaymentsVoidType::get_request_body(
-                self, req, connectors,
-            )?)
-            .build();
-        Ok(Some(request))
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::PaymentsCompleteAuthorizeType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::PaymentsCompleteAuthorizeType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
     }
-
     fn handle_response(
         &self,
-        data: &PaymentsCancelRouterData,
+        data: &PaymentsCompleteAuthorizeRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+    ) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
@@ -458,7 +458,7 @@ impl ConnectorIntegration<PostCaptureVoid, PaymentsCancelPostCaptureData, Paymen
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsCancelPostCaptureRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
@@ -501,7 +501,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Nuv
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
-            "{}ppp/api/v1/getPaymentStatus.do",
+            "{}ppp/api/v1/getTransactionDetails.do",
             ConnectorCommon::base_url(self, connectors)
         ))
     }
@@ -546,9 +546,9 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Nuv
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiTransactionSyncResponse = res
             .response
-            .parse_struct("NuveiPaymentsResponse")
+            .parse_struct("NuveiTransactionSyncResponse")
             .switch()?;
 
         event_builder.map(|i| i.set_response_body(&response));
@@ -622,7 +622,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
@@ -678,7 +678,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, req.get_session_token()?))?;
-
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
@@ -710,7 +709,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
@@ -883,13 +882,12 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-
         RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
@@ -965,7 +963,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Nuvei {
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
-        let response: nuvei::NuveiPaymentsResponse = res
+        let response: NuveiPaymentsResponse = res
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
@@ -1124,10 +1122,8 @@ impl IncomingWebhook for Nuvei {
         // Parse the webhook payload
         let webhook = serde_urlencoded::from_str::<nuvei::NuveiWebhook>(&request.query_params)
             .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
-
         // Convert webhook to payments response
-        let payment_response = nuvei::NuveiPaymentsResponse::from(webhook);
-
+        let payment_response = NuveiPaymentsResponse::from(webhook);
         Ok(Box::new(payment_response))
     }
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 0e032c3c804..2092fc40a20 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -49,7 +49,8 @@ use crate::{
     utils::{
         self, convert_amount, missing_field_err, AddressData, AddressDetailsData,
         BrowserInformationData, ForeignTryFrom, PaymentsAuthorizeRequestData,
-        PaymentsCancelRequestData, PaymentsPreProcessingRequestData, RouterData as _,
+        PaymentsCancelRequestData, PaymentsPreProcessingRequestData,
+        PaymentsSetupMandateRequestData, RouterData as _,
     },
 };
 
@@ -136,9 +137,7 @@ impl NuveiAuthorizePreprocessingCommon for SetupMandateRequestData {
     fn get_return_url_required(
         &self,
     ) -> Result<String, error_stack::Report<errors::ConnectorError>> {
-        self.router_return_url
-            .clone()
-            .ok_or_else(missing_field_err("return_url"))
+        self.get_router_return_url()
     }
 
     fn get_capture_method(&self) -> Option<CaptureMethod> {
@@ -201,10 +200,6 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
         self.customer_id.clone()
     }
 
-    fn get_complete_authorize_url(&self) -> Option<String> {
-        self.complete_authorize_url.clone()
-    }
-
     fn get_connector_mandate_id(&self) -> Option<String> {
         self.connector_mandate_id().clone()
     }
@@ -219,6 +214,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
         self.capture_method
     }
 
+    fn get_complete_authorize_url(&self) -> Option<String> {
+        self.complete_authorize_url.clone()
+    }
+
     fn get_minor_amount_required(
         &self,
     ) -> Result<MinorUnit, error_stack::Report<errors::ConnectorError>> {
@@ -273,10 +272,6 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
             && self.setup_future_usage == Some(FutureUsage::OffSession)
     }
 
-    fn get_complete_authorize_url(&self) -> Option<String> {
-        self.complete_authorize_url.clone()
-    }
-
     fn get_connector_mandate_id(&self) -> Option<String> {
         self.connector_mandate_id()
     }
@@ -291,6 +286,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
         self.capture_method
     }
 
+    fn get_complete_authorize_url(&self) -> Option<String> {
+        self.complete_authorize_url.clone()
+    }
+
     fn get_minor_amount_required(
         &self,
     ) -> Result<MinorUnit, error_stack::Report<errors::ConnectorError>> {
@@ -502,7 +501,11 @@ pub struct NuveiPaymentFlowRequest {
 #[derive(Debug, Serialize, Default)]
 #[serde(rename_all = "camelCase")]
 pub struct NuveiPaymentSyncRequest {
-    pub session_token: Secret<String>,
+    pub merchant_id: Secret<String>,
+    pub merchant_site_id: Secret<String>,
+    pub time_stamp: String,
+    pub checksum: Secret<String>,
+    pub transaction_id: String,
 }
 
 #[derive(Debug, Default, Serialize, Deserialize)]
@@ -848,9 +851,9 @@ pub struct NuveiACSResponse {
 
 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
 pub enum LiabilityShift {
-    #[serde(rename = "Y", alias = "1")]
+    #[serde(rename = "Y", alias = "1", alias = "y")]
     Success,
-    #[serde(rename = "N", alias = "0")]
+    #[serde(rename = "N", alias = "0", alias = "n")]
     Failed,
 }
 
@@ -1724,8 +1727,8 @@ where
         let shipping_address: Option<ShippingAddress> =
             item.get_optional_shipping().map(|address| address.into());
 
-        let billing_address: Option<BillingAddress> = address.map(|ref address| address.into());
-
+        let billing_address: Option<BillingAddress> =
+            address.clone().map(|ref address| address.into());
         let device_details = if request_data
             .device_details
             .ip_address
@@ -1902,25 +1905,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret<String>)>
                     ..Default::default()
                 })
             }
-            Some(PaymentMethodData::Wallet(..))
-            | Some(PaymentMethodData::PayLater(..))
-            | Some(PaymentMethodData::BankDebit(..))
-            | Some(PaymentMethodData::BankRedirect(..))
-            | Some(PaymentMethodData::BankTransfer(..))
-            | Some(PaymentMethodData::Crypto(..))
-            | Some(PaymentMethodData::MandatePayment)
-            | Some(PaymentMethodData::GiftCard(..))
-            | Some(PaymentMethodData::Voucher(..))
-            | Some(PaymentMethodData::CardRedirect(..))
-            | Some(PaymentMethodData::Reward)
-            | Some(PaymentMethodData::RealTimePayment(..))
-            | Some(PaymentMethodData::MobilePayment(..))
-            | Some(PaymentMethodData::Upi(..))
-            | Some(PaymentMethodData::OpenBanking(_))
-            | Some(PaymentMethodData::CardToken(..))
-            | Some(PaymentMethodData::NetworkToken(..))
-            | Some(PaymentMethodData::CardDetailsForNetworkTransactionId(_))
-            | None => Err(errors::ConnectorError::NotImplemented(
+            _ => Err(errors::ConnectorError::NotImplemented(
                 utils::get_unimplemented_payment_method_error_message("nuvei"),
             )),
         }?;
@@ -1938,7 +1923,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret<String>)>
             ..Default::default()
         })?;
         Ok(Self {
-            related_transaction_id: request_data.related_transaction_id,
+            related_transaction_id: item.request.connector_transaction_id.clone(),
             payment_option: request_data.payment_option,
             device_details: request_data.device_details,
             ..request
@@ -2071,9 +2056,33 @@ impl TryFrom<&types::RefundExecuteRouterData> for NuveiPaymentFlowRequest {
 impl TryFrom<&types::PaymentsSyncRouterData> for NuveiPaymentSyncRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(value: &types::PaymentsSyncRouterData) -> Result<Self, Self::Error> {
-        let meta: NuveiMeta = utils::to_connector_meta(value.request.connector_meta.clone())?;
+        let connector_meta: NuveiAuthType = NuveiAuthType::try_from(&value.connector_auth_type)?;
+        let merchant_id = connector_meta.merchant_id.clone();
+        let merchant_site_id = connector_meta.merchant_site_id.clone();
+        let merchant_secret = connector_meta.merchant_secret.clone();
+        let time_stamp =
+            date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss)
+                .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+        let transaction_id = value
+            .request
+            .connector_transaction_id
+            .clone()
+            .get_connector_transaction_id()
+            .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+        let checksum = Secret::new(encode_payload(&[
+            merchant_id.peek(),
+            merchant_site_id.peek(),
+            &transaction_id,
+            &time_stamp,
+            merchant_secret.peek(),
+        ])?);
+
         Ok(Self {
-            session_token: meta.session_token,
+            merchant_id,
+            merchant_site_id,
+            time_stamp,
+            checksum,
+            transaction_id,
         })
     }
 }
@@ -2189,11 +2198,17 @@ pub enum NuveiPaymentStatus {
 #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
 #[serde(rename_all = "UPPERCASE")]
 pub enum NuveiTransactionStatus {
+    #[serde(alias = "Approved", alias = "APPROVED")]
     Approved,
+    #[serde(alias = "Declined", alias = "DECLINED")]
     Declined,
+    #[serde(alias = "Filter Error", alias = "ERROR", alias = "Error")]
     Error,
+    #[serde(alias = "Redirect", alias = "REDIRECT")]
     Redirect,
+    #[serde(alias = "Pending", alias = "PENDING")]
     Pending,
+    #[serde(alias = "Processing", alias = "PROCESSING")]
     #[default]
     Processing,
 }
@@ -2251,35 +2266,105 @@ pub struct NuveiPaymentsResponse {
     pub client_request_id: Option<String>,
     pub merchant_advice_code: Option<String>,
 }
-impl NuveiPaymentsResponse {
-    /// returns amount_captured and minor_amount_capturable
-    pub fn get_amount_captured(
-        &self,
-    ) -> Result<(Option<i64>, Option<MinorUnit>), error_stack::Report<errors::ConnectorError>> {
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiTxnPartialApproval {
+    requested_amount: Option<StringMajorUnit>,
+    requested_currency: Option<enums::Currency>,
+}
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiTransactionSyncResponseDetails {
+    gw_error_code: Option<i64>,
+    gw_error_reason: Option<String>,
+    gw_extended_error_code: Option<i64>,
+    transaction_id: Option<String>,
+    transaction_status: Option<NuveiTransactionStatus>,
+    transaction_type: Option<NuveiTransactionType>,
+    auth_code: Option<String>,
+    processed_amount: Option<StringMajorUnit>,
+    processed_currency: Option<enums::Currency>,
+    acquiring_bank_name: Option<String>,
+}
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiTransactionSyncResponse {
+    pub payment_option: Option<PaymentOption>,
+    pub partial_approval: Option<NuveiTxnPartialApproval>,
+    pub is_currency_converted: Option<bool>,
+    pub transaction_details: Option<NuveiTransactionSyncResponseDetails>,
+    pub fraud_details: Option<FraudDetails>,
+    pub client_unique_id: Option<String>,
+    pub internal_request_id: Option<i64>,
+    pub status: NuveiPaymentStatus,
+    pub err_code: Option<i64>,
+    pub reason: Option<String>,
+    pub merchant_id: Option<Secret<String>>,
+    pub merchant_site_id: Option<Secret<String>>,
+    pub version: Option<String>,
+    pub client_request_id: Option<String>,
+    pub merchant_advice_code: Option<String>,
+}
+impl NuveiTransactionSyncResponse {
+    pub fn get_partial_approval(&self) -> Option<NuveiPartialApproval> {
         match &self.partial_approval {
-            Some(partial_approval) => {
-                let amount = utils::convert_back_amount_to_minor_units(
-                    NUVEI_AMOUNT_CONVERTOR,
-                    partial_approval.processed_amount.clone(),
-                    partial_approval.processed_currency,
-                )?;
-                match self.transaction_type {
-                    None => Ok((None, None)),
-                    Some(NuveiTransactionType::Sale) => {
-                        Ok((Some(MinorUnit::get_amount_as_i64(amount)), None))
-                    }
-                    Some(NuveiTransactionType::Auth) => Ok((None, Some(amount))),
-                    Some(NuveiTransactionType::Auth3D) => {
-                        Ok((Some(MinorUnit::get_amount_as_i64(amount)), None))
-                    }
-                    Some(NuveiTransactionType::InitAuth3D) => Ok((None, Some(amount))),
-                    Some(NuveiTransactionType::Credit) => Ok((None, None)),
-                    Some(NuveiTransactionType::Void) => Ok((None, None)),
-                    Some(NuveiTransactionType::Settle) => Ok((None, None)),
+            Some(partial_approval) => match (
+                partial_approval.requested_amount.clone(),
+                partial_approval.requested_currency,
+                self.transaction_details
+                    .as_ref()
+                    .and_then(|txn| txn.processed_amount.clone()),
+                self.transaction_details
+                    .as_ref()
+                    .and_then(|txn| txn.processed_currency),
+            ) {
+                (
+                    Some(requested_amount),
+                    Some(requested_currency),
+                    Some(processed_amount),
+                    Some(processed_currency),
+                ) => Some(NuveiPartialApproval {
+                    requested_amount,
+                    requested_currency,
+                    processed_amount,
+                    processed_currency,
+                }),
+                _ => None,
+            },
+            None => None,
+        }
+    }
+}
+
+pub fn get_amount_captured(
+    partial_approval_data: Option<NuveiPartialApproval>,
+    transaction_type: Option<NuveiTransactionType>,
+) -> Result<(Option<i64>, Option<MinorUnit>), error_stack::Report<errors::ConnectorError>> {
+    match partial_approval_data {
+        Some(partial_approval) => {
+            let amount = utils::convert_back_amount_to_minor_units(
+                NUVEI_AMOUNT_CONVERTOR,
+                partial_approval.processed_amount.clone(),
+                partial_approval.processed_currency,
+            )?;
+            match transaction_type {
+                None => Ok((None, None)),
+                Some(NuveiTransactionType::Sale) => {
+                    Ok((Some(MinorUnit::get_amount_as_i64(amount)), None))
+                }
+                Some(NuveiTransactionType::Auth) => Ok((None, Some(amount))),
+                Some(NuveiTransactionType::Auth3D) => {
+                    Ok((Some(MinorUnit::get_amount_as_i64(amount)), None))
                 }
+                Some(NuveiTransactionType::InitAuth3D) => Ok((None, Some(amount))),
+                Some(NuveiTransactionType::Credit) => Ok((None, None)),
+                Some(NuveiTransactionType::Void) => Ok((None, None)),
+                Some(NuveiTransactionType::Settle) => Ok((None, None)),
             }
-            None => Ok((None, None)),
         }
+        None => Ok((None, None)),
     }
 }
 
@@ -2301,13 +2386,15 @@ pub struct FraudDetails {
 }
 
 fn get_payment_status(
-    response: &NuveiPaymentsResponse,
     amount: Option<i64>,
     is_post_capture_void: bool,
+    transaction_type: Option<NuveiTransactionType>,
+    transaction_status: Option<NuveiTransactionStatus>,
+    status: NuveiPaymentStatus,
 ) -> enums::AttemptStatus {
     // ZERO dollar authorization
-    if amount == Some(0) && response.transaction_type.clone() == Some(NuveiTransactionType::Auth) {
-        return match response.transaction_status.clone() {
+    if amount == Some(0) && transaction_type == Some(NuveiTransactionType::Auth) {
+        return match transaction_status {
             Some(NuveiTransactionStatus::Approved) => enums::AttemptStatus::Charged,
             Some(NuveiTransactionStatus::Declined) | Some(NuveiTransactionStatus::Error) => {
                 enums::AttemptStatus::AuthorizationFailed
@@ -2316,7 +2403,7 @@ fn get_payment_status(
                 enums::AttemptStatus::Pending
             }
             Some(NuveiTransactionStatus::Redirect) => enums::AttemptStatus::AuthenticationPending,
-            None => match response.status {
+            None => match status {
                 NuveiPaymentStatus::Failed | NuveiPaymentStatus::Error => {
                     enums::AttemptStatus::Failure
                 }
@@ -2325,10 +2412,12 @@ fn get_payment_status(
         };
     }
 
-    match response.transaction_status.clone() {
+    match transaction_status {
         Some(status) => match status {
-            NuveiTransactionStatus::Approved => match response.transaction_type {
-                Some(NuveiTransactionType::Auth) => enums::AttemptStatus::Authorized,
+            NuveiTransactionStatus::Approved => match transaction_type {
+                Some(NuveiTransactionType::InitAuth3D) | Some(NuveiTransactionType::Auth) => {
+                    enums::AttemptStatus::Authorized
+                }
                 Some(NuveiTransactionType::Sale) | Some(NuveiTransactionType::Settle) => {
                     enums::AttemptStatus::Charged
                 }
@@ -2336,14 +2425,14 @@ fn get_payment_status(
                     enums::AttemptStatus::VoidedPostCharge
                 }
                 Some(NuveiTransactionType::Void) => enums::AttemptStatus::Voided,
-
+                Some(NuveiTransactionType::Auth3D) => enums::AttemptStatus::AuthenticationPending,
                 _ => enums::AttemptStatus::Pending,
             },
             NuveiTransactionStatus::Declined | NuveiTransactionStatus::Error => {
-                match response.transaction_type {
+                match transaction_type {
                     Some(NuveiTransactionType::Auth) => enums::AttemptStatus::AuthorizationFailed,
                     Some(NuveiTransactionType::Void) => enums::AttemptStatus::VoidFailed,
-                    Some(NuveiTransactionType::Auth3D) => {
+                    Some(NuveiTransactionType::Auth3D) | Some(NuveiTransactionType::InitAuth3D) => {
                         enums::AttemptStatus::AuthenticationFailed
                     }
                     _ => enums::AttemptStatus::Failure,
@@ -2354,37 +2443,49 @@ fn get_payment_status(
             }
             NuveiTransactionStatus::Redirect => enums::AttemptStatus::AuthenticationPending,
         },
-        None => match response.status {
+        None => match status {
             NuveiPaymentStatus::Failed | NuveiPaymentStatus::Error => enums::AttemptStatus::Failure,
             _ => enums::AttemptStatus::Pending,
         },
     }
 }
 
-fn build_error_response(response: &NuveiPaymentsResponse, http_code: u16) -> Option<ErrorResponse> {
-    match response.status {
+#[derive(Debug)]
+struct ErrorResponseParams {
+    http_code: u16,
+    status: NuveiPaymentStatus,
+    err_code: Option<i64>,
+    err_msg: Option<String>,
+    merchant_advice_code: Option<String>,
+    gw_error_code: Option<i64>,
+    gw_error_reason: Option<String>,
+    transaction_status: Option<NuveiTransactionStatus>,
+}
+
+fn build_error_response(params: ErrorResponseParams) -> Option<ErrorResponse> {
+    match params.status {
         NuveiPaymentStatus::Error => Some(get_error_response(
-            response.err_code,
-            &response.reason,
-            http_code,
-            &response.merchant_advice_code,
-            &response.gw_error_code.map(|e| e.to_string()),
-            &response.gw_error_reason,
+            params.err_code,
+            params.err_msg.clone(),
+            params.http_code,
+            params.merchant_advice_code.clone(),
+            params.gw_error_code.map(|code| code.to_string()),
+            params.gw_error_reason.clone(),
         )),
 
         _ => {
             let err = Some(get_error_response(
-                response.gw_error_code,
-                &response.gw_error_reason,
-                http_code,
-                &response.merchant_advice_code,
-                &response.gw_error_code.map(|e| e.to_string()),
-                &response.gw_error_reason,
+                params.gw_error_code,
+                params.gw_error_reason.clone(),
+                params.http_code,
+                params.merchant_advice_code,
+                params.gw_error_code.map(|e| e.to_string()),
+                params.gw_error_reason.clone(),
             ));
 
-            match response.transaction_status {
+            match params.transaction_status {
                 Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err,
-                _ => match response
+                _ => match params
                     .gw_error_reason
                     .as_ref()
                     .map(|r| r.eq("Missing argument"))
@@ -2433,11 +2534,15 @@ impl
         >,
     ) -> Result<Self, Self::Error> {
         let amount = item.data.request.amount;
+        let response = &item.response;
+        let (status, redirection_data, connector_response_data) = process_nuvei_payment_response(
+            NuveiPaymentResponseData::new(amount, false, item.data.payment_method, response),
+        )?;
 
-        let (status, redirection_data, connector_response_data) =
-            process_nuvei_payment_response(&item, amount, false)?;
-
-        let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?;
+        let (amount_captured, minor_amount_capturable) = get_amount_captured(
+            response.partial_approval.clone(),
+            response.transaction_type.clone(),
+        )?;
 
         let ip_address = item
             .data
@@ -2453,16 +2558,31 @@ impl
                 field_name: "browser_info.ip_address",
             })?
             .to_string();
+        let response = &item.response;
 
         Ok(Self {
             status,
-            response: if let Some(err) = build_error_response(&item.response, item.http_code) {
+            response: if let Some(err) = build_error_response(ErrorResponseParams {
+                http_code: item.http_code,
+                status: response.status.clone(),
+                err_code: response.err_code,
+                err_msg: response.reason.clone(),
+                merchant_advice_code: response.merchant_advice_code.clone(),
+                gw_error_code: response.gw_error_code,
+                gw_error_reason: response.gw_error_reason.clone(),
+                transaction_status: response.transaction_status.clone(),
+            }) {
                 Err(err)
             } else {
+                let response = &item.response;
                 Ok(create_transaction_response(
-                    &item.response,
                     redirection_data,
                     Some(ip_address),
+                    response.transaction_id.clone(),
+                    response.order_id.clone(),
+                    response.session_token.clone(),
+                    response.external_scheme_transaction_id.clone(),
+                    response.payment_option.clone(),
                 )?)
             },
             amount_captured,
@@ -2475,10 +2595,64 @@ impl
 
 // Helper function to process Nuvei payment response
 
-fn process_nuvei_payment_response<F, T>(
-    item: &ResponseRouterData<F, NuveiPaymentsResponse, T, PaymentsResponseData>,
-    amount: Option<i64>,
-    is_post_capture_void: bool,
+/// Struct to encapsulate parameters for processing Nuvei payment responses
+#[derive(Debug)]
+pub struct NuveiPaymentResponseData {
+    pub amount: Option<i64>,
+    pub is_post_capture_void: bool,
+    pub payment_method: enums::PaymentMethod,
+    pub payment_option: Option<PaymentOption>,
+    pub transaction_type: Option<NuveiTransactionType>,
+    pub transaction_status: Option<NuveiTransactionStatus>,
+    pub status: NuveiPaymentStatus,
+    pub merchant_advice_code: Option<String>,
+}
+
+impl NuveiPaymentResponseData {
+    pub fn new(
+        amount: Option<i64>,
+        is_post_capture_void: bool,
+        payment_method: enums::PaymentMethod,
+        response: &NuveiPaymentsResponse,
+    ) -> Self {
+        Self {
+            amount,
+            is_post_capture_void,
+            payment_method,
+            payment_option: response.payment_option.clone(),
+            transaction_type: response.transaction_type.clone(),
+            transaction_status: response.transaction_status.clone(),
+            status: response.status.clone(),
+            merchant_advice_code: response.merchant_advice_code.clone(),
+        }
+    }
+
+    pub fn new_from_sync_response(
+        amount: Option<i64>,
+        is_post_capture_void: bool,
+        payment_method: enums::PaymentMethod,
+        response: &NuveiTransactionSyncResponse,
+    ) -> Self {
+        let transaction_details = &response.transaction_details;
+        Self {
+            amount,
+            is_post_capture_void,
+            payment_method,
+            payment_option: response.payment_option.clone(),
+            transaction_type: transaction_details
+                .as_ref()
+                .and_then(|details| details.transaction_type.clone()),
+            transaction_status: transaction_details
+                .as_ref()
+                .and_then(|details| details.transaction_status.clone()),
+            status: response.status.clone(),
+            merchant_advice_code: None,
+        }
+    }
+}
+
+fn process_nuvei_payment_response(
+    data: NuveiPaymentResponseData,
 ) -> Result<
     (
         enums::AttemptStatus,
@@ -2486,20 +2660,14 @@ fn process_nuvei_payment_response<F, T>(
         Option<ConnectorResponseData>,
     ),
     error_stack::Report<errors::ConnectorError>,
->
-where
-    F: std::fmt::Debug,
-    T: std::fmt::Debug,
-{
-    let redirection_data = match item.data.payment_method {
-        enums::PaymentMethod::Wallet | enums::PaymentMethod::BankRedirect => item
-            .response
+> {
+    let redirection_data = match data.payment_method {
+        enums::PaymentMethod::Wallet | enums::PaymentMethod::BankRedirect => data
             .payment_option
             .as_ref()
             .and_then(|po| po.redirect_url.clone())
             .map(|base_url| RedirectForm::from((base_url, Method::Get))),
-        _ => item
-            .response
+        _ => data
             .payment_option
             .as_ref()
             .and_then(|o| o.card.clone())
@@ -2511,32 +2679,42 @@ where
                 form_fields: std::collections::HashMap::from([("creq".to_string(), creq.expose())]),
             }),
     };
-    let connector_response_data =
-        convert_to_additional_payment_method_connector_response(&item.response)
-            .map(ConnectorResponseData::with_additional_payment_method_data);
 
-    let status = get_payment_status(&item.response, amount, is_post_capture_void);
+    let connector_response_data = convert_to_additional_payment_method_connector_response(
+        data.payment_option.clone(),
+        data.merchant_advice_code,
+    )
+    .map(ConnectorResponseData::with_additional_payment_method_data);
+    let status = get_payment_status(
+        data.amount,
+        data.is_post_capture_void,
+        data.transaction_type,
+        data.transaction_status,
+        data.status,
+    );
 
     Ok((status, redirection_data, connector_response_data))
 }
 
 // Helper function to create transaction response
 fn create_transaction_response(
-    response: &NuveiPaymentsResponse,
     redirection_data: Option<RedirectForm>,
     ip_address: Option<String>,
+    transaction_id: Option<String>,
+    order_id: Option<String>,
+    session_token: Option<Secret<String>>,
+    external_scheme_transaction_id: Option<Secret<String>>,
+    payment_option: Option<PaymentOption>,
 ) -> Result<PaymentsResponseData, error_stack::Report<errors::ConnectorError>> {
     Ok(PaymentsResponseData::TransactionResponse {
-        resource_id: response
-            .transaction_id
+        resource_id: transaction_id
             .clone()
-            .map_or(response.order_id.clone(), Some) // For paypal there will be no transaction_id, only order_id will be present
+            .map_or(order_id.clone(), Some) // For paypal there will be no transaction_id, only order_id will be present
             .map(ResponseId::ConnectorTransactionId)
             .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
         redirection_data: Box::new(redirection_data),
         mandate_reference: Box::new(
-            response
-                .payment_option
+            payment_option
                 .as_ref()
                 .and_then(|po| po.user_payment_option_id.clone())
                 .map(|id| MandateReference {
@@ -2548,7 +2726,7 @@ fn create_transaction_response(
                 }),
         ),
         // we don't need to save session token for capture, void flow so ignoring if it is not present
-        connector_metadata: if let Some(token) = response.session_token.clone() {
+        connector_metadata: if let Some(token) = session_token {
             Some(
                 serde_json::to_value(NuveiMeta {
                     session_token: token,
@@ -2558,11 +2736,10 @@ fn create_transaction_response(
         } else {
             None
         },
-        network_txn_id: response
-            .external_scheme_transaction_id
+        network_txn_id: external_scheme_transaction_id
             .as_ref()
             .map(|ntid| ntid.clone().expose()),
-        connector_response_reference_id: response.order_id.clone(),
+        connector_response_reference_id: order_id.clone(),
         incremental_authorization_allowed: None,
         charges: None,
     })
@@ -2590,11 +2767,15 @@ impl
     ) -> Result<Self, Self::Error> {
         // Get amount directly from the authorize data
         let amount = Some(item.data.request.amount);
+        let response = &item.response;
+        let (status, redirection_data, connector_response_data) = process_nuvei_payment_response(
+            NuveiPaymentResponseData::new(amount, false, item.data.payment_method, response),
+        )?;
 
-        let (status, redirection_data, connector_response_data) =
-            process_nuvei_payment_response(&item, amount, false)?;
-
-        let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?;
+        let (amount_captured, minor_amount_capturable) = get_amount_captured(
+            response.partial_approval.clone(),
+            response.transaction_type.clone(),
+        )?;
 
         let ip_address = item
             .data
@@ -2605,13 +2786,27 @@ impl
 
         Ok(Self {
             status,
-            response: if let Some(err) = build_error_response(&item.response, item.http_code) {
+            response: if let Some(err) = build_error_response(ErrorResponseParams {
+                http_code: item.http_code,
+                status: response.status.clone(),
+                err_code: response.err_code,
+                err_msg: response.reason.clone(),
+                merchant_advice_code: response.merchant_advice_code.clone(),
+                gw_error_code: response.gw_error_code,
+                gw_error_reason: response.gw_error_reason.clone(),
+                transaction_status: response.transaction_status.clone(),
+            }) {
                 Err(err)
             } else {
+                let response = &item.response;
                 Ok(create_transaction_response(
-                    &item.response,
                     redirection_data,
                     ip_address,
+                    response.transaction_id.clone(),
+                    response.order_id.clone(),
+                    response.session_token.clone(),
+                    response.external_scheme_transaction_id.clone(),
+                    response.payment_option.clone(),
                 )?)
             },
             amount_captured,
@@ -2638,19 +2833,113 @@ where
             .data
             .minor_amount_capturable
             .map(|amount| amount.get_amount_as_i64());
+        let response = &item.response;
         let (status, redirection_data, connector_response_data) =
-            process_nuvei_payment_response(&item, amount, F::is_post_capture_void())?;
+            process_nuvei_payment_response(NuveiPaymentResponseData::new(
+                amount,
+                F::is_post_capture_void(),
+                item.data.payment_method,
+                response,
+            ))?;
+
+        let (amount_captured, minor_amount_capturable) = get_amount_captured(
+            response.partial_approval.clone(),
+            response.transaction_type.clone(),
+        )?;
+        Ok(Self {
+            status,
+            response: if let Some(err) = build_error_response(ErrorResponseParams {
+                http_code: item.http_code,
+                status: response.status.clone(),
+                err_code: response.err_code,
+                err_msg: response.reason.clone(),
+                merchant_advice_code: response.merchant_advice_code.clone(),
+                gw_error_code: response.gw_error_code,
+                gw_error_reason: response.gw_error_reason.clone(),
+                transaction_status: response.transaction_status.clone(),
+            }) {
+                Err(err)
+            } else {
+                let response = &item.response;
+                Ok(create_transaction_response(
+                    redirection_data,
+                    None,
+                    response.transaction_id.clone(),
+                    response.order_id.clone(),
+                    response.session_token.clone(),
+                    response.external_scheme_transaction_id.clone(),
+                    response.payment_option.clone(),
+                )?)
+            },
+            amount_captured,
+            minor_amount_capturable,
+            connector_response: connector_response_data,
+            ..item.data
+        })
+    }
+}
 
-        let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?;
+// Generic implementation for other flow types
+impl<F, T> TryFrom<ResponseRouterData<F, NuveiTransactionSyncResponse, T, PaymentsResponseData>>
+    for RouterData<F, T, PaymentsResponseData>
+where
+    F: NuveiPaymentsGenericResponse + std::fmt::Debug,
+    T: std::fmt::Debug,
+    F: std::any::Any,
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<F, NuveiTransactionSyncResponse, T, PaymentsResponseData>,
+    ) -> Result<Self, Self::Error> {
+        let amount = item
+            .data
+            .minor_amount_capturable
+            .map(|amount| amount.get_amount_as_i64());
+        let response = &item.response;
+        let transaction_details = &response.transaction_details;
+        let transaction_type = transaction_details
+            .as_ref()
+            .and_then(|details| details.transaction_type.clone());
+        let (status, redirection_data, connector_response_data) =
+            process_nuvei_payment_response(NuveiPaymentResponseData::new_from_sync_response(
+                amount,
+                F::is_post_capture_void(),
+                item.data.payment_method,
+                response,
+            ))?;
+
+        let (amount_captured, minor_amount_capturable) =
+            get_amount_captured(response.get_partial_approval(), transaction_type.clone())?;
         Ok(Self {
             status,
-            response: if let Some(err) = build_error_response(&item.response, item.http_code) {
+            response: if let Some(err) = build_error_response(ErrorResponseParams {
+                http_code: item.http_code,
+                status: response.status.clone(),
+                err_code: response.err_code,
+                err_msg: response.reason.clone(),
+                merchant_advice_code: None,
+                gw_error_code: transaction_details
+                    .as_ref()
+                    .and_then(|details| details.gw_error_code),
+                gw_error_reason: transaction_details
+                    .as_ref()
+                    .and_then(|details| details.gw_error_reason.clone()),
+                transaction_status: transaction_details
+                    .as_ref()
+                    .and_then(|details| details.transaction_status.clone()),
+            }) {
                 Err(err)
             } else {
                 Ok(create_transaction_response(
-                    &item.response,
                     redirection_data,
                     None,
+                    transaction_details
+                        .as_ref()
+                        .and_then(|data| data.transaction_id.clone()),
+                    None,
+                    None,
+                    None,
+                    response.payment_option.clone(),
                 )?)
             },
             amount_captured,
@@ -2678,12 +2967,17 @@ impl TryFrom<PaymentsPreprocessingResponseRouterData<NuveiPaymentsResponse>>
             .map(to_boolean)
             .unwrap_or_default();
         Ok(Self {
-            status: get_payment_status(&response, item.data.request.amount, false),
+            status: get_payment_status(
+                item.data.request.amount,
+                false,
+                response.transaction_type,
+                response.transaction_status,
+                response.status,
+            ),
             response: Ok(PaymentsResponseData::ThreeDSEnrollmentResponse {
                 enrolled_v2: is_enrolled_for_3ds,
                 related_transaction_id: response.transaction_id,
             }),
-
             ..item.data
         })
     }
@@ -2760,11 +3054,7 @@ where
                 .request
                 .get_customer_id_required()
                 .ok_or(missing_field_err("customer_id")())?;
-            let related_transaction_id = if item.is_three_ds() {
-                item.request.get_related_transaction_id().clone()
-            } else {
-                None
-            };
+            let related_transaction_id = item.request.get_related_transaction_id().clone();
 
             let ip_address = data
                 .recurring_mandate_payment_data
@@ -2823,20 +3113,20 @@ fn get_refund_response(
     match response.status {
         NuveiPaymentStatus::Error => Err(Box::new(get_error_response(
             response.err_code,
-            &response.reason,
+            response.reason.clone(),
             http_code,
-            &response.merchant_advice_code,
-            &response.gw_error_code.map(|e| e.to_string()),
-            &response.gw_error_reason,
+            response.merchant_advice_code,
+            response.gw_error_code.map(|e| e.to_string()),
+            response.gw_error_reason,
         ))),
         _ => match response.transaction_status {
             Some(NuveiTransactionStatus::Error) => Err(Box::new(get_error_response(
                 response.err_code,
-                &response.reason,
+                response.reason,
                 http_code,
-                &response.merchant_advice_code,
-                &response.gw_error_code.map(|e| e.to_string()),
-                &response.gw_error_reason,
+                response.merchant_advice_code,
+                response.gw_error_code.map(|e| e.to_string()),
+                response.gw_error_reason,
             ))),
             _ => Ok(RefundsResponseData {
                 connector_refund_id: txn_id,
@@ -2848,11 +3138,11 @@ fn get_refund_response(
 
 fn get_error_response(
     error_code: Option<i64>,
-    error_msg: &Option<String>,
+    error_msg: Option<String>,
     http_code: u16,
-    network_advice_code: &Option<String>,
-    network_decline_code: &Option<String>,
-    network_error_message: &Option<String>,
+    network_advice_code: Option<String>,
+    network_decline_code: Option<String>,
+    network_error_message: Option<String>,
 ) -> ErrorResponse {
     ErrorResponse {
         code: error_code
@@ -3049,6 +3339,7 @@ impl From<NuveiWebhook> for NuveiPaymentsResponse {
                         TransactionStatus::Declined => NuveiTransactionStatus::Declined,
                         TransactionStatus::Error => NuveiTransactionStatus::Error,
                         TransactionStatus::Settled => NuveiTransactionStatus::Approved,
+
                         _ => NuveiTransactionStatus::Processing,
                     }),
                     transaction_id: notification.transaction_id,
@@ -3116,21 +3407,17 @@ pub fn concat_strings(strings: &[String]) -> String {
 }
 
 fn convert_to_additional_payment_method_connector_response(
-    transaction_response: &NuveiPaymentsResponse,
+    payment_option: Option<PaymentOption>,
+    merchant_advice_code: Option<String>,
 ) -> Option<AdditionalPaymentMethodConnectorResponse> {
-    let card = transaction_response
-        .payment_option
-        .as_ref()?
-        .card
-        .as_ref()?;
+    let card = payment_option.as_ref()?.card.as_ref()?;
     let avs_code = card.avs_code.as_ref();
     let cvv2_code = card.cvv2_reply.as_ref();
-    let merchant_advice_code = transaction_response.merchant_advice_code.as_ref();
-
     let avs_description = avs_code.and_then(|code| get_avs_response_description(code));
     let cvv_description = cvv2_code.and_then(|code| get_cvv2_response_description(code));
-    let merchant_advice_description =
-        merchant_advice_code.and_then(|code| get_merchant_advice_code_description(code));
+    let merchant_advice_description = merchant_advice_code
+        .as_ref()
+        .and_then(|code| get_merchant_advice_code_description(code));
 
     let payment_checks = serde_json::json!({
         "avs_result": avs_code,
 | 
	2025-09-04T10:06:21Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- 3ds transaction were not actually 3ds transactions in Nuvei system. This occurred because we were not passing previous transaction data while making 3ds complete-authorize call.
- Prevoiusly psync was implemeted with session token. If we make 3ds payment but not confirm and make psycn the nuvei would return error as session transaction not found. Now we have implemented psync with transaction_id .
## TEST 
### Trigger 3ds payment
<details>
  <summary> Request </summary> 
```json
{
    "amount": 15100,
    "currency": "EUR",
    "confirm": true,
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    // "order_tax_amount": 100,
    "setup_future_usage": "off_session",
    // "payment_type":"setup_mandate",
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_type": "credit",
    "authentication_type": "three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "card": {
            "card_number": "2221008123677736",
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "CL-BRW2",
            "card_cvc": "100"
        }
    }
}
```
</details>
<details>
  <summary> Response  </summary> 
```
{
    "payment_id": "pay_wiZYcVFqfCNBOJMEpznT",
    "merchant_id": "merchant_1756789409",
    "status": "requires_customer_action",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 15100,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_wiZYcVFqfCNBOJMEpznT_secret_GiNUpAUyDpT4rK5COmn9",
    "created": "2025-09-10T05:09:57.712Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "cReq": "eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjE4MWEzOTQ4LWI5ZmYtNGMyZi05ODJkLTAzOTU1OTYzMjhjMSIsImFjc1RyYW5zSUQiOiIwMjcwOTg4OC0xNWIxLTRjOWMtYTA2OC04ZWVlMTBlZmRlODIiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVHlwZSI6IkNSZXEiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0",
                "flow": "challenge",
                "acsUrl": "https://3dsn.sandbox.safecharge.com/ThreeDSACSEmulatorChallenge/api/ThreeDSACSChallengeController/ChallengePage?eyJub3RpZmljYXRpb25VUkwiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvcGF5bWVudHMvcGF5X3dpWlljVkZxZkNOQk9KTUVwem5UL21lcmNoYW50XzE3NTY3ODk0MDkvcmVkaXJlY3QvY29tcGxldGUvbnV2ZWkiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjE4MWEzOTQ4LWI5ZmYtNGMyZi05ODJkLTAzOTU1OTYzMjhjMSIsImFjc1RyYW5zSUQiOiIwMjcwOTg4OC0xNWIxLTRjOWMtYTA2OC04ZWVlMTBlZmRlODIiLCJkc1RyYW5zSUQiOiJmMmRhYTg2Yi1kZWM2LTQ0ZmItODQzMC0zNGI4ZGFhZGVlMjAiLCJkYXRhIjpudWxsLCJNZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0=",
                "version": "2.2.0",
                "threeDFlow": "1",
                "decisionReason": "NoPreference",
                "threeDReasonId": "",
                "acquirerDecision": "ExemptionRequest",
                "challengePreferenceReason": "12",
                "isExemptionRequestInAuthentication": "0"
            }
        },
        "billing": null
    },
    "payment_token": "token_zab9VyBWQCNOWzesgwEe",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_wiZYcVFqfCNBOJMEpznT/merchant_1756789409/pay_wiZYcVFqfCNBOJMEpznT_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1757480997,
        "expires": 1757484597,
        "secret": "epk_f4e147f4736a41c0bf152be511495bd2"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "8110000000013946637",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8656791111",
    "payment_link": null,
    "profile_id": "pro_EzO6xGQZdE5pd9I5Rdzs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_i5QVCDvXmBLbZg7n97n2",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-10T05:24:57.712Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_PNtSuuIcOnjnfMyAoL8x",
    "network_transaction_id": null,
    "payment_method_status": "inactive",
    "updated": "2025-09-10T05:10:01.440Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2090421111",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
- connector_transaction_id = `8110000000013946637` 
### Make psync Before redirection 
<details>
  <summary>Response  </summary> 
```json
{
    "payment_id": "pay_wiZYcVFqfCNBOJMEpznT",
    "merchant_id": "merchant_1756789409",
    "status": "requires_customer_action",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 15100,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_wiZYcVFqfCNBOJMEpznT_secret_GiNUpAUyDpT4rK5COmn9",
    "created": "2025-09-10T05:09:57.712Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "cReq": "eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjE4MWEzOTQ4LWI5ZmYtNGMyZi05ODJkLTAzOTU1OTYzMjhjMSIsImFjc1RyYW5zSUQiOiIwMjcwOTg4OC0xNWIxLTRjOWMtYTA2OC04ZWVlMTBlZmRlODIiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVHlwZSI6IkNSZXEiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0",
                "flow": "challenge",
                "acsUrl": "https://3dsn.sandbox.safecharge.com/ThreeDSACSEmulatorChallenge/api/ThreeDSACSChallengeController/ChallengePage?eyJub3RpZmljYXRpb25VUkwiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvcGF5bWVudHMvcGF5X3dpWlljVkZxZkNOQk9KTUVwem5UL21lcmNoYW50XzE3NTY3ODk0MDkvcmVkaXJlY3QvY29tcGxldGUvbnV2ZWkiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjE4MWEzOTQ4LWI5ZmYtNGMyZi05ODJkLTAzOTU1OTYzMjhjMSIsImFjc1RyYW5zSUQiOiIwMjcwOTg4OC0xNWIxLTRjOWMtYTA2OC04ZWVlMTBlZmRlODIiLCJkc1RyYW5zSUQiOiJmMmRhYTg2Yi1kZWM2LTQ0ZmItODQzMC0zNGI4ZGFhZGVlMjAiLCJkYXRhIjpudWxsLCJNZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0=",
                "version": "2.2.0",
                "threeDFlow": "1",
                "decisionReason": "NoPreference",
                "threeDReasonId": "",
                "acquirerDecision": "ExemptionRequest",
                "challengePreferenceReason": "12",
                "isExemptionRequestInAuthentication": "0"
            }
        },
        "billing": null
    },
    "payment_token": "token_zab9VyBWQCNOWzesgwEe",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_wiZYcVFqfCNBOJMEpznT/merchant_1756789409/pay_wiZYcVFqfCNBOJMEpznT_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "8110000000013946637",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8656791111",
    "payment_link": null,
    "profile_id": "pro_EzO6xGQZdE5pd9I5Rdzs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_i5QVCDvXmBLbZg7n97n2",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-10T05:24:57.712Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_PNtSuuIcOnjnfMyAoL8x",
    "network_transaction_id": null,
    "payment_method_status": "inactive",
    "updated": "2025-09-10T05:11:10.384Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2090421111",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
### Complete redirection challenge
### Check Psync again
<details>
  <summary>Response  </summary> 
```json
{
    "payment_id": "pay_wiZYcVFqfCNBOJMEpznT",
    "merchant_id": "merchant_1756789409",
    "status": "succeeded",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 15100,
    "connector": "nuvei",
    "client_secret": "pay_wiZYcVFqfCNBOJMEpznT_secret_GiNUpAUyDpT4rK5COmn9",
    "created": "2025-09-10T05:09:57.712Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "flow": "challenge",
                "version": "2.2.0",
                "decisionReason": "NoPreference",
                "threeDReasonId": "",
                "acquirerDecision": "ExemptionRequest",
                "isLiabilityOnIssuer": "1",
                "challengeCancelReason": "",
                "challengeCancelReasonId": "",
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_zab9VyBWQCNOWzesgwEe",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000013946718",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8656791111",
    "payment_link": null,
    "profile_id": "pro_EzO6xGQZdE5pd9I5Rdzs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_i5QVCDvXmBLbZg7n97n2",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-10T05:24:57.712Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_PNtSuuIcOnjnfMyAoL8x",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-09-10T05:11:56.957Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
- connector_transaction_id :  `8110000000013946718`
### Check transaction in nuvei dashboard for complete validation
<img width="1857" height="938" alt="Screenshot 2025-09-10 at 10 43 50 AM" src="https://github.com/user-attachments/assets/2985795f-8c0b-43d8-a58f-fecd59af3273" />
<img width="1761" height="859" alt="Screenshot 2025-09-10 at 10 44 16 AM" src="https://github.com/user-attachments/assets/7d2436df-1004-4de0-b1e3-d6fcfb83adef" />
<img width="1356" height="1029" alt="Screenshot 2025-09-10 at 11 04 41 AM" src="https://github.com/user-attachments/assets/bd1bafeb-19e3-475d-a4a5-266d1cca0ce9" />
<img width="1728" height="1078" alt="Screenshot 2025-09-10 at 11 08 15 AM" src="https://github.com/user-attachments/assets/43c00bb3-1c0c-4366-92d2-1fed1f498f64" />
|  InitAuth3d | Auth3d | Sale |
|----------|----------|----------|
| 8110000000013946633  | 8110000000013946637 | 8110000000013946718  |
<!-- Similarly test txn id for manual capture 8110000000013946951 -->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	2edaa6e0578ae8cb6e4b44cc516b8c342262c082 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9322 | 
	Bug: Rename existing RevenueRecoveryRecordBack trait to InvoiceRecordBack
After a payment is successful for a invoice, we need to record the invoice as paid with the subscription provider. this implementation is already done for revenue recovery usecase. making it generic so that subscription also can use it | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index 19ec99fc1d0..5e2e23a8a90 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -13,28 +13,28 @@ use common_utils::{
 use error_stack::report;
 use error_stack::ResultExt;
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-use hyperswitch_domain_models::{
-    revenue_recovery, router_flow_types::revenue_recovery::RecoveryRecordBack,
-    router_request_types::revenue_recovery::RevenueRecoveryRecordBackRequest,
-    router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
-    types::RevenueRecoveryRecordBackRouterData,
-};
+use hyperswitch_domain_models::revenue_recovery;
 use hyperswitch_domain_models::{
     router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
     router_flow_types::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
+        revenue_recovery::InvoiceRecordBack,
     },
     router_request_types::{
-        AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
-        PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, SetupMandateRequestData,
+        revenue_recovery::InvoiceRecordBackRequest, AccessTokenRequestData,
+        PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,
+        PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,
+        SetupMandateRequestData,
+    },
+    router_response_types::{
+        revenue_recovery::InvoiceRecordBackResponse, ConnectorInfo, PaymentsResponseData,
+        RefundsResponseData,
     },
-    router_response_types::{ConnectorInfo, PaymentsResponseData, RefundsResponseData},
     types::{
-        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
-        RefundSyncRouterData, RefundsRouterData,
+        InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -560,24 +560,19 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Chargebee
     }
 }
 
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-impl
-    ConnectorIntegration<
-        RecoveryRecordBack,
-        RevenueRecoveryRecordBackRequest,
-        RevenueRecoveryRecordBackResponse,
-    > for Chargebee
+impl ConnectorIntegration<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>
+    for Chargebee
 {
     fn get_headers(
         &self,
-        req: &RevenueRecoveryRecordBackRouterData,
+        req: &InvoiceRecordBackRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
     fn get_url(
         &self,
-        req: &RevenueRecoveryRecordBackRouterData,
+        req: &InvoiceRecordBackRouterData,
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         let metadata: chargebee::ChargebeeMetadata =
@@ -600,7 +595,7 @@ impl
 
     fn get_request_body(
         &self,
-        req: &RevenueRecoveryRecordBackRouterData,
+        req: &InvoiceRecordBackRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let amount = utils::convert_amount(
@@ -616,20 +611,20 @@ impl
 
     fn build_request(
         &self,
-        req: &RevenueRecoveryRecordBackRouterData,
+        req: &InvoiceRecordBackRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Post)
-                .url(&types::RevenueRecoveryRecordBackType::get_url(
+                .url(&types::InvoiceRecordBackType::get_url(
                     self, req, connectors,
                 )?)
                 .attach_default_headers()
-                .headers(types::RevenueRecoveryRecordBackType::get_headers(
+                .headers(types::InvoiceRecordBackType::get_headers(
                     self, req, connectors,
                 )?)
-                .set_body(types::RevenueRecoveryRecordBackType::get_request_body(
+                .set_body(types::InvoiceRecordBackType::get_request_body(
                     self, req, connectors,
                 )?)
                 .build(),
@@ -638,10 +633,10 @@ impl
 
     fn handle_response(
         &self,
-        data: &RevenueRecoveryRecordBackRouterData,
+        data: &InvoiceRecordBackRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<RevenueRecoveryRecordBackRouterData, errors::ConnectorError> {
+    ) -> CustomResult<InvoiceRecordBackRouterData, errors::ConnectorError> {
         let response: chargebee::ChargebeeRecordbackResponse = res
             .response
             .parse_struct("chargebee ChargebeeRecordbackResponse")
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 95f105c67b9..6d942980e2f 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -11,14 +11,13 @@ use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, RouterData},
     router_flow_types::{
         refunds::{Execute, RSync},
-        RecoveryRecordBack,
+        InvoiceRecordBack,
     },
-    router_request_types::{revenue_recovery::RevenueRecoveryRecordBackRequest, ResponseId},
+    router_request_types::{revenue_recovery::InvoiceRecordBackRequest, ResponseId},
     router_response_types::{
-        revenue_recovery::RevenueRecoveryRecordBackResponse, PaymentsResponseData,
-        RefundsResponseData,
+        revenue_recovery::InvoiceRecordBackResponse, PaymentsResponseData, RefundsResponseData,
     },
-    types::{PaymentsAuthorizeRouterData, RefundsRouterData, RevenueRecoveryRecordBackRouterData},
+    types::{InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData, RefundsRouterData},
 };
 use hyperswitch_interfaces::errors;
 use masking::Secret;
@@ -673,13 +672,10 @@ pub enum ChargebeeRecordStatus {
     Failure,
 }
 
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-impl TryFrom<&ChargebeeRouterData<&RevenueRecoveryRecordBackRouterData>>
-    for ChargebeeRecordPaymentRequest
-{
+impl TryFrom<&ChargebeeRouterData<&InvoiceRecordBackRouterData>> for ChargebeeRecordPaymentRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: &ChargebeeRouterData<&RevenueRecoveryRecordBackRouterData>,
+        item: &ChargebeeRouterData<&InvoiceRecordBackRouterData>,
     ) -> Result<Self, Self::Error> {
         let req = &item.router_data.request;
         Ok(Self {
@@ -694,7 +690,6 @@ impl TryFrom<&ChargebeeRouterData<&RevenueRecoveryRecordBackRouterData>>
     }
 }
 
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl TryFrom<enums::AttemptStatus> for ChargebeeRecordStatus {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(status: enums::AttemptStatus) -> Result<Self, Self::Error> {
@@ -748,25 +743,25 @@ pub struct ChargebeeRecordbackInvoice {
 impl
     TryFrom<
         ResponseRouterData<
-            RecoveryRecordBack,
+            InvoiceRecordBack,
             ChargebeeRecordbackResponse,
-            RevenueRecoveryRecordBackRequest,
-            RevenueRecoveryRecordBackResponse,
+            InvoiceRecordBackRequest,
+            InvoiceRecordBackResponse,
         >,
-    > for RevenueRecoveryRecordBackRouterData
+    > for InvoiceRecordBackRouterData
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
         item: ResponseRouterData<
-            RecoveryRecordBack,
+            InvoiceRecordBack,
             ChargebeeRecordbackResponse,
-            RevenueRecoveryRecordBackRequest,
-            RevenueRecoveryRecordBackResponse,
+            InvoiceRecordBackRequest,
+            InvoiceRecordBackResponse,
         >,
     ) -> Result<Self, Self::Error> {
         let merchant_reference_id = item.response.invoice.id;
         Ok(Self {
-            response: Ok(RevenueRecoveryRecordBackResponse {
+            response: Ok(InvoiceRecordBackResponse {
                 merchant_reference_id,
             }),
             ..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index 35b736b844e..693095cfeb9 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -300,15 +300,15 @@ impl
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl
     ConnectorIntegrationV2<
-        recovery_router_flows::RecoveryRecordBack,
-        recovery_flow_common_types::RevenueRecoveryRecordBackData,
-        recovery_request_types::RevenueRecoveryRecordBackRequest,
-        recovery_response_types::RevenueRecoveryRecordBackResponse,
+        recovery_router_flows::InvoiceRecordBack,
+        recovery_flow_common_types::InvoiceRecordBackData,
+        recovery_request_types::InvoiceRecordBackRequest,
+        recovery_response_types::InvoiceRecordBackResponse,
     > for Recurly
 {
     fn get_headers(
         &self,
-        req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2,
+        req: &recovery_router_data_types::InvoiceRecordBackRouterDataV2,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         let mut header = vec![(
             headers::CONTENT_TYPE.to_string(),
@@ -321,7 +321,7 @@ impl
 
     fn get_url(
         &self,
-        req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2,
+        req: &recovery_router_data_types::InvoiceRecordBackRouterDataV2,
     ) -> CustomResult<String, errors::ConnectorError> {
         let invoice_id = req
             .request
@@ -344,16 +344,14 @@ impl
 
     fn build_request_v2(
         &self,
-        req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2,
+        req: &recovery_router_data_types::InvoiceRecordBackRouterDataV2,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Put)
-                .url(&types::RevenueRecoveryRecordBackTypeV2::get_url(self, req)?)
+                .url(&types::InvoiceRecordBackTypeV2::get_url(self, req)?)
                 .attach_default_headers()
-                .headers(types::RevenueRecoveryRecordBackTypeV2::get_headers(
-                    self, req,
-                )?)
+                .headers(types::InvoiceRecordBackTypeV2::get_headers(self, req)?)
                 .header("Content-Length", "0")
                 .build(),
         ))
@@ -361,11 +359,11 @@ impl
 
     fn handle_response_v2(
         &self,
-        data: &recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2,
+        data: &recovery_router_data_types::InvoiceRecordBackRouterDataV2,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<
-        recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2,
+        recovery_router_data_types::InvoiceRecordBackRouterDataV2,
         errors::ConnectorError,
     > {
         let response: recurly::RecurlyRecordBackResponse = res
@@ -374,13 +372,11 @@ impl
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2::try_from(
-            ResponseRouterDataV2 {
-                response,
-                data: data.clone(),
-                http_code: res.status_code,
-            },
-        )
+        recovery_router_data_types::InvoiceRecordBackRouterDataV2::try_from(ResponseRouterDataV2 {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
     }
 
     fn get_error_response_v2(
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
index 7338500db80..b17a01952ab 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
@@ -316,27 +316,27 @@ pub struct RecurlyRecordBackResponse {
 impl
     TryFrom<
         ResponseRouterDataV2<
-            recovery_router_flows::RecoveryRecordBack,
+            recovery_router_flows::InvoiceRecordBack,
             RecurlyRecordBackResponse,
-            recovery_flow_common_types::RevenueRecoveryRecordBackData,
-            recovery_request_types::RevenueRecoveryRecordBackRequest,
-            recovery_response_types::RevenueRecoveryRecordBackResponse,
+            recovery_flow_common_types::InvoiceRecordBackData,
+            recovery_request_types::InvoiceRecordBackRequest,
+            recovery_response_types::InvoiceRecordBackResponse,
         >,
-    > for recovery_router_data_types::RevenueRecoveryRecordBackRouterDataV2
+    > for recovery_router_data_types::InvoiceRecordBackRouterDataV2
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
         item: ResponseRouterDataV2<
-            recovery_router_flows::RecoveryRecordBack,
+            recovery_router_flows::InvoiceRecordBack,
             RecurlyRecordBackResponse,
-            recovery_flow_common_types::RevenueRecoveryRecordBackData,
-            recovery_request_types::RevenueRecoveryRecordBackRequest,
-            recovery_response_types::RevenueRecoveryRecordBackResponse,
+            recovery_flow_common_types::InvoiceRecordBackData,
+            recovery_request_types::InvoiceRecordBackRequest,
+            recovery_response_types::InvoiceRecordBackResponse,
         >,
     ) -> Result<Self, Self::Error> {
         let merchant_reference_id = item.response.id;
         Ok(Self {
-            response: Ok(recovery_response_types::RevenueRecoveryRecordBackResponse {
+            response: Ok(recovery_response_types::InvoiceRecordBackResponse {
                 merchant_reference_id,
             }),
             ..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
index 79f0bcc88d8..99d83e4ef82 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -663,14 +663,14 @@ impl
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl
     ConnectorIntegration<
-        recovery_router_flows::RecoveryRecordBack,
-        recovery_request_types::RevenueRecoveryRecordBackRequest,
-        recovery_response_types::RevenueRecoveryRecordBackResponse,
+        recovery_router_flows::InvoiceRecordBack,
+        recovery_request_types::InvoiceRecordBackRequest,
+        recovery_response_types::InvoiceRecordBackResponse,
     > for Stripebilling
 {
     fn get_headers(
         &self,
-        req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
+        req: &recovery_router_data_types::InvoiceRecordBackRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
@@ -682,7 +682,7 @@ impl
 
     fn get_url(
         &self,
-        req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
+        req: &recovery_router_data_types::InvoiceRecordBackRouterData,
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         let invoice_id = req
@@ -705,17 +705,17 @@ impl
 
     fn build_request(
         &self,
-        req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
+        req: &recovery_router_data_types::InvoiceRecordBackRouterData,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Post)
-                .url(&types::RevenueRecoveryRecordBackType::get_url(
+                .url(&types::InvoiceRecordBackType::get_url(
                     self, req, connectors,
                 )?)
                 .attach_default_headers()
-                .headers(types::RevenueRecoveryRecordBackType::get_headers(
+                .headers(types::InvoiceRecordBackType::get_headers(
                     self, req, connectors,
                 )?)
                 .build(),
@@ -724,13 +724,11 @@ impl
 
     fn handle_response(
         &self,
-        data: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
+        data: &recovery_router_data_types::InvoiceRecordBackRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<
-        recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
-        errors::ConnectorError,
-    > {
+    ) -> CustomResult<recovery_router_data_types::InvoiceRecordBackRouterData, errors::ConnectorError>
+    {
         let response = res
             .response
             .parse_struct::<stripebilling::StripebillingRecordBackResponse>(
@@ -739,13 +737,11 @@ impl
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        recovery_router_data_types::RevenueRecoveryRecordBackRouterData::try_from(
-            ResponseRouterData {
-                response,
-                data: data.clone(),
-                http_code: res.status_code,
-            },
-        )
+        recovery_router_data_types::InvoiceRecordBackRouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
     }
 
     fn get_error_response(
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
index a5e4610ffdb..a44a4d31a95 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
@@ -627,24 +627,24 @@ pub struct StripebillingRecordBackResponse {
 impl
     TryFrom<
         ResponseRouterData<
-            recovery_router_flows::RecoveryRecordBack,
+            recovery_router_flows::InvoiceRecordBack,
             StripebillingRecordBackResponse,
-            recovery_request_types::RevenueRecoveryRecordBackRequest,
-            recovery_response_types::RevenueRecoveryRecordBackResponse,
+            recovery_request_types::InvoiceRecordBackRequest,
+            recovery_response_types::InvoiceRecordBackResponse,
         >,
-    > for recovery_router_data_types::RevenueRecoveryRecordBackRouterData
+    > for recovery_router_data_types::InvoiceRecordBackRouterData
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
         item: ResponseRouterData<
-            recovery_router_flows::RecoveryRecordBack,
+            recovery_router_flows::InvoiceRecordBack,
             StripebillingRecordBackResponse,
-            recovery_request_types::RevenueRecoveryRecordBackRequest,
-            recovery_response_types::RevenueRecoveryRecordBackResponse,
+            recovery_request_types::InvoiceRecordBackRequest,
+            recovery_response_types::InvoiceRecordBackResponse,
         >,
     ) -> Result<Self, Self::Error> {
         Ok(Self {
-            response: Ok(recovery_response_types::RevenueRecoveryRecordBackResponse {
+            response: Ok(recovery_response_types::InvoiceRecordBackResponse {
                 merchant_reference_id: id_type::PaymentReferenceId::from_str(
                     item.response.id.as_str(),
                 )
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 0535088c884..2d366f3f99e 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -8,7 +8,7 @@ use common_enums::{CallConnectorAction, PaymentAction};
 use common_utils::errors::CustomResult;
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::router_flow_types::{
-    BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, RecoveryRecordBack,
+    BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, InvoiceRecordBack,
 };
 #[cfg(feature = "dummy_connector")]
 use hyperswitch_domain_models::router_request_types::authentication::{
@@ -17,12 +17,12 @@ use hyperswitch_domain_models::router_request_types::authentication::{
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::router_request_types::revenue_recovery::{
     BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-    RevenueRecoveryRecordBackRequest,
+    InvoiceRecordBackRequest,
 };
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::router_response_types::revenue_recovery::{
     BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-    RevenueRecoveryRecordBackResponse,
+    InvoiceRecordBackResponse,
 };
 use hyperswitch_domain_models::{
     router_data::AccessTokenAuthenticationResponse,
@@ -6611,9 +6611,9 @@ macro_rules! default_imp_for_revenue_recovery_record_back {
         $( impl recovery_traits::RevenueRecoveryRecordBack for $path::$connector {}
             impl
             ConnectorIntegration<
-            RecoveryRecordBack,
-            RevenueRecoveryRecordBackRequest,
-            RevenueRecoveryRecordBackResponse
+            InvoiceRecordBack,
+            InvoiceRecordBackRequest,
+            InvoiceRecordBackResponse
             > for $path::$connector
             {}
         )*
@@ -8358,11 +8358,8 @@ impl<const T: u8> api::revenue_recovery::RevenueRecoveryRecordBack
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 #[cfg(feature = "dummy_connector")]
 impl<const T: u8>
-    ConnectorIntegration<
-        RecoveryRecordBack,
-        RevenueRecoveryRecordBackRequest,
-        RevenueRecoveryRecordBackResponse,
-    > for connectors::DummyConnector<T>
+    ConnectorIntegration<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>
+    for connectors::DummyConnector<T>
 {
 }
 
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 5dc07ab43d4..f175c52e93f 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -3,8 +3,8 @@ use hyperswitch_domain_models::{
     router_data_v2::{
         flow_common_types::{
             BillingConnectorInvoiceSyncFlowData, BillingConnectorPaymentsSyncFlowData,
-            DisputesFlowData, MandateRevokeFlowData, PaymentFlowData, RefundFlowData,
-            RevenueRecoveryRecordBackData, WebhookSourceVerifyData,
+            DisputesFlowData, InvoiceRecordBackData, MandateRevokeFlowData, PaymentFlowData,
+            RefundFlowData, WebhookSourceVerifyData,
         },
         AccessTokenFlowData, AuthenticationTokenFlowData, ExternalAuthenticationFlowData,
         FilesFlowData, VaultConnectorFlowData,
@@ -24,7 +24,7 @@ use hyperswitch_domain_models::{
         },
         refunds::{Execute, RSync},
         revenue_recovery::{
-            BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, RecoveryRecordBack,
+            BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, InvoiceRecordBack,
         },
         webhooks::VerifyWebhookSource,
         AccessTokenAuth, AccessTokenAuthentication, ExternalVaultCreateFlow,
@@ -34,7 +34,7 @@ use hyperswitch_domain_models::{
         authentication,
         revenue_recovery::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-            RevenueRecoveryRecordBackRequest,
+            InvoiceRecordBackRequest,
         },
         AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AccessTokenRequestData,
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
@@ -52,7 +52,7 @@ use hyperswitch_domain_models::{
     router_response_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-            RevenueRecoveryRecordBackResponse,
+            InvoiceRecordBackResponse,
         },
         AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,
         DisputeSyncResponse, FetchDisputesResponse, MandateRevokeResponseData,
@@ -4120,10 +4120,10 @@ macro_rules! default_imp_for_new_connector_integration_revenue_recovery {
             impl BillingConnectorInvoiceSyncIntegrationV2 for $path::$connector {}
             impl
             ConnectorIntegrationV2<
-                RecoveryRecordBack,
-                RevenueRecoveryRecordBackData,
-                RevenueRecoveryRecordBackRequest,
-                RevenueRecoveryRecordBackResponse,
+                InvoiceRecordBack,
+                InvoiceRecordBackData,
+                InvoiceRecordBackRequest,
+                InvoiceRecordBackResponse,
                 > for $path::$connector
             {}
             impl
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 686912c6dca..1b5c48df929 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -148,7 +148,7 @@ pub struct FilesFlowData {
 }
 
 #[derive(Debug, Clone)]
-pub struct RevenueRecoveryRecordBackData;
+pub struct InvoiceRecordBackData;
 
 #[derive(Debug, Clone)]
 pub struct UasFlowData {
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs
index ec784f7d464..da496656c65 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs
@@ -1,7 +1,7 @@
 #[derive(Debug, Clone)]
 pub struct BillingConnectorPaymentsSync;
 #[derive(Debug, Clone)]
-pub struct RecoveryRecordBack;
+pub struct InvoiceRecordBack;
 
 #[derive(Debug, Clone)]
 pub struct BillingConnectorInvoiceSync;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs
index 9e1a59110f9..197de0b0fb5 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs
@@ -11,7 +11,7 @@ pub struct BillingConnectorPaymentsSyncRequest {
 }
 
 #[derive(Debug, Clone)]
-pub struct RevenueRecoveryRecordBackRequest {
+pub struct InvoiceRecordBackRequest {
     pub merchant_reference_id: common_utils::id_type::PaymentReferenceId,
     pub amount: common_utils::types::MinorUnit,
     pub currency: enums::Currency,
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
index 65a62f62125..dabdf981e3d 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
@@ -35,7 +35,7 @@ pub struct BillingConnectorPaymentsSyncResponse {
 }
 
 #[derive(Debug, Clone)]
-pub struct RevenueRecoveryRecordBackResponse {
+pub struct InvoiceRecordBackResponse {
     pub merchant_reference_id: common_utils::id_type::PaymentReferenceId,
 }
 
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index bcca0ba12a9..e907bbdfa20 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -4,7 +4,7 @@ use crate::{
     router_data::{AccessToken, AccessTokenAuthenticationResponse, RouterData},
     router_data_v2::{self, RouterDataV2},
     router_flow_types::{
-        mandate_revoke::MandateRevoke, revenue_recovery::RecoveryRecordBack, AccessTokenAuth,
+        mandate_revoke::MandateRevoke, revenue_recovery::InvoiceRecordBack, AccessTokenAuth,
         AccessTokenAuthentication, Authenticate, AuthenticationConfirmation, Authorize,
         AuthorizeSessionToken, BillingConnectorInvoiceSync, BillingConnectorPaymentsSync,
         CalculateTax, Capture, CompleteAuthorize, CreateConnectorCustomer, CreateOrder, Execute,
@@ -15,7 +15,7 @@ use crate::{
     router_request_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-            RevenueRecoveryRecordBackRequest,
+            InvoiceRecordBackRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -35,7 +35,7 @@ use crate::{
     router_response_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-            RevenueRecoveryRecordBackResponse,
+            InvoiceRecordBackResponse,
         },
         MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData,
         TaxCalculationResponseData, VaultResponseData, VerifyWebhookSourceResponseData,
@@ -114,11 +114,8 @@ pub type VerifyWebhookSourceRouterData = RouterData<
 #[cfg(feature = "payouts")]
 pub type PayoutsRouterData<F> = RouterData<F, PayoutsData, PayoutsResponseData>;
 
-pub type RevenueRecoveryRecordBackRouterData = RouterData<
-    RecoveryRecordBack,
-    RevenueRecoveryRecordBackRequest,
-    RevenueRecoveryRecordBackResponse,
->;
+pub type InvoiceRecordBackRouterData =
+    RouterData<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>;
 
 pub type UasAuthenticationRouterData =
     RouterData<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>;
@@ -149,11 +146,11 @@ pub type BillingConnectorPaymentsSyncRouterDataV2 = RouterDataV2<
     BillingConnectorPaymentsSyncResponse,
 >;
 
-pub type RevenueRecoveryRecordBackRouterDataV2 = RouterDataV2<
-    RecoveryRecordBack,
-    router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
-    RevenueRecoveryRecordBackRequest,
-    RevenueRecoveryRecordBackResponse,
+pub type InvoiceRecordBackRouterDataV2 = RouterDataV2<
+    InvoiceRecordBack,
+    router_data_v2::flow_common_types::InvoiceRecordBackData,
+    InvoiceRecordBackRequest,
+    InvoiceRecordBackResponse,
 >;
 
 pub type VaultRouterData<F> = RouterData<F, VaultRequestData, VaultResponseData>;
diff --git a/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs b/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
index 053d3cdde35..998c1888e64 100644
--- a/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
+++ b/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
@@ -2,15 +2,15 @@
 
 use hyperswitch_domain_models::{
     router_flow_types::{
-        BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, RecoveryRecordBack,
+        BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, InvoiceRecordBack,
     },
     router_request_types::revenue_recovery::{
         BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-        RevenueRecoveryRecordBackRequest,
+        InvoiceRecordBackRequest,
     },
     router_response_types::revenue_recovery::{
         BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-        RevenueRecoveryRecordBackResponse,
+        InvoiceRecordBackResponse,
     },
 };
 
@@ -40,11 +40,7 @@ pub trait BillingConnectorPaymentsSyncIntegration:
 
 /// trait RevenueRecoveryRecordBack
 pub trait RevenueRecoveryRecordBack:
-    ConnectorIntegration<
-    RecoveryRecordBack,
-    RevenueRecoveryRecordBackRequest,
-    RevenueRecoveryRecordBackResponse,
->
+    ConnectorIntegration<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>
 {
 }
 
diff --git a/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs b/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
index 11a854c6dec..08efb664f9b 100644
--- a/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
@@ -3,18 +3,18 @@
 use hyperswitch_domain_models::{
     router_data_v2::flow_common_types::{
         BillingConnectorInvoiceSyncFlowData, BillingConnectorPaymentsSyncFlowData,
-        RevenueRecoveryRecordBackData,
+        InvoiceRecordBackData,
     },
     router_flow_types::{
-        BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, RecoveryRecordBack,
+        BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, InvoiceRecordBack,
     },
     router_request_types::revenue_recovery::{
         BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-        RevenueRecoveryRecordBackRequest,
+        InvoiceRecordBackRequest,
     },
     router_response_types::revenue_recovery::{
         BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-        RevenueRecoveryRecordBackResponse,
+        InvoiceRecordBackResponse,
     },
 };
 
@@ -47,10 +47,10 @@ pub trait BillingConnectorPaymentsSyncIntegrationV2:
 /// trait RevenueRecoveryRecordBackV2
 pub trait RevenueRecoveryRecordBackV2:
     ConnectorIntegrationV2<
-    RecoveryRecordBack,
-    RevenueRecoveryRecordBackData,
-    RevenueRecoveryRecordBackRequest,
-    RevenueRecoveryRecordBackResponse,
+    InvoiceRecordBack,
+    InvoiceRecordBackData,
+    InvoiceRecordBackRequest,
+    InvoiceRecordBackResponse,
 >
 {
 }
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 23fb9e76bcd..d0612172561 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -11,9 +11,9 @@ use hyperswitch_domain_models::{
         flow_common_types::{
             AccessTokenFlowData, AuthenticationTokenFlowData, BillingConnectorInvoiceSyncFlowData,
             BillingConnectorPaymentsSyncFlowData, DisputesFlowData, ExternalAuthenticationFlowData,
-            ExternalVaultProxyFlowData, FilesFlowData, MandateRevokeFlowData, PaymentFlowData,
-            RefundFlowData, RevenueRecoveryRecordBackData, UasFlowData, VaultConnectorFlowData,
-            WebhookSourceVerifyData,
+            ExternalVaultProxyFlowData, FilesFlowData, InvoiceRecordBackData,
+            MandateRevokeFlowData, PaymentFlowData, RefundFlowData, UasFlowData,
+            VaultConnectorFlowData, WebhookSourceVerifyData,
         },
         RouterDataV2,
     },
@@ -759,9 +759,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
     }
 }
 
-impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
-    for RevenueRecoveryRecordBackData
-{
+impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for InvoiceRecordBackData {
     fn from_old_router_data(
         old_router_data: &RouterData<T, Req, Resp>,
     ) -> CustomResult<RouterDataV2<T, Self, Req, Resp>, ConnectorError>
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index eed89fe00ba..acb3dcfaa28 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -15,7 +15,7 @@ use hyperswitch_domain_models::{
             SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
         },
         refunds::{Execute, RSync},
-        revenue_recovery::{BillingConnectorPaymentsSync, RecoveryRecordBack},
+        revenue_recovery::{BillingConnectorPaymentsSync, InvoiceRecordBack},
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
@@ -29,7 +29,7 @@ use hyperswitch_domain_models::{
     router_request_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-            RevenueRecoveryRecordBackRequest,
+            InvoiceRecordBackRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -51,7 +51,7 @@ use hyperswitch_domain_models::{
     router_response_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-            RevenueRecoveryRecordBackResponse,
+            InvoiceRecordBackResponse,
         },
         AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
         MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData, RetrieveFileResponse,
@@ -264,11 +264,11 @@ pub type UasAuthenticationType = dyn ConnectorIntegration<
     UasAuthenticationResponseData,
 >;
 
-/// Type alias for `ConnectorIntegration<RecoveryRecordBack, RevenueRecoveryRecordBackRequest, RevenueRecoveryRecordBackResponse>`
-pub type RevenueRecoveryRecordBackType = dyn ConnectorIntegration<
-    RecoveryRecordBack,
-    RevenueRecoveryRecordBackRequest,
-    RevenueRecoveryRecordBackResponse,
+/// Type alias for `ConnectorIntegration<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>`
+pub type InvoiceRecordBackType = dyn ConnectorIntegration<
+    InvoiceRecordBack,
+    InvoiceRecordBackRequest,
+    InvoiceRecordBackResponse,
 >;
 
 /// Type alias for `ConnectorIntegration<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
@@ -285,12 +285,12 @@ pub type BillingConnectorInvoiceSyncType = dyn ConnectorIntegration<
     BillingConnectorInvoiceSyncResponse,
 >;
 
-/// Type alias for `ConnectorIntegrationV2<RecoveryRecordBack, RevenueRecoveryRecordBackData, RevenueRecoveryRecordBackRequest, RevenueRecoveryRecordBackResponse>`
-pub type RevenueRecoveryRecordBackTypeV2 = dyn ConnectorIntegrationV2<
-    RecoveryRecordBack,
-    flow_common_types::RevenueRecoveryRecordBackData,
-    RevenueRecoveryRecordBackRequest,
-    RevenueRecoveryRecordBackResponse,
+/// Type alias for `ConnectorIntegrationV2<InvoiceRecordBack, InvoiceRecordBackData, InvoiceRecordBackRequest, InvoiceRecordBackResponse>`
+pub type InvoiceRecordBackTypeV2 = dyn ConnectorIntegrationV2<
+    InvoiceRecordBack,
+    flow_common_types::InvoiceRecordBackData,
+    InvoiceRecordBackRequest,
+    InvoiceRecordBackResponse,
 >;
 
 /// Type alias for `ConnectorIntegrationV2<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index d9e3e9ee34b..4f63e0005cc 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -19,7 +19,7 @@ use async_trait::async_trait;
 use common_types::payments::CustomerAcceptance;
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::router_flow_types::{
-    BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, RecoveryRecordBack,
+    BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, InvoiceRecordBack,
 };
 use hyperswitch_domain_models::router_request_types::PaymentsCaptureData;
 
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index d2667cc63b0..f63259b0c85 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -1361,12 +1361,12 @@ async fn record_back_to_billing_connector(
     .attach_printable("invalid connector name received in billing merchant connector account")?;
 
     let connector_integration: services::BoxedRevenueRecoveryRecordBackInterface<
-        router_flow_types::RecoveryRecordBack,
-        revenue_recovery_request::RevenueRecoveryRecordBackRequest,
-        revenue_recovery_response::RevenueRecoveryRecordBackResponse,
+        router_flow_types::InvoiceRecordBack,
+        revenue_recovery_request::InvoiceRecordBackRequest,
+        revenue_recovery_response::InvoiceRecordBackResponse,
     > = connector_data.connector.get_connector_integration();
 
-    let router_data = construct_recovery_record_back_router_data(
+    let router_data = construct_invoice_record_back_router_data(
         state,
         billing_mca,
         payment_attempt,
@@ -1396,13 +1396,13 @@ async fn record_back_to_billing_connector(
     Ok(())
 }
 
-pub fn construct_recovery_record_back_router_data(
+pub fn construct_invoice_record_back_router_data(
     state: &SessionState,
     billing_mca: &merchant_connector_account::MerchantConnectorAccount,
     payment_attempt: &PaymentAttempt,
     payment_intent: &PaymentIntent,
-) -> RecoveryResult<hyperswitch_domain_models::types::RevenueRecoveryRecordBackRouterData> {
-    logger::info!("Entering construct_recovery_record_back_router_data");
+) -> RecoveryResult<hyperswitch_domain_models::types::InvoiceRecordBackRouterData> {
+    logger::info!("Entering construct_invoice_record_back_router_data");
 
     let auth_type: types::ConnectorAuthType =
         helpers::MerchantConnectorAccountType::DbVal(Box::new(billing_mca.clone()))
@@ -1433,11 +1433,11 @@ pub fn construct_recovery_record_back_router_data(
         ))?;
 
     let router_data = router_data_v2::RouterDataV2 {
-        flow: PhantomData::<router_flow_types::RecoveryRecordBack>,
+        flow: PhantomData::<router_flow_types::InvoiceRecordBack>,
         tenant_id: state.tenant.tenant_id.clone(),
-        resource_common_data: flow_common_types::RevenueRecoveryRecordBackData,
+        resource_common_data: flow_common_types::InvoiceRecordBackData,
         connector_auth_type: auth_type,
-        request: revenue_recovery_request::RevenueRecoveryRecordBackRequest {
+        request: revenue_recovery_request::InvoiceRecordBackRequest {
             merchant_reference_id,
             amount: payment_attempt.get_total_amount(),
             currency: payment_intent.amount_details.currency,
@@ -1451,10 +1451,9 @@ pub fn construct_recovery_record_back_router_data(
         },
         response: Err(types::ErrorResponse::default()),
     };
-    let old_router_data =
-        flow_common_types::RevenueRecoveryRecordBackData::to_old_router_data(router_data)
-            .change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
-            .attach_printable("Cannot construct record back router data")?;
+    let old_router_data = flow_common_types::InvoiceRecordBackData::to_old_router_data(router_data)
+        .change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
+        .attach_printable("Cannot construct record back router data")?;
     Ok(old_router_data)
 }
 
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index fa8e840fdea..7d59a1cad30 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -105,7 +105,7 @@ pub type BoxedAccessTokenConnectorIntegrationInterface<T, Req, Resp> =
 pub type BoxedFilesConnectorIntegrationInterface<T, Req, Resp> =
     BoxedConnectorIntegrationInterface<T, common_types::FilesFlowData, Req, Resp>;
 pub type BoxedRevenueRecoveryRecordBackInterface<T, Req, Res> =
-    BoxedConnectorIntegrationInterface<T, common_types::RevenueRecoveryRecordBackData, Req, Res>;
+    BoxedConnectorIntegrationInterface<T, common_types::InvoiceRecordBackData, Req, Res>;
 pub type BoxedBillingConnectorInvoiceSyncIntegrationInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<
         T,
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 525c25f7369..a4f024eb81c 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -61,7 +61,7 @@ pub use hyperswitch_domain_models::{
     router_request_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
-            RevenueRecoveryRecordBackRequest,
+            InvoiceRecordBackRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -87,7 +87,7 @@ pub use hyperswitch_domain_models::{
     router_response_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-            RevenueRecoveryRecordBackResponse,
+            InvoiceRecordBackResponse,
         },
         AcceptDisputeResponse, CaptureSyncResponse, DefendDisputeResponse, DisputeSyncResponse,
         FetchDisputesResponse, MandateReference, MandateRevokeResponseData, PaymentsResponseData,
 | 
	2025-09-09T10:54:34Z | 
	
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [X] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Make the RevenueRecoveryRecordBack functionality generic to make it usable by subscription after making a successful payment.
This pull request refactors the "record back" functionality in the revenue recovery flow by renaming types and data structures from RevenueRecoveryRecordBack* and RecoveryRecordBack to InvoiceRecordBack* and InvoiceRecordBack. This change is applied consistently across domain models, connector implementations, interfaces, and transformers, improving clarity and aligning naming with their purpose (handling invoice record backs).
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Only removing the feature flag and renamed it. compilation and PR checks should be sufficient
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	876ea3f61d599a4fdb9e509523619fe4a8c56c61 | 
	
Only removing the feature flag and renamed it. compilation and PR checks should be sufficient
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9297 | 
	Bug: [Bug] Update Redis TTL for customer locks after token selection
The revenue recovery workflow currently does not update the Redis TTL for a connector customer lock after the decider service selects the best PSP token. This behavior can lead to a customer lock expiring prematurely, which breaks the consistency of the recovery process. | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index b725be102c1..4ce52dfac4f 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1241,6 +1241,7 @@ initial_timestamp_in_seconds = 3600          # number of seconds added to start
 job_schedule_buffer_time_in_seconds = 3600    # buffer time in seconds to schedule the job for Revenue Recovery
 reopen_workflow_buffer_time_in_seconds = 3600  # time in seconds to be added in scheduling for calculate workflow
 max_random_schedule_delay_in_seconds = 300  # max random delay in seconds to schedule the payment for Revenue Recovery
+redis_ttl_buffer_in_seconds= 300 # buffer time in seconds to be added to redis ttl for Revenue Recovery
 
 [clone_connector_allowlist]
 merchant_ids = "merchant_ids"           # Comma-separated list of allowed merchant IDs
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index bfba035c1f3..726bdbe21a9 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -415,6 +415,7 @@ initial_timestamp_in_seconds = 3600        # number of seconds added to start ti
 job_schedule_buffer_time_in_seconds = 3600 # time in seconds to be added in schedule time as a buffer 
 reopen_workflow_buffer_time_in_seconds = 3600  # time in seconds to be added in scheduling for calculate workflow
 max_random_schedule_delay_in_seconds = 300 # max random delay in seconds to schedule the payment for Revenue Recovery
+redis_ttl_buffer_in_seconds=300 # buffer time in seconds to be added to redis ttl for Revenue Recovery
 
 [chat]
 enabled = false                                # Enable or disable chat features
diff --git a/config/development.toml b/config/development.toml
index 940e43b50ca..07cadbf3058 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1340,6 +1340,7 @@ initial_timestamp_in_seconds = 3600
 job_schedule_buffer_time_in_seconds = 3600
 reopen_workflow_buffer_time_in_seconds = 3600
 max_random_schedule_delay_in_seconds = 300
+redis_ttl_buffer_in_seconds= 300
 
 [revenue_recovery.card_config.amex]
 max_retries_per_day = 20
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 3844fa34bc4..b0b656a1ede 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2718,6 +2718,11 @@ pub struct ProfileResponse {
     /// Enable split payments, i.e., split the amount between multiple payment methods
     #[schema(value_type = SplitTxnsEnabled, default = "skip")]
     pub split_txns_enabled: common_enums::SplitTxnsEnabled,
+
+    /// Indicates the state of revenue recovery algorithm type
+    #[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
+    pub revenue_recovery_retry_algorithm_type:
+        Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
 }
 
 #[cfg(feature = "v1")]
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index c0b042b182f..71fe216322d 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -801,6 +801,7 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::payment_methods::PaymentMethodSessionResponse,
         api_models::payment_methods::AuthenticationDetails,
         api_models::process_tracker::revenue_recovery::RevenueRecoveryResponse,
+        api_models::enums::RevenueRecoveryAlgorithmType,
         api_models::enums::ProcessTrackerStatus,
         api_models::proxy::ProxyRequest,
         api_models::proxy::ProxyResponse,
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index d63cbd5f906..f714564e1f3 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -671,8 +671,9 @@ async fn update_calculate_job_schedule_time(
     base_time: Option<time::PrimitiveDateTime>,
     connector_customer_id: &str,
 ) -> Result<(), sch_errors::ProcessTrackerError> {
-    let new_schedule_time =
-        base_time.unwrap_or_else(common_utils::date_time::now) + additional_time;
+    let now = common_utils::date_time::now();
+
+    let new_schedule_time = base_time.filter(|&t| t > now).unwrap_or(now) + additional_time;
     logger::info!(
         new_schedule_time = %new_schedule_time,
         process_id = %process.id,
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index f63259b0c85..40532480d38 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -806,17 +806,13 @@ impl Action {
                         .change_context(errors::RecoveryError::ValueNotFound)
                         .attach_printable("Failed to extract customer ID from payment intent")?;
 
-                    let is_hard_decline =
-                        revenue_recovery::check_hard_decline(state, &payment_attempt)
-                            .await
-                            .ok();
-
                     // update the status of token in redis
                     let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
                     state,
                     &connector_customer_id,
                     &None,
-                    &is_hard_decline,
+                    // Since this is succeeded, 'hard_decine' will be false.
+                    &Some(false),
                     used_token.as_deref(),
                 )
                 .await;
@@ -900,13 +896,25 @@ impl Action {
         logger::info!("Entering psync_response_handler");
 
         let db = &*state.store;
+
+        let connector_customer_id = payment_intent
+            .feature_metadata
+            .as_ref()
+            .and_then(|fm| fm.payment_revenue_recovery_metadata.as_ref())
+            .map(|rr| {
+                rr.billing_connector_payment_details
+                    .connector_customer_id
+                    .clone()
+            });
+
         match self {
             Self::SyncPayment(payment_attempt) => {
                 //  get a schedule time for psync
                 // and retry the process if there is a schedule time
                 // if None mark the pt status as Retries Exceeded and finish the task
-                payment_sync::retry_sync_task(
-                    db,
+                payment_sync::recovery_retry_sync_task(
+                    state,
+                    connector_customer_id,
                     revenue_recovery_metadata.connector.to_string(),
                     revenue_recovery_payment_data
                         .merchant_account
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 2576bfbd8fc..0e8cb60ff81 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -322,6 +322,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
             merchant_category_code: item.merchant_category_code,
             merchant_country_code: item.merchant_country_code,
             split_txns_enabled: item.split_txns_enabled,
+            revenue_recovery_retry_algorithm_type: item.revenue_recovery_retry_algorithm_type,
         })
     }
 }
diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs
index 5a3f9f1bf7e..48110eb92ed 100644
--- a/crates/router/src/types/storage/revenue_recovery.rs
+++ b/crates/router/src/types/storage/revenue_recovery.rs
@@ -81,6 +81,7 @@ pub struct RecoveryTimestamp {
     pub job_schedule_buffer_time_in_seconds: i64,
     pub reopen_workflow_buffer_time_in_seconds: i64,
     pub max_random_schedule_delay_in_seconds: i64,
+    pub redis_ttl_buffer_in_seconds: i64,
 }
 
 impl Default for RecoveryTimestamp {
@@ -90,6 +91,7 @@ impl Default for RecoveryTimestamp {
             job_schedule_buffer_time_in_seconds: 15,
             reopen_workflow_buffer_time_in_seconds: 60,
             max_random_schedule_delay_in_seconds: 300,
+            redis_ttl_buffer_in_seconds: 300,
         }
     }
 }
diff --git a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
index e4eec924a98..f083e8bbbed 100644
--- a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
+++ b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
@@ -61,12 +61,22 @@ pub struct PaymentProcessorTokenWithRetryInfo {
     pub retry_wait_time_hours: i64,
     /// Number of retries remaining in the 30-day rolling window
     pub monthly_retry_remaining: i32,
+    // Current total retry count in 30-day window
+    pub total_30_day_retries: i32,
 }
 
 /// Redis-based token management struct
 pub struct RedisTokenManager;
 
 impl RedisTokenManager {
+    fn get_connector_customer_lock_key(connector_customer_id: &str) -> String {
+        format!("customer:{connector_customer_id}:status")
+    }
+
+    fn get_connector_customer_tokens_key(connector_customer_id: &str) -> String {
+        format!("customer:{connector_customer_id}:tokens")
+    }
+
     /// Lock connector customer
     #[instrument(skip_all)]
     pub async fn lock_connector_customer_status(
@@ -82,7 +92,7 @@ impl RedisTokenManager {
                     errors::RedisError::RedisConnectionError.into(),
                 ))?;
 
-        let lock_key = format!("customer:{connector_customer_id}:status");
+        let lock_key = Self::get_connector_customer_lock_key(connector_customer_id);
         let seconds = &state.conf.revenue_recovery.redis_ttl_in_seconds;
 
         let result: bool = match redis_conn
@@ -109,6 +119,42 @@ impl RedisTokenManager {
 
         Ok(result)
     }
+    #[instrument(skip_all)]
+    pub async fn update_connector_customer_lock_ttl(
+        state: &SessionState,
+        connector_customer_id: &str,
+        exp_in_seconds: i64,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let redis_conn =
+            state
+                .store
+                .get_redis_conn()
+                .change_context(errors::StorageError::RedisError(
+                    errors::RedisError::RedisConnectionError.into(),
+                ))?;
+
+        let lock_key = Self::get_connector_customer_lock_key(connector_customer_id);
+
+        let result: bool = redis_conn
+            .set_expiry(&lock_key.into(), exp_in_seconds)
+            .await
+            .map_or_else(
+                |error| {
+                    tracing::error!(operation = "update_lock_ttl", err = ?error);
+                    false
+                },
+                |_| true,
+            );
+
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            new_ttl_in_seconds = exp_in_seconds,
+            ttl_updated = %result,
+            "Connector customer lock TTL update with new expiry time"
+        );
+
+        Ok(result)
+    }
 
     /// Unlock connector customer status
     #[instrument(skip_all)]
@@ -124,7 +170,7 @@ impl RedisTokenManager {
                     errors::RedisError::RedisConnectionError.into(),
                 ))?;
 
-        let lock_key = format!("customer:{connector_customer_id}:status");
+        let lock_key = Self::get_connector_customer_lock_key(connector_customer_id);
 
         match redis_conn.delete_key(&lock_key.into()).await {
             Ok(DelReply::KeyDeleted) => {
@@ -158,7 +204,7 @@ impl RedisTokenManager {
                 .change_context(errors::StorageError::RedisError(
                     errors::RedisError::RedisConnectionError.into(),
                 ))?;
-        let tokens_key = format!("customer:{connector_customer_id}:tokens");
+        let tokens_key = Self::get_connector_customer_tokens_key(connector_customer_id);
 
         let get_hash_err =
             errors::StorageError::RedisError(errors::RedisError::GetHashFieldFailed.into());
@@ -209,7 +255,7 @@ impl RedisTokenManager {
                 .change_context(errors::StorageError::RedisError(
                     errors::RedisError::RedisConnectionError.into(),
                 ))?;
-        let tokens_key = format!("customer:{connector_customer_id}:tokens");
+        let tokens_key = Self::get_connector_customer_tokens_key(connector_customer_id);
 
         // allocate capacity up-front to avoid rehashing
         let mut serialized_payment_processor_tokens: HashMap<String, String> =
@@ -312,15 +358,18 @@ impl RedisTokenManager {
             // Obtain network-specific limits and compute remaining monthly retries.
             let card_network_config = card_config.get_network_config(card_network);
 
-            let monthly_retry_remaining = card_network_config
-                .max_retry_count_for_thirty_day
-                .saturating_sub(retry_info.total_30_day_retries);
+            let monthly_retry_remaining = std::cmp::max(
+                0,
+                card_network_config.max_retry_count_for_thirty_day
+                    - retry_info.total_30_day_retries,
+            );
 
             // Build the per-token result struct.
             let token_with_retry_info = PaymentProcessorTokenWithRetryInfo {
                 token_status: payment_processor_token_status.clone(),
                 retry_wait_time_hours,
                 monthly_retry_remaining,
+                total_30_day_retries: retry_info.total_30_day_retries,
             };
 
             result.insert(payment_processor_token_id.clone(), token_with_retry_info);
@@ -367,6 +416,7 @@ impl RedisTokenManager {
         let monthly_wait_hours =
             if total_30_day_retries >= card_network_config.max_retry_count_for_thirty_day {
                 (0..RETRY_WINDOW_DAYS)
+                    .rev()
                     .map(|i| today - Duration::days(i.into()))
                     .find(|date| token.daily_retry_history.get(date).copied().unwrap_or(0) > 0)
                     .map(|date| Self::calculate_wait_hours(date + Duration::days(31), now))
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index d7ac92e131e..f0bd7e3619d 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -1,3 +1,5 @@
+#[cfg(feature = "v2")]
+use common_utils::ext_traits::AsyncExt;
 use common_utils::ext_traits::{OptionExt, StringExt, ValueExt};
 use diesel_models::process_tracker::business_status;
 use error_stack::ResultExt;
@@ -7,6 +9,8 @@ use scheduler::{
     errors as sch_errors, utils as scheduler_utils,
 };
 
+#[cfg(feature = "v2")]
+use crate::workflows::revenue_recovery::update_token_expiry_based_on_schedule_time;
 use crate::{
     consts,
     core::{
@@ -304,6 +308,51 @@ pub async fn retry_sync_task(
     }
 }
 
+/// Schedule the task for retry and update redis token expiry time
+///
+/// Returns bool which indicates whether this was the last retry or not
+#[cfg(feature = "v2")]
+pub async fn recovery_retry_sync_task(
+    state: &SessionState,
+    connector_customer_id: Option<String>,
+    connector: String,
+    merchant_id: common_utils::id_type::MerchantId,
+    pt: storage::ProcessTracker,
+) -> Result<bool, sch_errors::ProcessTrackerError> {
+    let db = &*state.store;
+    let schedule_time =
+        get_sync_process_schedule_time(db, &connector, &merchant_id, pt.retry_count + 1).await?;
+
+    match schedule_time {
+        Some(s_time) => {
+            db.as_scheduler().retry_process(pt, s_time).await?;
+
+            connector_customer_id
+                .async_map(|id| async move {
+                    let _ = update_token_expiry_based_on_schedule_time(state, &id, Some(s_time))
+                        .await
+                        .map_err(|e| {
+                            logger::error!(
+                                error = ?e,
+                                connector_customer_id = %id,
+                                "Failed to update the token expiry time in redis"
+                            );
+                            e
+                        });
+                })
+                .await;
+
+            Ok(false)
+        }
+        None => {
+            db.as_scheduler()
+                .finish_process_with_business_status(pt, business_status::RETRIES_EXCEEDED)
+                .await?;
+            Ok(true)
+        }
+    }
+}
+
 #[cfg(test)]
 mod tests {
     #![allow(clippy::expect_used, clippy::unwrap_used)]
diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs
index b85ebd3ff11..6a6d9511062 100644
--- a/crates/router/src/workflows/revenue_recovery.rs
+++ b/crates/router/src/workflows/revenue_recovery.rs
@@ -371,10 +371,7 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
         card_network: card_network_str,
         card_issuer: card_issuer_str,
         invoice_start_time: Some(start_time_proto),
-        retry_count: Some(
-            (total_retry_count_within_network.max_retry_count_for_thirty_day - retry_count_left)
-                .into(),
-        ),
+        retry_count: Some(token_with_retry_info.total_30_day_retries.into()),
         merchant_id,
         invoice_amount,
         invoice_currency,
@@ -513,6 +510,47 @@ pub struct ScheduledToken {
     pub schedule_time: time::PrimitiveDateTime,
 }
 
+#[cfg(feature = "v2")]
+pub fn calculate_difference_in_seconds(scheduled_time: time::PrimitiveDateTime) -> i64 {
+    let now_utc = time::OffsetDateTime::now_utc();
+
+    let scheduled_offset_dt = scheduled_time.assume_utc();
+    let difference = scheduled_offset_dt - now_utc;
+
+    difference.whole_seconds()
+}
+
+#[cfg(feature = "v2")]
+pub async fn update_token_expiry_based_on_schedule_time(
+    state: &SessionState,
+    connector_customer_id: &str,
+    delayed_schedule_time: Option<time::PrimitiveDateTime>,
+) -> CustomResult<(), errors::ProcessTrackerError> {
+    let expiry_buffer = state
+        .conf
+        .revenue_recovery
+        .recovery_timestamp
+        .redis_ttl_buffer_in_seconds;
+
+    delayed_schedule_time
+        .async_map(|t| async move {
+            let expiry_time = calculate_difference_in_seconds(t) + expiry_buffer;
+            RedisTokenManager::update_connector_customer_lock_ttl(
+                state,
+                connector_customer_id,
+                expiry_time,
+            )
+            .await
+            .change_context(errors::ProcessTrackerError::ERedisError(
+                errors::RedisError::RedisConnectionError.into(),
+            ))
+        })
+        .await
+        .transpose()?;
+
+    Ok(())
+}
+
 #[cfg(feature = "v2")]
 pub async fn get_token_with_schedule_time_based_on_retry_algorithm_type(
     state: &SessionState,
@@ -553,6 +591,13 @@ pub async fn get_token_with_schedule_time_based_on_retry_algorithm_type(
     let delayed_schedule_time =
         scheduled_time.map(|time| add_random_delay_to_schedule_time(state, time));
 
+    let _ = update_token_expiry_based_on_schedule_time(
+        state,
+        connector_customer_id,
+        delayed_schedule_time,
+    )
+    .await;
+
     Ok(delayed_schedule_time)
 }
 
 | 
	2025-09-04T11:57:18Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR implements an update mechanism for Redis Time-to-Live (TTL) for connector customer locks within the revenue recovery workflow.
When the decider service provides token with scheduled time, the system now updates the TTL for the corresponding customer lock in Redis. The new TTL is calculated as the difference between the schedule_time_selected_token and the current time.
The default TTL for these locks is set to 3888000 seconds (approximately 45 days). This update ensures that the lock's expiration aligns with the newly scheduled event, preventing premature lock release.
A log entry is generated to track this change, with the message: Connector customer lock TTL update with new expiry time.
Added revenue_recovery_retry_algorithm_type in business profile response. 
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
For testing refer to this  : https://github.com/juspay/hyperswitch/pull/8848
System Update the Redis TTL for a connector customer lock after a best Payment Processor Token is selected.
Logs - "Connector customer lock TTL update with new expiry time"
<img width="356" height="57" alt="Screenshot 2025-09-08 at 11 15 41 AM" src="https://github.com/user-attachments/assets/13fe578a-1914-4823-b54e-94351c2b562d" />
### Business profile
#### curl 
```
curl --location --request PUT 'http://localhost:8080/v2/profiles/pro_0GHXcjcAhvGPXGu0pitK' \
--header 'x-merchant-id: cloth_seller_yMwFFEtiXtszMGELTg2P' \
--header 'Authorization: admin-api-key={}' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
    "profile_name": "Update334",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "revenue_recovery_retry_algorithm_type": "smart"
}'
```
#### Response
```
{
    "merchant_id": "cloth_seller_yMwFFEtiXtszMGELTg2P",
    "id": "pro_0GHXcjcAhvGPXGu0pitK",
    "profile_name": "Update334",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "OxvXuBlTAtrqwP9VGJ9VIR1Zg7WDo1ZHEFDOxYMo4V2knbIWZA10OLE6ofW7kih8",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "metadata": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "should_collect_cvv_during_payment": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_iframe_redirection_enabled": null,
    "is_external_vault_enabled": null,
    "external_vault_connector_details": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "split_txns_enabled": "skip",
    "revenue_recovery_retry_algorithm_type": "smart"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	ea2fd1d4768f83d8564477ef82940a5f33b0e3a1 | 
	
For testing refer to this  : https://github.com/juspay/hyperswitch/pull/8848
System Update the Redis TTL for a connector customer lock after a best Payment Processor Token is selected.
Logs - "Connector customer lock TTL update with new expiry time"
<img width="356" height="57" alt="Screenshot 2025-09-08 at 11 15 41 AM" src="https://github.com/user-attachments/assets/13fe578a-1914-4823-b54e-94351c2b562d" />
### Business profile
#### curl 
```
curl --location --request PUT 'http://localhost:8080/v2/profiles/pro_0GHXcjcAhvGPXGu0pitK' \
--header 'x-merchant-id: cloth_seller_yMwFFEtiXtszMGELTg2P' \
--header 'Authorization: admin-api-key={}' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
    "profile_name": "Update334",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "revenue_recovery_retry_algorithm_type": "smart"
}'
```
#### Response
```
{
    "merchant_id": "cloth_seller_yMwFFEtiXtszMGELTg2P",
    "id": "pro_0GHXcjcAhvGPXGu0pitK",
    "profile_name": "Update334",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "OxvXuBlTAtrqwP9VGJ9VIR1Zg7WDo1ZHEFDOxYMo4V2knbIWZA10OLE6ofW7kih8",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "metadata": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "should_collect_cvv_during_payment": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_iframe_redirection_enabled": null,
    "is_external_vault_enabled": null,
    "external_vault_connector_details": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "split_txns_enabled": "skip",
    "revenue_recovery_retry_algorithm_type": "smart"
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9309 | 
	Bug: FEATURE: [Paysafe] Implement card 3ds flow
- Implement card 3ds flow | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
index 64296c2ebe6..8d463966748 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
@@ -17,15 +17,15 @@ use hyperswitch_domain_models::{
     router_flow_types::{
         access_token_auth::AccessTokenAuth,
         payments::{
-            Authorize, Capture, PSync, PaymentMethodToken, PreProcessing, Session, SetupMandate,
-            Void,
+            Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, PreProcessing,
+            Session, SetupMandate, Void,
         },
         refunds::{Execute, RSync},
     },
     router_request_types::{
-        AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
-        PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData,
-        PaymentsSyncData, RefundsData, SetupMandateRequestData,
+        AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,
+        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData,
+        PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,
     },
     router_response_types::{
         ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
@@ -33,8 +33,8 @@ use hyperswitch_domain_models::{
     },
     types::{
         PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
-        PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,
-        RefundsRouterData,
+        PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -54,7 +54,10 @@ use transformers as paysafe;
 use crate::{
     constants::headers,
     types::ResponseRouterData,
-    utils::{self, RefundsRequestData as OtherRefundsRequestData},
+    utils::{
+        self, PaymentsSyncRequestData, RefundsRequestData as OtherRefundsRequestData,
+        RouterData as _,
+    },
 };
 
 #[derive(Clone)]
@@ -262,7 +265,6 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
 
         let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
         let connector_req = paysafe::PaysafePaymentHandleRequest::try_from(&connector_router_data)?;
-
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
@@ -333,10 +335,15 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
 
     fn get_url(
         &self,
-        _req: &PaymentsAuthorizeRouterData,
+        req: &PaymentsAuthorizeRouterData,
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Ok(format!("{}v1/payments", self.base_url(connectors),))
+        match req.payment_method {
+            enums::PaymentMethod::Card if !req.is_three_ds() => {
+                Ok(format!("{}v1/payments", self.base_url(connectors)))
+            }
+            _ => Ok(format!("{}v1/paymenthandles", self.base_url(connectors),)),
+        }
     }
 
     fn get_request_body(
@@ -351,8 +358,19 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         )?;
 
         let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
-        let connector_req = paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?;
-        Ok(RequestContent::Json(Box::new(connector_req)))
+        match req.payment_method {
+            //Card No 3DS
+            enums::PaymentMethod::Card if !req.is_three_ds() => {
+                let connector_req =
+                    paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?;
+                Ok(RequestContent::Json(Box::new(connector_req)))
+            }
+            _ => {
+                let connector_req =
+                    paysafe::PaysafePaymentHandleRequest::try_from(&connector_router_data)?;
+                Ok(RequestContent::Json(Box::new(connector_req)))
+            }
+        }
     }
 
     fn build_request(
@@ -383,17 +401,122 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+        match data.payment_method {
+            enums::PaymentMethod::Card if !data.is_three_ds() => {
+                let response: paysafe::PaysafePaymentsResponse = res
+                    .response
+                    .parse_struct("Paysafe PaymentsAuthorizeResponse")
+                    .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+                event_builder.map(|i| i.set_response_body(&response));
+                router_env::logger::info!(connector_response=?response);
+                RouterData::try_from(ResponseRouterData {
+                    response,
+                    data: data.clone(),
+                    http_code: res.status_code,
+                })
+            }
+            _ => {
+                let response: paysafe::PaysafePaymentHandleResponse = res
+                    .response
+                    .parse_struct("Paysafe PaymentHandleResponse")
+                    .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+                event_builder.map(|i| i.set_response_body(&response));
+                router_env::logger::info!(connector_response=?response);
+                RouterData::try_from(ResponseRouterData {
+                    response,
+                    data: data.clone(),
+                    http_code: res.status_code,
+                })
+            }
+        }
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl api::PaymentsCompleteAuthorize for Paysafe {}
+
+impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>
+    for Paysafe
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsCompleteAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+    fn get_url(
+        &self,
+        _req: &PaymentsCompleteAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!("{}v1/payments", self.base_url(connectors),))
+    }
+    fn get_request_body(
+        &self,
+        req: &PaymentsCompleteAuthorizeRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let amount = utils::convert_amount(
+            self.amount_converter,
+            req.request.minor_amount,
+            req.request.currency,
+        )?;
+
+        let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
+        let connector_req = paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+    fn build_request(
+        &self,
+        req: &PaymentsCompleteAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::PaymentsCompleteAuthorizeType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::PaymentsCompleteAuthorizeType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+    fn handle_response(
+        &self,
+        data: &PaymentsCompleteAuthorizeRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
         let response: paysafe::PaysafePaymentsResponse = res
             .response
             .parse_struct("Paysafe PaymentsAuthorizeResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
+
         RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
         })
+        .change_context(errors::ConnectorError::ResponseHandlingFailed)
     }
 
     fn get_error_response(
@@ -424,11 +547,17 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         let connector_payment_id = req.connector_request_reference_id.clone();
-        Ok(format!(
-            "{}v1/payments?merchantRefNum={}",
-            self.base_url(connectors),
-            connector_payment_id
-        ))
+        let connector_transaction_id = req.request.get_optional_connector_transaction_id();
+
+        let base_url = self.base_url(connectors);
+
+        let url = if connector_transaction_id.is_some() {
+            format!("{base_url}v1/payments?merchantRefNum={connector_payment_id}")
+        } else {
+            format!("{base_url}v1/paymenthandles?merchantRefNum={connector_payment_id}")
+        };
+
+        Ok(url)
     }
 
     fn build_request(
@@ -452,9 +581,9 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
-        let response: paysafe::PaysafePaymentsSyncResponse = res
+        let response: paysafe::PaysafeSyncResponse = res
             .response
-            .parse_struct("paysafe PaysafePaymentsSyncResponse")
+            .parse_struct("paysafe PaysafeSyncResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
index 50c665a65bd..26e9d8de48d 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
@@ -1,5 +1,7 @@
+use std::collections::HashMap;
+
 use cards::CardNumber;
-use common_enums::enums;
+use common_enums::{enums, Currency};
 use common_utils::{
     pii::{IpAddress, SecretSerdeValue},
     request::Method,
@@ -11,12 +13,13 @@ use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, RouterData},
     router_flow_types::refunds::{Execute, RSync},
     router_request_types::{
-        PaymentsAuthorizeData, PaymentsPreProcessingData, PaymentsSyncData, ResponseId,
+        CompleteAuthorizeData, PaymentsAuthorizeData, PaymentsPreProcessingData, PaymentsSyncData,
+        ResponseId,
     },
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
+    router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},
     types::{
         PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
-        PaymentsPreProcessingRouterData, RefundsRouterData,
+        PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::errors;
@@ -26,8 +29,8 @@ use serde::{Deserialize, Serialize};
 use crate::{
     types::{RefundsResponseRouterData, ResponseRouterData},
     utils::{
-        self, BrowserInformationData, CardData, PaymentsAuthorizeRequestData,
-        PaymentsPreProcessingRequestData, RouterData as _,
+        self, to_connector_meta, BrowserInformationData, CardData, PaymentsAuthorizeRequestData,
+        PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData, RouterData as _,
     },
 };
 
@@ -47,7 +50,18 @@ impl<T> From<(MinorUnit, T)> for PaysafeRouterData<T> {
 
 #[derive(Debug, Default, Serialize, Deserialize)]
 pub struct PaysafeConnectorMetadataObject {
-    pub account_id: Secret<String>,
+    pub account_id: PaysafePaymentMethodDetails,
+}
+
+#[derive(Debug, Default, Serialize, Deserialize)]
+pub struct PaysafePaymentMethodDetails {
+    pub card: Option<HashMap<Currency, CardAccountId>>,
+}
+
+#[derive(Debug, Default, Serialize, Deserialize)]
+pub struct CardAccountId {
+    no_three_ds: Option<Secret<String>>,
+    three_ds: Option<Secret<String>>,
 }
 
 impl TryFrom<&Option<SecretSerdeValue>> for PaysafeConnectorMetadataObject {
@@ -61,18 +75,65 @@ impl TryFrom<&Option<SecretSerdeValue>> for PaysafeConnectorMetadataObject {
     }
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ThreeDs {
+    pub merchant_url: String,
+    pub device_channel: DeviceChannel,
+    pub message_category: ThreeDsMessageCategory,
+    pub authentication_purpose: ThreeDsAuthenticationPurpose,
+    pub requestor_challenge_preference: ThreeDsChallengePreference,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum DeviceChannel {
+    Browser,
+    Sdk,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum ThreeDsMessageCategory {
+    Payment,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum ThreeDsAuthenticationPurpose {
+    PaymentTransaction,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum ThreeDsChallengePreference {
+    ChallengeMandated,
+    NoPreference,
+    NoChallengeRequested,
+    ChallengeRequested,
+}
+
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct PaysafePaymentHandleRequest {
     pub merchant_ref_num: String,
     pub amount: MinorUnit,
     pub settle_with_auth: bool,
-    pub card: PaysafeCard,
-    pub currency_code: enums::Currency,
+    #[serde(flatten)]
+    pub payment_method: PaysafePaymentMethod,
+    pub currency_code: Currency,
     pub payment_type: PaysafePaymentType,
     pub transaction_type: TransactionType,
     pub return_links: Vec<ReturnLink>,
     pub account_id: Secret<String>,
+    pub three_ds: Option<ThreeDs>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum PaysafePaymentMethod {
+    Card { card: PaysafeCard },
 }
 
 #[derive(Debug, Serialize)]
@@ -103,6 +164,34 @@ pub enum TransactionType {
     Payment,
 }
 
+impl PaysafePaymentMethodDetails {
+    pub fn get_no_three_ds_account_id(
+        &self,
+        currency: Currency,
+    ) -> Result<Secret<String>, errors::ConnectorError> {
+        self.card
+            .as_ref()
+            .and_then(|cards| cards.get(¤cy))
+            .and_then(|card| card.no_three_ds.clone())
+            .ok_or_else(|| errors::ConnectorError::InvalidConnectorConfig {
+                config: "Missing no_3ds account_id",
+            })
+    }
+
+    pub fn get_three_ds_account_id(
+        &self,
+        currency: Currency,
+    ) -> Result<Secret<String>, errors::ConnectorError> {
+        self.card
+            .as_ref()
+            .and_then(|cards| cards.get(¤cy))
+            .and_then(|card| card.three_ds.clone())
+            .ok_or_else(|| errors::ConnectorError::InvalidConnectorConfig {
+                config: "Missing 3ds account_id",
+            })
+    }
+}
+
 impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePaymentHandleRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
@@ -119,6 +208,7 @@ impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePa
                 .change_context(errors::ConnectorError::InvalidConnectorConfig {
                     config: "merchant_connector_account.metadata",
                 })?;
+        let currency = item.router_data.request.get_currency()?;
         match item.router_data.request.get_payment_method_data()?.clone() {
             PaymentMethodData::Card(req_card) => {
                 let card = PaysafeCard {
@@ -134,8 +224,9 @@ impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePa
                     },
                     holder_name: item.router_data.get_optional_billing_full_name(),
                 };
-                let account_id = metadata.account_id;
 
+                let payment_method = PaysafePaymentMethod::Card { card: card.clone() };
+                let account_id = metadata.account_id.get_no_three_ds_account_id(currency)?;
                 let amount = item.amount;
                 let payment_type = PaysafePaymentType::Card;
                 let transaction_type = TransactionType::Payment;
@@ -170,12 +261,13 @@ impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePa
                         item.router_data.request.capture_method,
                         Some(enums::CaptureMethod::Automatic) | None
                     ),
-                    card,
-                    currency_code: item.router_data.request.get_currency()?,
+                    payment_method,
+                    currency_code: currency,
                     payment_type,
                     transaction_type,
                     return_links,
                     account_id,
+                    three_ds: None,
                 })
             }
             _ => Err(errors::ConnectorError::NotImplemented(
@@ -192,6 +284,13 @@ pub struct PaysafePaymentHandleResponse {
     pub merchant_ref_num: String,
     pub payment_handle_token: Secret<String>,
     pub status: PaysafePaymentHandleStatus,
+    pub links: Option<Vec<PaymentLink>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct PaymentLink {
+    pub rel: String,
+    pub href: String,
 }
 
 #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
@@ -206,6 +305,23 @@ pub enum PaysafePaymentHandleStatus {
     Completed,
 }
 
+impl TryFrom<PaysafePaymentHandleStatus> for common_enums::AttemptStatus {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: PaysafePaymentHandleStatus) -> Result<Self, Self::Error> {
+        match item {
+            PaysafePaymentHandleStatus::Completed => Ok(Self::Authorized),
+            PaysafePaymentHandleStatus::Failed | PaysafePaymentHandleStatus::Expired => {
+                Ok(Self::Failure)
+            }
+            // We get an `Initiated` status, with a redirection link from the connector, which indicates that further action is required by the customer,
+            PaysafePaymentHandleStatus::Initiated => Ok(Self::AuthenticationPending),
+            PaysafePaymentHandleStatus::Payable | PaysafePaymentHandleStatus::Processing => {
+                Ok(Self::Pending)
+            }
+        }
+    }
+}
+
 #[derive(Debug, Serialize, Deserialize)]
 pub struct PaysafeMeta {
     pub payment_handle_token: Secret<String>,
@@ -287,6 +403,54 @@ impl<F>
     }
 }
 
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            PaysafePaymentHandleResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsAuthorizeData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            PaysafePaymentHandleResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let url = match item.response.links.as_ref().and_then(|links| links.first()) {
+            Some(link) => link.href.clone(),
+            None => return Err(errors::ConnectorError::ResponseDeserializationFailed)?,
+        };
+        let redirection_data = Some(RedirectForm::Form {
+            endpoint: url,
+            method: Method::Get,
+            form_fields: Default::default(),
+        });
+        let connector_metadata = serde_json::json!(PaysafeMeta {
+            payment_handle_token: item.response.payment_handle_token.clone(),
+        });
+        Ok(Self {
+            status: common_enums::AttemptStatus::try_from(item.response.status)?,
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::NoResponseId,
+                redirection_data: Box::new(redirection_data),
+                mandate_reference: Box::new(None),
+                connector_metadata: Some(connector_metadata),
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct PaysafePaymentsRequest {
@@ -294,11 +458,11 @@ pub struct PaysafePaymentsRequest {
     pub amount: MinorUnit,
     pub settle_with_auth: bool,
     pub payment_handle_token: Secret<String>,
-    pub currency_code: enums::Currency,
+    pub currency_code: Currency,
     pub customer_ip: Option<Secret<String, IpAddress>>,
 }
 
-#[derive(Debug, Serialize, PartialEq)]
+#[derive(Debug, Serialize, Clone, PartialEq)]
 #[serde(rename_all = "camelCase")]
 pub struct PaysafeCard {
     pub card_num: CardNumber,
@@ -319,12 +483,6 @@ impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymen
     fn try_from(
         item: &PaysafeRouterData<&PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
-        if item.router_data.is_three_ds() {
-            Err(errors::ConnectorError::NotSupported {
-                message: "Card 3DS".to_string(),
-                connector: "Paysafe",
-            })?
-        };
         let payment_handle_token = Secret::new(item.router_data.get_preprocessing_id()?);
         let amount = item.amount;
         let customer_ip = Some(
@@ -345,6 +503,169 @@ impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymen
     }
 }
 
+impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymentHandleRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &PaysafeRouterData<&PaymentsAuthorizeRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let metadata: PaysafeConnectorMetadataObject =
+            utils::to_connector_meta_from_secret(item.router_data.connector_meta_data.clone())
+                .change_context(errors::ConnectorError::InvalidConnectorConfig {
+                    config: "merchant_connector_account.metadata",
+                })?;
+        let redirect_url_success = item.router_data.request.get_complete_authorize_url()?;
+        let redirect_url = item.router_data.request.get_router_return_url()?;
+        let return_links = vec![
+            ReturnLink {
+                rel: LinkType::Default,
+                href: redirect_url.clone(),
+                method: Method::Get.to_string(),
+            },
+            ReturnLink {
+                rel: LinkType::OnCompleted,
+                href: redirect_url_success.clone(),
+                method: Method::Get.to_string(),
+            },
+            ReturnLink {
+                rel: LinkType::OnFailed,
+                href: redirect_url.clone(),
+                method: Method::Get.to_string(),
+            },
+            ReturnLink {
+                rel: LinkType::OnCancelled,
+                href: redirect_url.clone(),
+                method: Method::Get.to_string(),
+            },
+        ];
+        let amount = item.amount;
+        let currency_code = item.router_data.request.currency;
+        let settle_with_auth = matches!(
+            item.router_data.request.capture_method,
+            Some(enums::CaptureMethod::Automatic) | None
+        );
+        let transaction_type = TransactionType::Payment;
+        match item.router_data.request.payment_method_data.clone() {
+            PaymentMethodData::Card(req_card) => {
+                let card = PaysafeCard {
+                    card_num: req_card.card_number.clone(),
+                    card_expiry: PaysafeCardExpiry {
+                        month: req_card.card_exp_month.clone(),
+                        year: req_card.get_expiry_year_4_digit(),
+                    },
+                    cvv: if req_card.card_cvc.clone().expose().is_empty() {
+                        None
+                    } else {
+                        Some(req_card.card_cvc.clone())
+                    },
+                    holder_name: item.router_data.get_optional_billing_full_name(),
+                };
+                let payment_method = PaysafePaymentMethod::Card { card: card.clone() };
+                let payment_type = PaysafePaymentType::Card;
+                let headers = item.router_data.header_payload.clone();
+                let platform = headers
+                    .as_ref()
+                    .and_then(|headers| headers.x_client_platform.clone());
+                let device_channel = match platform {
+                    Some(common_enums::ClientPlatform::Web)
+                    | Some(common_enums::ClientPlatform::Unknown)
+                    | None => DeviceChannel::Browser,
+                    Some(common_enums::ClientPlatform::Ios)
+                    | Some(common_enums::ClientPlatform::Android) => DeviceChannel::Sdk,
+                };
+                let account_id = metadata.account_id.get_three_ds_account_id(currency_code)?;
+                let three_ds = Some(ThreeDs {
+                    merchant_url: item.router_data.request.get_router_return_url()?,
+                    device_channel,
+                    message_category: ThreeDsMessageCategory::Payment,
+                    authentication_purpose: ThreeDsAuthenticationPurpose::PaymentTransaction,
+                    requestor_challenge_preference: ThreeDsChallengePreference::ChallengeMandated,
+                });
+
+                Ok(Self {
+                    merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+                    amount,
+                    settle_with_auth,
+                    payment_method,
+                    currency_code,
+                    payment_type,
+                    transaction_type,
+                    return_links,
+                    account_id,
+                    three_ds,
+                })
+            }
+            _ => Err(errors::ConnectorError::NotImplemented(
+                "Payment Method".to_string(),
+            ))?,
+        }
+    }
+}
+
+impl TryFrom<&PaysafeRouterData<&PaymentsCompleteAuthorizeRouterData>> for PaysafePaymentsRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &PaysafeRouterData<&PaymentsCompleteAuthorizeRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let paysafe_meta: PaysafeMeta = to_connector_meta(
+            item.router_data.request.connector_meta.clone(),
+        )
+        .change_context(errors::ConnectorError::InvalidConnectorConfig {
+            config: "connector_metadata",
+        })?;
+        let payment_handle_token = paysafe_meta.payment_handle_token;
+        let amount = item.amount;
+        let customer_ip = Some(
+            item.router_data
+                .request
+                .get_browser_info()?
+                .get_ip_address()?,
+        );
+
+        Ok(Self {
+            merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+            payment_handle_token,
+            amount,
+            settle_with_auth: item.router_data.request.is_auto_capture()?,
+            currency_code: item.router_data.request.currency,
+            customer_ip,
+        })
+    }
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<F, PaysafePaymentsResponse, CompleteAuthorizeData, PaymentsResponseData>,
+    > for RouterData<F, CompleteAuthorizeData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            PaysafePaymentsResponse,
+            CompleteAuthorizeData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            status: get_paysafe_payment_status(
+                item.response.status,
+                item.data.request.capture_method,
+            ),
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(None),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
 pub struct PaysafeAuthType {
     pub(super) username: Secret<String>,
     pub(super) password: Secret<String>,
@@ -402,6 +723,13 @@ pub fn get_paysafe_payment_status(
     }
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum PaysafeSyncResponse {
+    Payments(PaysafePaymentsSyncResponse),
+    PaymentHandles(PaysafePaymentHandlesSyncResponse),
+}
+
 // Paysafe Payments Response Structure
 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
@@ -409,6 +737,12 @@ pub struct PaysafePaymentsSyncResponse {
     pub payments: Vec<PaysafePaymentsResponse>,
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafePaymentHandlesSyncResponse {
+    pub payment_handles: Vec<PaysafePaymentHandleResponse>,
+}
+
 // Paysafe Payments Response Structure
 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
 #[serde(rename_all = "camelCase")]
@@ -427,30 +761,34 @@ pub struct PaysafeSettlementResponse {
     pub status: PaysafeSettlementStatus,
 }
 
-impl<F>
-    TryFrom<
-        ResponseRouterData<F, PaysafePaymentsSyncResponse, PaymentsSyncData, PaymentsResponseData>,
-    > for RouterData<F, PaymentsSyncData, PaymentsResponseData>
+impl<F> TryFrom<ResponseRouterData<F, PaysafeSyncResponse, PaymentsSyncData, PaymentsResponseData>>
+    for RouterData<F, PaymentsSyncData, PaymentsResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: ResponseRouterData<
-            F,
-            PaysafePaymentsSyncResponse,
-            PaymentsSyncData,
-            PaymentsResponseData,
-        >,
+        item: ResponseRouterData<F, PaysafeSyncResponse, PaymentsSyncData, PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
-        let payment_handle = item
-            .response
-            .payments
-            .first()
-            .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
+        let status = match &item.response {
+            PaysafeSyncResponse::Payments(sync_response) => {
+                let payment_response = sync_response
+                    .payments
+                    .first()
+                    .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
+                get_paysafe_payment_status(
+                    payment_response.status,
+                    item.data.request.capture_method,
+                )
+            }
+            PaysafeSyncResponse::PaymentHandles(sync_response) => {
+                let payment_handle_response = sync_response
+                    .payment_handles
+                    .first()
+                    .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
+                common_enums::AttemptStatus::try_from(payment_handle_response.status)?
+            }
+        };
         Ok(Self {
-            status: get_paysafe_payment_status(
-                payment_handle.status,
-                item.data.request.capture_method,
-            ),
+            status,
             response: Ok(PaymentsResponseData::TransactionResponse {
                 resource_id: ResponseId::NoResponseId,
                 redirection_data: Box::new(None),
@@ -700,6 +1038,6 @@ pub struct Error {
 
 #[derive(Debug, Serialize, Deserialize)]
 pub struct FieldError {
-    pub field: String,
+    pub field: Option<String>,
     pub error: String,
 }
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 0535088c884..ce4f694b7c5 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -1145,7 +1145,6 @@ macro_rules! default_imp_for_complete_authorize {
 }
 
 default_imp_for_complete_authorize!(
-    connectors::Paysafe,
     connectors::Silverflow,
     connectors::Vgs,
     connectors::Aci,
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index c6bb9f10f0d..4b7d75ed772 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -2078,6 +2078,7 @@ pub trait PaymentsSyncRequestData {
     fn is_auto_capture(&self) -> Result<bool, Error>;
     fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError>;
     fn is_mandate_payment(&self) -> bool;
+    fn get_optional_connector_transaction_id(&self) -> Option<String>;
 }
 
 impl PaymentsSyncRequestData for PaymentsSyncData {
@@ -2105,6 +2106,13 @@ impl PaymentsSyncRequestData for PaymentsSyncData {
     fn is_mandate_payment(&self) -> bool {
         matches!(self.setup_future_usage, Some(FutureUsage::OffSession))
     }
+
+    fn get_optional_connector_transaction_id(&self) -> Option<String> {
+        match self.connector_transaction_id.clone() {
+            ResponseId::ConnectorTransactionId(txn_id) => Some(txn_id),
+            _ => None,
+        }
+    }
 }
 
 pub trait PaymentsPostSessionTokensRequestData {
 | 
	2025-09-08T16:59:01Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Implement card 3ds flow for Paysafe
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
Create a card 3ds payment for paysafe
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "amount": 1500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "aaaa",
    "payment_method": "card",
    "payment_method_type": "credit",
    "profile_id": "pro_ndJetHbOnmgPs4ed6FLr",
    "authentication_type" : "three_ds",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091", 
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "card_cvc": "111"
            
        }
    },
     "billing": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
      "shipping": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
        "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    }
}'
```
Response
```
{
    "payment_id": "pay_UZEf5nPy4rjBtygB8Wm1",
    "merchant_id": "merchant_1757407144",
    "status": "requires_customer_action",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 1500,
    "amount_received": null,
    "connector": "paysafe",
    "client_secret": "pay_UZEf5nPy4rjBtygB8Wm1_secret_mMQoKXN8QCHYDAl0fYKQ",
    "created": "2025-09-09T09:23:44.962Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_UZEf5nPy4rjBtygB8Wm1/merchant_1757407144/pay_UZEf5nPy4rjBtygB8Wm1_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1757409824,
        "expires": 1757413424,
        "secret": "epk_e1f53385eb104247b6d2a830b38696de"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_ndJetHbOnmgPs4ed6FLr",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uXktUCjj5V9CBf3x48Pz",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-09T09:38:44.962Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-09T09:23:46.684Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
complete the payment using redirection
2. sync payment 
```
curl --location 'http://localhost:8080/payments/pay_UZEf5nPy4rjBtygB8Wm1?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_tFbrAdIUEDW40STTsNQNk5dFxYgRoZPtPW7GtKCP7tbSapty2u1UuDBxl4zkLCxf'
```
Response
```
{
    "payment_id": "pay_UZEf5nPy4rjBtygB8Wm1",
    "merchant_id": "merchant_1757407144",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "paysafe",
    "client_secret": "pay_UZEf5nPy4rjBtygB8Wm1_secret_mMQoKXN8QCHYDAl0fYKQ",
    "created": "2025-09-09T09:23:44.962Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "3dbc45d1-878b-446c-8b97-3d299aa3effc",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_ndJetHbOnmgPs4ed6FLr",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uXktUCjj5V9CBf3x48Pz",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-09T09:38:44.962Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-09T09:25:27.509Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
cypress
<img width="1131" height="846" alt="Screenshot 2025-09-11 at 6 33 31 PM" src="https://github.com/user-attachments/assets/6e7669a6-6af3-4362-9afe-8cc8f832fd15" />
<img width="1201" height="813" alt="Screenshot 2025-09-11 at 6 33 59 PM" src="https://github.com/user-attachments/assets/3429e33b-6fbf-41a0-bb70-3de0add2f46c" />
After redirection i m using ngrok as , connector only allows https redirection. 
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	5ab8a27c10786885b91b79fbb9fb8b5e990029e1 | 
	Create a card 3ds payment for paysafe
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "amount": 1500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "aaaa",
    "payment_method": "card",
    "payment_method_type": "credit",
    "profile_id": "pro_ndJetHbOnmgPs4ed6FLr",
    "authentication_type" : "three_ds",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091", 
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "card_cvc": "111"
            
        }
    },
     "billing": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
      "shipping": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
        "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    }
}'
```
Response
```
{
    "payment_id": "pay_UZEf5nPy4rjBtygB8Wm1",
    "merchant_id": "merchant_1757407144",
    "status": "requires_customer_action",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 1500,
    "amount_received": null,
    "connector": "paysafe",
    "client_secret": "pay_UZEf5nPy4rjBtygB8Wm1_secret_mMQoKXN8QCHYDAl0fYKQ",
    "created": "2025-09-09T09:23:44.962Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_UZEf5nPy4rjBtygB8Wm1/merchant_1757407144/pay_UZEf5nPy4rjBtygB8Wm1_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1757409824,
        "expires": 1757413424,
        "secret": "epk_e1f53385eb104247b6d2a830b38696de"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_ndJetHbOnmgPs4ed6FLr",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uXktUCjj5V9CBf3x48Pz",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-09T09:38:44.962Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-09T09:23:46.684Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
complete the payment using redirection
2. sync payment 
```
curl --location 'http://localhost:8080/payments/pay_UZEf5nPy4rjBtygB8Wm1?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_tFbrAdIUEDW40STTsNQNk5dFxYgRoZPtPW7GtKCP7tbSapty2u1UuDBxl4zkLCxf'
```
Response
```
{
    "payment_id": "pay_UZEf5nPy4rjBtygB8Wm1",
    "merchant_id": "merchant_1757407144",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "paysafe",
    "client_secret": "pay_UZEf5nPy4rjBtygB8Wm1_secret_mMQoKXN8QCHYDAl0fYKQ",
    "created": "2025-09-09T09:23:44.962Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "3dbc45d1-878b-446c-8b97-3d299aa3effc",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_ndJetHbOnmgPs4ed6FLr",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uXktUCjj5V9CBf3x48Pz",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-09T09:38:44.962Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-09T09:25:27.509Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
cypress
<img width="1131" height="846" alt="Screenshot 2025-09-11 at 6 33 31 PM" src="https://github.com/user-attachments/assets/6e7669a6-6af3-4362-9afe-8cc8f832fd15" />
<img width="1201" height="813" alt="Screenshot 2025-09-11 at 6 33 59 PM" src="https://github.com/user-attachments/assets/3429e33b-6fbf-41a0-bb70-3de0add2f46c" />
After redirection i m using ngrok as , connector only allows https redirection. 
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9278 | 
	Bug: [BUG] payout status is not updated in outgoing webhook
### Bug Description
When an incoming webhook request triggers an outgoing webhooks request, it is triggered with a stale status.
### Expected Behavior
Outgoing webhooks triggered during incoming webhooks flow must contain the latest status.
### Actual Behavior
Outgoing webhooks triggered during incoming webhooks flow contains the stale status.
### Steps To Reproduce
-
### Context For The Bug
-
### Environment
-
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 4d38ce2ed02..b248955de4d 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -1157,7 +1157,7 @@ async fn payouts_incoming_webhook_flow(
                 payout_id: payouts.payout_id.clone(),
             });
 
-        let payout_data = Box::pin(payouts::make_payout_data(
+        let mut payout_data = Box::pin(payouts::make_payout_data(
             &state,
             &merchant_context,
             None,
@@ -1181,8 +1181,9 @@ async fn payouts_incoming_webhook_flow(
                     payout_attempt.payout_attempt_id
                 )
             })?;
+        payout_data.payout_attempt = updated_payout_attempt;
 
-        let event_type: Option<enums::EventType> = updated_payout_attempt.status.into();
+        let event_type: Option<enums::EventType> = payout_data.payout_attempt.status.into();
 
         // If event is NOT an UnsupportedEvent, trigger Outgoing Webhook
         if let Some(outgoing_event_type) = event_type {
@@ -1195,20 +1196,21 @@ async fn payouts_incoming_webhook_flow(
                 business_profile,
                 outgoing_event_type,
                 enums::EventClass::Payouts,
-                updated_payout_attempt
+                payout_data
+                    .payout_attempt
                     .payout_id
                     .get_string_repr()
                     .to_string(),
                 enums::EventObjectType::PayoutDetails,
                 api::OutgoingWebhookContent::PayoutDetails(Box::new(payout_create_response)),
-                Some(updated_payout_attempt.created_at),
+                Some(payout_data.payout_attempt.created_at),
             ))
             .await?;
         }
 
         Ok(WebhookResponseTracker::Payout {
-            payout_id: updated_payout_attempt.payout_id,
-            status: updated_payout_attempt.status,
+            payout_id: payout_data.payout_attempt.payout_id,
+            status: payout_data.payout_attempt.status,
         })
     } else {
         metrics::INCOMING_PAYOUT_WEBHOOK_SIGNATURE_FAILURE_METRIC.add(1, &[]);
 | 
	2025-09-04T12:28:47Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR fixes the state update for `payout_attempt` where latest status resides. This fixes the bug mentioned in https://github.com/juspay/hyperswitch/issues/9278
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
This change will allow the outgoing webhooks for payouts to receive the right status.
## How did you test it?
<details>
    <summary>1. Create a successful payout</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_o0Eo3tL2RDhcX3AzI9w5G5IguQslT7UDDYHne7W6QqjdBbQboNBTbHhW2ZuHFLIJ' \
        --data-raw '{"amount":100,"currency":"EUR","profile_id":"pro_BAzWgR1xTKZGtzWKCUea","customer":{"id":"cus_yvCM0YPCw76nC5Dj2Kwm","email":"new_cust@example.com","name":"John Doe","phone":"999999999","phone_country_code":"+65"},"connector":["adyen"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111 1111 1111 1111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"US","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_WIaDYW9nnqsiI50upbcg","merchant_id":"merchant_1756987500","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_yvCM0YPCw76nC5Dj2Kwm","customer":{"id":"cus_yvCM0YPCw76nC5Dj2Kwm","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_WIaDYW9nnqsiI50upbcg_secret_MBhR8Qp64emDZ3D0xsPq","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_B5g4wL5oJ6RGqSAdcsS5","status":"success","error_message":null,"error_code":null,"profile_id":"pro_BAzWgR1xTKZGtzWKCUea","created":"2025-09-04T12:22:28.359Z","connector_transaction_id":"TTGSSJV2MFZKTRV5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_8C3jiwCwp3fCfXMVcv6a"}
</details>
<details>
    <summary>2. Wait for incoming webhooks from Adyen and look at the status in outgoing webhook</summary>
Expectation - for `Adyen` the incoming webhook received for payout will be mapped to `initiated` - updating the payout status to `initiated` - the latest status (`initiated` in this case) should be propagated in the outgoing webhook.
HS outgoing webhook request
    {"merchant_id":"merchant_1756987500","event_id":"evt_019914af3ba678f1af65188c5722d96a","event_type":"payout_initiated","content":{"type":"payout_details","object":{"payout_id":"payout_WIaDYW9nnqsiI50upbcg","merchant_id":"merchant_1756987500","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_yvCM0YPCw76nC5Dj2Kwm","customer":{"id":"cus_yvCM0YPCw76nC5Dj2Kwm","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_WIaDYW9nnqsiI50upbcg_secret_MBhR8Qp64emDZ3D0xsPq","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_B5g4wL5oJ6RGqSAdcsS5","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_BAzWgR1xTKZGtzWKCUea","created":"2025-09-04T12:22:28.359Z","connector_transaction_id":"TTGSSJV2MFZKTRV5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_8C3jiwCwp3fCfXMVcv6a"}},"timestamp":"2025-09-04T12:24:12.454Z"}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	5e1fd0b187b99698936a8a0cb0d839a60b830de2 | 
	<details>
    <summary>1. Create a successful payout</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_o0Eo3tL2RDhcX3AzI9w5G5IguQslT7UDDYHne7W6QqjdBbQboNBTbHhW2ZuHFLIJ' \
        --data-raw '{"amount":100,"currency":"EUR","profile_id":"pro_BAzWgR1xTKZGtzWKCUea","customer":{"id":"cus_yvCM0YPCw76nC5Dj2Kwm","email":"new_cust@example.com","name":"John Doe","phone":"999999999","phone_country_code":"+65"},"connector":["adyen"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111 1111 1111 1111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"US","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_WIaDYW9nnqsiI50upbcg","merchant_id":"merchant_1756987500","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_yvCM0YPCw76nC5Dj2Kwm","customer":{"id":"cus_yvCM0YPCw76nC5Dj2Kwm","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_WIaDYW9nnqsiI50upbcg_secret_MBhR8Qp64emDZ3D0xsPq","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_B5g4wL5oJ6RGqSAdcsS5","status":"success","error_message":null,"error_code":null,"profile_id":"pro_BAzWgR1xTKZGtzWKCUea","created":"2025-09-04T12:22:28.359Z","connector_transaction_id":"TTGSSJV2MFZKTRV5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_8C3jiwCwp3fCfXMVcv6a"}
</details>
<details>
    <summary>2. Wait for incoming webhooks from Adyen and look at the status in outgoing webhook</summary>
Expectation - for `Adyen` the incoming webhook received for payout will be mapped to `initiated` - updating the payout status to `initiated` - the latest status (`initiated` in this case) should be propagated in the outgoing webhook.
HS outgoing webhook request
    {"merchant_id":"merchant_1756987500","event_id":"evt_019914af3ba678f1af65188c5722d96a","event_type":"payout_initiated","content":{"type":"payout_details","object":{"payout_id":"payout_WIaDYW9nnqsiI50upbcg","merchant_id":"merchant_1756987500","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_yvCM0YPCw76nC5Dj2Kwm","customer":{"id":"cus_yvCM0YPCw76nC5Dj2Kwm","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_WIaDYW9nnqsiI50upbcg_secret_MBhR8Qp64emDZ3D0xsPq","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_B5g4wL5oJ6RGqSAdcsS5","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_BAzWgR1xTKZGtzWKCUea","created":"2025-09-04T12:22:28.359Z","connector_transaction_id":"TTGSSJV2MFZKTRV5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_8C3jiwCwp3fCfXMVcv6a"}},"timestamp":"2025-09-04T12:24:12.454Z"}
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9295 | 
	Bug: feat(webhooks): Provide outgoing webhook support for revenue recovery
Provide outgoing webhook support for revenue recovery. Based on the retry status send out outgoing webhooks to the url in business profile in v2. | 
	diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index bb53eb1b6ee..52f75bbe8be 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -6170,6 +6170,11 @@ pub struct PaymentsResponse {
     #[serde(with = "common_utils::custom_serde::iso8601")]
     pub created: PrimitiveDateTime,
 
+    /// Time when the payment was last modified
+    #[schema(example = "2022-09-10T10:11:12Z")]
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub modified_at: PrimitiveDateTime,
+
     /// The payment method information provided for making a payment
     #[schema(value_type = Option<PaymentMethodDataResponseWithBilling>)]
     #[serde(serialize_with = "serialize_payment_method_data_response")]
@@ -6252,6 +6257,10 @@ pub struct PaymentsResponse {
 
     /// Additional data that might be required by hyperswitch based on the additional features.
     pub feature_metadata: Option<FeatureMetadata>,
+
+    /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
+    #[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
+    pub metadata: Option<pii::SecretSerdeValue>,
 }
 
 #[cfg(feature = "v2")]
@@ -9662,6 +9671,10 @@ pub struct RecoveryPaymentsCreate {
 
     /// Type of action that needs to be taken after consuming the recovery payload. For example: scheduling a failed payment or stopping the invoice.
     pub action: common_payments_types::RecoveryAction,
+
+    /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
+    #[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
+    pub metadata: Option<pii::SecretSerdeValue>,
 }
 
 /// Error details for the payment
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 6d942980e2f..83e4795f3ef 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -612,6 +612,7 @@ impl TryFrom<ChargebeeInvoiceBody> for revenue_recovery::RevenueRecoveryInvoiceD
             retry_count,
             next_billing_at: invoice_next_billing_time,
             billing_started_at,
+            metadata: None,
         })
     }
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
index a44a4d31a95..17b7fbd6ed6 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
@@ -422,6 +422,7 @@ impl TryFrom<StripebillingInvoiceBody> for revenue_recovery::RevenueRecoveryInvo
             retry_count: Some(item.data.object.attempt_count),
             next_billing_at,
             billing_started_at,
+            metadata: None,
         })
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 6249053c36b..c8ac34f8613 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -964,7 +964,7 @@ impl<F: Clone> PaymentConfirmData<F> {
 }
 
 #[cfg(feature = "v2")]
-#[derive(Clone)]
+#[derive(Clone, Debug)]
 pub struct PaymentStatusData<F>
 where
     F: Clone,
diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
index 094905b1baf..8377fb06cba 100644
--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
@@ -1,6 +1,6 @@
 use api_models::{payments as api_payments, webhooks};
 use common_enums::enums as common_enums;
-use common_utils::{id_type, types as util_types};
+use common_utils::{id_type, pii, types as util_types};
 use time::PrimitiveDateTime;
 
 use crate::{
@@ -77,6 +77,8 @@ pub struct RevenueRecoveryInvoiceData {
     pub next_billing_at: Option<PrimitiveDateTime>,
     /// Invoice Starting Time
     pub billing_started_at: Option<PrimitiveDateTime>,
+    /// metadata of the merchant
+    pub metadata: Option<pii::SecretSerdeValue>,
 }
 
 #[derive(Clone, Debug)]
@@ -153,7 +155,7 @@ impl From<&RevenueRecoveryInvoiceData> for api_payments::PaymentsCreateIntentReq
             statement_descriptor: None,
             order_details: None,
             allowed_payment_method_types: None,
-            metadata: None,
+            metadata: data.metadata.clone(),
             connector_metadata: None,
             feature_metadata: None,
             payment_link_enabled: None,
@@ -178,6 +180,7 @@ impl From<&BillingConnectorInvoiceSyncResponse> for RevenueRecoveryInvoiceData {
             retry_count: data.retry_count,
             next_billing_at: data.ends_at,
             billing_started_at: data.created_at,
+            metadata: None,
         }
     }
 }
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 595b437675e..6c9a1babb7d 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2390,6 +2390,7 @@ where
             customer_id: payment_intent.customer_id.clone(),
             connector: Some(connector),
             created: payment_intent.created_at,
+            modified_at: payment_intent.modified_at,
             payment_method_data,
             payment_method_type: Some(payment_attempt.payment_method_type),
             payment_method_subtype: Some(payment_attempt.payment_method_subtype),
@@ -2410,7 +2411,10 @@ where
             is_iframe_redirection_enabled: None,
             merchant_reference_id: payment_intent.merchant_reference_id.clone(),
             raw_connector_response,
-            feature_metadata: None,
+            feature_metadata: payment_intent
+                .feature_metadata
+                .map(|feature_metadata| feature_metadata.convert_back()),
+            metadata: payment_intent.metadata,
         };
 
         Ok(services::ApplicationResponse::JsonWithHeaders((
@@ -2501,6 +2505,7 @@ where
                 .map(From::from),
             shipping: self.payment_address.get_shipping().cloned().map(From::from),
             created: payment_intent.created_at,
+            modified_at: payment_intent.modified_at,
             payment_method_data,
             payment_method_type: Some(payment_attempt.payment_method_type),
             payment_method_subtype: Some(payment_attempt.payment_method_subtype),
@@ -2519,7 +2524,10 @@ where
             is_iframe_redirection_enabled: payment_intent.is_iframe_redirection_enabled,
             merchant_reference_id: payment_intent.merchant_reference_id.clone(),
             raw_connector_response,
-            feature_metadata: None,
+            feature_metadata: payment_intent
+                .feature_metadata
+                .map(|feature_metadata| feature_metadata.convert_back()),
+            metadata: payment_intent.metadata,
         };
 
         Ok(services::ApplicationResponse::JsonWithHeaders((
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index f714564e1f3..f9662a745dd 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -1,29 +1,45 @@
 pub mod api;
 pub mod transformers;
 pub mod types;
-use api_models::{enums, process_tracker::revenue_recovery, webhooks};
+use std::marker::PhantomData;
+
+use api_models::{
+    enums,
+    payments::{self as api_payments, PaymentsResponse},
+    process_tracker::revenue_recovery,
+    webhooks,
+};
 use common_utils::{
     self,
     errors::CustomResult,
-    ext_traits::{OptionExt, ValueExt},
+    ext_traits::{AsyncExt, OptionExt, ValueExt},
     id_type,
 };
 use diesel_models::{enums as diesel_enum, process_tracker::business_status};
 use error_stack::{self, ResultExt};
 use hyperswitch_domain_models::{
-    payments::PaymentIntent, revenue_recovery as domain_revenue_recovery,
-    ApiModelToDieselModelConvertor,
+    merchant_context,
+    payments::{PaymentIntent, PaymentStatusData},
+    revenue_recovery as domain_revenue_recovery, ApiModelToDieselModelConvertor,
 };
 use scheduler::errors as sch_errors;
 
 use crate::{
-    core::errors::{self, RouterResponse, RouterResult, StorageErrorExt},
+    core::{
+        errors::{self, RouterResponse, RouterResult, StorageErrorExt},
+        payments::{
+            self,
+            operations::{GetTrackerResponse, Operation},
+            transformers::GenerateResponse,
+        },
+        revenue_recovery::types::RevenueRecoveryOutgoingWebhook,
+    },
     db::StorageInterface,
     logger,
     routes::{app::ReqState, metrics, SessionState},
     services::ApplicationResponse,
     types::{
-        domain,
+        api as router_api_types, domain,
         storage::{self, revenue_recovery as pcr},
         transformers::{ForeignFrom, ForeignInto},
     },
@@ -220,7 +236,7 @@ pub async fn perform_execute_payment(
             .await;
 
             match record_attempt {
-                Ok(_) => {
+                Ok(record_attempt_response) => {
                     let action = Box::pin(types::Action::execute_payment(
                         state,
                         revenue_recovery_payment_data.merchant_account.get_id(),
@@ -230,6 +246,7 @@ pub async fn perform_execute_payment(
                         merchant_context,
                         revenue_recovery_payment_data,
                         &revenue_recovery_metadata,
+                        &record_attempt_response.id,
                     ))
                     .await?;
                     Box::pin(action.execute_payment_task_response_handler(
@@ -414,10 +431,12 @@ pub async fn perform_payments_sync(
         state,
         &tracking_data.global_payment_id,
         revenue_recovery_payment_data,
+        true,
+        true,
     )
     .await?;
 
-    let payment_attempt = psync_data.payment_attempt;
+    let payment_attempt = psync_data.payment_attempt.clone();
     let mut revenue_recovery_metadata = payment_intent
         .feature_metadata
         .as_ref()
@@ -426,6 +445,12 @@ pub async fn perform_payments_sync(
         .convert_back();
     let pcr_status: types::RevenueRecoveryPaymentsAttemptStatus =
         payment_attempt.status.foreign_into();
+
+    let new_revenue_recovery_payment_data = &pcr::RevenueRecoveryPaymentData {
+        psync_data: Some(psync_data),
+        ..revenue_recovery_payment_data.clone()
+    };
+
     Box::pin(
         pcr_status.update_pt_status_based_on_attempt_status_for_payments_sync(
             state,
@@ -433,7 +458,7 @@ pub async fn perform_payments_sync(
             process.clone(),
             profile,
             merchant_context,
-            revenue_recovery_payment_data,
+            new_revenue_recovery_payment_data,
             payment_attempt,
             &mut revenue_recovery_metadata,
         ),
@@ -457,6 +482,8 @@ pub async fn perform_calculate_workflow(
     let profile_id = revenue_recovery_payment_data.profile.get_id();
     let billing_mca_id = revenue_recovery_payment_data.billing_mca.get_id();
 
+    let mut event_type: Option<common_enums::EventType> = None;
+
     logger::info!(
         process_id = %process.id,
         payment_id = %tracking_data.global_payment_id.get_string_repr(),
@@ -488,6 +515,20 @@ pub async fn perform_calculate_workflow(
         }
     };
 
+    // External Payments which enter the calculate workflow for the first time will have active attempt id as None
+    // Then we dont need to send an webhook to the merchant as its not a failure from our side.
+    // Thus we dont need to a payment get call for such payments.
+    let active_payment_attempt_id = payment_intent.active_attempt_id.as_ref();
+
+    let payments_response = get_payment_response_using_payment_get_operation(
+        state,
+        &tracking_data.global_payment_id,
+        revenue_recovery_payment_data,
+        &merchant_context_from_revenue_recovery_payment_data,
+        active_payment_attempt_id,
+    )
+    .await?;
+
     // 2. Get best available token
     let best_time_to_schedule = match workflows::revenue_recovery::get_token_with_schedule_time_based_on_retry_algorithm_type(
         state,
@@ -517,6 +558,14 @@ pub async fn perform_calculate_workflow(
                 "Found best available token, creating EXECUTE_WORKFLOW task"
             );
 
+            // reset active attmept id and payment connector transmission before going to execute workflow
+            let  _ = Box::pin(reset_connector_transmission_and_active_attempt_id_before_pushing_to_execute_workflow(
+                state,
+                payment_intent,
+                revenue_recovery_payment_data,
+                active_payment_attempt_id
+            )).await?;
+
             // 3. If token found: create EXECUTE_WORKFLOW task and finish CALCULATE_WORKFLOW
             insert_execute_pcr_task_to_pt(
                 &tracking_data.billing_mca_id,
@@ -649,6 +698,8 @@ pub async fn perform_calculate_workflow(
                                     sch_errors::ProcessTrackerError::ProcessUpdateFailed
                                 })?;
 
+                            event_type = Some(common_enums::EventType::PaymentFailed);
+
                             logger::info!(
                                 process_id = %process.id,
                                 connector_customer_id = %connector_customer_id,
@@ -660,6 +711,34 @@ pub async fn perform_calculate_workflow(
             }
         }
     }
+
+    let _outgoing_webhook = event_type.and_then(|event_kind| {
+        payments_response.map(|resp| Some((event_kind, resp)))
+    })
+    .flatten()
+    .async_map(|(event_kind, response)| async move {
+        let _ = RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+            state,
+            common_enums::EventClass::Payments,
+            event_kind,
+            payment_intent,
+            &merchant_context,
+            profile,
+            tracking_data.payment_attempt_id.get_string_repr().to_string(),
+            response
+        )
+        .await
+        .map_err(|e| {
+            logger::error!(
+                error = ?e,
+                "Failed to send outgoing webhook"
+            );
+            e
+        })
+        .ok();
+    }
+    ).await;
+
     Ok(())
 }
 
@@ -937,3 +1016,88 @@ pub async fn retrieve_revenue_recovery_process_tracker(
     };
     Ok(ApplicationResponse::Json(response))
 }
+
+pub async fn get_payment_response_using_payment_get_operation(
+    state: &SessionState,
+    payment_intent_id: &id_type::GlobalPaymentId,
+    revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData,
+    merchant_context: &domain::MerchantContext,
+    active_payment_attempt_id: Option<&id_type::GlobalAttemptId>,
+) -> Result<Option<ApplicationResponse<PaymentsResponse>>, sch_errors::ProcessTrackerError> {
+    match active_payment_attempt_id {
+        Some(_) => {
+            let payment_response = api::call_psync_api(
+                state,
+                payment_intent_id,
+                revenue_recovery_payment_data,
+                false,
+                false,
+            )
+            .await?;
+            let payments_response = payment_response.generate_response(
+                state,
+                None,
+                None,
+                None,
+                merchant_context,
+                &revenue_recovery_payment_data.profile,
+                None,
+            )?;
+
+            Ok(Some(payments_response))
+        }
+        None => Ok(None),
+    }
+}
+
+// This function can be implemented to reset the connector transmission and active attempt ID
+// before pushing to the execute workflow.
+pub async fn reset_connector_transmission_and_active_attempt_id_before_pushing_to_execute_workflow(
+    state: &SessionState,
+    payment_intent: &PaymentIntent,
+    revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData,
+    active_payment_attempt_id: Option<&id_type::GlobalAttemptId>,
+) -> Result<Option<()>, sch_errors::ProcessTrackerError> {
+    let mut revenue_recovery_metadata = payment_intent
+        .feature_metadata
+        .as_ref()
+        .and_then(|feature_metadata| feature_metadata.payment_revenue_recovery_metadata.clone())
+        .get_required_value("Payment Revenue Recovery Metadata")?
+        .convert_back();
+    match active_payment_attempt_id {
+        Some(_) => {
+            // update the connector payment transmission field to Unsuccessful and unset active attempt id
+            revenue_recovery_metadata.set_payment_transmission_field_for_api_request(
+                enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful,
+            );
+
+            let payment_update_req =
+        api_payments::PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api(
+            payment_intent
+                .feature_metadata
+                .clone()
+                .unwrap_or_default()
+                .convert_back()
+                .set_payment_revenue_recovery_metadata_using_api(
+                    revenue_recovery_metadata.clone(),
+                ),
+            enums::UpdateActiveAttempt::Unset,
+        );
+            logger::info!(
+                "Call made to payments update intent api , with the request body {:?}",
+                payment_update_req
+            );
+            api::update_payment_intent_api(
+                state,
+                payment_intent.id.clone(),
+                revenue_recovery_payment_data,
+                payment_update_req,
+            )
+            .await
+            .change_context(errors::RecoveryError::PaymentCallFailed)?;
+
+            Ok(Some(()))
+        }
+        None => Ok(None),
+    }
+}
diff --git a/crates/router/src/core/revenue_recovery/api.rs b/crates/router/src/core/revenue_recovery/api.rs
index f7172e2369f..fe919979086 100644
--- a/crates/router/src/core/revenue_recovery/api.rs
+++ b/crates/router/src/core/revenue_recovery/api.rs
@@ -32,12 +32,14 @@ pub async fn call_psync_api(
     state: &SessionState,
     global_payment_id: &id_type::GlobalPaymentId,
     revenue_recovery_data: &revenue_recovery_types::RevenueRecoveryPaymentData,
+    force_sync_bool: bool,
+    expand_attempts_bool: bool,
 ) -> RouterResult<payments_domain::PaymentStatusData<api_types::PSync>> {
     let operation = payments::operations::PaymentGet;
     let req = payments_api::PaymentsRetrieveRequest {
-        force_sync: true,
+        force_sync: force_sync_bool,
         param: None,
-        expand_attempts: true,
+        expand_attempts: expand_attempts_bool,
         return_raw_connector_response: None,
         merchant_connector_details: None,
     };
diff --git a/crates/router/src/core/revenue_recovery/transformers.rs b/crates/router/src/core/revenue_recovery/transformers.rs
index 9835999627f..df6e430a112 100644
--- a/crates/router/src/core/revenue_recovery/transformers.rs
+++ b/crates/router/src/core/revenue_recovery/transformers.rs
@@ -56,6 +56,7 @@ impl ForeignFrom<api_models::payments::RecoveryPaymentsCreate>
             retry_count: None,
             next_billing_at: None,
             billing_started_at: data.billing_started_at,
+            metadata: data.metadata,
         }
     }
 }
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index 40532480d38..0b7fb4ad062 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -17,11 +17,12 @@ use diesel_models::{
 };
 use error_stack::{self, ResultExt};
 use hyperswitch_domain_models::{
+    api::ApplicationResponse,
     business_profile, merchant_connector_account,
     merchant_context::{Context, MerchantContext},
     payments::{
         self as domain_payments, payment_attempt::PaymentAttempt, PaymentConfirmData,
-        PaymentIntent, PaymentIntentData,
+        PaymentIntent, PaymentIntentData, PaymentStatusData,
     },
     router_data_v2::{self, flow_common_types},
     router_flow_types,
@@ -35,9 +36,11 @@ use super::errors::StorageErrorExt;
 use crate::{
     core::{
         errors::{self, RouterResult},
-        payments::{self, helpers, operations::Operation},
+        payments::{self, helpers, operations::Operation, transformers::GenerateResponse},
         revenue_recovery::{self as revenue_recovery_core, pcr, perform_calculate_workflow},
-        webhooks::recovery_incoming as recovery_incoming_flow,
+        webhooks::{
+            create_event_and_trigger_outgoing_webhook, recovery_incoming as recovery_incoming_flow,
+        },
     },
     db::StorageInterface,
     logger,
@@ -137,6 +140,12 @@ impl RevenueRecoveryPaymentsAttemptStatus {
 
         let retry_count = process_tracker.retry_count;
 
+        let psync_response = revenue_recovery_payment_data
+            .psync_data
+            .as_ref()
+            .ok_or(errors::RecoveryError::ValueNotFound)
+            .attach_printable("Psync data not found in revenue recovery payment data")?;
+
         match self {
             Self::Succeeded => {
                 // finish psync task as the payment was a success
@@ -146,6 +155,9 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                         business_status::PSYNC_WORKFLOW_COMPLETE,
                     )
                     .await?;
+
+                let event_status = common_enums::EventType::PaymentSucceeded;
+
                 // publish events to kafka
                 if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka(
                     state,
@@ -177,6 +189,27 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                 )
                 .await;
 
+                let payments_response = psync_response
+                    .clone()
+                    .generate_response(state, None, None, None, &merchant_context, profile, None)
+                    .change_context(errors::RecoveryError::PaymentsResponseGenerationFailed)
+                    .attach_printable("Failed while generating response for payment")?;
+
+                RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+                    state,
+                    common_enums::EventClass::Payments,
+                    event_status,
+                    payment_intent,
+                    &merchant_context,
+                    profile,
+                    recovery_payment_attempt
+                        .attempt_id
+                        .get_string_repr()
+                        .to_string(),
+                    payments_response
+                )
+                .await?;
+
                 // Record a successful transaction back to Billing Connector
                 // TODO: Add support for retrying failed outgoing recordback webhooks
                 record_back_to_billing_connector(
@@ -233,14 +266,15 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                 .await;
 
                 // Reopen calculate workflow on payment failure
-                reopen_calculate_workflow_on_payment_failure(
+                Box::pin(reopen_calculate_workflow_on_payment_failure(
                     state,
                     &process_tracker,
                     profile,
                     merchant_context,
                     payment_intent,
                     revenue_recovery_payment_data,
-                )
+                    psync_response.payment_attempt.get_id(),
+                ))
                 .await?;
             }
             Self::Processing => {
@@ -308,6 +342,8 @@ impl Decision {
                     state,
                     payment_id,
                     revenue_recovery_data,
+                    true,
+                    true,
                 )
                 .await
                 .change_context(errors::RecoveryError::PaymentCallFailed)
@@ -324,6 +360,8 @@ impl Decision {
                     state,
                     payment_id,
                     revenue_recovery_data,
+                    true,
+                    true,
                 )
                 .await
                 .change_context(errors::RecoveryError::PaymentCallFailed)
@@ -368,6 +406,7 @@ impl Action {
         merchant_context: domain::MerchantContext,
         revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
         revenue_recovery_metadata: &PaymentRevenueRecoveryMetadata,
+        latest_attempt_id: &id_type::GlobalAttemptId,
     ) -> RecoveryResult<Self> {
         let connector_customer_id = payment_intent
             .extract_connector_customer_id_from_payment_intent()
@@ -426,7 +465,6 @@ impl Action {
                     hyperswitch_domain_models::revenue_recovery::RecoveryPaymentIntent::from(
                         payment_intent,
                     );
-
                 // handle proxy api's response
                 match response {
                     Ok(payment_data) => match payment_data.payment_attempt.status.foreign_into() {
@@ -444,16 +482,16 @@ impl Action {
 
                             // publish events to kafka
                             if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka(
-                            state,
-                            &recovery_payment_tuple,
-                            Some(process.retry_count+1)
-                        )
-                        .await{
-                            router_env::logger::error!(
-                                "Failed to publish revenue recovery event to kafka: {:?}",
-                                e
-                            );
-                        };
+                                state,
+                                &recovery_payment_tuple,
+                                Some(process.retry_count+1)
+                            )
+                            .await{
+                                router_env::logger::error!(
+                                    "Failed to publish revenue recovery event to kafka: {:?}",
+                                    e
+                                );
+                            };
 
                             let is_hard_decline = revenue_recovery::check_hard_decline(
                                 state,
@@ -474,10 +512,40 @@ impl Action {
 
                             // unlocking the token
                             let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
-                    state,
-                    &connector_customer_id,
-                )
-                .await;
+                                state,
+                                &connector_customer_id,
+                            )
+                            .await;
+
+                            let event_status = common_enums::EventType::PaymentSucceeded;
+
+                            let payments_response = payment_data
+                                .clone()
+                                .generate_response(
+                                    state,
+                                    None,
+                                    None,
+                                    None,
+                                    &merchant_context,
+                                    profile,
+                                    None,
+                                )
+                                .change_context(
+                                    errors::RecoveryError::PaymentsResponseGenerationFailed,
+                                )
+                                .attach_printable("Failed while generating response for payment")?;
+
+                            RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+                                state,
+                                common_enums::EventClass::Payments,
+                                event_status,
+                                payment_intent,
+                                &merchant_context,
+                                profile,
+                                payment_data.payment_attempt.id.get_string_repr().to_string(),
+                                payments_response
+                            )
+                            .await?;
 
                             Ok(Self::SuccessfulPayment(
                                 payment_data.payment_attempt.clone(),
@@ -541,14 +609,15 @@ impl Action {
                             .await;
 
                             // Reopen calculate workflow on payment failure
-                            reopen_calculate_workflow_on_payment_failure(
+                            Box::pin(reopen_calculate_workflow_on_payment_failure(
                                 state,
                                 process,
                                 profile,
                                 merchant_context,
                                 payment_intent,
                                 revenue_recovery_payment_data,
-                            )
+                                latest_attempt_id,
+                            ))
                             .await?;
 
                             // Return terminal failure to finish the current execute workflow
@@ -576,6 +645,8 @@ impl Action {
                     state,
                     payment_intent.get_id(),
                     revenue_recovery_payment_data,
+                    true,
+                    true,
                 )
                 .await;
 
@@ -690,36 +761,6 @@ impl Action {
                 Ok(())
             }
             Self::TerminalFailure(payment_attempt) => {
-                // update the connector payment transmission field to Unsuccessful and unset active attempt id
-                revenue_recovery_metadata.set_payment_transmission_field_for_api_request(
-                    enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful,
-                );
-
-                let payment_update_req =
-                PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api(
-                    payment_intent
-                        .feature_metadata
-                        .clone()
-                        .unwrap_or_default()
-                        .convert_back()
-                        .set_payment_revenue_recovery_metadata_using_api(
-                            revenue_recovery_metadata.clone(),
-                        ),
-                    api_enums::UpdateActiveAttempt::Unset,
-                );
-                logger::info!(
-                    "Call made to payments update intent api , with the request body {:?}",
-                    payment_update_req
-                );
-                revenue_recovery_core::api::update_payment_intent_api(
-                    state,
-                    payment_intent.id.clone(),
-                    revenue_recovery_payment_data,
-                    payment_update_req,
-                )
-                .await
-                .change_context(errors::RecoveryError::PaymentCallFailed)?;
-
                 db.as_scheduler()
                     .finish_process_with_business_status(
                         execute_task_process.clone(),
@@ -794,6 +835,8 @@ impl Action {
             state,
             payment_intent.get_id(),
             revenue_recovery_payment_data,
+            true,
+            true,
         )
         .await;
         let used_token = get_payment_processor_token_id_from_payment_attempt(&payment_attempt);
@@ -856,14 +899,15 @@ impl Action {
                     .await;
 
                     // Reopen calculate workflow on payment failure
-                    reopen_calculate_workflow_on_payment_failure(
+                    Box::pin(reopen_calculate_workflow_on_payment_failure(
                         state,
                         process,
                         profile,
                         merchant_context,
                         payment_intent,
                         revenue_recovery_payment_data,
-                    )
+                        payment_attempt.get_id(),
+                    ))
                     .await?;
 
                     Ok(Self::TerminalFailure(payment_attempt.clone()))
@@ -937,37 +981,6 @@ impl Action {
                     .change_context(errors::RecoveryError::ProcessTrackerFailure)
                     .attach_printable("Failed to update the process tracker")?;
 
-                // update the connector payment transmission field to Unsuccessful and unset active attempt id
-                revenue_recovery_metadata.set_payment_transmission_field_for_api_request(
-                    enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful,
-                );
-
-                let payment_update_req =
-                PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api(
-                    payment_intent
-                        .feature_metadata
-                        .clone()
-                        .unwrap_or_default()
-                        .convert_back()
-                        .set_payment_revenue_recovery_metadata_using_api(
-                            revenue_recovery_metadata.clone(),
-                        ),
-                    api_enums::UpdateActiveAttempt::Unset,
-                );
-                logger::info!(
-                    "Call made to payments update intent api , with the request body {:?}",
-                    payment_update_req
-                );
-
-                revenue_recovery_core::api::update_payment_intent_api(
-                    state,
-                    payment_intent.id.clone(),
-                    revenue_recovery_payment_data,
-                    payment_update_req,
-                )
-                .await
-                .change_context(errors::RecoveryError::PaymentCallFailed)?;
-
                 // fetch the execute task
                 let task = revenue_recovery_core::EXECUTE_WORKFLOW;
                 let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
@@ -990,37 +1003,6 @@ impl Action {
             }
 
             Self::TerminalFailure(payment_attempt) => {
-                // update the connector payment transmission field to Unsuccessful and unset active attempt id
-                revenue_recovery_metadata.set_payment_transmission_field_for_api_request(
-                    enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful,
-                );
-
-                let payment_update_req =
-                PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api(
-                    payment_intent
-                        .feature_metadata
-                        .clone()
-                        .unwrap_or_default()
-                        .convert_back()
-                        .set_payment_revenue_recovery_metadata_using_api(
-                            revenue_recovery_metadata.clone(),
-                        ),
-                    api_enums::UpdateActiveAttempt::Unset,
-                );
-                logger::info!(
-                    "Call made to payments update intent api , with the request body {:?}",
-                    payment_update_req
-                );
-
-                revenue_recovery_core::api::update_payment_intent_api(
-                    state,
-                    payment_intent.id.clone(),
-                    revenue_recovery_payment_data,
-                    payment_update_req,
-                )
-                .await
-                .change_context(errors::RecoveryError::PaymentCallFailed)?;
-
                 // TODO: Add support for retrying failed outgoing recordback webhooks
                 // finish the current psync task
                 db.as_scheduler()
@@ -1150,12 +1132,27 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
     merchant_context: domain::MerchantContext,
     payment_intent: &PaymentIntent,
     revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
+    latest_attempt_id: &id_type::GlobalAttemptId,
 ) -> RecoveryResult<()> {
     let db = &*state.store;
     let id = payment_intent.id.clone();
     let task = revenue_recovery_core::CALCULATE_WORKFLOW;
     let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
 
+    let old_tracking_data: pcr::RevenueRecoveryWorkflowTrackingData =
+        serde_json::from_value(process.tracking_data.clone())
+            .change_context(errors::RecoveryError::ValueNotFound)
+            .attach_printable("Failed to deserialize the tracking data from process tracker")?;
+
+    let new_tracking_data = pcr::RevenueRecoveryWorkflowTrackingData {
+        payment_attempt_id: latest_attempt_id.clone(),
+        ..old_tracking_data
+    };
+
+    let tracking_data = serde_json::to_value(new_tracking_data)
+        .change_context(errors::RecoveryError::ValueNotFound)
+        .attach_printable("Failed to serialize the tracking data for process tracker")?;
+
     // Construct the process tracker ID for CALCULATE_WORKFLOW
     let process_tracker_id = format!("{}_{}_{}", runner, task, id.get_string_repr());
 
@@ -1201,7 +1198,7 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
                 name: Some(task.to_string()),
                 retry_count: Some(new_retry_count),
                 schedule_time: Some(new_schedule_time),
-                tracking_data: Some(process.clone().tracking_data),
+                tracking_data: Some(tracking_data),
                 business_status: Some(String::from(business_status::PENDING)),
                 status: Some(common_enums::ProcessTrackerStatus::Pending),
                 updated_at: Some(common_utils::date_time::now()),
@@ -1301,7 +1298,7 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
                 .attach_printable("Failed to deserialize the tracking data from process tracker")?;
 
             // Call the existing perform_calculate_workflow function
-            perform_calculate_workflow(
+            Box::pin(perform_calculate_workflow(
                 state,
                 process,
                 profile,
@@ -1309,7 +1306,7 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
                 &tracking_data,
                 revenue_recovery_payment_data,
                 payment_intent,
-            )
+            ))
             .await
             .change_context(errors::RecoveryError::ProcessTrackerFailure)
             .attach_printable("Failed to perform calculate workflow")?;
@@ -1476,3 +1473,50 @@ pub fn get_payment_processor_token_id_from_payment_attempt(
 
     used_token
 }
+
+pub struct RevenueRecoveryOutgoingWebhook;
+
+impl RevenueRecoveryOutgoingWebhook {
+    #[allow(clippy::too_many_arguments)]
+    pub async fn send_outgoing_webhook_based_on_revenue_recovery_status(
+        state: &SessionState,
+        event_class: common_enums::EventClass,
+        event_status: common_enums::EventType,
+        payment_intent: &PaymentIntent,
+        merchant_context: &domain::MerchantContext,
+        profile: &domain::Profile,
+        payment_attempt_id: String,
+        payments_response: ApplicationResponse<api_models::payments::PaymentsResponse>,
+    ) -> RecoveryResult<()> {
+        match payments_response {
+            ApplicationResponse::JsonWithHeaders((response, _headers)) => {
+                let outgoing_webhook_content =
+                    api_models::webhooks::OutgoingWebhookContent::PaymentDetails(Box::new(
+                        response,
+                    ));
+                create_event_and_trigger_outgoing_webhook(
+                    state.clone(),
+                    profile.clone(),
+                    merchant_context.get_merchant_key_store(),
+                    event_status,
+                    event_class,
+                    payment_attempt_id,
+                    enums::EventObjectType::PaymentDetails,
+                    outgoing_webhook_content,
+                    payment_intent.created_at,
+                )
+                .await
+                .change_context(errors::RecoveryError::InvalidTask)
+                .attach_printable("Failed to send out going webhook")?;
+
+                Ok(())
+            }
+
+            _other_variant => {
+                // Handle other successful response types if needed
+                logger::warn!("Unexpected application response variant for outgoing webhook");
+                Err(errors::RecoveryError::RevenueRecoveryOutgoingWebhookFailed.into())
+            }
+        }
+    }
+}
diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs
index 48110eb92ed..4cde3bd99f8 100644
--- a/crates/router/src/types/storage/revenue_recovery.rs
+++ b/crates/router/src/types/storage/revenue_recovery.rs
@@ -7,7 +7,7 @@ use external_services::grpc_client::{self as external_grpc_client, GrpcHeaders};
 use hyperswitch_domain_models::{
     business_profile, merchant_account, merchant_connector_account, merchant_key_store,
     payment_method_data::{Card, PaymentMethodData},
-    payments::{payment_attempt::PaymentAttempt, PaymentIntent},
+    payments::{payment_attempt::PaymentAttempt, PaymentIntent, PaymentStatusData},
 };
 use masking::PeekInterface;
 use router_env::logger;
@@ -32,6 +32,7 @@ pub struct RevenueRecoveryPaymentData {
     pub key_store: merchant_key_store::MerchantKeyStore,
     pub billing_mca: merchant_connector_account::MerchantConnectorAccount,
     pub retry_algorithm: enums::RevenueRecoveryAlgorithmType,
+    pub psync_data: Option<PaymentStatusData<types::api::PSync>>,
 }
 impl RevenueRecoveryPaymentData {
     pub async fn get_schedule_time_based_on_retry_type(
diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs
index 6a6d9511062..e87b26e4c15 100644
--- a/crates/router/src/workflows/revenue_recovery.rs
+++ b/crates/router/src/workflows/revenue_recovery.rs
@@ -232,6 +232,7 @@ pub(crate) async fn extract_data_and_perform_action(
         retry_algorithm: profile
             .revenue_recovery_retry_algorithm_type
             .unwrap_or(tracking_data.revenue_recovery_retry),
+        psync_data: None,
     };
     Ok(pcr_payment_data)
 }
diff --git a/crates/storage_impl/src/errors.rs b/crates/storage_impl/src/errors.rs
index a2b4dad779b..3aade73383c 100644
--- a/crates/storage_impl/src/errors.rs
+++ b/crates/storage_impl/src/errors.rs
@@ -288,6 +288,10 @@ pub enum RecoveryError {
     RecordBackToBillingConnectorFailed,
     #[error("Failed to fetch billing connector account id")]
     BillingMerchantConnectorAccountIdNotFound,
+    #[error("Failed to generate payment sync data")]
+    PaymentsResponseGenerationFailed,
+    #[error("Outgoing Webhook Failed")]
+    RevenueRecoveryOutgoingWebhookFailed,
 }
 #[derive(Debug, Clone, thiserror::Error)]
 pub enum HealthCheckDecisionEngineError {
 | 
	2025-09-07T20:28:56Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR enables outgoing webhook support for revenue recovery. 
When the retries get succeeded that are done using the revenue recovery system, an outgoing webhook needs to be triggered to the url in business profile. This pr adds that support.
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
PaymentResponse -> added modified at in api_models
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
## How did you test it?
1. create a billing profile with webhook.site url to monitor the webhooks.
2. Create an payment mca using this
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id:  {{merchant-id}}'
--header 'x-profile-id:  {{profile-id}}' \
--header 'Authorization: {{api-key}}'
--header 'api-key:{{api-key}}' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "{{api_key}}"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                 {
                    "payment_method_subtype": "card",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "metadata": {
        "report_group": "Hello",
        "merchant_config_currency": "USD"
    },
    "profile_id": "{{profile_id}}"
}'
```
3. create an billing mca
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id:  {{merchant-id}}'
--header 'x-profile-id:  {{profile-id}}' \
--header 'Authorization: {{api-key}}'
--header 'api-key:{{api-key}}' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "custombilling",
    "connector_account_details": {
        "auth_type": "NoKey"
    },
    "feature_metadata" : {
        "revenue_recovery" : {
            "max_retry_count" : 9,
            "billing_connector_retry_threshold" : 0,
            "billing_account_reference" :{
                "{{payment_mca}}" : "{{payment_mca}}"
            },
            "switch_payment_method_config" : {
                "retry_threshold" : 0,
                "time_threshold_after_creation": 0
            }
        }
    },
    "profile_id": "{{profile_id}}"
}'
```
4. switch revenue recovery config to cascading
```
curl --location --request PUT 'http://localhost:8080/v2/profiles/pro_DD6ZRORqBtEwR3ITjseM' \
--header 'x-merchant-id: {{erchant-id}}' \
--header 'Authorization:  {{api-key}}' \
--header 'Content-Type: application/json' \
--header 'api-key:  {{api-key}}' \
--data '{
    "revenue_recovery_retry_algorithm_type": "cascading"
}   '
```
5.   Go to stripe dashboard and create a customer and attach a card for that customer
6. Hit this recovery api with that customer_id and payment_method_id
```
curl --location 'http://localhost:8080/v2/payments/recovery' \
--header 'Authorization: {{api-key}}'
--header 'x-profile-id: {{profile-id}}
--header 'x-merchant-id: {{merchant-id}}'
--header 'Content-Type: application/json' \
--header 'api-key:{{api_key}}' \
--data '{
    "amount_details": {
      "order_amount": 2250,
      "currency": "USD"
    },
    "merchant_reference_id": "test_ffhgfewf3476f5",
    "connector_transaction_id": "1831984",
    "connector_customer_id": "{{customer_id_from_stripe}}",
    "error": {
      "code": "110",
      "message": "Insufficient Funds"
    },
    "billing": {
      "address": {
        "state": "CA",
        "country": "US"
      }
    },
    "payment_method_type": "card",
    "payment_method_sub_type": "credit",
    "payment_method_data": {
      "primary_processor_payment_method_token": "{{payment_method_id_from_stripe}}",
      "additional_payment_method_info": {
        "card_exp_month": "12",
        "card_exp_year": "25",
        "last_four_digits": 1997,
        "card_network": "Visa",
        "card_issuer": "Wells Fargo NA",
        "card_type": "credit"
      }
    },
    "billing_started_at": "2024-05-29T08:10:58Z",
    "transaction_created_at": "2024-05-29T08:10:58Z",
    "attempt_status": "failure",
    "action": "schedule_failed_payment",
    "billing_merchant_connector_id": "{{billing_mca}}
    "payment_merchant_connector_id": "{{payment_mca}}"
  }'
```
7. There will be a process tracker entry now and wait till it get triggered. Based on the test card if we mentioned a successful card's payment method id then we will get a webhook to webhook.site url. 
Sample screen shot and sample webhook body are mentioned below
<img width="1727" height="951" alt="Screenshot 2025-09-08 at 1 55 58 AM" src="https://github.com/user-attachments/assets/77c67c1b-ba07-4d48-8109-be0de40837d6" />
 Sample body of the webhook
```
{
  "merchant_id": "cloth_seller_I7nS4iwZnxRDJtGfiNTy",
  "event_id": "evt_019925c838c877c282d3eaf5b86e9036",
  "event_type": "payment_succeeded",
  "content": {
    "type": "payment_details",
    "object": {
      "id": "12345_pay_019925c5959a79418301a9460b92edb1",
      "status": "succeeded",
      "amount": {
        "order_amount": 2250,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 2250,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 2250
      },
      "customer_id": null,
      "connector": "stripe",
      "created": "2025-09-07T20:02:09.947Z",
      "modified_at": "2025-09-07T20:05:02.777Z",
      "payment_method_data": {
        "billing": null
      },
      "payment_method_type": "card",
      "payment_method_subtype": "credit",
      "connector_transaction_id": "pi_3S4opd2KXBHSNjod0tD34Dmw",
      "connector_reference_id": "pi_3S4opd2KXBHSNjod0tD34Dmw",
      "merchant_connector_id": "mca_MbQwWzi4tFItmgYAmshC",
      "browser_info": null,
      "error": null,
      "shipping": null,
      "billing": null,
      "attempts": null,
      "connector_token_details": {
        "token": "pm_1S4olu2KXBHSNjodBbiedqY9",
        "connector_token_request_reference_id": null
      },
      "payment_method_id": null,
      "next_action": null,
      "return_url": "https://google.com/success",
      "authentication_type": "no_three_ds",
      "authentication_type_applied": "no_three_ds",
      "is_iframe_redirection_enabled": null,
      "merchant_reference_id": "test_ffhgfewf3476f5",
      "raw_connector_response": null,
      "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "revenue_recovery": {
          "total_retry_count": 2,
          "payment_connector_transmission": "ConnectorCallSucceeded",
          "billing_connector_id": "mca_ppEVMjRWgTiGyCiwFtg9",
          "active_attempt_payment_connector_id": "mca_MbQwWzi4tFItmgYAmshC",
          "billing_connector_payment_details": {
            "payment_processor_token": "pm_1S4olu2KXBHSNjodBbiedqY9",
            "connector_customer_id": "cus_T0qSE723C5Xxic"
          },
          "payment_method_type": "card",
          "payment_method_subtype": "credit",
          "connector": "stripe",
          "billing_connector_payment_method_details": {
            "type": "card",
            "value": {
              "card_network": "Visa",
              "card_issuer": "Wells Fargo NA"
            }
          },
          "invoice_next_billing_time": null,
          "invoice_billing_started_at_time": null,
          "first_payment_attempt_pg_error_code": "resource_missing",
          "first_payment_attempt_network_decline_code": null,
          "first_payment_attempt_network_advice_code": null
        }
      }
    }
  },
  "timestamp": "2025-09-07T20:05:02.792Z"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	cadfcf7c22bfd1124f19e2f1cc1c98c3d152be99 | 
	1. create a billing profile with webhook.site url to monitor the webhooks.
2. Create an payment mca using this
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id:  {{merchant-id}}'
--header 'x-profile-id:  {{profile-id}}' \
--header 'Authorization: {{api-key}}'
--header 'api-key:{{api-key}}' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "{{api_key}}"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                 {
                    "payment_method_subtype": "card",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "metadata": {
        "report_group": "Hello",
        "merchant_config_currency": "USD"
    },
    "profile_id": "{{profile_id}}"
}'
```
3. create an billing mca
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id:  {{merchant-id}}'
--header 'x-profile-id:  {{profile-id}}' \
--header 'Authorization: {{api-key}}'
--header 'api-key:{{api-key}}' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "custombilling",
    "connector_account_details": {
        "auth_type": "NoKey"
    },
    "feature_metadata" : {
        "revenue_recovery" : {
            "max_retry_count" : 9,
            "billing_connector_retry_threshold" : 0,
            "billing_account_reference" :{
                "{{payment_mca}}" : "{{payment_mca}}"
            },
            "switch_payment_method_config" : {
                "retry_threshold" : 0,
                "time_threshold_after_creation": 0
            }
        }
    },
    "profile_id": "{{profile_id}}"
}'
```
4. switch revenue recovery config to cascading
```
curl --location --request PUT 'http://localhost:8080/v2/profiles/pro_DD6ZRORqBtEwR3ITjseM' \
--header 'x-merchant-id: {{erchant-id}}' \
--header 'Authorization:  {{api-key}}' \
--header 'Content-Type: application/json' \
--header 'api-key:  {{api-key}}' \
--data '{
    "revenue_recovery_retry_algorithm_type": "cascading"
}   '
```
5.   Go to stripe dashboard and create a customer and attach a card for that customer
6. Hit this recovery api with that customer_id and payment_method_id
```
curl --location 'http://localhost:8080/v2/payments/recovery' \
--header 'Authorization: {{api-key}}'
--header 'x-profile-id: {{profile-id}}
--header 'x-merchant-id: {{merchant-id}}'
--header 'Content-Type: application/json' \
--header 'api-key:{{api_key}}' \
--data '{
    "amount_details": {
      "order_amount": 2250,
      "currency": "USD"
    },
    "merchant_reference_id": "test_ffhgfewf3476f5",
    "connector_transaction_id": "1831984",
    "connector_customer_id": "{{customer_id_from_stripe}}",
    "error": {
      "code": "110",
      "message": "Insufficient Funds"
    },
    "billing": {
      "address": {
        "state": "CA",
        "country": "US"
      }
    },
    "payment_method_type": "card",
    "payment_method_sub_type": "credit",
    "payment_method_data": {
      "primary_processor_payment_method_token": "{{payment_method_id_from_stripe}}",
      "additional_payment_method_info": {
        "card_exp_month": "12",
        "card_exp_year": "25",
        "last_four_digits": 1997,
        "card_network": "Visa",
        "card_issuer": "Wells Fargo NA",
        "card_type": "credit"
      }
    },
    "billing_started_at": "2024-05-29T08:10:58Z",
    "transaction_created_at": "2024-05-29T08:10:58Z",
    "attempt_status": "failure",
    "action": "schedule_failed_payment",
    "billing_merchant_connector_id": "{{billing_mca}}
    "payment_merchant_connector_id": "{{payment_mca}}"
  }'
```
7. There will be a process tracker entry now and wait till it get triggered. Based on the test card if we mentioned a successful card's payment method id then we will get a webhook to webhook.site url. 
Sample screen shot and sample webhook body are mentioned below
<img width="1727" height="951" alt="Screenshot 2025-09-08 at 1 55 58 AM" src="https://github.com/user-attachments/assets/77c67c1b-ba07-4d48-8109-be0de40837d6" />
 Sample body of the webhook
```
{
  "merchant_id": "cloth_seller_I7nS4iwZnxRDJtGfiNTy",
  "event_id": "evt_019925c838c877c282d3eaf5b86e9036",
  "event_type": "payment_succeeded",
  "content": {
    "type": "payment_details",
    "object": {
      "id": "12345_pay_019925c5959a79418301a9460b92edb1",
      "status": "succeeded",
      "amount": {
        "order_amount": 2250,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 2250,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 2250
      },
      "customer_id": null,
      "connector": "stripe",
      "created": "2025-09-07T20:02:09.947Z",
      "modified_at": "2025-09-07T20:05:02.777Z",
      "payment_method_data": {
        "billing": null
      },
      "payment_method_type": "card",
      "payment_method_subtype": "credit",
      "connector_transaction_id": "pi_3S4opd2KXBHSNjod0tD34Dmw",
      "connector_reference_id": "pi_3S4opd2KXBHSNjod0tD34Dmw",
      "merchant_connector_id": "mca_MbQwWzi4tFItmgYAmshC",
      "browser_info": null,
      "error": null,
      "shipping": null,
      "billing": null,
      "attempts": null,
      "connector_token_details": {
        "token": "pm_1S4olu2KXBHSNjodBbiedqY9",
        "connector_token_request_reference_id": null
      },
      "payment_method_id": null,
      "next_action": null,
      "return_url": "https://google.com/success",
      "authentication_type": "no_three_ds",
      "authentication_type_applied": "no_three_ds",
      "is_iframe_redirection_enabled": null,
      "merchant_reference_id": "test_ffhgfewf3476f5",
      "raw_connector_response": null,
      "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "revenue_recovery": {
          "total_retry_count": 2,
          "payment_connector_transmission": "ConnectorCallSucceeded",
          "billing_connector_id": "mca_ppEVMjRWgTiGyCiwFtg9",
          "active_attempt_payment_connector_id": "mca_MbQwWzi4tFItmgYAmshC",
          "billing_connector_payment_details": {
            "payment_processor_token": "pm_1S4olu2KXBHSNjodBbiedqY9",
            "connector_customer_id": "cus_T0qSE723C5Xxic"
          },
          "payment_method_type": "card",
          "payment_method_subtype": "credit",
          "connector": "stripe",
          "billing_connector_payment_method_details": {
            "type": "card",
            "value": {
              "card_network": "Visa",
              "card_issuer": "Wells Fargo NA"
            }
          },
          "invoice_next_billing_time": null,
          "invoice_billing_started_at_time": null,
          "first_payment_attempt_pg_error_code": "resource_missing",
          "first_payment_attempt_network_decline_code": null,
          "first_payment_attempt_network_advice_code": null
        }
      }
    }
  },
  "timestamp": "2025-09-07T20:05:02.792Z"
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9284 | 
	Bug: [FEATURE] [ACI] Setup mandate and network token flow added and existing flows fixed
Setup mandate and networkToken flow added for ACI connector.
While doing payments, we were not validating the capture method in the request payload. Instead, we were directly treating it as automatic capture which was causing capture to fail. Made changes in API contracts in both request and response and status mapping for capture. | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index d2bbb75a04e..b725be102c1 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -541,8 +541,8 @@ wallet.google_pay = { connector_list = "bankofamerica,authorizedotnet,cybersourc
 bank_redirect.giropay = { connector_list = "globalpay" }
 
 [mandates.supported_payment_methods]
-card.credit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
-card.debit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.credit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.debit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
 wallet.paypal = { connector_list = "adyen,novalnet" }                                          # Mandate supported payment method type and connector for wallets
 pay_later.klarna = { connector_list = "adyen" }                                       # Mandate supported payment method type and connector for pay_later
 bank_debit.ach = { connector_list = "gocardless,adyen" }                              # Mandate supported payment method type and connector for bank_debit
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 15665793cca..c756b0a9e9c 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -231,8 +231,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
 bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
 bank_debit.bacs = { connector_list = "stripe,gocardless" }
 bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
-card.debit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.credit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.debit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
 wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,nuvei,authorizedotnet,wellsfargo"
 wallet.samsung_pay.connector_list = "cybersource"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 3843682e910..f685bbe2787 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -231,8 +231,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
 bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
 bank_debit.bacs = { connector_list = "stripe,gocardless" }
 bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
-card.debit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.credit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.debit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
 wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,nuvei,authorizedotnet,wellsfargo"
 wallet.samsung_pay.connector_list = "cybersource"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 3fd60dfe8f9..9ed89a01c9b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -238,8 +238,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
 bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
 bank_debit.bacs = { connector_list = "stripe,gocardless" }
 bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
-card.debit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.credit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.debit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
 wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,nuvei,authorizedotnet,wellsfargo,worldpayvantiv"
 wallet.samsung_pay.connector_list = "cybersource"
diff --git a/config/development.toml b/config/development.toml
index 0454eb1931c..940e43b50ca 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1081,8 +1081,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
 bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
 bank_debit.bacs = { connector_list = "stripe,gocardless" }
 bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
-card.debit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.credit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
+card.debit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
 wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nuvei,nexinets,novalnet,authorizedotnet,wellsfargo,worldpayvantiv"
 wallet.samsung_pay.connector_list = "cybersource"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index b154cea783b..d299323f2c1 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1009,8 +1009,8 @@ wallet.google_pay = { connector_list = "stripe,cybersource,adyen,bankofamerica,a
 wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo,nuvei" }
 wallet.samsung_pay = { connector_list = "cybersource" }
 wallet.paypal = { connector_list = "adyen,novalnet,authorizedotnet" }
-card.credit = { connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
-card.debit = { connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
+card.credit = { connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
+card.debit = { connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
 bank_debit.ach = { connector_list = "gocardless,adyen" }
 bank_debit.becs = { connector_list = "gocardless" }
 bank_debit.bacs = { connector_list = "adyen" }
diff --git a/crates/hyperswitch_connectors/src/connectors/aci.rs b/crates/hyperswitch_connectors/src/connectors/aci.rs
index 59c89ae9771..96c3a059c22 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci.rs
@@ -96,7 +96,7 @@ impl ConnectorCommon for Aci {
             .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
         Ok(vec![(
             headers::AUTHORIZATION.to_string(),
-            auth.api_key.into_masked(),
+            format!("Bearer {}", auth.api_key.peek()).into_masked(),
         )])
     }
 
@@ -161,31 +161,133 @@ impl api::PaymentToken for Aci {}
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Aci
 {
-    // Not Implemented (R)
+    fn build_request(
+        &self,
+        _req: &RouterData<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotSupported {
+            message: "Payment method tokenization not supported".to_string(),
+            connector: "ACI",
+        }
+        .into())
+    }
 }
 
 impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Aci {
-    // Not Implemented (R)
+    fn build_request(
+        &self,
+        _req: &RouterData<Session, PaymentsSessionData, PaymentsResponseData>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotSupported {
+            message: "Payment sessions not supported".to_string(),
+            connector: "ACI",
+        }
+        .into())
+    }
 }
 
 impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Aci {
-    // Not Implemented (R)
+    fn build_request(
+        &self,
+        _req: &RouterData<AccessTokenAuth, AccessTokenRequestData, AccessToken>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotSupported {
+            message: "Access token authentication not supported".to_string(),
+            connector: "ACI",
+        }
+        .into())
+    }
 }
 
 impl api::MandateSetup for Aci {}
 
 impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Aci {
-    // Issue: #173
-    fn build_request(
+    fn get_headers(
+        &self,
+        req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        let mut header = vec![(
+            headers::CONTENT_TYPE.to_string(),
+            self.common_get_content_type().to_string().into(),
+        )];
+        let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+        header.append(&mut api_key);
+        Ok(header)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
         &self,
         _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!("{}v1/registrations", self.base_url(connectors)))
+    }
+
+    fn get_request_body(
+        &self,
+        req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
         _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_req = aci::AciMandateRequest::try_from(req)?;
+        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("Setup Mandate flow for Aci".to_string()).into())
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&self.get_url(req, connectors)?)
+                .attach_default_headers()
+                .headers(self.get_headers(req, connectors)?)
+                .set_body(self.get_request_body(req, connectors)?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<
+        RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        errors::ConnectorError,
+    > {
+        let response: aci::AciMandateResponse = res
+            .response
+            .parse_struct("AciMandateResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+        .change_context(errors::ConnectorError::ResponseHandlingFailed)
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
     }
 }
 
-// TODO: Investigate unexplained error in capture flow from connector.
 impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Aci {
     fn get_headers(
         &self,
@@ -409,8 +511,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         req: &PaymentsAuthorizeRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        // encode only for for urlencoded things.
-
         let amount = convert_amount(
             self.amount_converter,
             req.request.minor_amount,
@@ -724,14 +824,13 @@ fn decrypt_aci_webhook_payload(
     Ok(ciphertext_and_tag)
 }
 
-// TODO: Test this webhook flow once dashboard access is available.
 #[async_trait::async_trait]
 impl IncomingWebhook for Aci {
     fn get_webhook_source_verification_algorithm(
         &self,
         _request: &IncomingWebhookRequestDetails<'_>,
     ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
-        Ok(Box::new(crypto::NoAlgorithm))
+        Ok(Box::new(crypto::HmacSha256))
     }
 
     fn get_webhook_source_verification_signature(
@@ -899,15 +998,15 @@ static ACI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLo
         enums::CaptureMethod::Manual,
     ];
 
-    let supported_card_network = vec![
+    let supported_card_networks = vec![
+        common_enums::CardNetwork::Visa,
+        common_enums::CardNetwork::Mastercard,
         common_enums::CardNetwork::AmericanExpress,
+        common_enums::CardNetwork::JCB,
         common_enums::CardNetwork::DinersClub,
         common_enums::CardNetwork::Discover,
-        common_enums::CardNetwork::JCB,
-        common_enums::CardNetwork::Maestro,
-        common_enums::CardNetwork::Mastercard,
         common_enums::CardNetwork::UnionPay,
-        common_enums::CardNetwork::Visa,
+        common_enums::CardNetwork::Maestro,
     ];
 
     let mut aci_supported_payment_methods = SupportedPaymentMethods::new();
@@ -944,9 +1043,9 @@ static ACI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLo
             specific_features: Some(
                 api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
                     api_models::feature_matrix::CardSpecificFeatures {
-                        three_ds: common_enums::FeatureStatus::NotSupported,
+                        three_ds: common_enums::FeatureStatus::Supported,
                         no_three_ds: common_enums::FeatureStatus::Supported,
-                        supported_card_networks: supported_card_network.clone(),
+                        supported_card_networks: supported_card_networks.clone(),
                     }
                 }),
             ),
@@ -963,14 +1062,15 @@ static ACI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLo
             specific_features: Some(
                 api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
                     api_models::feature_matrix::CardSpecificFeatures {
-                        three_ds: common_enums::FeatureStatus::NotSupported,
+                        three_ds: common_enums::FeatureStatus::Supported,
                         no_three_ds: common_enums::FeatureStatus::Supported,
-                        supported_card_networks: supported_card_network.clone(),
+                        supported_card_networks: supported_card_networks.clone(),
                     }
                 }),
             ),
         },
     );
+
     aci_supported_payment_methods.add(
         enums::PaymentMethod::BankRedirect,
         enums::PaymentMethodType::Eps,
@@ -1051,6 +1151,7 @@ static ACI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLo
             specific_features: None,
         },
     );
+
     aci_supported_payment_methods.add(
         enums::PaymentMethod::PayLater,
         enums::PaymentMethodType::Klarna,
@@ -1061,6 +1162,7 @@ static ACI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLo
             specific_features: None,
         },
     );
+
     aci_supported_payment_methods
 });
 
diff --git a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
index 3edd04f8308..c3f5e53d9a4 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
@@ -4,10 +4,15 @@ use common_enums::enums;
 use common_utils::{id_type, pii::Email, request::Method, types::StringMajorUnit};
 use error_stack::report;
 use hyperswitch_domain_models::{
-    payment_method_data::{BankRedirectData, Card, PayLaterData, PaymentMethodData, WalletData},
+    network_tokenization::NetworkTokenNumber,
+    payment_method_data::{
+        BankRedirectData, Card, NetworkTokenData, PayLaterData, PaymentMethodData, WalletData,
+    },
     router_data::{ConnectorAuthType, RouterData},
+    router_flow_types::SetupMandate,
     router_request_types::{
         PaymentsAuthorizeData, PaymentsCancelData, PaymentsSyncData, ResponseId,
+        SetupMandateRequestData,
     },
     router_response_types::{
         MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData,
@@ -25,7 +30,10 @@ use url::Url;
 use super::aci_result_codes::{FAILURE_CODES, PENDING_CODES, SUCCESSFUL_CODES};
 use crate::{
     types::{RefundsResponseRouterData, ResponseRouterData},
-    utils::{self, PhoneDetailsData, RouterData as _},
+    utils::{
+        self, CardData, NetworkTokenData as NetworkTokenDataTrait, PaymentsAuthorizeRequestData,
+        PhoneDetailsData, RouterData as _,
+    },
 };
 
 type Error = error_stack::Report<errors::ConnectorError>;
@@ -54,8 +62,8 @@ impl GetCaptureMethod for PaymentsCancelData {
 
 #[derive(Debug, Serialize)]
 pub struct AciRouterData<T> {
-    amount: StringMajorUnit,
-    router_data: T,
+    pub amount: StringMajorUnit,
+    pub router_data: T,
 }
 
 impl<T> From<(StringMajorUnit, T)> for AciRouterData<T> {
@@ -114,6 +122,24 @@ pub struct AciCancelRequest {
     pub payment_type: AciPaymentType,
 }
 
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AciMandateRequest {
+    pub entity_id: Secret<String>,
+    pub payment_brand: PaymentBrand,
+    #[serde(flatten)]
+    pub payment_details: PaymentDetails,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AciMandateResponse {
+    pub id: String,
+    pub result: ResultCode,
+    pub build_number: String,
+    pub timestamp: String,
+}
+
 #[derive(Debug, Clone, Serialize)]
 #[serde(untagged)]
 pub enum PaymentDetails {
@@ -123,6 +149,7 @@ pub enum PaymentDetails {
     Wallet(Box<WalletPMData>),
     Klarna,
     Mandate,
+    AciNetworkToken(Box<AciNetworkTokenData>),
 }
 
 impl TryFrom<(&WalletData, &PaymentsAuthorizeRouterData)> for PaymentDetails {
@@ -321,21 +348,117 @@ impl
     }
 }
 
+fn get_aci_payment_brand(
+    card_network: Option<common_enums::CardNetwork>,
+    is_network_token_flow: bool,
+) -> Result<PaymentBrand, Error> {
+    match card_network {
+        Some(common_enums::CardNetwork::Visa) => Ok(PaymentBrand::Visa),
+        Some(common_enums::CardNetwork::Mastercard) => Ok(PaymentBrand::Mastercard),
+        Some(common_enums::CardNetwork::AmericanExpress) => Ok(PaymentBrand::AmericanExpress),
+        Some(common_enums::CardNetwork::JCB) => Ok(PaymentBrand::Jcb),
+        Some(common_enums::CardNetwork::DinersClub) => Ok(PaymentBrand::DinersClub),
+        Some(common_enums::CardNetwork::Discover) => Ok(PaymentBrand::Discover),
+        Some(common_enums::CardNetwork::UnionPay) => Ok(PaymentBrand::UnionPay),
+        Some(common_enums::CardNetwork::Maestro) => Ok(PaymentBrand::Maestro),
+        Some(unsupported_network) => Err(errors::ConnectorError::NotSupported {
+            message: format!(
+                "Card network {:?} is not supported by ACI",
+                unsupported_network
+            ),
+            connector: "ACI",
+        })?,
+        None => {
+            if is_network_token_flow {
+                Ok(PaymentBrand::Visa)
+            } else {
+                Err(errors::ConnectorError::MissingRequiredField {
+                    field_name: "card.card_network",
+                }
+                .into())
+            }
+        }
+    }
+}
+
 impl TryFrom<(Card, Option<Secret<String>>)> for PaymentDetails {
     type Error = Error;
     fn try_from(
         (card_data, card_holder_name): (Card, Option<Secret<String>>),
     ) -> Result<Self, Self::Error> {
+        let card_expiry_year = card_data.get_expiry_year_4_digit();
+
+        let payment_brand = get_aci_payment_brand(card_data.card_network, false)?;
+
         Ok(Self::AciCard(Box::new(CardDetails {
             card_number: card_data.card_number,
-            card_holder: card_holder_name.unwrap_or(Secret::new("".to_string())),
-            card_expiry_month: card_data.card_exp_month,
-            card_expiry_year: card_data.card_exp_year,
+            card_holder: card_holder_name.ok_or(errors::ConnectorError::MissingRequiredField {
+                field_name: "card_holder_name",
+            })?,
+            card_expiry_month: card_data.card_exp_month.clone(),
+            card_expiry_year,
             card_cvv: card_data.card_cvc,
+            payment_brand,
         })))
     }
 }
 
+impl
+    TryFrom<(
+        &AciRouterData<&PaymentsAuthorizeRouterData>,
+        &NetworkTokenData,
+    )> for PaymentDetails
+{
+    type Error = Error;
+    fn try_from(
+        value: (
+            &AciRouterData<&PaymentsAuthorizeRouterData>,
+            &NetworkTokenData,
+        ),
+    ) -> Result<Self, Self::Error> {
+        let (_item, network_token_data) = value;
+        let token_number = network_token_data.get_network_token();
+        let payment_brand = get_aci_payment_brand(network_token_data.card_network.clone(), true)?;
+        let aci_network_token_data = AciNetworkTokenData {
+            token_type: AciTokenAccountType::Network,
+            token_number,
+            token_expiry_month: network_token_data.get_network_token_expiry_month(),
+            token_expiry_year: network_token_data.get_expiry_year_4_digit(),
+            token_cryptogram: Some(
+                network_token_data
+                    .get_cryptogram()
+                    .clone()
+                    .unwrap_or_default(),
+            ),
+            payment_brand,
+        };
+        Ok(Self::AciNetworkToken(Box::new(aci_network_token_data)))
+    }
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum AciTokenAccountType {
+    Network,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AciNetworkTokenData {
+    #[serde(rename = "tokenAccount.type")]
+    pub token_type: AciTokenAccountType,
+    #[serde(rename = "tokenAccount.number")]
+    pub token_number: NetworkTokenNumber,
+    #[serde(rename = "tokenAccount.expiryMonth")]
+    pub token_expiry_month: Secret<String>,
+    #[serde(rename = "tokenAccount.expiryYear")]
+    pub token_expiry_year: Secret<String>,
+    #[serde(rename = "tokenAccount.cryptogram")]
+    pub token_cryptogram: Option<Secret<String>>,
+    #[serde(rename = "paymentBrand")]
+    pub payment_brand: PaymentBrand,
+}
+
 #[derive(Debug, Clone, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct BankRedirectionPMData {
@@ -365,7 +488,7 @@ pub struct WalletPMData {
     account_id: Option<Secret<String>>,
 }
 
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
 #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
 pub enum PaymentBrand {
     Eps,
@@ -379,6 +502,23 @@ pub enum PaymentBrand {
     Mbway,
     #[serde(rename = "ALIPAY")]
     AliPay,
+    // Card network brands
+    #[serde(rename = "VISA")]
+    Visa,
+    #[serde(rename = "MASTER")]
+    Mastercard,
+    #[serde(rename = "AMEX")]
+    AmericanExpress,
+    #[serde(rename = "JCB")]
+    Jcb,
+    #[serde(rename = "DINERS")]
+    DinersClub,
+    #[serde(rename = "DISCOVER")]
+    Discover,
+    #[serde(rename = "UNIONPAY")]
+    UnionPay,
+    #[serde(rename = "MAESTRO")]
+    Maestro,
 }
 
 #[derive(Debug, Clone, Eq, PartialEq, Serialize)]
@@ -393,6 +533,8 @@ pub struct CardDetails {
     pub card_expiry_year: Secret<String>,
     #[serde(rename = "card.cvv")]
     pub card_cvv: Secret<String>,
+    #[serde(rename = "paymentBrand")]
+    pub payment_brand: PaymentBrand,
 }
 
 #[derive(Debug, Clone, Serialize)]
@@ -460,6 +602,9 @@ impl TryFrom<&AciRouterData<&PaymentsAuthorizeRouterData>> for AciPaymentsReques
     fn try_from(item: &AciRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
         match item.router_data.request.payment_method_data.clone() {
             PaymentMethodData::Card(ref card_data) => Self::try_from((item, card_data)),
+            PaymentMethodData::NetworkToken(ref network_token_data) => {
+                Self::try_from((item, network_token_data))
+            }
             PaymentMethodData::Wallet(ref wallet_data) => Self::try_from((item, wallet_data)),
             PaymentMethodData::PayLater(ref pay_later_data) => {
                 Self::try_from((item, pay_later_data))
@@ -487,7 +632,6 @@ impl TryFrom<&AciRouterData<&PaymentsAuthorizeRouterData>> for AciPaymentsReques
             | PaymentMethodData::Voucher(_)
             | PaymentMethodData::OpenBanking(_)
             | PaymentMethodData::CardToken(_)
-            | PaymentMethodData::NetworkToken(_)
             | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
                 Err(errors::ConnectorError::NotImplemented(
                     utils::get_unimplemented_payment_method_error_message("Aci"),
@@ -574,7 +718,34 @@ impl TryFrom<(&AciRouterData<&PaymentsAuthorizeRouterData>, &Card)> for AciPayme
             txn_details,
             payment_method,
             instruction,
-            shopper_result_url: None,
+            shopper_result_url: item.router_data.request.router_return_url.clone(),
+        })
+    }
+}
+
+impl
+    TryFrom<(
+        &AciRouterData<&PaymentsAuthorizeRouterData>,
+        &NetworkTokenData,
+    )> for AciPaymentsRequest
+{
+    type Error = Error;
+    fn try_from(
+        value: (
+            &AciRouterData<&PaymentsAuthorizeRouterData>,
+            &NetworkTokenData,
+        ),
+    ) -> Result<Self, Self::Error> {
+        let (item, network_token_data) = value;
+        let txn_details = get_transaction_details(item)?;
+        let payment_method = PaymentDetails::try_from((item, network_token_data))?;
+        let instruction = get_instruction_details(item);
+
+        Ok(Self {
+            txn_details,
+            payment_method,
+            instruction,
+            shopper_result_url: item.router_data.request.router_return_url.clone(),
         })
     }
 }
@@ -609,11 +780,16 @@ fn get_transaction_details(
     item: &AciRouterData<&PaymentsAuthorizeRouterData>,
 ) -> Result<TransactionDetails, error_stack::Report<errors::ConnectorError>> {
     let auth = AciAuthType::try_from(&item.router_data.connector_auth_type)?;
+    let payment_type = if item.router_data.request.is_auto_capture()? {
+        AciPaymentType::Debit
+    } else {
+        AciPaymentType::Preauthorization
+    };
     Ok(TransactionDetails {
         entity_id: auth.entity_id,
         amount: item.amount.to_owned(),
         currency: item.router_data.request.currency.to_string(),
-        payment_type: AciPaymentType::Debit,
+        payment_type,
     })
 }
 
@@ -650,6 +826,61 @@ impl TryFrom<&PaymentsCancelRouterData> for AciCancelRequest {
     }
 }
 
+impl TryFrom<&RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>>
+    for AciMandateRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+
+    fn try_from(
+        item: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+    ) -> Result<Self, Self::Error> {
+        let auth = AciAuthType::try_from(&item.connector_auth_type)?;
+
+        let (payment_brand, payment_details) = match &item.request.payment_method_data {
+            PaymentMethodData::Card(card_data) => {
+                let brand = get_aci_payment_brand(card_data.card_network.clone(), false)?;
+                match brand {
+                    PaymentBrand::Visa
+                    | PaymentBrand::Mastercard
+                    | PaymentBrand::AmericanExpress => {}
+                    _ => Err(errors::ConnectorError::NotSupported {
+                        message: "Payment method not supported for mandate setup".to_string(),
+                        connector: "ACI",
+                    })?,
+                }
+
+                let details = PaymentDetails::AciCard(Box::new(CardDetails {
+                    card_number: card_data.card_number.clone(),
+                    card_expiry_month: card_data.card_exp_month.clone(),
+                    card_expiry_year: card_data.get_expiry_year_4_digit(),
+                    card_cvv: card_data.card_cvc.clone(),
+                    card_holder: card_data.card_holder_name.clone().ok_or(
+                        errors::ConnectorError::MissingRequiredField {
+                            field_name: "card_holder_name",
+                        },
+                    )?,
+                    payment_brand: brand.clone(),
+                }));
+
+                (brand, details)
+            }
+            _ => {
+                return Err(errors::ConnectorError::NotSupported {
+                    message: "Payment method not supported for mandate setup".to_string(),
+                    connector: "ACI",
+                }
+                .into());
+            }
+        };
+
+        Ok(Self {
+            entity_id: auth.entity_id,
+            payment_brand,
+            payment_details,
+        })
+    }
+}
+
 #[derive(Debug, Default, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "lowercase")]
 pub enum AciPaymentStatus {
@@ -674,6 +905,7 @@ fn map_aci_attempt_status(item: AciPaymentStatus, auto_capture: bool) -> enums::
         AciPaymentStatus::RedirectShopper => enums::AttemptStatus::AuthenticationPending,
     }
 }
+
 impl FromStr for AciPaymentStatus {
     type Err = error_stack::Report<errors::ConnectorError>;
     fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -696,10 +928,8 @@ impl FromStr for AciPaymentStatus {
 pub struct AciPaymentsResponse {
     id: String,
     registration_id: Option<Secret<String>>,
-    // ndc is an internal unique identifier for the request.
     ndc: String,
     timestamp: String,
-    // Number useful for support purposes.
     build_number: String,
     pub(super) result: ResultCode,
     pub(super) redirect: Option<AciRedirectionData>,
@@ -717,15 +947,24 @@ pub struct AciErrorResponse {
 #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct AciRedirectionData {
-    method: Option<Method>,
-    parameters: Vec<Parameters>,
-    url: Url,
+    pub method: Option<Method>,
+    pub parameters: Vec<Parameters>,
+    pub url: Url,
+    pub preconditions: Option<Vec<PreconditionData>>,
+}
+
+#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PreconditionData {
+    pub method: Option<Method>,
+    pub parameters: Vec<Parameters>,
+    pub url: Url,
 }
 
 #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
 pub struct Parameters {
-    name: String,
-    value: String,
+    pub name: String,
+    pub value: String,
 }
 
 #[derive(Default, Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]
@@ -863,12 +1102,45 @@ pub struct AciCaptureResultDetails {
     extended_description: String,
     #[serde(rename = "clearingInstituteName")]
     clearing_institute_name: String,
-    connector_tx_id1: String,
-    connector_tx_id3: String,
-    connector_tx_id2: String,
+    connector_tx_i_d1: String,
+    connector_tx_i_d3: String,
+    connector_tx_i_d2: String,
     acquirer_response: String,
 }
 
+#[derive(Debug, Default, Clone, Deserialize)]
+pub enum AciCaptureStatus {
+    Succeeded,
+    Failed,
+    #[default]
+    Pending,
+}
+
+impl FromStr for AciCaptureStatus {
+    type Err = error_stack::Report<errors::ConnectorError>;
+    fn from_str(s: &str) -> Result<Self, Self::Err> {
+        if FAILURE_CODES.contains(&s) {
+            Ok(Self::Failed)
+        } else if PENDING_CODES.contains(&s) {
+            Ok(Self::Pending)
+        } else if SUCCESSFUL_CODES.contains(&s) {
+            Ok(Self::Succeeded)
+        } else {
+            Err(report!(errors::ConnectorError::UnexpectedResponseError(
+                bytes::Bytes::from(s.to_owned())
+            )))
+        }
+    }
+}
+
+fn map_aci_capture_status(item: AciCaptureStatus) -> enums::AttemptStatus {
+    match item {
+        AciCaptureStatus::Succeeded => enums::AttemptStatus::Charged,
+        AciCaptureStatus::Failed => enums::AttemptStatus::Failure,
+        AciCaptureStatus::Pending => enums::AttemptStatus::Pending,
+    }
+}
+
 impl<F, T> TryFrom<ResponseRouterData<F, AciCaptureResponse, T, PaymentsResponseData>>
     for RouterData<F, T, PaymentsResponseData>
 {
@@ -877,10 +1149,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, AciCaptureResponse, T, PaymentsResponse
         item: ResponseRouterData<F, AciCaptureResponse, T, PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
         Ok(Self {
-            status: map_aci_attempt_status(
-                AciPaymentStatus::from_str(&item.response.result.code)?,
-                false,
-            ),
+            status: map_aci_capture_status(AciCaptureStatus::from_str(&item.response.result.code)?),
             reference_id: Some(item.response.referenced_id.clone()),
             response: Ok(PaymentsResponseData::TransactionResponse {
                 resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()),
@@ -963,7 +1232,6 @@ impl From<AciRefundStatus> for enums::RefundStatus {
 #[serde(rename_all = "camelCase")]
 pub struct AciRefundResponse {
     id: String,
-    //ndc is an internal unique identifier for the request.
     ndc: String,
     timestamp: String,
     build_number: String,
@@ -987,6 +1255,58 @@ impl<F> TryFrom<RefundsResponseRouterData<F, AciRefundResponse>> for RefundsRout
     }
 }
 
+impl
+    TryFrom<
+        ResponseRouterData<
+            SetupMandate,
+            AciMandateResponse,
+            SetupMandateRequestData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+
+    fn try_from(
+        item: ResponseRouterData<
+            SetupMandate,
+            AciMandateResponse,
+            SetupMandateRequestData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let mandate_reference = Some(MandateReference {
+            connector_mandate_id: Some(item.response.id.clone()),
+            payment_method_id: None,
+            mandate_metadata: None,
+            connector_mandate_request_reference_id: None,
+        });
+
+        let status = if SUCCESSFUL_CODES.contains(&item.response.result.code.as_str()) {
+            enums::AttemptStatus::Charged
+        } else if FAILURE_CODES.contains(&item.response.result.code.as_str()) {
+            enums::AttemptStatus::Failure
+        } else {
+            enums::AttemptStatus::Pending
+        };
+
+        Ok(Self {
+            status,
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()),
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(mandate_reference),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: Some(item.response.id),
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
 #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
 pub enum AciWebhookEventType {
     Payment,
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 9d3544d5cee..f50a7c16075 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -1,456 +1,559 @@
-#![allow(clippy::print_stdout)]
+use std::str::FromStr;
 
-use std::{borrow::Cow, marker::PhantomData, str::FromStr, sync::Arc};
-
-use common_utils::id_type;
-use hyperswitch_domain_models::address::{Address, AddressDetails, PhoneDetails};
+use hyperswitch_domain_models::{
+    address::{Address, AddressDetails, PhoneDetails},
+    payment_method_data::{Card, PaymentMethodData},
+    router_request_types::AuthenticationData,
+};
 use masking::Secret;
-use router::{
-    configs::settings::Settings,
-    core::payments,
-    db::StorageImpl,
-    routes, services,
-    types::{self, storage::enums, PaymentAddress},
+use router::types::{self, storage::enums, PaymentAddress};
+
+use crate::{
+    connector_auth,
+    utils::{self, ConnectorActions, PaymentInfo},
 };
-use tokio::sync::oneshot;
-
-use crate::{connector_auth::ConnectorAuthentication, utils};
-
-fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
-    let auth = ConnectorAuthentication::new()
-        .aci
-        .expect("Missing ACI connector authentication configuration");
-
-    let merchant_id = id_type::MerchantId::try_from(Cow::from("aci")).unwrap();
-
-    types::RouterData {
-        flow: PhantomData,
-        merchant_id,
-        customer_id: Some(id_type::CustomerId::try_from(Cow::from("aci")).unwrap()),
-        tenant_id: id_type::TenantId::try_from_string("public".to_string()).unwrap(),
-        connector: "aci".to_string(),
-        payment_id: uuid::Uuid::new_v4().to_string(),
-        attempt_id: uuid::Uuid::new_v4().to_string(),
-        status: enums::AttemptStatus::default(),
-        auth_type: enums::AuthenticationType::NoThreeDs,
-        payment_method: enums::PaymentMethod::Card,
-        connector_auth_type: utils::to_connector_auth_type(auth.into()),
-        description: Some("This is a test".to_string()),
-        payment_method_status: None,
-        request: types::PaymentsAuthorizeData {
-            amount: 1000,
-            currency: enums::Currency::USD,
-            payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card {
-                card_number: cards::CardNumber::from_str("4200000000000000").unwrap(),
-                card_exp_month: Secret::new("10".to_string()),
-                card_exp_year: Secret::new("2025".to_string()),
-                card_cvc: Secret::new("999".to_string()),
-                card_issuer: None,
-                card_network: None,
-                card_type: None,
-                card_issuing_country: None,
-                bank_code: None,
-                nick_name: Some(Secret::new("nick_name".into())),
-                card_holder_name: Some(Secret::new("card holder name".into())),
-                co_badged_card_data: None,
-            }),
-            confirm: true,
-            statement_descriptor_suffix: None,
-            statement_descriptor: None,
-            setup_future_usage: None,
-            mandate_id: None,
-            off_session: None,
-            setup_mandate_details: None,
-            capture_method: None,
-            browser_info: None,
-            order_details: None,
-            order_category: None,
-            email: None,
-            customer_name: None,
-            session_token: None,
-            enrolled_for_3ds: false,
-            related_transaction_id: None,
-            payment_experience: None,
-            payment_method_type: None,
-            router_return_url: None,
-            webhook_url: None,
-            complete_authorize_url: None,
-            customer_id: None,
-            surcharge_details: None,
-            request_incremental_authorization: false,
-            metadata: None,
-            authentication_data: None,
-            customer_acceptance: None,
-            locale: None,
-            enable_partial_authorization: None,
-            ..utils::PaymentAuthorizeType::default().0
-        },
-        response: Err(types::ErrorResponse::default()),
-        address: PaymentAddress::new(
+
+#[derive(Clone, Copy)]
+struct AciTest;
+impl ConnectorActions for AciTest {}
+impl utils::Connector for AciTest {
+    fn get_data(&self) -> types::api::ConnectorData {
+        use router::connector::Aci;
+        utils::construct_connector_data_old(
+            Box::new(Aci::new()),
+            types::Connector::Aci,
+            types::api::GetToken::Connector,
             None,
+        )
+    }
+
+    fn get_auth_token(&self) -> types::ConnectorAuthType {
+        utils::to_connector_auth_type(
+            connector_auth::ConnectorAuthentication::new()
+                .aci
+                .expect("Missing connector authentication configuration")
+                .into(),
+        )
+    }
+
+    fn get_name(&self) -> String {
+        "aci".to_string()
+    }
+}
+
+static CONNECTOR: AciTest = AciTest {};
+
+fn get_default_payment_info() -> Option<PaymentInfo> {
+    Some(PaymentInfo {
+        address: Some(PaymentAddress::new(
             None,
             Some(Address {
                 address: Some(AddressDetails {
                     first_name: Some(Secret::new("John".to_string())),
                     last_name: Some(Secret::new("Doe".to_string())),
+                    line1: Some(Secret::new("123 Main St".to_string())),
+                    city: Some("New York".to_string()),
+                    state: Some(Secret::new("NY".to_string())),
+                    zip: Some(Secret::new("10001".to_string())),
+                    country: Some(enums::CountryAlpha2::US),
                     ..Default::default()
                 }),
                 phone: Some(PhoneDetails {
-                    number: Some(Secret::new("9123456789".to_string())),
-                    country_code: Some("+351".to_string()),
+                    number: Some(Secret::new("+1234567890".to_string())),
+                    country_code: Some("+1".to_string()),
                 }),
                 email: None,
             }),
             None,
-        ),
-        connector_meta_data: None,
-        connector_wallets_details: None,
-        amount_captured: None,
-        minor_amount_captured: None,
-        access_token: None,
-        session_token: None,
-        reference_id: None,
-        payment_method_token: None,
-        connector_customer: None,
-        recurring_mandate_payment_data: None,
-        connector_response: None,
-        preprocessing_id: None,
-        connector_request_reference_id: uuid::Uuid::new_v4().to_string(),
-        #[cfg(feature = "payouts")]
-        payout_method_data: None,
-        #[cfg(feature = "payouts")]
-        quote_id: None,
-        test_mode: None,
-        payment_method_balance: None,
-        connector_api_version: None,
-        connector_http_status_code: None,
-        apple_pay_flow: None,
-        external_latency: None,
-        frm_metadata: None,
-        refund_id: None,
-        dispute_id: None,
-        integrity_check: Ok(()),
-        additional_merchant_data: None,
-        header_payload: None,
-        connector_mandate_request_reference_id: None,
-        authentication_id: None,
-        psd2_sca_exemption_type: None,
-        raw_connector_response: None,
-        is_payment_id_from_merchant: None,
-        l2_l3_data: None,
-        minor_amount_capturable: None,
-    }
+            None,
+        )),
+        ..Default::default()
+    })
 }
 
-fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
-    let auth = ConnectorAuthentication::new()
-        .aci
-        .expect("Missing ACI connector authentication configuration");
-
-    let merchant_id = id_type::MerchantId::try_from(Cow::from("aci")).unwrap();
-
-    types::RouterData {
-        flow: PhantomData,
-        merchant_id,
-        customer_id: Some(id_type::CustomerId::try_from(Cow::from("aci")).unwrap()),
-        tenant_id: id_type::TenantId::try_from_string("public".to_string()).unwrap(),
-        connector: "aci".to_string(),
-        payment_id: uuid::Uuid::new_v4().to_string(),
-        attempt_id: uuid::Uuid::new_v4().to_string(),
-        payment_method_status: None,
-        status: enums::AttemptStatus::default(),
-        payment_method: enums::PaymentMethod::Card,
-        auth_type: enums::AuthenticationType::NoThreeDs,
-        connector_auth_type: utils::to_connector_auth_type(auth.into()),
-        description: Some("This is a test".to_string()),
-        request: types::RefundsData {
-            payment_amount: 1000,
-            currency: enums::Currency::USD,
-
-            refund_id: uuid::Uuid::new_v4().to_string(),
-            connector_transaction_id: String::new(),
-            refund_amount: 100,
-            webhook_url: None,
-            connector_metadata: None,
-            reason: None,
-            connector_refund_id: None,
-            browser_info: None,
-            ..utils::PaymentRefundType::default().0
-        },
-        response: Err(types::ErrorResponse::default()),
-        address: PaymentAddress::default(),
-        connector_meta_data: None,
-        connector_wallets_details: None,
-        amount_captured: None,
-        minor_amount_captured: None,
-        access_token: None,
-        session_token: None,
-        reference_id: None,
-        payment_method_token: None,
-        connector_customer: None,
-        recurring_mandate_payment_data: None,
-        connector_response: None,
-        preprocessing_id: None,
-        connector_request_reference_id: uuid::Uuid::new_v4().to_string(),
-        #[cfg(feature = "payouts")]
-        payout_method_data: None,
-        #[cfg(feature = "payouts")]
-        quote_id: None,
-        test_mode: None,
-        payment_method_balance: None,
-        connector_api_version: None,
-        connector_http_status_code: None,
-        apple_pay_flow: None,
-        external_latency: None,
-        frm_metadata: None,
-        refund_id: None,
-        dispute_id: None,
-        integrity_check: Ok(()),
-        additional_merchant_data: None,
-        header_payload: None,
-        connector_mandate_request_reference_id: None,
-        authentication_id: None,
-        psd2_sca_exemption_type: None,
-        raw_connector_response: None,
-        is_payment_id_from_merchant: None,
-        l2_l3_data: None,
-        minor_amount_capturable: None,
-    }
+fn get_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
+    Some(types::PaymentsAuthorizeData {
+        payment_method_data: PaymentMethodData::Card(Card {
+            card_number: cards::CardNumber::from_str("4200000000000000").unwrap(),
+            card_exp_month: Secret::new("10".to_string()),
+            card_exp_year: Secret::new("2025".to_string()),
+            card_cvc: Secret::new("999".to_string()),
+            card_holder_name: Some(Secret::new("John Doe".to_string())),
+            ..utils::CCardType::default().0
+        }),
+        ..utils::PaymentAuthorizeType::default().0
+    })
+}
+
+fn get_threeds_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
+    Some(types::PaymentsAuthorizeData {
+        payment_method_data: PaymentMethodData::Card(Card {
+            card_number: cards::CardNumber::from_str("4200000000000000").unwrap(),
+            card_exp_month: Secret::new("10".to_string()),
+            card_exp_year: Secret::new("2025".to_string()),
+            card_cvc: Secret::new("999".to_string()),
+            card_holder_name: Some(Secret::new("John Doe".to_string())),
+            ..utils::CCardType::default().0
+        }),
+        enrolled_for_3ds: true,
+        authentication_data: Some(AuthenticationData {
+            eci: Some("05".to_string()),
+            cavv: Secret::new("jJ81HADVRtXfCBATEp01CJUAAAA".to_string()),
+            threeds_server_transaction_id: Some("9458d8d4-f19f-4c28-b5c7-421b1dd2e1aa".to_string()),
+            message_version: Some(common_utils::types::SemanticVersion::new(2, 1, 0)),
+            ds_trans_id: Some("97267598FAE648F28083B2D2AF7B1234".to_string()),
+            created_at: common_utils::date_time::now(),
+            challenge_code: Some("01".to_string()),
+            challenge_cancel: None,
+            challenge_code_reason: Some("01".to_string()),
+            message_extension: None,
+            acs_trans_id: None,
+            authentication_type: None,
+        }),
+        ..utils::PaymentAuthorizeType::default().0
+    })
 }
 
 #[actix_web::test]
-async fn payments_create_success() {
-    let conf = Settings::new().unwrap();
-    let tx: oneshot::Sender<()> = oneshot::channel().0;
-
-    let app_state = Box::pin(routes::AppState::with_storage(
-        conf,
-        StorageImpl::PostgresqlTest,
-        tx,
-        Box::new(services::MockApiClient),
-    ))
-    .await;
-    let state = Arc::new(app_state)
-        .get_session_state(
-            &id_type::TenantId::try_from_string("public".to_string()).unwrap(),
+async fn should_only_authorize_payment() {
+    let response = CONNECTOR
+        .authorize_payment(get_payment_authorize_data(), get_default_payment_info())
+        .await
+        .expect("Authorize payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+    let response = CONNECTOR
+        .authorize_and_capture_payment(
+            get_payment_authorize_data(),
             None,
-            || {},
+            get_default_payment_info(),
         )
-        .unwrap();
+        .await
+        .expect("Capture payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
 
-    use router::connector::Aci;
-    let connector = utils::construct_connector_data_old(
-        Box::new(Aci::new()),
-        types::Connector::Aci,
-        types::api::GetToken::Connector,
-        None,
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+    let response = CONNECTOR
+        .authorize_and_capture_payment(
+            get_payment_authorize_data(),
+            Some(types::PaymentsCaptureData {
+                amount_to_capture: 50,
+                ..utils::PaymentCaptureType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("Capture payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+    let authorize_response = CONNECTOR
+        .authorize_payment(get_payment_authorize_data(), get_default_payment_info())
+        .await
+        .expect("Authorize payment response");
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    let response = CONNECTOR
+        .psync_retry_till_status_matches(
+            enums::AttemptStatus::Authorized,
+            Some(types::PaymentsSyncData {
+                connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+                    txn_id.unwrap(),
+                ),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("PSync response");
+    assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+    let response = CONNECTOR
+        .authorize_and_void_payment(
+            get_payment_authorize_data(),
+            Some(types::PaymentsCancelData {
+                connector_transaction_id: String::from(""),
+                cancellation_reason: Some("requested_by_customer".to_string()),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("Void payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+    let response = CONNECTOR
+        .capture_payment_and_refund(
+            get_payment_authorize_data(),
+            None,
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
     );
-    let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
-        types::api::Authorize,
-        types::PaymentsAuthorizeData,
-        types::PaymentsResponseData,
-    > = connector.connector.get_connector_integration();
-    let request = construct_payment_router_data();
-    let response = services::api::execute_connector_processing_step(
-        &state,
-        connector_integration,
-        &request,
-        payments::CallConnectorAction::Trigger,
-        None,
-        None,
-    )
-    .await
-    .unwrap();
-    assert!(
-        response.status == enums::AttemptStatus::Charged,
-        "The payment failed"
+}
+
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+    let response = CONNECTOR
+        .capture_payment_and_refund(
+            get_payment_authorize_data(),
+            None,
+            Some(types::RefundsData {
+                refund_amount: 50,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
     );
 }
 
 #[actix_web::test]
-#[ignore]
-async fn payments_create_failure() {
-    {
-        let conf = Settings::new().unwrap();
-        use router::connector::Aci;
-        let tx: oneshot::Sender<()> = oneshot::channel().0;
-
-        let app_state = Box::pin(routes::AppState::with_storage(
-            conf,
-            StorageImpl::PostgresqlTest,
-            tx,
-            Box::new(services::MockApiClient),
-        ))
-        .await;
-        let state = Arc::new(app_state)
-            .get_session_state(
-                &id_type::TenantId::try_from_string("public".to_string()).unwrap(),
-                None,
-                || {},
-            )
-            .unwrap();
-        let connector = utils::construct_connector_data_old(
-            Box::new(Aci::new()),
-            types::Connector::Aci,
-            types::api::GetToken::Connector,
+async fn should_sync_manually_captured_refund() {
+    let refund_response = CONNECTOR
+        .capture_payment_and_refund(
+            get_payment_authorize_data(),
             None,
-        );
-        let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
-            types::api::Authorize,
-            types::PaymentsAuthorizeData,
-            types::PaymentsResponseData,
-        > = connector.connector.get_connector_integration();
-        let mut request = construct_payment_router_data();
-        request.request.payment_method_data =
-            types::domain::PaymentMethodData::Card(types::domain::Card {
-                card_number: cards::CardNumber::from_str("4200000000000000").unwrap(),
-                card_exp_month: Secret::new("10".to_string()),
-                card_exp_year: Secret::new("2025".to_string()),
-                card_cvc: Secret::new("99".to_string()),
-                card_issuer: None,
-                card_network: None,
-                card_type: None,
-                card_issuing_country: None,
-                bank_code: None,
-                nick_name: Some(Secret::new("nick_name".into())),
-                card_holder_name: Some(Secret::new("card holder name".into())),
-                co_badged_card_data: None,
-            });
-
-        let response = services::api::execute_connector_processing_step(
-            &state,
-            connector_integration,
-            &request,
-            payments::CallConnectorAction::Trigger,
             None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    let response = CONNECTOR
+        .rsync_retry_till_status_matches(
+            enums::RefundStatus::Success,
+            refund_response.response.unwrap().connector_refund_id,
             None,
+            get_default_payment_info(),
         )
         .await
-        .is_err();
-        println!("{response:?}");
-        assert!(response, "The payment was intended to fail but it passed");
-    }
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+#[actix_web::test]
+async fn should_make_payment() {
+    let authorize_response = CONNECTOR
+        .make_payment(get_payment_authorize_data(), get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
 }
 
 #[actix_web::test]
-async fn refund_for_successful_payments() {
-    let conf = Settings::new().unwrap();
-    use router::connector::Aci;
-    let connector = utils::construct_connector_data_old(
-        Box::new(Aci::new()),
-        types::Connector::Aci,
-        types::api::GetToken::Connector,
-        None,
+async fn should_sync_auto_captured_payment() {
+    let authorize_response = CONNECTOR
+        .make_payment(get_payment_authorize_data(), get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    assert_ne!(txn_id, None, "Empty connector transaction id");
+    let response = CONNECTOR
+        .psync_retry_till_status_matches(
+            enums::AttemptStatus::Charged,
+            Some(types::PaymentsSyncData {
+                connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+                    txn_id.unwrap(),
+                ),
+                capture_method: Some(enums::CaptureMethod::Automatic),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+    let response = CONNECTOR
+        .make_payment_and_refund(
+            get_payment_authorize_data(),
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
     );
-    let tx: oneshot::Sender<()> = oneshot::channel().0;
-
-    let app_state = Box::pin(routes::AppState::with_storage(
-        conf,
-        StorageImpl::PostgresqlTest,
-        tx,
-        Box::new(services::MockApiClient),
-    ))
-    .await;
-    let state = Arc::new(app_state)
-        .get_session_state(
-            &id_type::TenantId::try_from_string("public".to_string()).unwrap(),
+}
+
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+    let refund_response = CONNECTOR
+        .make_payment_and_refund(
+            get_payment_authorize_data(),
+            Some(types::RefundsData {
+                refund_amount: 50,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        refund_response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+    CONNECTOR
+        .make_payment_and_multiple_refund(
+            get_payment_authorize_data(),
+            Some(types::RefundsData {
+                refund_amount: 50,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await;
+}
+
+#[actix_web::test]
+async fn should_sync_refund() {
+    let refund_response = CONNECTOR
+        .make_payment_and_refund(
+            get_payment_authorize_data(),
             None,
-            || {},
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    let response = CONNECTOR
+        .rsync_retry_till_status_matches(
+            enums::RefundStatus::Success,
+            refund_response.response.unwrap().connector_refund_id,
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+    let response = CONNECTOR
+        .make_payment(
+            Some(types::PaymentsAuthorizeData {
+                payment_method_data: PaymentMethodData::Card(Card {
+                    card_cvc: Secret::new("12345".to_string()),
+                    ..utils::CCardType::default().0
+                }),
+                ..utils::PaymentAuthorizeType::default().0
+            }),
+            get_default_payment_info(),
         )
+        .await
         .unwrap();
-    let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
-        types::api::Authorize,
-        types::PaymentsAuthorizeData,
-        types::PaymentsResponseData,
-    > = connector.connector.get_connector_integration();
-    let request = construct_payment_router_data();
-    let response = services::api::execute_connector_processing_step(
-        &state,
-        connector_integration,
-        &request,
-        payments::CallConnectorAction::Trigger,
-        None,
-        None,
-    )
-    .await
-    .unwrap();
     assert!(
-        response.status == enums::AttemptStatus::Charged,
-        "The payment failed"
+        response.response.is_err(),
+        "Payment should fail with incorrect CVC"
     );
-    let connector_integration: services::BoxedRefundConnectorIntegrationInterface<
-        types::api::Execute,
-        types::RefundsData,
-        types::RefundsResponseData,
-    > = connector.connector.get_connector_integration();
-    let mut refund_request = construct_refund_router_data();
-    refund_request.request.connector_transaction_id = match response.response.unwrap() {
-        types::PaymentsResponseData::TransactionResponse { resource_id, .. } => {
-            resource_id.get_connector_transaction_id().unwrap()
-        }
-        _ => panic!("Connector transaction id not found"),
-    };
-    let response = services::api::execute_connector_processing_step(
-        &state,
-        connector_integration,
-        &refund_request,
-        payments::CallConnectorAction::Trigger,
-        None,
-        None,
-    )
-    .await
-    .unwrap();
-    println!("{response:?}");
+}
+
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+    let response = CONNECTOR
+        .make_payment(
+            Some(types::PaymentsAuthorizeData {
+                payment_method_data: PaymentMethodData::Card(Card {
+                    card_exp_month: Secret::new("20".to_string()),
+                    ..utils::CCardType::default().0
+                }),
+                ..utils::PaymentAuthorizeType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
     assert!(
-        response.response.unwrap().refund_status == enums::RefundStatus::Success,
-        "The refund transaction failed"
+        response.response.is_err(),
+        "Payment should fail with invalid expiry month"
     );
 }
 
 #[actix_web::test]
-#[ignore]
-async fn refunds_create_failure() {
-    let conf = Settings::new().unwrap();
-    use router::connector::Aci;
-    let connector = utils::construct_connector_data_old(
-        Box::new(Aci::new()),
-        types::Connector::Aci,
-        types::api::GetToken::Connector,
-        None,
+async fn should_fail_payment_for_incorrect_expiry_year() {
+    let response = CONNECTOR
+        .make_payment(
+            Some(types::PaymentsAuthorizeData {
+                payment_method_data: PaymentMethodData::Card(Card {
+                    card_exp_year: Secret::new("2000".to_string()),
+                    ..utils::CCardType::default().0
+                }),
+                ..utils::PaymentAuthorizeType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert!(
+        response.response.is_err(),
+        "Payment should fail with incorrect expiry year"
     );
-    let tx: oneshot::Sender<()> = oneshot::channel().0;
-
-    let app_state = Box::pin(routes::AppState::with_storage(
-        conf,
-        StorageImpl::PostgresqlTest,
-        tx,
-        Box::new(services::MockApiClient),
-    ))
-    .await;
-    let state = Arc::new(app_state)
-        .get_session_state(
-            &id_type::TenantId::try_from_string("public".to_string()).unwrap(),
-            None,
-            || {},
+}
+
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+    let authorize_response = CONNECTOR
+        .make_payment(get_payment_authorize_data(), get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    assert_ne!(txn_id, None, "Empty connector transaction id");
+    let void_response = CONNECTOR
+        .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+        .await
+        .unwrap();
+    assert!(
+        void_response.response.is_err(),
+        "Void should fail for already captured payment"
+    );
+}
+
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+    let capture_response = CONNECTOR
+        .capture_payment("123456789".to_string(), None, get_default_payment_info())
+        .await
+        .unwrap();
+    assert!(
+        capture_response.response.is_err(),
+        "Capture should fail for invalid payment ID"
+    );
+}
+
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+    let response = CONNECTOR
+        .make_payment_and_refund(
+            get_payment_authorize_data(),
+            Some(types::RefundsData {
+                refund_amount: 150,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
         )
+        .await
+        .unwrap();
+    assert!(
+        response.response.is_err(),
+        "Refund should fail when amount exceeds payment amount"
+    );
+}
+
+#[actix_web::test]
+#[ignore]
+async fn should_make_threeds_payment() {
+    let authorize_response = CONNECTOR
+        .make_payment(
+            get_threeds_payment_authorize_data(),
+            get_default_payment_info(),
+        )
+        .await
         .unwrap();
-    let connector_integration: services::BoxedRefundConnectorIntegrationInterface<
-        types::api::Execute,
-        types::RefundsData,
-        types::RefundsResponseData,
-    > = connector.connector.get_connector_integration();
-    let mut request = construct_refund_router_data();
-    request.request.connector_transaction_id = "1234".to_string();
-    let response = services::api::execute_connector_processing_step(
-        &state,
-        connector_integration,
-        &request,
-        payments::CallConnectorAction::Trigger,
-        None,
-        None,
-    )
-    .await
-    .is_err();
-    println!("{response:?}");
-    assert!(response, "The refund was intended to fail but it passed");
+
+    assert!(
+        authorize_response.status == enums::AttemptStatus::AuthenticationPending
+            || authorize_response.status == enums::AttemptStatus::Charged,
+        "3DS payment should result in AuthenticationPending or Charged status, got: {:?}",
+        authorize_response.status
+    );
+
+    if let Ok(types::PaymentsResponseData::TransactionResponse {
+        redirection_data, ..
+    }) = &authorize_response.response
+    {
+        if authorize_response.status == enums::AttemptStatus::AuthenticationPending {
+            assert!(
+                redirection_data.is_some(),
+                "3DS flow should include redirection data for authentication"
+            );
+        }
+    }
+}
+
+#[actix_web::test]
+#[ignore]
+async fn should_authorize_threeds_payment() {
+    let response = CONNECTOR
+        .authorize_payment(
+            get_threeds_payment_authorize_data(),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("Authorize 3DS payment response");
+
+    assert!(
+        response.status == enums::AttemptStatus::AuthenticationPending
+            || response.status == enums::AttemptStatus::Authorized,
+        "3DS authorization should result in AuthenticationPending or Authorized status, got: {:?}",
+        response.status
+    );
+}
+
+#[actix_web::test]
+#[ignore]
+async fn should_sync_threeds_payment() {
+    let authorize_response = CONNECTOR
+        .authorize_payment(
+            get_threeds_payment_authorize_data(),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("Authorize 3DS payment response");
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    let response = CONNECTOR
+        .psync_retry_till_status_matches(
+            enums::AttemptStatus::AuthenticationPending,
+            Some(types::PaymentsSyncData {
+                connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+                    txn_id.unwrap(),
+                ),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("PSync 3DS response");
+    assert!(
+        response.status == enums::AttemptStatus::AuthenticationPending
+            || response.status == enums::AttemptStatus::Authorized,
+        "3DS sync should maintain AuthenticationPending or Authorized status"
+    );
 }
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 65fd42accf2..7508208069d 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -721,8 +721,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
 bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
 bank_debit.bacs = { connector_list = "stripe,gocardless" }
 bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,worldpayvantiv,payload"
-card.debit.connector_list = "checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,worldpayvantiv,payload"
+card.credit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,worldpayvantiv,payload"
+card.debit.connector_list = "aci,checkout,stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
 wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
 wallet.samsung_pay.connector_list = "cybersource"
 | 
	2025-08-19T07:22:43Z | 
	## Type of Change
- [ ] Bugfix
- [ ] New feature
- [X] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Summary
  This PR enhances the ACI connector with comprehensive 3D Secure (3DS) authentication support and modernizes the test suite, porting behavioral improvements from the `ORCH-2/aci-fixes` branch to be compatible with
  the current upstream codebase structure.
  ### Key Changes
  - **Standalone 3DS Implementation**: Added complete 3DS authentication flow using proper `/v1/threeDSecure` endpoints (PreAuthentication and Authentication)
  - **Framework Integration**: Implemented `AciThreeDSFlow` redirect form variant with dual iframe support for precondition and authentication steps
  - **Enhanced Request Structures**: Updated request models to include all required fields matching the reference script at `@hyperswitch/tmp/poc-exipay-cnp/scripts/aci/3ds`
  - **Payment Processing Improvements**: Added network token support, payment brand mapping, and proper mandate setup functionality
  - **Security Enhancement**: Updated webhook verification from NoAlgorithm to HMAC-SHA256
  - **Modernized Test Suite**: Refactored tests to use `ConnectorActions` pattern with comprehensive coverage including positive, negative, and 3DS scenarios
  ### Technical Details
  #### Files Modified
  - `crates/hyperswitch_connectors/src/connectors/aci.rs` - Main connector implementation
  - `crates/hyperswitch_connectors/src/connectors/aci/transformers.rs` - Request/response transformers
  - `crates/hyperswitch_domain_models/src/router_response_types.rs` - RedirectForm enum extension
  - `crates/diesel_models/src/payment_attempt.rs` - Database model updates
  - `crates/router/src/services/api.rs` - Framework-level redirect handling
  - `crates/router/tests/connectors/aci.rs` - Complete test suite modernization
  #### Key Implementations
  - **3DS Request Structure**: Complete `AciStandalone3DSRequest` with all required fields including challenge indicators, enrollment flags, and proper card data handling
  - **Dual Iframe Support**: Framework-level HTML generation for both precondition and authentication iframes
  - **Payment Brand Mapping**: Support for Visa, Mastercard, American Express, JCB, and other major card networks
  - **Authentication**: Fixed authentication to use Bearer format
  - **Modern Test Architecture**: Implemented `ConnectorActions` trait pattern following project standards
  ### Test Coverage Enhancements
  #### Positive Test Scenarios
  - Manual capture flow: authorize, capture, partial capture, sync, void, refund
  - Automatic capture flow: payment, sync, refund, partial refund, multiple refunds
  - 3DS authentication flows with proper status validation
  #### Negative Test Scenarios
  - Invalid card details (CVC, expiry month, expiry year)
  - Invalid payment operations (void auto-captured, invalid payment ID)
  - Refund validation (amount exceeding payment amount)
  #### 3DS-Specific Tests
  - 3DS payment creation with authentication data
  - 3DS authorization with redirect data validation
  - 3DS payment synchronization
  - Authentication flow status verification
  ### Validation
  - ✅ All modified files pass `cargo +nightly fmt` formatting checks
  - ✅ Code follows project conventions and patterns
  - ✅ Implementation matches reference script behavior
  - ✅ Comprehensive test coverage (18+ test scenarios)
  - ✅ Modern `ConnectorActions` pattern implementation
  - ✅ Backward compatibility maintained for existing functionality
  ### Test Plan
  - [x] Manual capture flow tests (authorize, capture, void, refund, sync)
  - [x] Automatic capture flow tests (payment, refund, sync)
  - [x] Negative scenario tests (invalid inputs, edge cases)
  - [x] 3DS authentication flow tests with redirect validation
  - [x] Framework-level redirect form handling validation
  - [x] Error handling and status code validation
### Additional Changes
- [x] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<details>
<summary>1. Cards payment </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Tz5ePEgSZ0NRdEOsdx3cloAjMSV3KkPbsWubLbAlSsv0ndwsblQKTkZZMu3332yC' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal"
}'
```
Response
```
```
</details>
2. Redirection
<img width="1721" height="1082" alt="Screenshot 2025-09-03 at 10 17 24 AM" src="https://github.com/user-attachments/assets/4e4c7059-1353-4160-b02e-bfa24fe7aa00" />
<details>
<summary>3. CIT </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "off_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900, 
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    }    
}'
````
Response:
```
{"payment_id":"pay_nJrHQrInwO77Uvsjrp1h","merchant_id":"merchant_1756939264","status":"requires_customer_action","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":6540,"amount_received":null,"connector":"aci","client_secret":"pay_nJrHQrInwO77Uvsjrp1h_secret_klCqSLL4Va5yqCqoS7iU","created":"2025-09-03T22:48:45.789Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":"man_JblRgVnFHqYNKvQIONrg","mandate_data":{"update_mandate_id":null,"customer_acceptance":{"acceptance_type":"offline","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"125.0.0.1","user_agent":"amet irure esse"}},"mandate_type":{"multi_use":{"amount":1000,"currency":"USD","start_date":"2023-04-21T00:00:00.000Z","end_date":"2023-05-21T00:00:00.000Z","metadata":{"frequency":"13"}}}},"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_nJrHQrInwO77Uvsjrp1h/merchant_1756939264/pay_nJrHQrInwO77Uvsjrp1h_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"customer123","created_at":1756939725,"expires":1756943325,"secret":"epk_a1f0c3c09a644947b2fbad66699edd4d"},"manual_retry_allowed":null,"connector_transaction_id":"8ac7a4a19911957d019911c4b0db7792","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a19911957d019911c4b0db7792","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T23:03:45.788Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_Nm9GUukfMLZhXdHJSEy0","network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T22:48:47.635Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":"test_ord","order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>4. Corresponding MIT </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data '{
    "amount": 1000,
    "currency": "EUR",
    
    "customer_id": "customer123",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_Nm9GUukfMLZhXdHJSEy0"
    }
}
'
```
Response
```
{"payment_id":"pay_tzYpHGeuRYHdPGK5M89d","merchant_id":"merchant_1756939264","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"aci","client_secret":"pay_tzYpHGeuRYHdPGK5M89d_secret_AErv7wAoaKE3LP4CWUR1","created":"2025-09-03T22:49:39.145Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Subsequent Mandate Test Payment (MIT from New CIT Demo)","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":"Mastercard","card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"customer123","created_at":1756939779,"expires":1756943379,"secret":"epk_63a75cd297424ac8b2af9abbd2e7396b"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a49f99119578019911c57d647953","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f99119578019911c57d647953","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T23:04:39.145Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_Nm9GUukfMLZhXdHJSEy0","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T22:49:40.001Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a299119a87019911c4af57529a","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>5. setup mandate </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_dVV9Je3mjaAV1ryc2n6xxIBOOiA5O7RoCqSRMpVpb9Gj9AV6dS5g3hEbMQp3K5rG' \
--data-raw '
{
    "amount": 0,
    "currency": "USD",
    "confirm": true,
    "customer_id": "tester123C",
    "email": "johndoe@gmail.com",
    "setup_future_usage": "off_session",
    "payment_type": "setup_mandate",
    "off_session": true,
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "email":"johndoe@gmail.com"
    }
}'
```
Response
```
{"payment_id":"pay_4fB1VOfBvH94w8ubEwIR","merchant_id":"merchant_1756917466","status":"succeeded","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"aci","client_secret":"pay_4fB1VOfBvH94w8ubEwIR_secret_CGiYMO43dEvBza21wCNY","created":"2025-09-03T21:43:07.598Z","currency":"USD","customer_id":"tester123C","customer":{"id":"tester123C","name":null,"email":"johndoe@gmail.com","phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":"man_D0PDZ3sITaf5hRKWOv9w","mandate_data":{"update_mandate_id":null,"customer_acceptance":{"acceptance_type":"offline","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"125.0.0.1","user_agent":"amet irure esse"}},"mandate_type":{"multi_use":{"amount":1000,"currency":"USD","start_date":"2023-04-21T00:00:00.000Z","end_date":"2023-05-21T00:00:00.000Z","metadata":{"frequency":"13"}}}},"setup_future_usage":"off_session","off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"John","last_name":"Doe","origin_zip":null},"phone":null,"email":"johndoe@gmail.com"},"billing":null,"order_details":null,"email":"johndoe@gmail.com","name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"tester123C","created_at":1756935787,"expires":1756939387,"secret":"epk_297846ba6efb4bc1a00da345f2d56273"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a1990ec863019911889b7c095d","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a1990ec863019911889b7c095d","payment_link":null,"profile_id":"pro_xtK5YkotshPxwjOySVEi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_gnftzAdh1YZJvZj3U2nU","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T21:58:07.597Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_lM41ZHCkvobdOiYZwhPr","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T21:43:10.100Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a1990ec863019911889b7c095d","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>6. MIT corresponding to setup mandate</summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_T42KWe2OWnUIg0vvhyYcFu7R1lLBKCRrpLWyPb4hWHNFyyC34aN9NQjpUdLsd9t9' \
--data '{
    "amount": 1000,
    "currency": "USD",
    
    "customer_id": "tester123C",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_lM41ZHCkvobdOiYZwhPr"
    }
}
'
```
Response
```
{"payment_id":"pay_TzRnmR2Nthv3WQbjCToR","merchant_id":"merchant_1756917466","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"aci","client_secret":"pay_TzRnmR2Nthv3WQbjCToR_secret_dOfVMRSVNv25sfAoN6nO","created":"2025-09-03T21:44:32.257Z","currency":"USD","customer_id":"tester123C","customer":{"id":"tester123C","name":null,"email":"johndoe@gmail.com","phone":null,"phone_country_code":null},"description":"Subsequent Mandate Test Payment (MIT from New CIT Demo)","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":"Mastercard","card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"johndoe@gmail.com","name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"tester123C","created_at":1756935872,"expires":1756939472,"secret":"epk_a4ec4eaa5b374dc682e3fac2ad45b421"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a0990ed03f01991189e2d474be","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a0990ed03f01991189e2d474be","payment_link":null,"profile_id":"pro_xtK5YkotshPxwjOySVEi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_gnftzAdh1YZJvZj3U2nU","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T21:59:32.256Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_lM41ZHCkvobdOiYZwhPr","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T21:44:33.883Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a1990ec863019911889b7c095d","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>7. Network Token  flow</summary>
I. Create ACI connector
```
curl --location 'http://localhost:8080/account/merchant_1756935953/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "aci",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": API_KEY,
        "key1": ENTITY_ID
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries":null,
                    "accepted_currencies": null
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": null,
                    "accepted_currencies": null
                }
            ]
        },
    ],
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    },
    "business_label": "default"
}'
```
II. Enable UAS for profile
```
curl --location 'http://localhost:8080/configs/merchants_eligible_for_authentication_service' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "key": "merchants_eligible_for_authentication_service",
    "value": VALUE_HERE
}'
```
III. create ctp_mastercard
```
curl --location 'http://localhost:8080/account/merchant_1756935953/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "connector_type": "authentication_processor",
    "connector_name": "ctp_mastercard",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": API_KEY
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "business_country": "US",
    "business_label": "default",
    "metadata": {
        "dpa_id": "DPA ID",
        "dpa_name": "TestMerchant",
        "locale": "en_AU",
        "card_brands": [
            "mastercard",
            "visa"
        ],
        "acquirer_bin": "ACQUIRER BIN",
        "acquirer_merchant_id": "ACQUIRER MERCHANT ID",
        "merchant_category_code": "0001",
        "merchant_country_code": "US"
    }
}'
```
IV. CTP profile update
```
curl --location 'http://localhost:8080/account/merchant_1756935953/business_profile/pro_kkwmU6LfcSIte3TlcHMh' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "is_click_to_pay_enabled": true,
    "authentication_product_ids": {"click_to_pay": "mca_foGzOn6nPM6TFvwh6fhj"}
}'
```
V. create payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data-raw '
{
    "amount": 1130,
    "currency": "EUR",
    "confirm": false,
    "return_url": "https://hyperswitch.io",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    }
}'
```
Response
```
{"payment_id":"pay_CHQQv8xweeAmih5MdFXd","merchant_id":"merchant_1756935953","status":"requires_payment_method","amount":1130,"net_amount":1130,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn","created":"2025-09-03T21:48:11.651Z","currency":"EUR","customer_id":null,"customer":null,"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_kkwmU6LfcSIte3TlcHMh","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T22:03:11.651Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T21:48:11.673Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
VI. confirm payment
```
curl --location 'http://localhost:8080/payments/pay_CHQQv8xweeAmih5MdFXd/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_4c7f1ffc1dfc4e889e867ac60505d178' \
--data '{
    "payment_method": "card",
    "payment_method_type": "debit",
    "client_secret": "pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn",
    "all_keys_required":true,
    "ctp_service_details": {
        "merchant_transaction_id": VALUE_HERE,
        "correlation_id": VALUE_HERE,
        "x_src_flow_id": VALUE_HERE
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "color_depth": 24,
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-GB",
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36"
    }
}'
```
Response
```
{"payment_id":"pay_CHQQv8xweeAmih5MdFXd","merchant_id":"merchant_1756935953","status":"requires_customer_action","amount":1130,"net_amount":1130,"shipping_cost":null,"amount_capturable":1130,"amount_received":null,"connector":"aci","client_secret":"pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn","created":"2025-09-03T21:48:11.651Z","currency":"EUR","customer_id":null,"customer":null,"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_CHQQv8xweeAmih5MdFXd/merchant_1756935953/pay_CHQQv8xweeAmih5MdFXd_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":null,"connector_transaction_id":"8ac7a4a1990ec8630199118d5b0d11ed","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a1990ec8630199118d5b0d11ed","payment_link":null,"profile_id":"pro_kkwmU6LfcSIte3TlcHMh","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_bQFt1dkbAjSp6Gv6pbJR","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":{"authentication_flow":null,"electronic_commerce_indicator":"06","status":"success","ds_transaction_id":null,"version":null,"error_code":null,"error_message":null},"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T22:03:11.651Z","fingerprint":null,"browser_info":{"os_type":null,"language":"en-GB","time_zone":-330,"ip_address":"::1","os_version":null,"user_agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36","color_depth":24,"device_model":null,"java_enabled":true,"screen_width":2560,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1440,"accept_language":"en","java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T21:48:20.951Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"click_to_pay","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":"{\"id\":\"8ac7a4a1990ec8630199118d5b0d11ed\",\"paymentType\":\"DB\",\"paymentBrand\":\"VISA\",\"amount\":\"11.30\",\"currency\":\"EUR\",\"descriptor\":\"3484.7818.5182 NetworkTokenChannel \",\"result\":{\"code\":\"000.200.000\",\"description\":\"transaction pending\"},\"tokenAccount\":{\"number\":\"2222030199301958\",\"type\":\"NETWORK\",\"expiryMonth\":\"10\",\"expiryYear\":\"2027\"},\"redirect\":{\"url\":\"https://eu-test.oppwa.com/connectors/demo/cybersourcerest/simulator/payment.ftl?ndcid=8a8294175d602369015d73bf009f1808_efdb58167aad468a928b44dde03c2115\",\"parameters\":[{\"name\":\"TransactionId\",\"value\":\"0000000070575071\"},{\"name\":\"uuid\",\"value\":\"8ac7a4a1990ec8630199118d5b0d11ed\"}]},\"buildNumber\":\"e05bc10dcc6acc6bd4abda346f4af077dcd905d7@2025-09-02 06:02:21 +0000\",\"timestamp\":\"2025-09-03 21:48:20+0000\",\"ndc\":\"8a8294175d602369015d73bf009f1808_efdb58167aad468a928b44dde03c2115\",\"source\":\"OPP\",\"paymentMethod\":\"NT\",\"shortId\":\"3484.7818.5182\"}","enable_partial_authorization":null}
```
</details>
<details>
<summary>7. Manual capture </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5386024192625914",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal"
}
'
```
Response:
```
{"payment_id":"pay_dTlUOqtFsHTk2pYjcNDt","merchant_id":"merchant_1756939264","status":"requires_customer_action","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":6540,"amount_received":null,"connector":"aci","client_secret":"pay_dTlUOqtFsHTk2pYjcNDt_secret_quBPvBLmgEoMeGq30q8W","created":"2025-09-04T12:25:30.223Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"5914","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"538602","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_dTlUOqtFsHTk2pYjcNDt/merchant_1756939264/pay_dTlUOqtFsHTk2pYjcNDt_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"customer123","created_at":1756988730,"expires":1756992330,"secret":"epk_fbfca29dcba44555b3c4abb3e7ce9b67"},"manual_retry_allowed":null,"connector_transaction_id":"8ac7a49f9912a69e019914b074cd08f8","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f9912a69e019914b074cd08f8","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T12:40:30.223Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-04T12:25:33.311Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
````
capture after redirection:
```
curl --location 'http://localhost:8080/payments/pay_dTlUOqtFsHTk2pYjcNDt/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data '{
  "amount_to_capture": 6540,
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}'
```
Response 
```
{"payment_id":"pay_dTlUOqtFsHTk2pYjcNDt","merchant_id":"merchant_1756939264","status":"succeeded","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":0,"amount_received":6540,"connector":"aci","client_secret":"pay_dTlUOqtFsHTk2pYjcNDt_secret_quBPvBLmgEoMeGq30q8W","created":"2025-09-04T12:25:30.223Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"5914","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"538602","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a29912ae61019914b0fd8866f5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f9912a69e019914b074cd08f8","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T12:40:30.223Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_dgRVnCJRHsU6c2LmY34G","network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-04T12:26:08.107Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [x] I added unit tests for my changes where possible
 | 
	7355a83ef9316a6cc7f9fa0c9c9aec7397e9fc4b | 
	
<details>
<summary>1. Cards payment </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Tz5ePEgSZ0NRdEOsdx3cloAjMSV3KkPbsWubLbAlSsv0ndwsblQKTkZZMu3332yC' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal"
}'
```
Response
```
```
</details>
2. Redirection
<img width="1721" height="1082" alt="Screenshot 2025-09-03 at 10 17 24 AM" src="https://github.com/user-attachments/assets/4e4c7059-1353-4160-b02e-bfa24fe7aa00" />
<details>
<summary>3. CIT </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "off_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900, 
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    }    
}'
````
Response:
```
{"payment_id":"pay_nJrHQrInwO77Uvsjrp1h","merchant_id":"merchant_1756939264","status":"requires_customer_action","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":6540,"amount_received":null,"connector":"aci","client_secret":"pay_nJrHQrInwO77Uvsjrp1h_secret_klCqSLL4Va5yqCqoS7iU","created":"2025-09-03T22:48:45.789Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":"man_JblRgVnFHqYNKvQIONrg","mandate_data":{"update_mandate_id":null,"customer_acceptance":{"acceptance_type":"offline","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"125.0.0.1","user_agent":"amet irure esse"}},"mandate_type":{"multi_use":{"amount":1000,"currency":"USD","start_date":"2023-04-21T00:00:00.000Z","end_date":"2023-05-21T00:00:00.000Z","metadata":{"frequency":"13"}}}},"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_nJrHQrInwO77Uvsjrp1h/merchant_1756939264/pay_nJrHQrInwO77Uvsjrp1h_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"customer123","created_at":1756939725,"expires":1756943325,"secret":"epk_a1f0c3c09a644947b2fbad66699edd4d"},"manual_retry_allowed":null,"connector_transaction_id":"8ac7a4a19911957d019911c4b0db7792","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a19911957d019911c4b0db7792","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T23:03:45.788Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_Nm9GUukfMLZhXdHJSEy0","network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T22:48:47.635Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":"test_ord","order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>4. Corresponding MIT </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data '{
    "amount": 1000,
    "currency": "EUR",
    
    "customer_id": "customer123",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_Nm9GUukfMLZhXdHJSEy0"
    }
}
'
```
Response
```
{"payment_id":"pay_tzYpHGeuRYHdPGK5M89d","merchant_id":"merchant_1756939264","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"aci","client_secret":"pay_tzYpHGeuRYHdPGK5M89d_secret_AErv7wAoaKE3LP4CWUR1","created":"2025-09-03T22:49:39.145Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Subsequent Mandate Test Payment (MIT from New CIT Demo)","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":"Mastercard","card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"customer123","created_at":1756939779,"expires":1756943379,"secret":"epk_63a75cd297424ac8b2af9abbd2e7396b"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a49f99119578019911c57d647953","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f99119578019911c57d647953","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T23:04:39.145Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_Nm9GUukfMLZhXdHJSEy0","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T22:49:40.001Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a299119a87019911c4af57529a","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>5. setup mandate </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_dVV9Je3mjaAV1ryc2n6xxIBOOiA5O7RoCqSRMpVpb9Gj9AV6dS5g3hEbMQp3K5rG' \
--data-raw '
{
    "amount": 0,
    "currency": "USD",
    "confirm": true,
    "customer_id": "tester123C",
    "email": "johndoe@gmail.com",
    "setup_future_usage": "off_session",
    "payment_type": "setup_mandate",
    "off_session": true,
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "email":"johndoe@gmail.com"
    }
}'
```
Response
```
{"payment_id":"pay_4fB1VOfBvH94w8ubEwIR","merchant_id":"merchant_1756917466","status":"succeeded","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"aci","client_secret":"pay_4fB1VOfBvH94w8ubEwIR_secret_CGiYMO43dEvBza21wCNY","created":"2025-09-03T21:43:07.598Z","currency":"USD","customer_id":"tester123C","customer":{"id":"tester123C","name":null,"email":"johndoe@gmail.com","phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":"man_D0PDZ3sITaf5hRKWOv9w","mandate_data":{"update_mandate_id":null,"customer_acceptance":{"acceptance_type":"offline","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"125.0.0.1","user_agent":"amet irure esse"}},"mandate_type":{"multi_use":{"amount":1000,"currency":"USD","start_date":"2023-04-21T00:00:00.000Z","end_date":"2023-05-21T00:00:00.000Z","metadata":{"frequency":"13"}}}},"setup_future_usage":"off_session","off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"John","last_name":"Doe","origin_zip":null},"phone":null,"email":"johndoe@gmail.com"},"billing":null,"order_details":null,"email":"johndoe@gmail.com","name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"tester123C","created_at":1756935787,"expires":1756939387,"secret":"epk_297846ba6efb4bc1a00da345f2d56273"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a1990ec863019911889b7c095d","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a1990ec863019911889b7c095d","payment_link":null,"profile_id":"pro_xtK5YkotshPxwjOySVEi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_gnftzAdh1YZJvZj3U2nU","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T21:58:07.597Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_lM41ZHCkvobdOiYZwhPr","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T21:43:10.100Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a1990ec863019911889b7c095d","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>6. MIT corresponding to setup mandate</summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_T42KWe2OWnUIg0vvhyYcFu7R1lLBKCRrpLWyPb4hWHNFyyC34aN9NQjpUdLsd9t9' \
--data '{
    "amount": 1000,
    "currency": "USD",
    
    "customer_id": "tester123C",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_lM41ZHCkvobdOiYZwhPr"
    }
}
'
```
Response
```
{"payment_id":"pay_TzRnmR2Nthv3WQbjCToR","merchant_id":"merchant_1756917466","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"aci","client_secret":"pay_TzRnmR2Nthv3WQbjCToR_secret_dOfVMRSVNv25sfAoN6nO","created":"2025-09-03T21:44:32.257Z","currency":"USD","customer_id":"tester123C","customer":{"id":"tester123C","name":null,"email":"johndoe@gmail.com","phone":null,"phone_country_code":null},"description":"Subsequent Mandate Test Payment (MIT from New CIT Demo)","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":"Mastercard","card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"johndoe@gmail.com","name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"tester123C","created_at":1756935872,"expires":1756939472,"secret":"epk_a4ec4eaa5b374dc682e3fac2ad45b421"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a0990ed03f01991189e2d474be","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a0990ed03f01991189e2d474be","payment_link":null,"profile_id":"pro_xtK5YkotshPxwjOySVEi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_gnftzAdh1YZJvZj3U2nU","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T21:59:32.256Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_lM41ZHCkvobdOiYZwhPr","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T21:44:33.883Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a1990ec863019911889b7c095d","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
<details>
<summary>7. Network Token  flow</summary>
I. Create ACI connector
```
curl --location 'http://localhost:8080/account/merchant_1756935953/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "aci",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": API_KEY,
        "key1": ENTITY_ID
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries":null,
                    "accepted_currencies": null
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": null,
                    "accepted_currencies": null
                }
            ]
        },
    ],
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    },
    "business_label": "default"
}'
```
II. Enable UAS for profile
```
curl --location 'http://localhost:8080/configs/merchants_eligible_for_authentication_service' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "key": "merchants_eligible_for_authentication_service",
    "value": VALUE_HERE
}'
```
III. create ctp_mastercard
```
curl --location 'http://localhost:8080/account/merchant_1756935953/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "connector_type": "authentication_processor",
    "connector_name": "ctp_mastercard",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": API_KEY
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "business_country": "US",
    "business_label": "default",
    "metadata": {
        "dpa_id": "DPA ID",
        "dpa_name": "TestMerchant",
        "locale": "en_AU",
        "card_brands": [
            "mastercard",
            "visa"
        ],
        "acquirer_bin": "ACQUIRER BIN",
        "acquirer_merchant_id": "ACQUIRER MERCHANT ID",
        "merchant_category_code": "0001",
        "merchant_country_code": "US"
    }
}'
```
IV. CTP profile update
```
curl --location 'http://localhost:8080/account/merchant_1756935953/business_profile/pro_kkwmU6LfcSIte3TlcHMh' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "is_click_to_pay_enabled": true,
    "authentication_product_ids": {"click_to_pay": "mca_foGzOn6nPM6TFvwh6fhj"}
}'
```
V. create payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data-raw '
{
    "amount": 1130,
    "currency": "EUR",
    "confirm": false,
    "return_url": "https://hyperswitch.io",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    }
}'
```
Response
```
{"payment_id":"pay_CHQQv8xweeAmih5MdFXd","merchant_id":"merchant_1756935953","status":"requires_payment_method","amount":1130,"net_amount":1130,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn","created":"2025-09-03T21:48:11.651Z","currency":"EUR","customer_id":null,"customer":null,"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_kkwmU6LfcSIte3TlcHMh","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T22:03:11.651Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T21:48:11.673Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
VI. confirm payment
```
curl --location 'http://localhost:8080/payments/pay_CHQQv8xweeAmih5MdFXd/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_4c7f1ffc1dfc4e889e867ac60505d178' \
--data '{
    "payment_method": "card",
    "payment_method_type": "debit",
    "client_secret": "pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn",
    "all_keys_required":true,
    "ctp_service_details": {
        "merchant_transaction_id": VALUE_HERE,
        "correlation_id": VALUE_HERE,
        "x_src_flow_id": VALUE_HERE
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "color_depth": 24,
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-GB",
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36"
    }
}'
```
Response
```
{"payment_id":"pay_CHQQv8xweeAmih5MdFXd","merchant_id":"merchant_1756935953","status":"requires_customer_action","amount":1130,"net_amount":1130,"shipping_cost":null,"amount_capturable":1130,"amount_received":null,"connector":"aci","client_secret":"pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn","created":"2025-09-03T21:48:11.651Z","currency":"EUR","customer_id":null,"customer":null,"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_CHQQv8xweeAmih5MdFXd/merchant_1756935953/pay_CHQQv8xweeAmih5MdFXd_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":null,"connector_transaction_id":"8ac7a4a1990ec8630199118d5b0d11ed","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a1990ec8630199118d5b0d11ed","payment_link":null,"profile_id":"pro_kkwmU6LfcSIte3TlcHMh","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_bQFt1dkbAjSp6Gv6pbJR","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":{"authentication_flow":null,"electronic_commerce_indicator":"06","status":"success","ds_transaction_id":null,"version":null,"error_code":null,"error_message":null},"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T22:03:11.651Z","fingerprint":null,"browser_info":{"os_type":null,"language":"en-GB","time_zone":-330,"ip_address":"::1","os_version":null,"user_agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36","color_depth":24,"device_model":null,"java_enabled":true,"screen_width":2560,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1440,"accept_language":"en","java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T21:48:20.951Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"click_to_pay","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":"{\"id\":\"8ac7a4a1990ec8630199118d5b0d11ed\",\"paymentType\":\"DB\",\"paymentBrand\":\"VISA\",\"amount\":\"11.30\",\"currency\":\"EUR\",\"descriptor\":\"3484.7818.5182 NetworkTokenChannel \",\"result\":{\"code\":\"000.200.000\",\"description\":\"transaction pending\"},\"tokenAccount\":{\"number\":\"2222030199301958\",\"type\":\"NETWORK\",\"expiryMonth\":\"10\",\"expiryYear\":\"2027\"},\"redirect\":{\"url\":\"https://eu-test.oppwa.com/connectors/demo/cybersourcerest/simulator/payment.ftl?ndcid=8a8294175d602369015d73bf009f1808_efdb58167aad468a928b44dde03c2115\",\"parameters\":[{\"name\":\"TransactionId\",\"value\":\"0000000070575071\"},{\"name\":\"uuid\",\"value\":\"8ac7a4a1990ec8630199118d5b0d11ed\"}]},\"buildNumber\":\"e05bc10dcc6acc6bd4abda346f4af077dcd905d7@2025-09-02 06:02:21 +0000\",\"timestamp\":\"2025-09-03 21:48:20+0000\",\"ndc\":\"8a8294175d602369015d73bf009f1808_efdb58167aad468a928b44dde03c2115\",\"source\":\"OPP\",\"paymentMethod\":\"NT\",\"shortId\":\"3484.7818.5182\"}","enable_partial_authorization":null}
```
</details>
<details>
<summary>7. Manual capture </summary>
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5386024192625914",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal"
}
'
```
Response:
```
{"payment_id":"pay_dTlUOqtFsHTk2pYjcNDt","merchant_id":"merchant_1756939264","status":"requires_customer_action","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":6540,"amount_received":null,"connector":"aci","client_secret":"pay_dTlUOqtFsHTk2pYjcNDt_secret_quBPvBLmgEoMeGq30q8W","created":"2025-09-04T12:25:30.223Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"5914","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"538602","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_dTlUOqtFsHTk2pYjcNDt/merchant_1756939264/pay_dTlUOqtFsHTk2pYjcNDt_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"customer123","created_at":1756988730,"expires":1756992330,"secret":"epk_fbfca29dcba44555b3c4abb3e7ce9b67"},"manual_retry_allowed":null,"connector_transaction_id":"8ac7a49f9912a69e019914b074cd08f8","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f9912a69e019914b074cd08f8","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T12:40:30.223Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-04T12:25:33.311Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
````
capture after redirection:
```
curl --location 'http://localhost:8080/payments/pay_dTlUOqtFsHTk2pYjcNDt/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data '{
  "amount_to_capture": 6540,
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}'
```
Response 
```
{"payment_id":"pay_dTlUOqtFsHTk2pYjcNDt","merchant_id":"merchant_1756939264","status":"succeeded","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":0,"amount_received":6540,"connector":"aci","client_secret":"pay_dTlUOqtFsHTk2pYjcNDt_secret_quBPvBLmgEoMeGq30q8W","created":"2025-09-04T12:25:30.223Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"5914","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"538602","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a29912ae61019914b0fd8866f5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f9912a69e019914b074cd08f8","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T12:40:30.223Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_dgRVnCJRHsU6c2LmY34G","network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-04T12:26:08.107Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9268 | 
	Bug: Fix UCS address precedence order for payment method billing addresses
## Problem
The current implementation in the UCS (Unified Connector Service) transformers has incorrect precedence order when handling addresses. The unified payment method billing address should take priority over the shipping/billing addresses from the payment request.
## Current Behavior
- Shipping address: `shipping.or(unified_payment_method_billing.clone())`
- Billing address: `billing.or(unified_payment_method_billing)`
This means the payment request addresses take precedence over the unified payment method billing address.
## Expected Behavior
The unified payment method billing address should take precedence:
- Shipping address: `unified_payment_method_billing.clone().or(shipping)`
- Billing address: `unified_payment_method_billing.or(billing)`
## Impact
This affects address data consistency in UCS transformations and could lead to incorrect address information being sent to connectors.
## Files Affected
- `crates/router/src/core/unified_connector_service/transformers.rs` | 
	diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index dec4281e7a9..9cc94c4a866 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -967,8 +967,8 @@ impl ForeignTryFrom<hyperswitch_domain_models::payment_address::PaymentAddress>
                 }
             });
         Ok(Self {
-            shipping_address: shipping.or(unified_payment_method_billing.clone()),
-            billing_address: billing.or(unified_payment_method_billing),
+            shipping_address: shipping,
+            billing_address: unified_payment_method_billing.or(billing),
         })
     }
 }
 | 
	2025-09-03T14:53:29Z | 
	## Summary
This PR fixes the billing address precedence order in the UCS (Unified Connector Service) transformers to ensure that unified payment method billing addresses take priority over billing addresses from payment requests.
## Changes
- Changed billing address precedence: `unified_payment_method_billing.or(billing)` instead of `billing.or(unified_payment_method_billing)`
- Shipping address logic remains unchanged: `shipping`
## Related Issues
- Closes #9268: Fix UCS address precedence order for payment method billing addresses
## Type of Change
- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
- [ ] Refactoring
## Testing
- [x] Code follows project style guidelines
- [x] Self-review completed
- [ ] Tests pass locally
- [ ] Documentation updated if needed
## Impact
This change ensures that unified payment method billing addresses take priority over payment request billing addresses in UCS transformations, providing more consistent address data handling.
## Files Modified
- `crates/router/src/core/unified_connector_service/transformers.rs` (line 971)
## Technical Details
The fix changes the precedence logic for billing addresses in the `ForeignTryFrom` implementation for `payments_grpc::PaymentAddress`. Previously, billing addresses from the payment request took precedence over unified payment method billing addresses. Now, if a unified payment method billing address exists, it will be used; otherwise, it falls back to the payment request billing address.
### Testing 
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-request-id: adsfadfads' \
--header 'api-key: dev_iTbySOVTqap2S4d7lr80lizI9gP4Ud3cji91v7AV1xk1elLdWNNq6dDVnSoAbpI6' \
--data-raw '{
    "amount": 6540,
    "currency": "INR",
    "amount_to_capture": 6540,
    "confirm": true,
    "profile_id": "pro_RkdjC1k2ZDLH1wvhSc76",
    "email": "customer@gmail.com",
    "capture_method": "automatic",
    
    "authentication_type": "no_three_ds",
    
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+91"
    },
    "customer_id": "customer123",
    
    
    
    
    
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "upi",
    "payment_method_type": "upi_collect",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "success@razorpay"
            }
        },
        "billing": {
            "email": "pmbi@example.com",
            "phone": {
                "country_code": "+91",
                "number": "6502530000"
            }
        }
    },
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        
    
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "IN",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "si@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "testing_the_integ03454",
    "all_keys_required": true,
    "session_expiry": 900
}'
```
```json
{
    "payment_id": "pay_d4tMeFMxF4EmZZ4w18Ym",
    "merchant_id": "merchant_1756906013",
    "status": "requires_customer_action",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 6540,
    "amount_received": null,
    "connector": "razorpay",
    "client_secret": "pay_d4tMeFMxF4EmZZ4w18Ym_secret_Bj4JWSrDkGDGK3TfKBt1",
    "created": "2025-09-03T15:36:23.275Z",
    "currency": "INR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+91"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "upi",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "su*****@razorpay"
            }
        },
        "billing": {
            "address": null,
            "phone": {
                "number": "6502530000",
                "country_code": "+91"
            },
            "email": null
        }
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "si@example.com"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "bi@example.com"
    },
    "order_details": [
        {
            "sku": null,
            "upc": null,
            "brand": null,
            "amount": 6540,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "description": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "total_amount": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "unit_discount_amount": null
        }
    ],
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "upi_collect",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer123",
        "created_at": 1756913783,
        "expires": 1756917383,
        "secret": "epk_53d393130e224556b2105520350533ae"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_RDBFdT6qU2bwzC",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": "order_RDBFcufill32B5",
    "payment_link": null,
    "profile_id": "pro_RkdjC1k2ZDLH1wvhSc76",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_1cYyVsBadn8UVLK5vI24",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-03T15:51:23.275Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-03T15:36:26.339Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "testing_the_integ03454",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"razorpay_payment_id\":\"pay_RDBFdT6qU2bwzC\"}",
    "enable_partial_authorization": null
}
```
**Important Note**: before fix the status was failed as it wasn't able to consume email but now it is correct | 
	4ab54f3c835de59cc098c8518938c746f4895bd1 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9270 | 
	Bug: [FEATURE] Map NTID for nuvei
Map NTID for Nuvei connector | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 791261d9ee0..b5bf5236330 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -2113,6 +2113,7 @@ pub struct NuveiPaymentsResponse {
     pub auth_code: Option<String>,
     pub custom_data: Option<String>,
     pub fraud_details: Option<FraudDetails>,
+    // NTID
     pub external_scheme_transaction_id: Option<Secret<String>>,
     pub session_token: Option<Secret<String>>,
     pub partial_approval: Option<NuveiPartialApproval>,
@@ -2420,7 +2421,10 @@ fn create_transaction_response(
         } else {
             None
         },
-        network_txn_id: None,
+        network_txn_id: response
+            .external_scheme_transaction_id
+            .as_ref()
+            .map(|ntid| ntid.clone().expose()),
         connector_response_reference_id: response.order_id.clone(),
         incremental_authorization_allowed: None,
         charges: None,
 | 
	2025-09-03T11:36:44Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
 Return Network transaction if from connector Response
- NOTE: we need to ask nuvei to return `external_scheme_transaction_id` during integration.
<details>
<summary> See returned NTID in the connector payment response</summary>
### Request
```json
{
    "amount": 4324,
    "currency": "EUR",
    "confirm": true,
    "capture_method":"automatic",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    // "order_tax_amount": 100,
    "setup_future_usage": "on_session",
    "payment_type":"setup_mandate",
    "connector":["nuvei"],
    "customer_id": "nidthhxxinn",
    "return_url": "https://www.google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000009995",
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "card_cvc": "100"
        }
    }
}
```
### Response
```json
{
    "payment_id": "pay_132ox19xtSuuI0v9ys8n",
    "merchant_id": "merchant_1756789409",
    "status": "succeeded",
    "amount": 4324,
    "net_amount": 4324,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_132ox19xtSuuI0v9ys8n_secret_zh69zcTMS8m8Gu3Qbxqj",
    "created": "2025-09-03T11:35:15.849Z",
    "currency": "EUR",
    "customer_id": "nidthhxxinn",
    "customer": {
        "id": "nidthhxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "9995",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_G1CCSamx2eABoRZkUVdu",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nidthhxxinn",
        "created_at": 1756899315,
        "expires": 1756902915,
        "secret": "epk_47477b29a38249f98abba6493c539f4b"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016989638",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8460393111",
    "payment_link": null,
    "profile_id": "pro_EzO6xGQZdE5pd9I5Rdzs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_i5QVCDvXmBLbZg7n97n2",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-03T11:50:15.849Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_bdgYAugJg43wY2L78Vkb",
    "network_transaction_id": "483299310332879", // NETWORK TRANSACTION ID
    "payment_method_status": "active",
    "updated": "2025-09-03T11:35:18.030Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2313100111",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
<summary> make a payment using NTID and card details</summary>
### request
```json
{
    "amount": 10023,
    "currency": "EUR",
    "confirm": true,
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    // "order_tax_amount": 100,
    "setup_future_usage": "off_session",
    // "payment_type":"setup_mandate",
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
 
    "payment_method": "card",
    "payment_method_type": "credit",
    "off_session": true,
    "recurring_details": {
        "type": "network_transaction_id_and_card_details",
        "data": {
            "card_number": "4000000000009995",
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_network":"VISA",
            "network_transaction_id": "483299310332879"
        }
    }
}
```
### Response
```json
{
    "payment_id": "pay_PP3muTBqIZL7tmrcOUgt",
    "merchant_id": "merchant_1756789409",
    "status": "succeeded",
    "amount": 10023,
    "net_amount": 10023,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 10023,
    "connector": "nuvei",
    "client_secret": "pay_PP3muTBqIZL7tmrcOUgt_secret_nv6ljhZsvECDd4g7p3V2",
    "created": "2025-09-03T11:48:42.127Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": null,
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": true,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "9995",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1756900122,
        "expires": 1756903722,
        "secret": "epk_803cf15eb02a4cd29894d6eb117b464e"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016990565",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "8460887111",
    "payment_link": null,
    "profile_id": "pro_EzO6xGQZdE5pd9I5Rdzs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_i5QVCDvXmBLbZg7n97n2",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-03T12:03:42.127Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "483299310332879",
    "payment_method_status": null,
    "updated": "2025-09-03T11:48:43.810Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e30842892a48ff6e4bc0e7c0a4990d3e5fc50027 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9258 | 
	Bug: [BUG] secure payment links don't render
### Bug Description
Secure payment links are not instantiating and rendering the checkout widget.
### Expected Behavior
Secure payment links should render the checkout widget.
### Actual Behavior
Secure payment links are breaking the functionality.
### Steps To Reproduce
- Whitelist `allowed_domains` in `payment_link_config`
- Create a payment link
- Open secure links
### Context For The Bug
-
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js b/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
index c539363c102..3a9e7f60336 100644
--- a/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
+++ b/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
@@ -30,7 +30,8 @@ if (!isFramed) {
    **/
   function initializeSDK() {
     // @ts-ignore
-    var paymentDetails = window.__PAYMENT_DETAILS;
+    var encodedPaymentDetails = window.__PAYMENT_DETAILS;
+    var paymentDetails = decodeUri(encodedPaymentDetails);
     var clientSecret = paymentDetails.client_secret;
     var sdkUiRules = paymentDetails.sdk_ui_rules;
     var labelType = paymentDetails.payment_form_label_type;
 | 
	2025-09-03T10:49:24Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR fixes the bug where the encoded payment link details were being read without decoding them first.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Fixes usage of secure payment links.
## How did you test it?
Locally by creating secure payment links.
<details>
    <summary>1. Update allowed domains in payment link config</summary>
cURL
    curl --location --request POST 'https://sandbox.hyperswitch.io/account/merchant_1681193734270/business_profile/pro_E7pM8kGERopEKEhqwfWQ' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_001otYWH3kG1v2SYexBXbt7AwbGQx8lK18wdsAmDvxtKVVLbBupRICLt6Styqadq' \
        --data '{
            "payment_link_config": {
                "theme": "#003264",
                "allowed_domains": [
                    "localhost:5000",
                    "http://localhost:5500",
                    "localhost:5500",
                    "http://localhost:5000",
                    "http://localhost:5501",
                    "localhost:5501",
                    "http://127.0.0.1:5501",
                    "127.0.0.1:5501"
                ],
                "branding_visibility": false
            }
        }'
</details>
<details>
    <summary>2. Create a payment link</summary>
cURL
    curl --location --request POST 'https://sandbox.hyperswitch.io/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'Accept-Language: de' \
        --header 'api-key: dev_001otYWH3kG1v2SYexBXbt7AwbGQx8lK18wdsAmDvxtKVVLbBupRICLt6Styqadq' \
        --data-raw '{
            "customer_id": "cus_CDei4NEhboFFubgAxsy8",
            "customer_acceptance": {
                "acceptance_type": "online",
                "accepted_at": "1963-05-03T04:07:52.723Z",
                "online": {
                    "ip_address": "127.0.0.1",
                    "user_agent": "amet irure esse"
                }
            },
            "setup_future_usage": "off_session",
            "amount": 100,
            "currency": "EUR",
            "confirm": false,
            "payment_link": true,
            "session_expiry": 7890000,
            "billing": {
                "address": {
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": "Harrison Street",
                    "zip": "94122",
                    "country": "IT",
                    "first_name": "John",
                    "last_name": "Doe"
                },
                "phone": {
                    "number": "8056594427",
                    "country_code": "+91"
                },
                "email": "random@juspay.in"
            },
            "return_url": "https://www.example.com"
        }'
Response
    {"payment_id":"pay_6tphveQF5TmCQO90G05r","merchant_id":"merchant_1756818611","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_6tphveQF5TmCQO90G05r_secret_VUlaPQSpKYZWGwCpGBI4","created":"2025-09-03T10:38:39.889Z","currency":"EUR","customer_id":"cus_Ey5nUuS0S4R2xds9t51K","customer":{"id":"cus_Ey5nUuS0S4R2xds9t51K","name":"John Doe","email":"abc@example.com","phone":"999999999","phone_country_code":"+65"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":null,"payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":null,"country":"IT","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"random@juspay.in"},"order_details":null,"email":"abc@example.com","name":"John Doe","phone":"999999999","return_url":"https://www.example.com/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_Ey5nUuS0S4R2xds9t51K","created_at":1756895919,"expires":1756899519,"secret":"epk_a9551c5842a04d8cbd9eb0213ea5790d"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1756818611/pay_6tphveQF5TmCQO90G05r?locale=de","secure_link":"http://localhost:8080/payment_link/s/merchant_1756818611/pay_6tphveQF5TmCQO90G05r?locale=de","payment_link_id":"plink_KZjExI8gP8BP0pRGVaI9"},"profile_id":"pro_GlXrXUKHbckWzGnidhzV","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-12-03T18:18:39.883Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T10:38:39.911Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
</details>
<details>
    <summary>3. Open in an iframe</summary>
HTML
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Document</title>
            <style>
                html, body {
                    margin: 0;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    background-color: black;
                    height: 100vh;
                    width: 100vw;
                }
                iframe {
                    border-radius: 4px;
                    height: 90vh;
                    width: 90vw;
                    background-color: white;
                }
            </style>
        </head>
        <body>
            <iframe
                allow="payment"
                src="http://localhost:8080/payment_link/s/merchant_1756818611/pay_5NZOVfi2G1Xg856uyTCZ?locale=de"
                frameborder="0"></iframe>
        </body>
    </html>
<img width="860" height="840" alt="Screenshot 2025-09-03 at 4 18 58 PM" src="https://github.com/user-attachments/assets/990d25a1-cb4c-4049-bc60-78f9a2232047" />
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e30842892a48ff6e4bc0e7c0a4990d3e5fc50027 | 
	Locally by creating secure payment links.
<details>
    <summary>1. Update allowed domains in payment link config</summary>
cURL
    curl --location --request POST 'https://sandbox.hyperswitch.io/account/merchant_1681193734270/business_profile/pro_E7pM8kGERopEKEhqwfWQ' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_001otYWH3kG1v2SYexBXbt7AwbGQx8lK18wdsAmDvxtKVVLbBupRICLt6Styqadq' \
        --data '{
            "payment_link_config": {
                "theme": "#003264",
                "allowed_domains": [
                    "localhost:5000",
                    "http://localhost:5500",
                    "localhost:5500",
                    "http://localhost:5000",
                    "http://localhost:5501",
                    "localhost:5501",
                    "http://127.0.0.1:5501",
                    "127.0.0.1:5501"
                ],
                "branding_visibility": false
            }
        }'
</details>
<details>
    <summary>2. Create a payment link</summary>
cURL
    curl --location --request POST 'https://sandbox.hyperswitch.io/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'Accept-Language: de' \
        --header 'api-key: dev_001otYWH3kG1v2SYexBXbt7AwbGQx8lK18wdsAmDvxtKVVLbBupRICLt6Styqadq' \
        --data-raw '{
            "customer_id": "cus_CDei4NEhboFFubgAxsy8",
            "customer_acceptance": {
                "acceptance_type": "online",
                "accepted_at": "1963-05-03T04:07:52.723Z",
                "online": {
                    "ip_address": "127.0.0.1",
                    "user_agent": "amet irure esse"
                }
            },
            "setup_future_usage": "off_session",
            "amount": 100,
            "currency": "EUR",
            "confirm": false,
            "payment_link": true,
            "session_expiry": 7890000,
            "billing": {
                "address": {
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": "Harrison Street",
                    "zip": "94122",
                    "country": "IT",
                    "first_name": "John",
                    "last_name": "Doe"
                },
                "phone": {
                    "number": "8056594427",
                    "country_code": "+91"
                },
                "email": "random@juspay.in"
            },
            "return_url": "https://www.example.com"
        }'
Response
    {"payment_id":"pay_6tphveQF5TmCQO90G05r","merchant_id":"merchant_1756818611","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_6tphveQF5TmCQO90G05r_secret_VUlaPQSpKYZWGwCpGBI4","created":"2025-09-03T10:38:39.889Z","currency":"EUR","customer_id":"cus_Ey5nUuS0S4R2xds9t51K","customer":{"id":"cus_Ey5nUuS0S4R2xds9t51K","name":"John Doe","email":"abc@example.com","phone":"999999999","phone_country_code":"+65"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":null,"payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":null,"country":"IT","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"random@juspay.in"},"order_details":null,"email":"abc@example.com","name":"John Doe","phone":"999999999","return_url":"https://www.example.com/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_Ey5nUuS0S4R2xds9t51K","created_at":1756895919,"expires":1756899519,"secret":"epk_a9551c5842a04d8cbd9eb0213ea5790d"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1756818611/pay_6tphveQF5TmCQO90G05r?locale=de","secure_link":"http://localhost:8080/payment_link/s/merchant_1756818611/pay_6tphveQF5TmCQO90G05r?locale=de","payment_link_id":"plink_KZjExI8gP8BP0pRGVaI9"},"profile_id":"pro_GlXrXUKHbckWzGnidhzV","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-12-03T18:18:39.883Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T10:38:39.911Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
</details>
<details>
    <summary>3. Open in an iframe</summary>
HTML
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Document</title>
            <style>
                html, body {
                    margin: 0;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    background-color: black;
                    height: 100vh;
                    width: 100vw;
                }
                iframe {
                    border-radius: 4px;
                    height: 90vh;
                    width: 90vw;
                    background-color: white;
                }
            </style>
        </head>
        <body>
            <iframe
                allow="payment"
                src="http://localhost:8080/payment_link/s/merchant_1756818611/pay_5NZOVfi2G1Xg856uyTCZ?locale=de"
                frameborder="0"></iframe>
        </body>
    </html>
<img width="860" height="840" alt="Screenshot 2025-09-03 at 4 18 58 PM" src="https://github.com/user-attachments/assets/990d25a1-cb4c-4049-bc60-78f9a2232047" />
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9264 | 
	Bug: [BUG] Add extra field for Cybersource MIT payment for acquirer CMCIC
### Bug Description
For acquirer CMCIC, Cybersource MIT payments needs the following field
`paymentInformation.card.typeSelectionIndicator`
### Expected Behavior
the said field should be present in MIT payments
### Actual Behavior
the said field is currently not present in MIT payments
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index e39bc64c3f6..c877832521f 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -562,11 +562,17 @@ pub struct MandatePaymentTokenizedCard {
     transaction_type: TransactionType,
 }
 
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MandateCard {
+    type_selection_indicator: Option<String>,
+}
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct MandatePaymentInformation {
     payment_instrument: CybersoucrePaymentInstrument,
     tokenized_card: MandatePaymentTokenizedCard,
+    card: Option<MandateCard>,
 }
 
 #[derive(Debug, Serialize)]
@@ -2555,6 +2561,15 @@ impl TryFrom<(&CybersourceRouterData<&PaymentsAuthorizeRouterData>, String)>
         let payment_instrument = CybersoucrePaymentInstrument {
             id: connector_mandate_id.into(),
         };
+        let mandate_card_information = match item.router_data.request.payment_method_type {
+            Some(enums::PaymentMethodType::Credit) | Some(enums::PaymentMethodType::Debit) => {
+                Some(MandateCard {
+                    type_selection_indicator: Some("1".to_owned()),
+                })
+            }
+            _ => None,
+        };
+
         let bill_to = item
             .router_data
             .get_optional_billing_email()
@@ -2567,6 +2582,7 @@ impl TryFrom<(&CybersourceRouterData<&PaymentsAuthorizeRouterData>, String)>
                 tokenized_card: MandatePaymentTokenizedCard {
                     transaction_type: TransactionType::StoredCredentials,
                 },
+                card: mandate_card_information,
             }));
         let client_reference_information = ClientReferenceInformation::from(item);
         let merchant_defined_information = item
 | 
	2025-09-03T13:09:14Z | 
	…IT payments
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [X] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
For acquirer CMCIC, Cybersource MIT payments needs the following field
`paymentInformation.card.typeSelectionIndicator`
This PR addresses the same
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<details>
<summary>Create MIT for cards via cybersource</summary>
**MIT curl**
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jEdNDCtQGso72keWEtypBWmXAKaYNLmAcTTsutLbPwa8CY4p2I36w4wVkZziDTuK' \
--data-raw '{
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_TjN8SPmxPhH9HMUG1QRT"
    },
    "authentication_type": "no_three_ds",
    "customer": {
        "id": "StripeCustomer",
        "email": "guest@example.com"
    },
    "description": "This is the test payment made through Mule API",
    "currency": "USD",
    "amount": 126,
    "confirm": true,
    "capture_method": "automatic",
    "off_session": true,
    "metadata": {
        "businessUnit": "ZG_GL_Group",
        "country": "US",
        "clientId": "N/A",
        "productName": "Travel insurance",
        "orderReference": "order-040724-001"
    }
}'
```
**Response**
```
{"payment_id":"pay_IwxJCwYyfgVs2dmuJEGV","merchant_id":"merchant_1756212829","status":"succeeded","amount":126,"net_amount":126,"shipping_cost":null,"amount_capturable":0,"amount_received":126,"connector":"cybersource","client_secret":"pay_IwxJCwYyfgVs2dmuJEGV_secret_vrVfkIHFXMHTjV15kPvX","created":"2025-09-03T13:03:09.431Z","currency":"USD","customer_id":"StripeCustomer","customer":{"id":"StripeCustomer","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+1"},"description":"This is the test payment made through Mule API","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1091","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"2025","card_holder_name":"Max Mustermann","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"StripeCustomer","created_at":1756904589,"expires":1756908189,"secret":"epk_98623acc878f40c58dec97f2ccd8b2c9"},"manual_retry_allowed":false,"connector_transaction_id":"7569045896736796904805","frm_message":null,"metadata":{"country":"US","clientId":"N/A","productName":"Travel insurance","businessUnit":"ZG_GL_Group","orderReference":"order-040724-001"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_IwxJCwYyfgVs2dmuJEGV_1","payment_link":null,"profile_id":"pro_LDyaQED9dZ5fgu7cmTQ0","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_xal1vas6DVUdGb6LDbro","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T13:18:09.431Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_TjN8SPmxPhH9HMUG1QRT","network_transaction_id":"123456789619999","payment_method_status":"active","updated":"2025-09-03T13:03:09.995Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"3DE62376C727E833E063AF598E0A2728","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
Screenshot of logs: `type_selection_indicator` is passed as 1 
<img width="1721" height="252" alt="Screenshot 2025-09-03 at 6 32 25 PM" src="https://github.com/user-attachments/assets/8b2f4abb-80dd-415f-960e-413b0ecc7ebc" />
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [X] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	04578801b62245144c029accb6de5c23042480cb | 
	
<details>
<summary>Create MIT for cards via cybersource</summary>
**MIT curl**
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jEdNDCtQGso72keWEtypBWmXAKaYNLmAcTTsutLbPwa8CY4p2I36w4wVkZziDTuK' \
--data-raw '{
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_TjN8SPmxPhH9HMUG1QRT"
    },
    "authentication_type": "no_three_ds",
    "customer": {
        "id": "StripeCustomer",
        "email": "guest@example.com"
    },
    "description": "This is the test payment made through Mule API",
    "currency": "USD",
    "amount": 126,
    "confirm": true,
    "capture_method": "automatic",
    "off_session": true,
    "metadata": {
        "businessUnit": "ZG_GL_Group",
        "country": "US",
        "clientId": "N/A",
        "productName": "Travel insurance",
        "orderReference": "order-040724-001"
    }
}'
```
**Response**
```
{"payment_id":"pay_IwxJCwYyfgVs2dmuJEGV","merchant_id":"merchant_1756212829","status":"succeeded","amount":126,"net_amount":126,"shipping_cost":null,"amount_capturable":0,"amount_received":126,"connector":"cybersource","client_secret":"pay_IwxJCwYyfgVs2dmuJEGV_secret_vrVfkIHFXMHTjV15kPvX","created":"2025-09-03T13:03:09.431Z","currency":"USD","customer_id":"StripeCustomer","customer":{"id":"StripeCustomer","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+1"},"description":"This is the test payment made through Mule API","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1091","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"2025","card_holder_name":"Max Mustermann","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"StripeCustomer","created_at":1756904589,"expires":1756908189,"secret":"epk_98623acc878f40c58dec97f2ccd8b2c9"},"manual_retry_allowed":false,"connector_transaction_id":"7569045896736796904805","frm_message":null,"metadata":{"country":"US","clientId":"N/A","productName":"Travel insurance","businessUnit":"ZG_GL_Group","orderReference":"order-040724-001"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_IwxJCwYyfgVs2dmuJEGV_1","payment_link":null,"profile_id":"pro_LDyaQED9dZ5fgu7cmTQ0","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_xal1vas6DVUdGb6LDbro","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T13:18:09.431Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_TjN8SPmxPhH9HMUG1QRT","network_transaction_id":"123456789619999","payment_method_status":"active","updated":"2025-09-03T13:03:09.995Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"3DE62376C727E833E063AF598E0A2728","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
```
Screenshot of logs: `type_selection_indicator` is passed as 1 
<img width="1721" height="252" alt="Screenshot 2025-09-03 at 6 32 25 PM" src="https://github.com/user-attachments/assets/8b2f4abb-80dd-415f-960e-413b0ecc7ebc" />
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9255 | 
	Bug: [FEATURE] [SHIFT4] Pass metadata to connector
### Feature Description
Pass metadata to connector Shift4
### Possible Implementation
Pass metadata to connector Shift4
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index eeaf340e103..98793e691ff 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -43,6 +43,7 @@ trait Shift4AuthorizePreprocessingCommon {
     fn get_email_optional(&self) -> Option<pii::Email>;
     fn get_complete_authorize_url(&self) -> Option<String>;
     fn get_currency_required(&self) -> Result<enums::Currency, Error>;
+    fn get_metadata(&self) -> Result<Option<serde_json::Value>, Error>;
     fn get_payment_method_data_required(&self) -> Result<PaymentMethodData, Error>;
 }
 
@@ -88,6 +89,12 @@ impl Shift4AuthorizePreprocessingCommon for PaymentsAuthorizeData {
     fn get_router_return_url(&self) -> Option<String> {
         self.router_return_url.clone()
     }
+
+    fn get_metadata(
+        &self,
+    ) -> Result<Option<serde_json::Value>, error_stack::Report<errors::ConnectorError>> {
+        Ok(self.metadata.clone())
+    }
 }
 
 impl Shift4AuthorizePreprocessingCommon for PaymentsPreProcessingData {
@@ -117,12 +124,18 @@ impl Shift4AuthorizePreprocessingCommon for PaymentsPreProcessingData {
     fn get_router_return_url(&self) -> Option<String> {
         self.router_return_url.clone()
     }
+    fn get_metadata(
+        &self,
+    ) -> Result<Option<serde_json::Value>, error_stack::Report<errors::ConnectorError>> {
+        Ok(None)
+    }
 }
 #[derive(Debug, Serialize)]
 pub struct Shift4PaymentsRequest {
     amount: MinorUnit,
     currency: enums::Currency,
     captured: bool,
+    metadata: Option<serde_json::Value>,
     #[serde(flatten)]
     payment_method: Shift4PaymentMethod,
 }
@@ -275,11 +288,13 @@ where
         let submit_for_settlement = item.router_data.request.is_automatic_capture()?;
         let amount = item.amount.to_owned();
         let currency = item.router_data.request.get_currency_required()?;
+        let metadata = item.router_data.request.get_metadata()?;
         let payment_method = Shift4PaymentMethod::try_from(item.router_data)?;
         Ok(Self {
             amount,
             currency,
             captured: submit_for_settlement,
+            metadata,
             payment_method,
         })
     }
@@ -641,9 +656,11 @@ impl<T> TryFrom<&Shift4RouterData<&RouterData<T, CompleteAuthorizeData, Payments
             Some(PaymentMethodData::Card(_)) => {
                 let card_token: Shift4CardToken =
                     to_connector_meta(item.router_data.request.connector_meta.clone())?;
+                let metadata = item.router_data.request.metadata.clone();
                 Ok(Self {
                     amount: item.amount.to_owned(),
                     currency: item.router_data.request.currency,
+                    metadata,
                     payment_method: Shift4PaymentMethod::CardsNon3DSRequest(Box::new(
                         CardsNon3DSRequest {
                             card: CardPayment::CardToken(card_token.id),
 | 
	2025-09-03T09:33:08Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Pass metadata to connector Shift4.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
https://github.com/juspay/hyperswitch/issues/9255
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Payment Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_eJHaeshBvRK6V5mOAoloL5aRczu82zuQt41YvafbbOxn5nDxMNIHOWsJ5TDCT8dJ' \
--data-raw '{
    "amount": 5556,
    "currency": "USD",
    "confirm": true,
    "profile_id": "pro_mId6vzqmEh4dUmJyLRSI", 
    "authentication_type": "no_three_ds",
    "customer": {
        "id": "deepanshu",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4012001800000016",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    }
}'
```
Payment Response:
```
{
    "payment_id": "pay_Xb9hjoMzOeSqH14S1HXy",
    "merchant_id": "merchant_1756889332",
    "status": "succeeded",
    "amount": 5556,
    "net_amount": 5556,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 5556,
    "connector": "shift4",
    "client_secret": "pay_Xb9hjoMzOeSqH14S1HXy_secret_EYxCuRxvHkZu7WyJW1Hh",
    "created": "2025-09-03T09:34:00.407Z",
    "currency": "USD",
    "customer_id": "deepanshu",
    "customer": {
        "id": "deepanshu",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0016",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "401200",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_whphrdy66T0EROtSP61h",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": null,
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "deepanshu",
        "created_at": 1756892040,
        "expires": 1756895640,
        "secret": "epk_00a0b91c83104def83f9758c18ee9034"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "char_pBsemSHNsodexllVdUWYvyUi",
    "frm_message": null,
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "char_pBsemSHNsodexllVdUWYvyUi",
    "payment_link": null,
    "profile_id": "pro_mId6vzqmEh4dUmJyLRSI",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lLEdkj8jX102T4hpRpLE",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-03T09:49:00.407Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-03T09:34:01.500Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Shift4 Dashboard:
<img width="1955" height="217" alt="image" src="https://github.com/user-attachments/assets/47fb3ce8-0687-41f1-990b-2d8c30e8b65f" />
Cypress:
<img width="822" height="1071" alt="image" src="https://github.com/user-attachments/assets/af192e95-66a5-49d6-a0f7-7960b8e1e76a" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e30842892a48ff6e4bc0e7c0a4990d3e5fc50027 | 
	
Payment Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_eJHaeshBvRK6V5mOAoloL5aRczu82zuQt41YvafbbOxn5nDxMNIHOWsJ5TDCT8dJ' \
--data-raw '{
    "amount": 5556,
    "currency": "USD",
    "confirm": true,
    "profile_id": "pro_mId6vzqmEh4dUmJyLRSI", 
    "authentication_type": "no_three_ds",
    "customer": {
        "id": "deepanshu",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4012001800000016",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    }
}'
```
Payment Response:
```
{
    "payment_id": "pay_Xb9hjoMzOeSqH14S1HXy",
    "merchant_id": "merchant_1756889332",
    "status": "succeeded",
    "amount": 5556,
    "net_amount": 5556,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 5556,
    "connector": "shift4",
    "client_secret": "pay_Xb9hjoMzOeSqH14S1HXy_secret_EYxCuRxvHkZu7WyJW1Hh",
    "created": "2025-09-03T09:34:00.407Z",
    "currency": "USD",
    "customer_id": "deepanshu",
    "customer": {
        "id": "deepanshu",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0016",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "401200",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_whphrdy66T0EROtSP61h",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": null,
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "deepanshu",
        "created_at": 1756892040,
        "expires": 1756895640,
        "secret": "epk_00a0b91c83104def83f9758c18ee9034"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "char_pBsemSHNsodexllVdUWYvyUi",
    "frm_message": null,
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "char_pBsemSHNsodexllVdUWYvyUi",
    "payment_link": null,
    "profile_id": "pro_mId6vzqmEh4dUmJyLRSI",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lLEdkj8jX102T4hpRpLE",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-03T09:49:00.407Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-03T09:34:01.500Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Shift4 Dashboard:
<img width="1955" height="217" alt="image" src="https://github.com/user-attachments/assets/47fb3ce8-0687-41f1-990b-2d8c30e8b65f" />
Cypress:
<img width="822" height="1071" alt="image" src="https://github.com/user-attachments/assets/af192e95-66a5-49d6-a0f7-7960b8e1e76a" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9257 | 
	Bug: [BUG] Enable nuvei applepay googlepay mandate features in sbx , prod and integ
Update .toml files for sbx, prod and integ to enable mandates for applae pay and google_pay | 
	diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 0867ca7014a..15f3233e175 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -233,9 +233,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,nuvei,authorizedotnet,wellsfargo"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,nuvei,authorizedotnet,wellsfargo"
 wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal,authorizedotnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 20040502e11..124a31113df 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -233,9 +233,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,nuvei,authorizedotnet,wellsfargo"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,nuvei,authorizedotnet,wellsfargo"
 wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal,authorizedotnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 23a362581e9..4fe6332572b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -240,9 +240,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo,worldpayvantiv"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,nuvei,authorizedotnet,wellsfargo,worldpayvantiv"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo,worldpayvantiv"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,nuvei,authorizedotnet,wellsfargo,worldpayvantiv"
 wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal,authorizedotnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index fbe2be161fa..8dbbd2aadaa 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1003,8 +1003,8 @@ bank_redirect.open_banking_uk.connector_list = "adyen"
 
 [mandates.supported_payment_methods]
 pay_later.klarna = { connector_list = "adyen,aci" }
-wallet.google_pay = { connector_list = "stripe,cybersource,adyen,bankofamerica,authorizedotnet,noon,novalnet,multisafepay,wellsfargo" }
-wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo" }
+wallet.google_pay = { connector_list = "stripe,cybersource,adyen,bankofamerica,authorizedotnet,noon,novalnet,multisafepay,wellsfargo,nuvei" }
+wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo,nuvei" }
 wallet.samsung_pay = { connector_list = "cybersource" }
 wallet.paypal = { connector_list = "adyen,novalnet,authorizedotnet" }
 card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
 | 
	2025-09-03T09:38:46Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add apple_pay and google_pay mandate support for nuvei in integ,sbx and prod ( updation of config files)
Parent pr : https://github.com/juspay/hyperswitch/pull/9081
Refer test cases with above pr
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e30842892a48ff6e4bc0e7c0a4990d3e5fc50027 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9250 | 
	Bug: fix(users): Add Bad request response in openidconnect
Currently, when users provide an invalid or expired code during SSO login, the system returns a 500 response. This is misleading, as the issue is with the client input rather than a server error. This change introduces a proper 400 BadRequest response to better reflect the actual problem and improve error handling. | 
	diff --git a/crates/router/src/services/openidconnect.rs b/crates/router/src/services/openidconnect.rs
index ca20b021a56..69b890d657e 100644
--- a/crates/router/src/services/openidconnect.rs
+++ b/crates/router/src/services/openidconnect.rs
@@ -76,7 +76,14 @@ pub async fn get_user_email_from_oidc_provider(
         .exchange_code(oidc::AuthorizationCode::new(authorization_code.expose()))
         .request_async(|req| get_oidc_reqwest_client(state, req))
         .await
-        .change_context(UserErrors::InternalServerError)
+        .map_err(|e| match e {
+            oidc::RequestTokenError::ServerResponse(resp)
+                if resp.error() == &oidc_core::CoreErrorResponseType::InvalidGrant =>
+            {
+                UserErrors::SSOFailed
+            }
+            _ => UserErrors::InternalServerError,
+        })
         .attach_printable("Failed to exchange code and fetch oidc token")?;
 
     // Fetch id token from response
 | 
	2025-09-02T13:29:23Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Added a BadRequest response for SSO login when an invalid authorization code is provided.
<!-- Describe your changes in detail -->
### Additional Changes
- [X] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Currently, when users provide an invalid or expired code during SSO login, the system returns a 500 response. This is misleading, as the issue is with the client input rather than a server error. This change introduces a proper 400 BadRequest response to better reflect the actual problem and improve error handling.
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
```sh
curl --location '<BASE URL>/user/oidc' \
--header 'Content-Type: application/json' \
--data '{
    "state": "<correct state>",
    "code": "<wrong code>"
}'
```
This should give `400` instead of 500.
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e30842892a48ff6e4bc0e7c0a4990d3e5fc50027 | 
	```sh
curl --location '<BASE URL>/user/oidc' \
--header 'Content-Type: application/json' \
--data '{
    "state": "<correct state>",
    "code": "<wrong code>"
}'
```
This should give `400` instead of 500.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9240 | 
	Bug: [BUG] MIT for migrated wallet tokens does not go through
### Bug Description
Creating MIT transactions for migrated wallets leads to unexpected behavior -
<img width="1282" height="513" alt="Image" src="https://github.com/user-attachments/assets/cc889293-3916-4f0f-b2a8-8f034a373fee" />
Transaction is incorrectly marked as payment_method_type - debit leading to failed routing
### Expected Behavior
Transaction should be routed as expected.
### Actual Behavior
Migrated wallet MIT transaction is incorrectly marked with incorrect payment_method_type based on the card BIN.
### Steps To Reproduce
1. Migrate wallets (PSP tokens + additional card info - card expiry + last4 + card BIN)
2. Perform MIT transaction 
### Context For The Bug
-
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 0e343a437b6..bcd71636f05 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -662,6 +662,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
         let payment_method_type = Option::<api_models::enums::PaymentMethodType>::foreign_from((
             payment_method_type,
             additional_pm_data.as_ref(),
+            payment_method,
         ));
 
         payment_attempt.payment_method_type = payment_method_type
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 79bfbebf499..1f54b1b72a1 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1266,6 +1266,7 @@ impl PaymentCreate {
         let payment_method_type = Option::<enums::PaymentMethodType>::foreign_from((
             payment_method_type,
             additional_pm_data.as_ref(),
+            payment_method,
         ));
 
         // TODO: remove once https://github.com/juspay/hyperswitch/issues/7421 is fixed
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 66de9b4ee60..484a3ec757e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -5961,38 +5961,67 @@ impl ForeignFrom<diesel_models::ConnectorTokenDetails>
     }
 }
 
-impl ForeignFrom<(Self, Option<&api_models::payments::AdditionalPaymentData>)>
-    for Option<enums::PaymentMethodType>
+impl
+    ForeignFrom<(
+        Self,
+        Option<&api_models::payments::AdditionalPaymentData>,
+        Option<enums::PaymentMethod>,
+    )> for Option<enums::PaymentMethodType>
 {
-    fn foreign_from(req: (Self, Option<&api_models::payments::AdditionalPaymentData>)) -> Self {
-        let (payment_method_type, additional_pm_data) = req;
-        additional_pm_data
-            .and_then(|pm_data| {
-                if let api_models::payments::AdditionalPaymentData::Card(card_info) = pm_data {
-                    card_info.card_type.as_ref().and_then(|card_type_str| {
-                        api_models::enums::PaymentMethodType::from_str(&card_type_str.to_lowercase()).map_err(|err| {
-                            crate::logger::error!(
-                                "Err - {:?}\nInvalid card_type value found in BIN DB - {:?}",
-                                err,
-                                card_type_str,
-                            );
-                        }).ok()
-                    })
-                } else {
-                    None
-                }
-            })
-            .map_or(payment_method_type, |card_type_in_bin_store| {
-                if let Some(card_type_in_req) = payment_method_type {
-                    if card_type_in_req != card_type_in_bin_store {
+    fn foreign_from(
+        req: (
+            Self,
+            Option<&api_models::payments::AdditionalPaymentData>,
+            Option<enums::PaymentMethod>,
+        ),
+    ) -> Self {
+        let (payment_method_type, additional_pm_data, payment_method) = req;
+
+        match (additional_pm_data, payment_method, payment_method_type) {
+            (
+                Some(api_models::payments::AdditionalPaymentData::Card(card_info)),
+                Some(enums::PaymentMethod::Card),
+                original_type,
+            ) => {
+                let bin_card_type = card_info.card_type.as_ref().and_then(|card_type_str| {
+                    let normalized_type = card_type_str.trim().to_lowercase();
+                    if normalized_type.is_empty() {
+                        return None;
+                    }
+                    api_models::enums::PaymentMethodType::from_str(&normalized_type)
+                        .map_err(|_| {
+                            crate::logger::warn!("Invalid BIN card_type: '{}'", card_type_str);
+                        })
+                        .ok()
+                });
+
+                match (original_type, bin_card_type) {
+                    // Override when there's a mismatch
+                    (
+                        Some(
+                            original @ (enums::PaymentMethodType::Debit
+                            | enums::PaymentMethodType::Credit),
+                        ),
+                        Some(bin_type),
+                    ) if original != bin_type => {
+                        crate::logger::info!("BIN lookup override: {} -> {}", original, bin_type);
+                        bin_card_type
+                    }
+                    // Use BIN lookup if no original type exists
+                    (None, Some(bin_type)) => {
                         crate::logger::info!(
-                            "Mismatch in card_type\nAPI request - {}; BIN lookup - {}\nOverriding with {}",
-                            card_type_in_req, card_type_in_bin_store, card_type_in_bin_store,
+                            "BIN lookup override: No original payment method type, using BIN result={}",
+                            bin_type
                         );
+                        Some(bin_type)
                     }
+                    // Default
+                    _ => original_type,
                 }
-                Some(card_type_in_bin_store)
-            })
+            }
+            // Skip BIN lookup for non-card payments
+            _ => payment_method_type,
+        }
     }
 }
 
 | 
	2025-09-02T09:51:17Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR updates the BIN lookup override logic in payment transformers.rs to ensure payment_method_type is overridden only for Card payment methods.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Motivation and Context
This allows performing MIT wallet transactions for migrated wallet tokens.
## How did you test it?
Locally
<details>
    <summary>Run wallet migration</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payment_methods/migrate-batch' \
        --header 'api-key: test_admin' \
        --form 'merchant_id="merchant_1756795715"' \
        --form 'merchant_connector_ids="mca_6wrjYYbE1zrrFSmbB0CJ"' \
        --form 'file=@"wallet-migration.csv"'
Response
    [
        {
            "line_number": 1,
            "payment_method_id": "pm_edmFuErgTu8rvVwUtdTg",
            "payment_method": "wallet",
            "payment_method_type": "google_pay",
            "customer_id": "e4c4a19c2f92c9b61a65d1b1d31bdab9",
            "migration_status": "Success",
            "card_number_masked": "555555XXXXXX4444",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 2,
            "payment_method_id": "pm_KC3l2F4HNRFiwVs8Xjaw",
            "payment_method": "wallet",
            "payment_method_type": "google_pay",
            "customer_id": "03ba537453a18466e42b2f9a92b70599",
            "migration_status": "Success",
            "card_number_masked": "411111XXXXXX1111",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 3,
            "payment_method_id": "pm_zGxLnsiI4Eos0SPsY91Y",
            "payment_method": "wallet",
            "payment_method_type": "apple_pay",
            "customer_id": "c4ff0659d5e8775e9197092247355e8a",
            "migration_status": "Success",
            "card_number_masked": "520424XXXXXX7180",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 4,
            "payment_method_id": "pm_6MueQrSZoca7NDcR5Ui9",
            "payment_method": "wallet",
            "payment_method_type": "apple_pay",
            "customer_id": "4b1f7771d465639a4856e0c246de8a50",
            "migration_status": "Success",
            "card_number_masked": "520424XXXXXX7180",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        }
    ]
</details>
<details>
    <summary>Perform wallet MIT using migrated token</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_3x1wBsCK5Er6sMaYvQFVxQdzpVi8wfDXgVm6stQ5yZAZfnU4MM5rGXHGjhVaZAIt' \
        --data '{"amount":1000,"currency":"EUR","confirm":true,"capture_on":"2022-09-10T10:11:12Z","customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","profile_id":"pro_SQD3Im1aEzJIm2o6xobw","description":"Its my first payment request","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_edmFuErgTu8rvVwUtdTg"}}'
Response
    {"payment_id":"pay_B9cZsoExS75t62J5G5Gl","merchant_id":"merchant_1756795715","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"adyen","client_secret":"pay_B9cZsoExS75t62J5G5Gl_secret_1SKcL0XjWp8Rv0upzo7H","created":"2025-09-02T08:45:49.872Z","currency":"EUR","customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","customer":{"id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","name":null,"email":"rsuolf2z6xlke@googlemail.com","phone":null,"phone_country_code":null},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"wallet","payment_method_data":{"card":{"last4":"4444","card_type":"CREDIT","card_network":"Mastercard","card_issuer":"MASTERCARD INTERNATIONAL","card_issuing_country":"BRAZIL","card_isin":"555555","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"2027","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"rsuolf2z6xlke@googlemail.com","name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":"UE_9000","unified_message":"Something went wrong","payment_experience":null,"payment_method_type":"google_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","created_at":1756802749,"expires":1756806349,"secret":"epk_9c30790bc68a4fd997d53b17e9087a9f"},"manual_retry_allowed":true,"connector_transaction_id":"DZFZZDRD5HSN6KV5","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":null,"payment_link":null,"profile_id":"pro_SQD3Im1aEzJIm2o6xobw","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_6wrjYYbE1zrrFSmbB0CJ","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-02T09:00:49.872Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_edmFuErgTu8rvVwUtdTg","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-02T08:45:51.392Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"VVBV24y20uF-D20uVHTVD-12m14oZHDBZ20uRXT14oJ22w06g20u20u000232251","card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible (logging enhancement - tests not applicable) | 
	10cf161d14810cc9c6320933909e9cd3bfdc41ca | 
	Locally
<details>
    <summary>Run wallet migration</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payment_methods/migrate-batch' \
        --header 'api-key: test_admin' \
        --form 'merchant_id="merchant_1756795715"' \
        --form 'merchant_connector_ids="mca_6wrjYYbE1zrrFSmbB0CJ"' \
        --form 'file=@"wallet-migration.csv"'
Response
    [
        {
            "line_number": 1,
            "payment_method_id": "pm_edmFuErgTu8rvVwUtdTg",
            "payment_method": "wallet",
            "payment_method_type": "google_pay",
            "customer_id": "e4c4a19c2f92c9b61a65d1b1d31bdab9",
            "migration_status": "Success",
            "card_number_masked": "555555XXXXXX4444",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 2,
            "payment_method_id": "pm_KC3l2F4HNRFiwVs8Xjaw",
            "payment_method": "wallet",
            "payment_method_type": "google_pay",
            "customer_id": "03ba537453a18466e42b2f9a92b70599",
            "migration_status": "Success",
            "card_number_masked": "411111XXXXXX1111",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 3,
            "payment_method_id": "pm_zGxLnsiI4Eos0SPsY91Y",
            "payment_method": "wallet",
            "payment_method_type": "apple_pay",
            "customer_id": "c4ff0659d5e8775e9197092247355e8a",
            "migration_status": "Success",
            "card_number_masked": "520424XXXXXX7180",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 4,
            "payment_method_id": "pm_6MueQrSZoca7NDcR5Ui9",
            "payment_method": "wallet",
            "payment_method_type": "apple_pay",
            "customer_id": "4b1f7771d465639a4856e0c246de8a50",
            "migration_status": "Success",
            "card_number_masked": "520424XXXXXX7180",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        }
    ]
</details>
<details>
    <summary>Perform wallet MIT using migrated token</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_3x1wBsCK5Er6sMaYvQFVxQdzpVi8wfDXgVm6stQ5yZAZfnU4MM5rGXHGjhVaZAIt' \
        --data '{"amount":1000,"currency":"EUR","confirm":true,"capture_on":"2022-09-10T10:11:12Z","customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","profile_id":"pro_SQD3Im1aEzJIm2o6xobw","description":"Its my first payment request","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_edmFuErgTu8rvVwUtdTg"}}'
Response
    {"payment_id":"pay_B9cZsoExS75t62J5G5Gl","merchant_id":"merchant_1756795715","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"adyen","client_secret":"pay_B9cZsoExS75t62J5G5Gl_secret_1SKcL0XjWp8Rv0upzo7H","created":"2025-09-02T08:45:49.872Z","currency":"EUR","customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","customer":{"id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","name":null,"email":"rsuolf2z6xlke@googlemail.com","phone":null,"phone_country_code":null},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"wallet","payment_method_data":{"card":{"last4":"4444","card_type":"CREDIT","card_network":"Mastercard","card_issuer":"MASTERCARD INTERNATIONAL","card_issuing_country":"BRAZIL","card_isin":"555555","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"2027","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"rsuolf2z6xlke@googlemail.com","name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":"UE_9000","unified_message":"Something went wrong","payment_experience":null,"payment_method_type":"google_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","created_at":1756802749,"expires":1756806349,"secret":"epk_9c30790bc68a4fd997d53b17e9087a9f"},"manual_retry_allowed":true,"connector_transaction_id":"DZFZZDRD5HSN6KV5","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":null,"payment_link":null,"profile_id":"pro_SQD3Im1aEzJIm2o6xobw","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_6wrjYYbE1zrrFSmbB0CJ","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-02T09:00:49.872Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_edmFuErgTu8rvVwUtdTg","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-02T08:45:51.392Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"VVBV24y20uF-D20uVHTVD-12m14oZHDBZ20uRXT14oJ22w06g20u20u000232251","card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9128 | 
	Bug: [FEATURE] allow wallet data migration
### Feature Description
Currently, migration API is card-centric and performs validation assuming all the entries are for migrating cards. These validations make the wallet migration fail. 
### Possible Implementation
Make card expiry validation optional per payment method type. For now it should be optional for - `PayPal` and `SamsungPay`.
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/payment_methods/src/core/migration/payment_methods.rs b/crates/payment_methods/src/core/migration/payment_methods.rs
index 5c30698f615..494e1987e21 100644
--- a/crates/payment_methods/src/core/migration/payment_methods.rs
+++ b/crates/payment_methods/src/core/migration/payment_methods.rs
@@ -51,8 +51,12 @@ pub async fn migrate_payment_method(
     let card_number_validation_result =
         cards::CardNumber::from_str(card_details.card_number.peek());
 
-    let card_bin_details =
-        populate_bin_details_for_masked_card(card_details, &*state.store).await?;
+    let card_bin_details = populate_bin_details_for_masked_card(
+        card_details,
+        &*state.store,
+        req.payment_method_type.as_ref(),
+    )
+    .await?;
 
     req.card = Some(api_models::payment_methods::MigrateCardDetail {
         card_issuing_country: card_bin_details.issuer_country.clone(),
@@ -176,8 +180,23 @@ pub async fn migrate_payment_method(
 pub async fn populate_bin_details_for_masked_card(
     card_details: &api_models::payment_methods::MigrateCardDetail,
     db: &dyn state::PaymentMethodsStorageInterface,
+    payment_method_type: Option<&enums::PaymentMethodType>,
 ) -> CustomResult<pm_api::CardDetailFromLocker, errors::ApiErrorResponse> {
-    migration::validate_card_expiry(&card_details.card_exp_month, &card_details.card_exp_year)?;
+    if let Some(
+            // Cards
+            enums::PaymentMethodType::Credit
+            | enums::PaymentMethodType::Debit
+
+            // Wallets
+            | enums::PaymentMethodType::ApplePay
+            | enums::PaymentMethodType::GooglePay,
+        ) = payment_method_type {
+        migration::validate_card_expiry(
+            &card_details.card_exp_month,
+            &card_details.card_exp_year,
+        )?;
+    }
+
     let card_number = card_details.card_number.clone();
 
     let (card_isin, _last4_digits) = get_card_bin_and_last4_digits_for_masked_card(
 | 
	2025-09-01T11:38:08Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR updates the migration flow around card validation to skip card expiry validation for `PayPal` and `SamsungPay` - these payment methods do not have the linked card's expiry details.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Allows migration of `PayPal` and `SamsungPay` PSP tokens.
## How did you test it?
Performing PayPal migration without specifying card details.
<details>
    <summary>Run migration</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payment_methods/migrate-batch' \
        --header 'api-key: test_admin' \
        --form 'merchant_id="merchant_1756723897"' \
        --form 'merchant_connector_ids="mca_0HKNtxio5DvoSuELXkRm"' \
        --form 'file=@"sample.csv"'
Response
    [
        {
            "line_number": 40,
            "payment_method_id": "pm_cy7Xo2En9vh9vqZydXO2",
            "payment_method": "wallet",
            "payment_method_type": "paypal",
            "customer_id": "ef57377bf54cd4ff3bfc26e1e60dbebf",
            "migration_status": "Success",
            "card_number_masked": "",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": null
        },
        {
            "line_number": 41,
            "payment_method_id": "pm_GPmSXeoPxhEtAxSC4uDD",
            "payment_method": "wallet",
            "payment_method_type": "paypal",
            "customer_id": "pet-5cda4ebb25e102e30043f14425915b58",
            "migration_status": "Success",
            "card_number_masked": "",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": null
        },
        {
            "line_number": 42,
            "payment_method_id": "pm_gB4DmNbBNqWsfKru9ZkE",
            "payment_method": "wallet",
            "payment_method_type": "paypal",
            "customer_id": "088e36d3b9ef09533b77d086497a8dc4",
            "migration_status": "Success",
            "card_number_masked": "",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": null
        }
    ]
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c02d8b9ba9e204fa163b61c419811eaa65fdbcb4 | 
	Performing PayPal migration without specifying card details.
<details>
    <summary>Run migration</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payment_methods/migrate-batch' \
        --header 'api-key: test_admin' \
        --form 'merchant_id="merchant_1756723897"' \
        --form 'merchant_connector_ids="mca_0HKNtxio5DvoSuELXkRm"' \
        --form 'file=@"sample.csv"'
Response
    [
        {
            "line_number": 40,
            "payment_method_id": "pm_cy7Xo2En9vh9vqZydXO2",
            "payment_method": "wallet",
            "payment_method_type": "paypal",
            "customer_id": "ef57377bf54cd4ff3bfc26e1e60dbebf",
            "migration_status": "Success",
            "card_number_masked": "",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": null
        },
        {
            "line_number": 41,
            "payment_method_id": "pm_GPmSXeoPxhEtAxSC4uDD",
            "payment_method": "wallet",
            "payment_method_type": "paypal",
            "customer_id": "pet-5cda4ebb25e102e30043f14425915b58",
            "migration_status": "Success",
            "card_number_masked": "",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": null
        },
        {
            "line_number": 42,
            "payment_method_id": "pm_gB4DmNbBNqWsfKru9ZkE",
            "payment_method": "wallet",
            "payment_method_type": "paypal",
            "customer_id": "088e36d3b9ef09533b77d086497a8dc4",
            "migration_status": "Success",
            "card_number_masked": "",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": null
        }
    ]
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9288 | 
	Bug: Updated openapi spec to include labels to wallet data
Updated openapi spec to include labels to wallet data | 
	diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 34a8beee16f..7f0c797a151 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3816,73 +3816,108 @@ impl GetAddressFromPaymentMethodData for BankDebitBilling {
 #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
 #[serde(rename_all = "snake_case")]
 pub enum WalletData {
+    /// The wallet data for Ali Pay HK redirect
+    #[schema(title = "AliPayHkRedirect")]
+    AliPayHkRedirect(AliPayHkRedirection),
     /// The wallet data for Ali Pay QrCode
+    #[schema(title = "AliPayQr")]
     AliPayQr(Box<AliPayQr>),
     /// The wallet data for Ali Pay redirect
+    #[schema(title = "AliPayRedirect")]
     AliPayRedirect(AliPayRedirection),
-    /// The wallet data for Ali Pay HK redirect
-    AliPayHkRedirect(AliPayHkRedirection),
     /// The wallet data for Amazon Pay
+    #[schema(title = "AmazonPay")]
     AmazonPay(AmazonPayWalletData),
     /// The wallet data for Amazon Pay redirect
+    #[schema(title = "AmazonPayRedirect")]
     AmazonPayRedirect(AmazonPayRedirectData),
-    /// The wallet data for Bluecode QR Code Redirect
-    BluecodeRedirect {},
-    /// The wallet data for Skrill
-    Skrill(SkrillData),
-    /// The wallet data for Paysera
-    Paysera(PayseraData),
-    /// The wallet data for Momo redirect
-    MomoRedirect(MomoRedirection),
-    /// The wallet data for KakaoPay redirect
-    KakaoPayRedirect(KakaoPayRedirection),
-    /// The wallet data for GoPay redirect
-    GoPayRedirect(GoPayRedirection),
-    /// The wallet data for Gcash redirect
-    GcashRedirect(GcashRedirection),
     /// The wallet data for Apple pay
+    #[schema(title = "ApplePay")]
     ApplePay(ApplePayWalletData),
     /// Wallet data for apple pay redirect flow
+    #[schema(title = "ApplePayRedirect")]
     ApplePayRedirect(Box<ApplePayRedirectData>),
     /// Wallet data for apple pay third party sdk flow
+    #[schema(title = "ApplePayThirdPartySdk")]
     ApplePayThirdPartySdk(Box<ApplePayThirdPartySdkData>),
+    /// The wallet data for Bluecode QR Code Redirect
+    #[schema(title = "BluecodeRedirect")]
+    BluecodeRedirect {},
+    /// The wallet data for Cashapp Qr
+    #[schema(title = "CashappQr")]
+    CashappQr(Box<CashappQr>),
     /// Wallet data for DANA redirect flow
+    #[schema(title = "DanaRedirect")]
     DanaRedirect {},
+    /// The wallet data for Gcash redirect
+    #[schema(title = "GcashRedirect")]
+    GcashRedirect(GcashRedirection),
+    /// The wallet data for GoPay redirect
+    #[schema(title = "GoPayRedirect")]
+    GoPayRedirect(GoPayRedirection),
     /// The wallet data for Google pay
+    #[schema(title = "GooglePay")]
     GooglePay(GooglePayWalletData),
     /// Wallet data for google pay redirect flow
+    #[schema(title = "GooglePayRedirect")]
     GooglePayRedirect(Box<GooglePayRedirectData>),
     /// Wallet data for Google pay third party sdk flow
+    #[schema(title = "GooglePayThirdPartySdk")]
     GooglePayThirdPartySdk(Box<GooglePayThirdPartySdkData>),
+    /// The wallet data for KakaoPay redirect
+    #[schema(title = "KakaoPayRedirect")]
+    KakaoPayRedirect(KakaoPayRedirection),
+    /// Wallet data for MbWay redirect flow
+    #[schema(title = "MbWayRedirect")]
     MbWayRedirect(Box<MbWayRedirection>),
+    // The wallet data for Mifinity Ewallet
+    #[schema(title = "Mifinity")]
+    Mifinity(MifinityData),
     /// The wallet data for MobilePay redirect
+    #[schema(title = "MobilePayRedirect")]
     MobilePayRedirect(Box<MobilePayRedirection>),
+    /// The wallet data for Momo redirect
+    #[schema(title = "MomoRedirect")]
+    MomoRedirect(MomoRedirection),
     /// This is for paypal redirection
+    #[schema(title = "PaypalRedirect")]
     PaypalRedirect(PaypalRedirection),
     /// The wallet data for Paypal
+    #[schema(title = "PaypalSdk")]
     PaypalSdk(PayPalWalletData),
+    /// The wallet data for Paysera
+    #[schema(title = "Paysera")]
+    Paysera(PayseraData),
     /// The wallet data for Paze
+    #[schema(title = "Paze")]
     Paze(PazeWalletData),
+    // The wallet data for RevolutPay
+    #[schema(title = "RevolutPay")]
+    RevolutPay(RevolutPayData),
     /// The wallet data for Samsung Pay
+    #[schema(title = "SamsungPay")]
     SamsungPay(Box<SamsungPayWalletData>),
+    /// The wallet data for Skrill
+    #[schema(title = "Skrill")]
+    Skrill(SkrillData),
+    // The wallet data for Swish
+    #[schema(title = "SwishQr")]
+    SwishQr(SwishQrData),
+    /// The wallet data for Touch n Go Redirection
+    #[schema(title = "TouchNGoRedirect")]
+    TouchNGoRedirect(Box<TouchNGoRedirection>),
     /// Wallet data for Twint Redirection
+    #[schema(title = "TwintRedirect")]
     TwintRedirect {},
     /// Wallet data for Vipps Redirection
+    #[schema(title = "VippsRedirect")]
     VippsRedirect {},
-    /// The wallet data for Touch n Go Redirection
-    TouchNGoRedirect(Box<TouchNGoRedirection>),
-    /// The wallet data for WeChat Pay Redirection
-    WeChatPayRedirect(Box<WeChatPayRedirection>),
     /// The wallet data for WeChat Pay Display QrCode
+    #[schema(title = "WeChatPayQr")]
     WeChatPayQr(Box<WeChatPayQr>),
-    /// The wallet data for Cashapp Qr
-    CashappQr(Box<CashappQr>),
-    // The wallet data for Swish
-    SwishQr(SwishQrData),
-    // The wallet data for Mifinity Ewallet
-    Mifinity(MifinityData),
-    // The wallet data for RevolutPay
-    RevolutPay(RevolutPayData),
+    /// The wallet data for WeChat Pay Redirection
+    #[schema(title = "WeChatPayRedirect")]
+    WeChatPayRedirect(Box<WeChatPayRedirection>),
 }
 
 impl GetAddressFromPaymentMethodData for WalletData {
 | 
	2025-09-04T13:20:49Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Updated openapi spec added labels to wallet data
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<img width="641" height="637" alt="image" src="https://github.com/user-attachments/assets/c4d2f2a3-fb7c-46f7-98ed-01e8004d89d9" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	5e1fd0b187b99698936a8a0cb0d839a60b830de2 | 
	
<img width="641" height="637" alt="image" src="https://github.com/user-attachments/assets/c4d2f2a3-fb7c-46f7-98ed-01e8004d89d9" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9129 | 
	Bug: [FEATURE] Checkout: Add Google Pay Predecrypt Flow
### Feature Description
Add Google Pay Predecrypt Flow in Checkout
### Possible Implementation
Add Google Pay Predecrypt Flow in Checkout
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index b69f959fbe3..cc3468029e4 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -475,7 +475,7 @@ force_cookies = true                 # Whether to use only cookies for JWT extra
 #tokenization configuration which describe token lifetime and payment method for specific connector
 [tokenization]
 stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization",google_pay_pre_decrypt_flow = "network_tokenization" }
 mollie = { long_lived_token = false, payment_method = "card" }
 stax = { long_lived_token = true, payment_method = "card,bank_debit" }
 square = { long_lived_token = false, payment_method = "card" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index fdcb7891f30..2d88a1b2739 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -853,7 +853,7 @@ redsys = { payment_method = "card" }
 #tokenization configuration which describe token lifetime and payment method for specific connector
 [tokenization]
 braintree = { long_lived_token = false, payment_method = "card" }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization" }
 gocardless = { long_lived_token = true, payment_method = "bank_debit" }
 hipay = { long_lived_token = false, payment_method = "card" }
 mollie = { long_lived_token = false, payment_method = "card" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 552a6ebb0ed..d3cbd02cc20 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -862,7 +862,7 @@ redsys = { payment_method = "card" }
 #tokenization configuration which describe token lifetime and payment method for specific connector
 [tokenization]
 braintree = { long_lived_token = false, payment_method = "card" }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization" }
 gocardless = { long_lived_token = true, payment_method = "bank_debit" }
 hipay = { long_lived_token = false, payment_method = "card" }
 mollie = { long_lived_token = false, payment_method = "card" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 520883d5558..7a006dd704b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -868,7 +868,7 @@ redsys = { payment_method = "card" }
 #tokenization configuration which describe token lifetime and payment method for specific connector
 [tokenization]
 braintree = { long_lived_token = false, payment_method = "card" }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization" }
 gocardless = { long_lived_token = true, payment_method = "bank_debit" }
 hipay = { long_lived_token = false, payment_method = "card" }
 mollie = { long_lived_token = false, payment_method = "card" }
diff --git a/config/development.toml b/config/development.toml
index 3bab0fc27bb..3d8aff0fc8c 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -996,7 +996,7 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD
 
 [tokenization]
 stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization"  }
 stax = { long_lived_token = true, payment_method = "card,bank_debit" }
 mollie = { long_lived_token = false, payment_method = "card" }
 square = { long_lived_token = false, payment_method = "card" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index fa082b35522..75d67f4eb91 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -396,7 +396,7 @@ workers = 1
 #tokenization configuration which describe token lifetime and payment method for specific connector
 [tokenization]
 stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization" }
 mollie = { long_lived_token = false, payment_method = "card" }
 stax = { long_lived_token = true, payment_method = "card,bank_debit" }
 square = { long_lived_token = false, payment_method = "card" }
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
index 42ff1d537d9..6754778539c 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
@@ -231,6 +231,19 @@ pub enum PaymentSource {
     Wallets(WalletSource),
     ApplePayPredecrypt(Box<ApplePayPredecrypt>),
     MandatePayment(MandateSource),
+    GooglePayPredecrypt(Box<GooglePayPredecrypt>),
+}
+
+#[derive(Debug, Serialize)]
+pub struct GooglePayPredecrypt {
+    #[serde(rename = "type")]
+    _type: String,
+    token: cards::CardNumber,
+    token_type: String,
+    expiry_month: Secret<String>,
+    expiry_year: Secret<String>,
+    eci: String,
+    cryptogram: Option<Secret<String>>,
 }
 
 #[derive(Debug, Serialize)]
@@ -453,25 +466,47 @@ impl TryFrom<&CheckoutRouterData<&PaymentsAuthorizeRouterData>> for PaymentsRequ
             }
             PaymentMethodData::Wallet(wallet_data) => match wallet_data {
                 WalletData::GooglePay(_) => {
-                    let p_source = PaymentSource::Wallets(WalletSource {
-                        source_type: CheckoutSourceTypes::Token,
-                        token: match item.router_data.get_payment_method_token()? {
-                            PaymentMethodToken::Token(token) => token,
-                            PaymentMethodToken::ApplePayDecrypt(_) => {
-                                Err(unimplemented_payment_method!(
-                                    "Apple Pay",
-                                    "Simplified",
-                                    "Checkout"
-                                ))?
-                            }
-                            PaymentMethodToken::PazeDecrypt(_) => {
-                                Err(unimplemented_payment_method!("Paze", "Checkout"))?
-                            }
-                            PaymentMethodToken::GooglePayDecrypt(_) => {
-                                Err(unimplemented_payment_method!("Google Pay", "Checkout"))?
-                            }
-                        },
-                    });
+                    let p_source = match item.router_data.get_payment_method_token()? {
+                        PaymentMethodToken::Token(token) => PaymentSource::Wallets(WalletSource {
+                            source_type: CheckoutSourceTypes::Token,
+                            token,
+                        }),
+                        PaymentMethodToken::ApplePayDecrypt(_) => Err(
+                            unimplemented_payment_method!("Apple Pay", "Simplified", "Checkout"),
+                        )?,
+                        PaymentMethodToken::PazeDecrypt(_) => {
+                            Err(unimplemented_payment_method!("Paze", "Checkout"))?
+                        }
+                        PaymentMethodToken::GooglePayDecrypt(google_pay_decrypted_data) => {
+                            let token = google_pay_decrypted_data
+                                .application_primary_account_number
+                                .clone();
+
+                            let expiry_month = google_pay_decrypted_data
+                                .get_expiry_month()
+                                .change_context(errors::ConnectorError::InvalidDataFormat {
+                                    field_name: "payment_method_data.card.card_exp_month",
+                                })?;
+
+                            let expiry_year = google_pay_decrypted_data
+                                .get_four_digit_expiry_year()
+                                .change_context(errors::ConnectorError::InvalidDataFormat {
+                                    field_name: "payment_method_data.card.card_exp_year",
+                                })?;
+
+                            let cryptogram = google_pay_decrypted_data.cryptogram.clone();
+
+                            PaymentSource::GooglePayPredecrypt(Box::new(GooglePayPredecrypt {
+                                _type: "network_token".to_string(),
+                                token,
+                                token_type: "googlepay".to_string(),
+                                expiry_month,
+                                expiry_year,
+                                eci: "06".to_string(),
+                                cryptogram,
+                            }))
+                        }
+                    };
                     Ok((
                         p_source,
                         None,
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 1923af66b35..223b5ae4cbf 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -638,6 +638,7 @@ pub struct PaymentMethodTokenFilter {
     pub payment_method_type: Option<PaymentMethodTypeTokenFilter>,
     pub long_lived_token: bool,
     pub apple_pay_pre_decrypt_flow: Option<ApplePayPreDecryptFlow>,
+    pub google_pay_pre_decrypt_flow: Option<GooglePayPreDecryptFlow>,
     pub flow: Option<PaymentFlow>,
 }
 
@@ -655,6 +656,14 @@ pub enum ApplePayPreDecryptFlow {
     NetworkTokenization,
 }
 
+#[derive(Debug, Deserialize, Clone, Default)]
+#[serde(deny_unknown_fields, rename_all = "snake_case")]
+pub enum GooglePayPreDecryptFlow {
+    #[default]
+    ConnectorTokenization,
+    NetworkTokenization,
+}
+
 #[derive(Debug, Deserialize, Clone, Default)]
 pub struct TempLockerEnablePaymentMethodFilter {
     #[serde(deserialize_with = "deserialize_hashset")]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e04b790ab12..cf6a6852dcc 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -108,7 +108,9 @@ use crate::core::routing::helpers as routing_helpers;
 #[cfg(all(feature = "v1", feature = "dynamic_routing"))]
 use crate::types::api::convert_connector_data_to_routable_connectors;
 use crate::{
-    configs::settings::{ApplePayPreDecryptFlow, PaymentFlow, PaymentMethodTypeTokenFilter},
+    configs::settings::{
+        ApplePayPreDecryptFlow, GooglePayPreDecryptFlow, PaymentFlow, PaymentMethodTypeTokenFilter,
+    },
     consts,
     core::{
         errors::{self, CustomResult, RouterResponse, RouterResult},
@@ -6938,6 +6940,11 @@ fn is_payment_method_tokenization_enabled_for_connector(
                     payment_method_token,
                     connector_filter.apple_pay_pre_decrypt_flow.clone(),
                 )
+                && is_google_pay_pre_decrypt_type_connector_tokenization(
+                    payment_method_type,
+                    payment_method_token,
+                    connector_filter.google_pay_pre_decrypt_flow.clone(),
+                )
                 && is_payment_flow_allowed_for_connector(
                     mandate_flow_enabled,
                     connector_filter.flow.clone(),
@@ -6978,6 +6985,28 @@ fn is_apple_pay_pre_decrypt_type_connector_tokenization(
     }
 }
 
+fn is_google_pay_pre_decrypt_type_connector_tokenization(
+    payment_method_type: Option<storage::enums::PaymentMethodType>,
+    payment_method_token: Option<&PaymentMethodToken>,
+    google_pay_pre_decrypt_flow_filter: Option<GooglePayPreDecryptFlow>,
+) -> bool {
+    if let (
+        Some(storage::enums::PaymentMethodType::GooglePay),
+        Some(PaymentMethodToken::GooglePayDecrypt(..)),
+    ) = (payment_method_type, payment_method_token)
+    {
+        !matches!(
+            google_pay_pre_decrypt_flow_filter,
+            Some(GooglePayPreDecryptFlow::NetworkTokenization)
+        )
+    } else {
+        // Always return true for non–Google Pay pre-decrypt cases,
+        // because the filter is only relevant for Google Pay pre-decrypt tokenization.
+        // Returning true ensures that other payment methods or token types are not blocked.
+        true
+    }
+}
+
 fn decide_apple_pay_flow(
     state: &SessionState,
     payment_method_type: Option<enums::PaymentMethodType>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 5818cee9519..33b93cc2b73 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -691,7 +691,7 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD
 #tokenization configuration which describe token lifetime and payment method for specific connector
 [tokenization]
 stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization" }
 mollie = { long_lived_token = false, payment_method = "card" }
 braintree = { long_lived_token = false, payment_method = "card" }
 gocardless = { long_lived_token = true, payment_method = "bank_debit" }
 | 
	2025-09-01T11:34:56Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/9129)
## Description
<!-- Describe your changes in detail -->
Added Google Pay Predecrypt Flow
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_lCkY35u2evZqwny1tXdtyZuu7VufIiJjFTJhuI0kMJAP8RL9XmyomvPqQDBzDvo1' \
--data-raw '{
    "amount": 7445,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 7445,
    "customer_id": "cu_1756821388",
    "capture_method": "automatic",
     "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "billing": {
        "address": {
            "line1": "1467",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "description": "SuccessfulAuth: Visa •••• 4242",
                "info": {
                    "assurance_details": {
                        "account_verified": true,
                        "card_holder_authenticated": false
                    },
                    "card_details": "4242",
                    "card_network": "MASTERCARD"
                },
                "tokenization_data": {
                    "application_primary_account_number": "4242424242424242",
                    "card_exp_month": "10",
                    "card_exp_year": "25",
                    "cryptogram": CRYPTOGRAM
                }
            }
        }
    }
}'
```
Response:
```
{
    "payment_id": "pay_kZOyskQtl91kB3oiAaFS",
    "merchant_id": "merchant_1756821155",
    "status": "processing",
    "amount": 7445,
    "net_amount": 7445,
    "shipping_cost": null,
    "amount_capturable": 7445,
    "amount_received": null,
    "connector": "checkout",
    "client_secret": "pay_kZOyskQtl91kB3oiAaFS_secret_1VaHJKidL1jl9DftOx0Z",
    "created": "2025-09-02T13:53:01.094Z",
    "currency": "USD",
    "customer_id": "cu_1756821181",
    "customer": {
        "id": "cu_1756821181",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "4242",
                "card_network": "MASTERCARD",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": "checkout_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1756821181",
        "created_at": 1756821181,
        "expires": 1756824781,
        "secret": "epk_39573ad4636840e2a30021f811f4a9c4"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_ddjiyc5cghrernmk7gqlpnua6e",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_kZOyskQtl91kB3oiAaFS_1",
    "payment_link": null,
    "profile_id": "pro_YQn8ejoAyLrvevnCJLnZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_hkY02nmI5cs4ygBEbIUg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T14:08:01.094Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T13:53:02.364Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
2. Payments - Retrieve
Request:
```
curl --location 'http://localhost:8080/payments/pay_kZOyskQtl91kB3oiAaFS?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_lCkY35u2evZqwny1tXdtyZuu7VufIiJjFTJhuI0kMJAP8RL9XmyomvPqQDBzDvo1'
```
Response:
```
{
    "payment_id": "pay_kZOyskQtl91kB3oiAaFS",
    "merchant_id": "merchant_1756821155",
    "status": "succeeded",
    "amount": 7445,
    "net_amount": 7445,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 7445,
    "connector": "checkout",
    "client_secret": "pay_kZOyskQtl91kB3oiAaFS_secret_1VaHJKidL1jl9DftOx0Z",
    "created": "2025-09-02T13:53:01.094Z",
    "currency": "USD",
    "customer_id": "cu_1756821181",
    "customer": {
        "id": "cu_1756821181",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "4242",
                "card_network": "MASTERCARD",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": "checkout_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_ddjiyc5cghrernmk7gqlpnua6e",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_kZOyskQtl91kB3oiAaFS_1",
    "payment_link": null,
    "profile_id": "pro_YQn8ejoAyLrvevnCJLnZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_hkY02nmI5cs4ygBEbIUg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T14:08:01.094Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_LSM4mcvLDbufpOlCjb1X",
    "network_transaction_id": null,
    "payment_method_status": "inactive",
    "updated": "2025-09-02T13:53:11.202Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	b26e845198407f3672a7f80d8eea670419858e0e | 
	
1. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_lCkY35u2evZqwny1tXdtyZuu7VufIiJjFTJhuI0kMJAP8RL9XmyomvPqQDBzDvo1' \
--data-raw '{
    "amount": 7445,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 7445,
    "customer_id": "cu_1756821388",
    "capture_method": "automatic",
     "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "billing": {
        "address": {
            "line1": "1467",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "description": "SuccessfulAuth: Visa •••• 4242",
                "info": {
                    "assurance_details": {
                        "account_verified": true,
                        "card_holder_authenticated": false
                    },
                    "card_details": "4242",
                    "card_network": "MASTERCARD"
                },
                "tokenization_data": {
                    "application_primary_account_number": "4242424242424242",
                    "card_exp_month": "10",
                    "card_exp_year": "25",
                    "cryptogram": CRYPTOGRAM
                }
            }
        }
    }
}'
```
Response:
```
{
    "payment_id": "pay_kZOyskQtl91kB3oiAaFS",
    "merchant_id": "merchant_1756821155",
    "status": "processing",
    "amount": 7445,
    "net_amount": 7445,
    "shipping_cost": null,
    "amount_capturable": 7445,
    "amount_received": null,
    "connector": "checkout",
    "client_secret": "pay_kZOyskQtl91kB3oiAaFS_secret_1VaHJKidL1jl9DftOx0Z",
    "created": "2025-09-02T13:53:01.094Z",
    "currency": "USD",
    "customer_id": "cu_1756821181",
    "customer": {
        "id": "cu_1756821181",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "4242",
                "card_network": "MASTERCARD",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": "checkout_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1756821181",
        "created_at": 1756821181,
        "expires": 1756824781,
        "secret": "epk_39573ad4636840e2a30021f811f4a9c4"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_ddjiyc5cghrernmk7gqlpnua6e",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_kZOyskQtl91kB3oiAaFS_1",
    "payment_link": null,
    "profile_id": "pro_YQn8ejoAyLrvevnCJLnZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_hkY02nmI5cs4ygBEbIUg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T14:08:01.094Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T13:53:02.364Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
2. Payments - Retrieve
Request:
```
curl --location 'http://localhost:8080/payments/pay_kZOyskQtl91kB3oiAaFS?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_lCkY35u2evZqwny1tXdtyZuu7VufIiJjFTJhuI0kMJAP8RL9XmyomvPqQDBzDvo1'
```
Response:
```
{
    "payment_id": "pay_kZOyskQtl91kB3oiAaFS",
    "merchant_id": "merchant_1756821155",
    "status": "succeeded",
    "amount": 7445,
    "net_amount": 7445,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 7445,
    "connector": "checkout",
    "client_secret": "pay_kZOyskQtl91kB3oiAaFS_secret_1VaHJKidL1jl9DftOx0Z",
    "created": "2025-09-02T13:53:01.094Z",
    "currency": "USD",
    "customer_id": "cu_1756821181",
    "customer": {
        "id": "cu_1756821181",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "4242",
                "card_network": "MASTERCARD",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": "checkout_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_ddjiyc5cghrernmk7gqlpnua6e",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_kZOyskQtl91kB3oiAaFS_1",
    "payment_link": null,
    "profile_id": "pro_YQn8ejoAyLrvevnCJLnZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_hkY02nmI5cs4ygBEbIUg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T14:08:01.094Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_LSM4mcvLDbufpOlCjb1X",
    "network_transaction_id": null,
    "payment_method_status": "inactive",
    "updated": "2025-09-02T13:53:11.202Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9120 | 
	Bug: [BUG] Setup fail : migration_runner exits with code 1 during standalone setup
### Bug Description
While setting up Hyperswitch locally   using the scripts/setup.sh script, the setup consistently fails during the migration_runner step.
The database (pg) and Redis services start successfully and report as Healthy, but the migration_runner container exits with code 1, causing the setup process to stop.
This blocks local development/testing on Windows environments.
Below is the ss of error :
<img width="930" height="942" alt="Image" src="https://github.com/user-attachments/assets/1578a5d6-323b-4858-8599-fb2cac588804" />
### Expected Behavior
All the containers should have been started and compiled successfully
### Actual Behavior
The error mentioned above occurred 
### Steps To Reproduce
Clone the Repo and run `scripts/setup.sh`
### Context For The Bug
This is my first time setting up  a project this big locally , so i might have miss something , or this might be an actual bug . Either way , i request some help in this matter
### Environment
OS : Windows
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/.gitattributes b/.gitattributes
index 176a458f94e..d7ed342927a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,2 @@
 * text=auto
+*.patch text eol=lf
\ No newline at end of file
 | 
	2025-09-10T06:06:07Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR adds the following rule to `.gitattributes` to ensure `.patch` files always use LF line endings, regardless of developer OS:
```gitattributes
*.patch text eol=lf
```
This rule overrides Windows’ default `core.autocrlf` behavior and prevents errors during migration when Diesel’s patch parser encounters CRLF line endings.
**Additionally**: For developers who have already cloned the repository and whose `.patch` files may still have CRLF endings, a workaround :
```bash
git checkout -- crates/diesel_models/drop_id.patch
```
This ensures the `.patch` file is re-checked-out with the correct LF line endings, without requiring a full reclone.
Closes: #9120
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Diesel’s migration runner fails on Windows because CRLF line endings corrupt the patch file format (e.g., `diff --git a/file.rs b/file.rs\r\n`), causing “invalid char in unquoted filename” parsing errors. By forcing LF endings for patch files via `.gitattributes`, this PR ensures cross-platform consistency and prevents migration failures.
Issue: #9120 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
* Applied the change on a Windows environment with `core.autocrlf=true` and confirmed `.patch` files now use `\n` instead of `\r\n`.
* Ran `scripts/setup.sh` and verified that the migration runner no longer exits with code 1.
* Provided the `git checkout -- <patch>` fix to confirm re-checkout resets line endings to LF without recloning.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
### Additional Context 
**CRLF vs LF Line Endings Explained**
* **LF (Line Feed)** – used by Unix/Linux/macOS; represented by `\n`
* **CRLF (Carriage Return + Line Feed)** – used by Windows; represented by `\r\n`
Git’s `core.autocrlf=true` (Windows default) can introduce CRLF line endings on checkout and convert them back to LF on commit. Explicit `.gitattributes` configuration (`*.patch text eol=lf`) guarantees LF regardless of platform, preventing CRLF-related parsing issues.
---
 | 
	2edaa6e0578ae8cb6e4b44cc516b8c342262c082 | 
	
* Applied the change on a Windows environment with `core.autocrlf=true` and confirmed `.patch` files now use `\n` instead of `\r\n`.
* Ran `scripts/setup.sh` and verified that the migration runner no longer exits with code 1.
* Provided the `git checkout -- <patch>` fix to confirm re-checkout resets line endings to LF without recloning.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9109 | 
	Bug: [FEAT: CONNECTOR] [PAYLOAD] Add setup mandate support
```sh
curl --location 'https://api.payload.com/transactions' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic apiKey' \
--data-urlencode 'amount=0' \
--data-urlencode 'type=payment' \
--data-urlencode 'payment_method%5Btype%5D=card' \
--data-urlencode 'payment_method%5Bcard%5D%5Bcard_number%5D=4242 4242 4242 4242' \
--data-urlencode 'payment_method%5Bcard%5D%5Bexpiry%5D=12/25' \
--data-urlencode 'payment_method%5Bcard%5D%5Bcard_code%5D=123' \
--data-urlencode 'payment_method%5Bbilling_address%5D%5Bcountry_code%5D=US' \
--data-urlencode 'payment_method%5Bbilling_address%5D%5Bpostal_code%5D=11111' \
--data-urlencode 'payment_method%5Bbilling_address%5D%5Bcity%5D=Los Angeles' \
--data-urlencode 'payment_method%5Bbilling_address%5D%5Bstate_province%5D=Texas' \
--data-urlencode 'payment_method%5Bbilling_address%5D%5Bstreet_address%5D%22=Line1' \
--data-urlencode 'payment_method%5Bdefault_payment_method%5D=false' \
--data-urlencode 'payment_method%5Bkeep_active%5D=true'
```
```json
{
	"amount": 0,
	"attrs": null,
	"avs": "street_and_zip",
	"created_at": "Fri, 29 Aug 2025 12:56:29 GMT",
	"customer_id": null,
	"description": null,
	"funding_delay": 2,
	"funding_status": "pending",
	"funding_type": "debit",
	"id": "",
	"ledger": [],
	"modified_at": "Fri, 29 Aug 2025 12:56:29 GMT",
	"notes": null,
	"object": "transaction",
	"order_number": null,
	"payment_method": {
		"account_holder": null,
		"attrs": null,
		"bank_name": "STRIPE PAYMENTS UK, LTD.",
		"billing_address": {
			"city": "Los Angeles",
			"country_code": "US",
			"postal_code": "11111",
			"state_province": "Te",
			"street_address": "Line1",
			"unit_number": null
		},
		"card": {
			"card_brand": "visa",
			"card_number": "xxxxxxxxxxxx4242",
			"card_type": "credit",
			"expiry": "2025-12-31"
		},
		"created_at": "Fri, 29 Aug 2025 12:56:29 GMT",
		"customer_id": null,
		"default_credit_method": false,
		"default_deposit_method": false,
		"default_payment_method": false,
		"default_reversal_method": null,
		"description": "Visa x-4242",
		"email": null,
		"id": "",
		"keep_active": true,
		"modified_at": "Fri, 29 Aug 2025 12:56:29 GMT",
		"object": "payment_method",
		"phone_number": null,
		"status": "active",
		"transfer_type": "send-only",
		"type": "card",
		"verification_status": "not-verified"
	},
	"payment_method_id": "",
	"processed_date": "2025-09-02",
	"processing_id": "",
	"processing_method": null,
	"processing_method_id": null,
	"reader_id": null,
	"ref_number": "PL-V7P-ZOI-74Y",
	"rejected_date": null,
	"risk_flag": "allowed",
	"risk_score": 0,
	"source": "api",
	"status": "processed",
	"status_code": "approved",
	"status_message": "Transaction approved.",
	"type": "payment"
}
```
connector indeed supports 0 dollar mandates! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/payload.rs b/crates/hyperswitch_connectors/src/connectors/payload.rs
index 792fa493c4d..3967736fd06 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload.rs
@@ -33,7 +33,7 @@ use hyperswitch_domain_models::{
     },
     types::{
         PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
-        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -44,7 +44,7 @@ use hyperswitch_interfaces::{
     configs::Connectors,
     errors,
     events::connector_api_logs::ConnectorEvent,
-    types::{self, PaymentsVoidType, Response},
+    types::{self, PaymentsVoidType, Response, SetupMandateType},
     webhooks,
 };
 use masking::{ExposeInterface, Mask, Secret};
@@ -190,15 +190,77 @@ impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> fo
 impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Payload {}
 
 impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Payload {
-    fn build_request(
+    fn get_headers(
+        &self,
+        req: &SetupMandateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &SetupMandateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!("{}/transactions", self.base_url(connectors)))
+    }
+
+    fn get_request_body(
         &self,
-        _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        req: &SetupMandateRouterData,
         _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_req = requests::PayloadCardsRequestData::try_from(req)?;
+        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Err(
-            errors::ConnectorError::NotImplemented("Setup Mandate flow for Payload".to_string())
-                .into(),
-        )
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&SetupMandateType::get_url(self, req, connectors)?)
+                .headers(SetupMandateType::get_headers(self, req, connectors)?)
+                .set_body(SetupMandateType::get_request_body(self, req, connectors)?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &SetupMandateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<SetupMandateRouterData, errors::ConnectorError> {
+        let response: responses::PayloadPaymentsResponse = res
+            .response
+            .parse_struct("PayloadPaymentsResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
     }
 }
 
diff --git a/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
index 778aedb89fd..90f4a650647 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
@@ -5,12 +5,16 @@ use common_enums::enums;
 use common_utils::{ext_traits::ValueExt, types::StringMajorUnit};
 use error_stack::ResultExt;
 use hyperswitch_domain_models::{
+    address::AddressDetails,
     payment_method_data::PaymentMethodData,
     router_data::{ConnectorAuthType, ErrorResponse, RouterData},
     router_flow_types::refunds::{Execute, RSync},
-    router_request_types::{PaymentsAuthorizeData, ResponseId},
+    router_request_types::ResponseId,
     router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData},
-    types::{PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, RefundsRouterData},
+    types::{
+        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, RefundsRouterData,
+        SetupMandateRouterData,
+    },
 };
 use hyperswitch_interfaces::{
     consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
@@ -23,16 +27,77 @@ use super::{requests, responses};
 use crate::{
     types::{RefundsResponseRouterData, ResponseRouterData},
     utils::{
-        is_manual_capture, AddressDetailsData, CardData, PaymentsAuthorizeRequestData,
+        get_unimplemented_payment_method_error_message, is_manual_capture, AddressDetailsData,
+        CardData, PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData,
         RouterData as OtherRouterData,
     },
 };
 
 type Error = error_stack::Report<errors::ConnectorError>;
 
-//TODO: Fill the struct with respective fields
+fn build_payload_cards_request_data(
+    payment_method_data: &PaymentMethodData,
+    connector_auth_type: &ConnectorAuthType,
+    currency: enums::Currency,
+    amount: StringMajorUnit,
+    billing_address: &AddressDetails,
+    capture_method: Option<enums::CaptureMethod>,
+    is_mandate: bool,
+) -> Result<requests::PayloadCardsRequestData, Error> {
+    if let PaymentMethodData::Card(req_card) = payment_method_data {
+        let payload_auth = PayloadAuth::try_from((connector_auth_type, currency))?;
+
+        let card = requests::PayloadCard {
+            number: req_card.clone().card_number,
+            expiry: req_card
+                .clone()
+                .get_card_expiry_month_year_2_digit_with_delimiter("/".to_owned())?,
+            cvc: req_card.card_cvc.clone(),
+        };
+
+        let city = billing_address.get_city()?.to_owned();
+        let country = billing_address.get_country()?.to_owned();
+        let postal_code = billing_address.get_zip()?.to_owned();
+        let state_province = billing_address.get_state()?.to_owned();
+        let street_address = billing_address.get_line1()?.to_owned();
+
+        let billing_address = requests::BillingAddress {
+            city,
+            country,
+            postal_code,
+            state_province,
+            street_address,
+        };
+
+        // For manual capture, set status to "authorized"
+        let status = if is_manual_capture(capture_method) {
+            Some(responses::PayloadPaymentStatus::Authorized)
+        } else {
+            None
+        };
+
+        Ok(requests::PayloadCardsRequestData {
+            amount,
+            card,
+            transaction_types: requests::TransactionTypes::Payment,
+            payment_method_type: "card".to_string(),
+            status,
+            billing_address,
+            processing_id: payload_auth.processing_account_id,
+            keep_active: is_mandate,
+        })
+    } else {
+        Err(
+            errors::ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message(
+                "Payload",
+            ))
+            .into(),
+        )
+    }
+}
+
 pub struct PayloadRouterData<T> {
-    pub amount: StringMajorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+    pub amount: StringMajorUnit,
     pub router_data: T,
 }
 
@@ -104,6 +169,33 @@ impl TryFrom<&ConnectorAuthType> for PayloadAuthType {
     }
 }
 
+impl TryFrom<&SetupMandateRouterData> for requests::PayloadCardsRequestData {
+    type Error = Error;
+    fn try_from(item: &SetupMandateRouterData) -> Result<Self, Self::Error> {
+        match item.request.amount {
+            Some(amount) if amount > 0 => Err(errors::ConnectorError::FlowNotSupported {
+                flow: "Setup mandate with non zero amount".to_string(),
+                connector: "Payload".to_string(),
+            }
+            .into()),
+            _ => {
+                let billing_address = item.get_billing_address()?;
+                let is_mandate = item.request.is_customer_initiated_mandate_payment();
+
+                build_payload_cards_request_data(
+                    &item.request.payment_method_data,
+                    &item.connector_auth_type,
+                    item.request.currency,
+                    StringMajorUnit::zero(),
+                    billing_address,
+                    item.request.capture_method,
+                    is_mandate,
+                )
+            }
+        }
+    }
+}
+
 impl TryFrom<&PayloadRouterData<&PaymentsAuthorizeRouterData>>
     for requests::PayloadPaymentsRequest
 {
@@ -119,55 +211,21 @@ impl TryFrom<&PayloadRouterData<&PaymentsAuthorizeRouterData>>
         }
 
         match item.router_data.request.payment_method_data.clone() {
-            PaymentMethodData::Card(req_card) => {
-                let payload_auth = PayloadAuth::try_from((
-                    &item.router_data.connector_auth_type,
-                    item.router_data.request.currency,
-                ))?;
-                let card = requests::PayloadCard {
-                    number: req_card.clone().card_number,
-                    expiry: req_card
-                        .clone()
-                        .get_card_expiry_month_year_2_digit_with_delimiter("/".to_owned())?,
-                    cvc: req_card.card_cvc,
-                };
+            PaymentMethodData::Card(_) => {
+                let billing_address = item.router_data.get_billing_address()?;
                 let is_mandate = item.router_data.request.is_mandate_payment();
-                let address = item.router_data.get_billing_address()?;
-
-                // Check for required fields and fail if they're missing
-                let city = address.get_city()?.to_owned();
-                let country = address.get_country()?.to_owned();
-                let postal_code = address.get_zip()?.to_owned();
-                let state_province = address.get_state()?.to_owned();
-                let street_address = address.get_line1()?.to_owned();
-
-                let billing_address = requests::BillingAddress {
-                    city,
-                    country,
-                    postal_code,
-                    state_province,
-                    street_address,
-                };
 
-                // For manual capture, set status to "authorized"
-                let status = if is_manual_capture(item.router_data.request.capture_method) {
-                    Some(responses::PayloadPaymentStatus::Authorized)
-                } else {
-                    None
-                };
+                let cards_data = build_payload_cards_request_data(
+                    &item.router_data.request.payment_method_data,
+                    &item.router_data.connector_auth_type,
+                    item.router_data.request.currency,
+                    item.amount.clone(),
+                    billing_address,
+                    item.router_data.request.capture_method,
+                    is_mandate,
+                )?;
 
-                Ok(Self::PayloadCardsRequest(Box::new(
-                    requests::PayloadCardsRequestData {
-                        amount: item.amount.clone(),
-                        card,
-                        transaction_types: requests::TransactionTypes::Payment,
-                        payment_method_type: "card".to_string(),
-                        status,
-                        billing_address,
-                        processing_id: payload_auth.processing_account_id,
-                        keep_active: is_mandate,
-                    },
-                )))
+                Ok(Self::PayloadCardsRequest(Box::new(cards_data)))
             }
             PaymentMethodData::MandatePayment => {
                 // For manual capture, set status to "authorized"
@@ -206,7 +264,7 @@ impl From<responses::PayloadPaymentStatus> for common_enums::AttemptStatus {
     }
 }
 
-impl<F, T>
+impl<F: 'static, T>
     TryFrom<ResponseRouterData<F, responses::PayloadPaymentsResponse, T, PaymentsResponseData>>
     for RouterData<F, T, PaymentsResponseData>
 where
@@ -220,10 +278,13 @@ where
             responses::PayloadPaymentsResponse::PayloadCardsResponse(response) => {
                 let status = enums::AttemptStatus::from(response.status);
 
-                let request_any: &dyn std::any::Any = &item.data.request;
-                let is_mandate_payment = request_any
-                    .downcast_ref::<PaymentsAuthorizeData>()
-                    .is_some_and(|req| req.is_mandate_payment());
+                let router_data: &dyn std::any::Any = &item.data;
+                let is_mandate_payment = router_data
+                    .downcast_ref::<PaymentsAuthorizeRouterData>()
+                    .is_some_and(|router_data| router_data.request.is_mandate_payment())
+                    || router_data
+                        .downcast_ref::<SetupMandateRouterData>()
+                        .is_some();
 
                 let mandate_reference = if is_mandate_payment {
                     let connector_payment_method_id =
 | 
	2025-08-29T19:23:50Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [x] CI/CD
## Description
<!-- Describe your changes in detail -->
this pr introduces 0 dollar mandate (setup mandate) for payload connector.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
feature coverage. closes https://github.com/juspay/hyperswitch/issues/9109
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Payment Method Id:
<details>
<summary>CIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
	"currency": "USD",
	"amount": 0,
	"confirm": true,
	"customer_id": "payload_connector_test",
	"capture_method": "automatic",
	"capture_on": "2022-09-10T10:11:12Z",
	"authentication_type": "no_three_ds",
	"return_url": "https://www.google.com",
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"phone_country_code": "+65",
	"description": "Its my first payment request",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"payment_method": "card",
	"setup_future_usage": "off_session",
	"payment_type": "setup_mandate",
	"payment_method_type": "debit",
	"payment_method_data": {
		"card": {
			"card_number": "4242424242424242",
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"card_cvc": "737"
		}
	},
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		}
	},
	"shipping": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "john",
			"last_name": "Doe"
		}
	},
	"browser_info": {
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"language": "nl-NL",
		"color_depth": 24,
		"screen_height": 723,
		"screen_width": 1536,
		"time_zone": 0,
		"java_enabled": true,
		"java_script_enabled": true,
		"ip_address": "109.71.40.0"
	},
	"metadata": {
		"order_category": "applepay"
	},
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 300,
			"account_name": "transaction_processing"
		}
	],
	"customer_acceptance": {
		"acceptance_type": "offline",
		"accepted_at": "1963-05-03T04:07:52.723Z",
		"online": {
			"ip_address": "in sit",
			"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]"
		}
	}
}'
```
```json
{
	"payment_id": "pay_4ybWqJgD05Ur3L8rmDwd",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 0,
	"net_amount": 0,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": null,
	"connector": "payload",
	"client_secret": "pay_4ybWqJgD05Ur3L8rmDwd_secret_aRQ0QjaG7ROtanCpfQ2x",
	"created": "2025-08-29T19:00:35.597Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "something@gmail.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": "off_session",
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "john",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "joseph",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		},
		"email": null
	},
	"order_details": [
		{
			"sku": null,
			"upc": null,
			"brand": null,
			"amount": 300,
			"category": null,
			"quantity": 1,
			"tax_rate": null,
			"product_id": null,
			"description": null,
			"product_name": "Apple iphone 15",
			"product_type": null,
			"sub_category": null,
			"total_amount": null,
			"commodity_code": null,
			"unit_of_measure": null,
			"product_img_link": null,
			"product_tax_code": null,
			"total_tax_amount": null,
			"requires_shipping": null,
			"unit_discount_amount": null
		}
	],
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": "https://www.google.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494035,
		"expires": 1756497635,
		"secret": "epk_dd8f8b864b6e40a5af4f366967aa7c81"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQY8b9lWzU1wQHkqM3F",
	"frm_message": null,
	"metadata": {
		"order_category": "applepay"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-JOE-QIZ-TY7",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:15:35.597Z",
	"fingerprint": null,
	"browser_info": {
		"language": "nl-NL",
		"time_zone": 0,
		"ip_address": "109.71.40.0",
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"color_depth": 24,
		"java_enabled": true,
		"screen_width": 1536,
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"screen_height": 723,
		"java_script_enabled": true
	},
	"payment_channel": null,
	"payment_method_id": "pm_aNYtgqzHA7LuY38clFX6",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:00:37.348Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQY8Ztroeb9d3FizYWe",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
<details>
<summary>DB</summary>
<img width="1386" height="621" alt="image" src="https://github.com/user-attachments/assets/1018173e-5f30-4088-9e06-a1a8395a4b44" />
</details>
<details>
<summary>MIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "payload_connector_test",
    "email": "guest@example.com",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_aNYtgqzHA7LuY38clFX6"
    },
    "authentication_type": "no_three_ds"
}'
```
```json
{
	"payment_id": "pay_jLbHJLkFleJp5BKY9eP1",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 499,
	"net_amount": 499,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 499,
	"connector": "payload",
	"client_secret": "pay_jLbHJLkFleJp5BKY9eP1_secret_H21H8T0hMFJyIOEe2cbb",
	"created": "2025-08-29T19:01:50.520Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "guest@example.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": null,
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": true,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": null,
	"billing": null,
	"order_details": null,
	"email": "guest@example.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": null,
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": null,
	"statement_descriptor_suffix": null,
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494110,
		"expires": 1756497710,
		"secret": "epk_f267def8c8e444a79293278502e04313"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQYQOPSgkZCsRjGp8BI",
	"frm_message": null,
	"metadata": null,
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-PTQ-PL7-04C",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:16:50.520Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": "pm_aNYtgqzHA7LuY38clFX6",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:01:51.480Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQY8Ztroeb9d3FizYWe",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
Mandate Id:
<details>
<summary>CIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
	"currency": "USD",
	"amount": 0,
	"confirm": true,
	"customer_id": "payload_connector_test",
	"capture_method": "automatic",
	"capture_on": "2022-09-10T10:11:12Z",
	"authentication_type": "no_three_ds",
	"return_url": "https://www.google.com",
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"phone_country_code": "+65",
	"description": "Its my first payment request",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"payment_method": "card",
	"setup_future_usage": "off_session",
	"payment_type": "setup_mandate",
	"payment_method_type": "debit",
	"payment_method_data": {
		"card": {
			"card_number": "4242424242424242",
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"card_cvc": "737"
		}
	},
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		}
	},
	"shipping": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "john",
			"last_name": "Doe"
		}
	},
	"browser_info": {
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"language": "nl-NL",
		"color_depth": 24,
		"screen_height": 723,
		"screen_width": 1536,
		"time_zone": 0,
		"java_enabled": true,
		"java_script_enabled": true,
		"ip_address": "109.71.40.0"
	},
	"metadata": {
		"order_category": "applepay"
	},
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 300,
			"account_name": "transaction_processing"
		}
	],
	"mandate_data": {
		"customer_acceptance": {
			"acceptance_type": "offline",
			"accepted_at": "1963-05-03T04:07:52.723Z",
			"online": {
				"ip_address": "125.0.0.1",
				
				"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X"
			}
		},
		"mandate_type": {
			"multi_use": {
				"amount": 1000,
				"currency": "USD",
				"start_date": "2023-04-21T00:00:00Z",
				"end_date": "2023-05-21T00:00:00Z",
				"metadata": {
					"frequency": "13"
				}
			}
		}
	}
}'
```
```json
{
	"payment_id": "pay_cb28Jbsq7T9gcQj6guLd",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 0,
	"net_amount": 0,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": null,
	"connector": "payload",
	"client_secret": "pay_cb28Jbsq7T9gcQj6guLd_secret_uPq3s4qwO4kMcC33m6jf",
	"created": "2025-08-29T19:03:49.113Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "something@gmail.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": "man_3mj9Jwv4MwbOlI5CaXlC",
	"mandate_data": {
		"update_mandate_id": null,
		"customer_acceptance": {
			"acceptance_type": "offline",
			"accepted_at": "1963-05-03T04:07:52.723Z",
			"online": {
				"ip_address": "125.0.0.1",
				"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X"
			}
		},
		"mandate_type": {
			"multi_use": {
				"amount": 1000,
				"currency": "USD",
				"start_date": "2023-04-21T00:00:00.000Z",
				"end_date": "2023-05-21T00:00:00.000Z",
				"metadata": {
					"frequency": "13"
				}
			}
		}
	},
	"setup_future_usage": "off_session",
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "john",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "joseph",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		},
		"email": null
	},
	"order_details": [
		{
			"sku": null,
			"upc": null,
			"brand": null,
			"amount": 300,
			"category": null,
			"quantity": 1,
			"tax_rate": null,
			"product_id": null,
			"description": null,
			"product_name": "Apple iphone 15",
			"product_type": null,
			"sub_category": null,
			"total_amount": null,
			"commodity_code": null,
			"unit_of_measure": null,
			"product_img_link": null,
			"product_tax_code": null,
			"total_tax_amount": null,
			"requires_shipping": null,
			"unit_discount_amount": null
		}
	],
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": "https://www.google.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494229,
		"expires": 1756497829,
		"secret": "epk_7500c29e58b2436ba3c2702b7513f04c"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQYszstRDRYhiNjZZu3",
	"frm_message": null,
	"metadata": {
		"order_category": "applepay"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-IW6-K1O-C2J",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:18:49.113Z",
	"fingerprint": null,
	"browser_info": {
		"language": "nl-NL",
		"time_zone": 0,
		"ip_address": "109.71.40.0",
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"color_depth": 24,
		"java_enabled": true,
		"screen_width": 1536,
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"screen_height": 723,
		"java_script_enabled": true
	},
	"payment_channel": null,
	"payment_method_id": "pm_rFxrI0UIZ4dJuFNW6vrQ",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:03:50.744Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQYsyiEXTjoc3LyDvJO",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
<details>
<summary>DB</summary>
<img width="1396" height="705" alt="image" src="https://github.com/user-attachments/assets/5e7eaae8-4113-4eb4-a4df-12c86cced6b8" />
</details>
<details>
<summary>MIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "payload_connector_test",
    "email": "guest@example.com",
    "off_session": true,
    "recurring_details": {
        "type": "mandate_id",
        "data": "man_3mj9Jwv4MwbOlI5CaXlC"
    },
    "authentication_type": "no_three_ds"
}'
```
```json
{
	"payment_id": "pay_n6Q7mVWZolxL0iEvvWCq",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 499,
	"net_amount": 499,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 499,
	"connector": "payload",
	"client_secret": "pay_n6Q7mVWZolxL0iEvvWCq_secret_2kO6VPJ9ZB2gjKJ5FYY6",
	"created": "2025-08-29T19:04:16.806Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "guest@example.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": null,
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": true,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": "df98d618-af0e-49d7-ba36-fb618248a19c",
	"shipping": null,
	"billing": null,
	"order_details": null,
	"email": "guest@example.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": null,
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": null,
	"statement_descriptor_suffix": null,
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494256,
		"expires": 1756497856,
		"secret": "epk_868f1a923aa54d42b1fb7413cdffcede"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQYzTsOACXwo57SzYAY",
	"frm_message": null,
	"metadata": null,
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-1AQ-M6K-KC7",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:19:16.806Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": "pm_rFxrI0UIZ4dJuFNW6vrQ",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:04:17.696Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQYsyiEXTjoc3LyDvJO",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
Cypress changes:
<details>
<summary>Images of Cypress CI</summary>
<img width="724" height="562" alt="image" src="https://github.com/user-attachments/assets/20120708-0090-4c5b-ae4e-b54ed339498f" />
<img width="562" height="796" alt="image" src="https://github.com/user-attachments/assets/fefd2f7d-37eb-4e18-9df8-c7558cf3dcc7" />
all the 11 failures because of timeouts (even 30 seconds is not enough):
<img width="418" height="468" alt="image" src="https://github.com/user-attachments/assets/30e0de84-64fc-44ff-bac1-60947e273273" />
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [x] I added unit tests for my changes where possible
<!-- @coderabbitai ignore --> | 
	8ce36a2fd513034755a1bf1aacbd3210083e07c9 | 
	
Payment Method Id:
<details>
<summary>CIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
	"currency": "USD",
	"amount": 0,
	"confirm": true,
	"customer_id": "payload_connector_test",
	"capture_method": "automatic",
	"capture_on": "2022-09-10T10:11:12Z",
	"authentication_type": "no_three_ds",
	"return_url": "https://www.google.com",
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"phone_country_code": "+65",
	"description": "Its my first payment request",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"payment_method": "card",
	"setup_future_usage": "off_session",
	"payment_type": "setup_mandate",
	"payment_method_type": "debit",
	"payment_method_data": {
		"card": {
			"card_number": "4242424242424242",
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"card_cvc": "737"
		}
	},
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		}
	},
	"shipping": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "john",
			"last_name": "Doe"
		}
	},
	"browser_info": {
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"language": "nl-NL",
		"color_depth": 24,
		"screen_height": 723,
		"screen_width": 1536,
		"time_zone": 0,
		"java_enabled": true,
		"java_script_enabled": true,
		"ip_address": "109.71.40.0"
	},
	"metadata": {
		"order_category": "applepay"
	},
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 300,
			"account_name": "transaction_processing"
		}
	],
	"customer_acceptance": {
		"acceptance_type": "offline",
		"accepted_at": "1963-05-03T04:07:52.723Z",
		"online": {
			"ip_address": "in sit",
			"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]"
		}
	}
}'
```
```json
{
	"payment_id": "pay_4ybWqJgD05Ur3L8rmDwd",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 0,
	"net_amount": 0,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": null,
	"connector": "payload",
	"client_secret": "pay_4ybWqJgD05Ur3L8rmDwd_secret_aRQ0QjaG7ROtanCpfQ2x",
	"created": "2025-08-29T19:00:35.597Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "something@gmail.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": "off_session",
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "john",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "joseph",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		},
		"email": null
	},
	"order_details": [
		{
			"sku": null,
			"upc": null,
			"brand": null,
			"amount": 300,
			"category": null,
			"quantity": 1,
			"tax_rate": null,
			"product_id": null,
			"description": null,
			"product_name": "Apple iphone 15",
			"product_type": null,
			"sub_category": null,
			"total_amount": null,
			"commodity_code": null,
			"unit_of_measure": null,
			"product_img_link": null,
			"product_tax_code": null,
			"total_tax_amount": null,
			"requires_shipping": null,
			"unit_discount_amount": null
		}
	],
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": "https://www.google.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494035,
		"expires": 1756497635,
		"secret": "epk_dd8f8b864b6e40a5af4f366967aa7c81"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQY8b9lWzU1wQHkqM3F",
	"frm_message": null,
	"metadata": {
		"order_category": "applepay"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-JOE-QIZ-TY7",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:15:35.597Z",
	"fingerprint": null,
	"browser_info": {
		"language": "nl-NL",
		"time_zone": 0,
		"ip_address": "109.71.40.0",
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"color_depth": 24,
		"java_enabled": true,
		"screen_width": 1536,
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"screen_height": 723,
		"java_script_enabled": true
	},
	"payment_channel": null,
	"payment_method_id": "pm_aNYtgqzHA7LuY38clFX6",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:00:37.348Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQY8Ztroeb9d3FizYWe",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
<details>
<summary>DB</summary>
<img width="1386" height="621" alt="image" src="https://github.com/user-attachments/assets/1018173e-5f30-4088-9e06-a1a8395a4b44" />
</details>
<details>
<summary>MIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "payload_connector_test",
    "email": "guest@example.com",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_aNYtgqzHA7LuY38clFX6"
    },
    "authentication_type": "no_three_ds"
}'
```
```json
{
	"payment_id": "pay_jLbHJLkFleJp5BKY9eP1",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 499,
	"net_amount": 499,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 499,
	"connector": "payload",
	"client_secret": "pay_jLbHJLkFleJp5BKY9eP1_secret_H21H8T0hMFJyIOEe2cbb",
	"created": "2025-08-29T19:01:50.520Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "guest@example.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": null,
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": true,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": null,
	"billing": null,
	"order_details": null,
	"email": "guest@example.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": null,
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": null,
	"statement_descriptor_suffix": null,
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494110,
		"expires": 1756497710,
		"secret": "epk_f267def8c8e444a79293278502e04313"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQYQOPSgkZCsRjGp8BI",
	"frm_message": null,
	"metadata": null,
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-PTQ-PL7-04C",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:16:50.520Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": "pm_aNYtgqzHA7LuY38clFX6",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:01:51.480Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQY8Ztroeb9d3FizYWe",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
Mandate Id:
<details>
<summary>CIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
	"currency": "USD",
	"amount": 0,
	"confirm": true,
	"customer_id": "payload_connector_test",
	"capture_method": "automatic",
	"capture_on": "2022-09-10T10:11:12Z",
	"authentication_type": "no_three_ds",
	"return_url": "https://www.google.com",
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"phone_country_code": "+65",
	"description": "Its my first payment request",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"payment_method": "card",
	"setup_future_usage": "off_session",
	"payment_type": "setup_mandate",
	"payment_method_type": "debit",
	"payment_method_data": {
		"card": {
			"card_number": "4242424242424242",
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"card_cvc": "737"
		}
	},
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		}
	},
	"shipping": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "CA",
			"zip": "94122",
			"country": "US",
			"first_name": "john",
			"last_name": "Doe"
		}
	},
	"browser_info": {
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"language": "nl-NL",
		"color_depth": 24,
		"screen_height": 723,
		"screen_width": 1536,
		"time_zone": 0,
		"java_enabled": true,
		"java_script_enabled": true,
		"ip_address": "109.71.40.0"
	},
	"metadata": {
		"order_category": "applepay"
	},
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 300,
			"account_name": "transaction_processing"
		}
	],
	"mandate_data": {
		"customer_acceptance": {
			"acceptance_type": "offline",
			"accepted_at": "1963-05-03T04:07:52.723Z",
			"online": {
				"ip_address": "125.0.0.1",
				
				"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X"
			}
		},
		"mandate_type": {
			"multi_use": {
				"amount": 1000,
				"currency": "USD",
				"start_date": "2023-04-21T00:00:00Z",
				"end_date": "2023-05-21T00:00:00Z",
				"metadata": {
					"frequency": "13"
				}
			}
		}
	}
}'
```
```json
{
	"payment_id": "pay_cb28Jbsq7T9gcQj6guLd",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 0,
	"net_amount": 0,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": null,
	"connector": "payload",
	"client_secret": "pay_cb28Jbsq7T9gcQj6guLd_secret_uPq3s4qwO4kMcC33m6jf",
	"created": "2025-08-29T19:03:49.113Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "something@gmail.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": "man_3mj9Jwv4MwbOlI5CaXlC",
	"mandate_data": {
		"update_mandate_id": null,
		"customer_acceptance": {
			"acceptance_type": "offline",
			"accepted_at": "1963-05-03T04:07:52.723Z",
			"online": {
				"ip_address": "125.0.0.1",
				"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X"
			}
		},
		"mandate_type": {
			"multi_use": {
				"amount": 1000,
				"currency": "USD",
				"start_date": "2023-04-21T00:00:00.000Z",
				"end_date": "2023-05-21T00:00:00.000Z",
				"metadata": {
					"frequency": "13"
				}
			}
		}
	},
	"setup_future_usage": "off_session",
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "john",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "CA",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "CA",
			"first_name": "joseph",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": {
			"number": "8056594427",
			"country_code": "+91"
		},
		"email": null
	},
	"order_details": [
		{
			"sku": null,
			"upc": null,
			"brand": null,
			"amount": 300,
			"category": null,
			"quantity": 1,
			"tax_rate": null,
			"product_id": null,
			"description": null,
			"product_name": "Apple iphone 15",
			"product_type": null,
			"sub_category": null,
			"total_amount": null,
			"commodity_code": null,
			"unit_of_measure": null,
			"product_img_link": null,
			"product_tax_code": null,
			"total_tax_amount": null,
			"requires_shipping": null,
			"unit_discount_amount": null
		}
	],
	"email": "something@gmail.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": "https://www.google.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "Juspay",
	"statement_descriptor_suffix": "Router",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494229,
		"expires": 1756497829,
		"secret": "epk_7500c29e58b2436ba3c2702b7513f04c"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQYszstRDRYhiNjZZu3",
	"frm_message": null,
	"metadata": {
		"order_category": "applepay"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-IW6-K1O-C2J",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:18:49.113Z",
	"fingerprint": null,
	"browser_info": {
		"language": "nl-NL",
		"time_zone": 0,
		"ip_address": "109.71.40.0",
		"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
		"color_depth": 24,
		"java_enabled": true,
		"screen_width": 1536,
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"screen_height": 723,
		"java_script_enabled": true
	},
	"payment_channel": null,
	"payment_method_id": "pm_rFxrI0UIZ4dJuFNW6vrQ",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:03:50.744Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQYsyiEXTjoc3LyDvJO",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
<details>
<summary>DB</summary>
<img width="1396" height="705" alt="image" src="https://github.com/user-attachments/assets/5e7eaae8-4113-4eb4-a4df-12c86cced6b8" />
</details>
<details>
<summary>MIT</summary>
```sh
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uGs7ayYh5hoENIMQ43lMkQGC2i863OXlIg5XhqxcyfaKjNYcOtUv1YRrUTYuD1WW' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "payload_connector_test",
    "email": "guest@example.com",
    "off_session": true,
    "recurring_details": {
        "type": "mandate_id",
        "data": "man_3mj9Jwv4MwbOlI5CaXlC"
    },
    "authentication_type": "no_three_ds"
}'
```
```json
{
	"payment_id": "pay_n6Q7mVWZolxL0iEvvWCq",
	"merchant_id": "postman_merchant_GHAction_1756491108",
	"status": "succeeded",
	"amount": 499,
	"net_amount": 499,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 499,
	"connector": "payload",
	"client_secret": "pay_n6Q7mVWZolxL0iEvvWCq_secret_2kO6VPJ9ZB2gjKJ5FYY6",
	"created": "2025-08-29T19:04:16.806Z",
	"currency": "USD",
	"customer_id": "payload_connector_test",
	"customer": {
		"id": "payload_connector_test",
		"name": "Joseph Doe",
		"email": "guest@example.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": null,
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": true,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "4242",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "STRIPE PAYMENTS UK LIMITED",
			"card_issuing_country": "UNITEDKINGDOM",
			"card_isin": "424242",
			"card_extended_bin": null,
			"card_exp_month": "03",
			"card_exp_year": "2030",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": "df98d618-af0e-49d7-ba36-fb618248a19c",
	"shipping": null,
	"billing": null,
	"order_details": null,
	"email": "guest@example.com",
	"name": "Joseph Doe",
	"phone": "999999999",
	"return_url": null,
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": null,
	"statement_descriptor_suffix": null,
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "payload_connector_test",
		"created_at": 1756494256,
		"expires": 1756497856,
		"secret": "epk_868f1a923aa54d42b1fb7413cdffcede"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "txn_3euQYzTsOACXwo57SzYAY",
	"frm_message": null,
	"metadata": null,
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "PL-1AQ-M6K-KC7",
	"payment_link": null,
	"profile_id": "pro_JprfwhCqYDKEKZwcwHSo",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_nXQ68xSyk8uShjAhLx1p",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-29T19:19:16.806Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": "pm_rFxrI0UIZ4dJuFNW6vrQ",
	"network_transaction_id": null,
	"payment_method_status": "active",
	"updated": "2025-08-29T19:04:17.696Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": "pm_3euQYsyiEXTjoc3LyDvJO",
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
Cypress changes:
<details>
<summary>Images of Cypress CI</summary>
<img width="724" height="562" alt="image" src="https://github.com/user-attachments/assets/20120708-0090-4c5b-ae4e-b54ed339498f" />
<img width="562" height="796" alt="image" src="https://github.com/user-attachments/assets/fefd2f7d-37eb-4e18-9df8-c7558cf3dcc7" />
all the 11 failures because of timeouts (even 30 seconds is not enough):
<img width="418" height="468" alt="image" src="https://github.com/user-attachments/assets/30e0de84-64fc-44ff-bac1-60947e273273" />
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9139 | 
	Bug: feat(revenue_recovery): add support for data migration from merchant csv to Redis
 | 
	diff --git a/Cargo.lock b/Cargo.lock
index 196c7b9820b..82373eafbee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -459,6 +459,7 @@ dependencies = [
  "common_enums",
  "common_types",
  "common_utils",
+ "csv",
  "deserialize_form_style_query_parameter",
  "error-stack 0.4.1",
  "euclid",
@@ -470,6 +471,7 @@ dependencies = [
  "serde",
  "serde_json",
  "strum 0.26.3",
+ "tempfile",
  "time",
  "url",
  "utoipa",
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index cac70d26649..16403f0e25e 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -17,21 +17,23 @@ olap = []
 openapi = ["common_enums/openapi", "olap", "recon", "dummy_connector", "olap"]
 recon = []
 v1 = ["common_utils/v1"]
-v2 = ["common_types/v2", "common_utils/v2", "tokenization_v2", "dep:reqwest"]
+v2 = ["common_types/v2", "common_utils/v2", "tokenization_v2", "dep:reqwest", "revenue_recovery"]
 dynamic_routing = []
 control_center_theme = ["dep:actix-web", "dep:actix-multipart"]
-revenue_recovery = []
+revenue_recovery = ["dep:actix-multipart"]
 tokenization_v2 = ["common_utils/tokenization_v2"]
 
 [dependencies]
 actix-multipart = { version = "0.6.2", optional = true }
 actix-web = { version = "4.11.0", optional = true }
+csv = "1.3"
 error-stack = "0.4.1"
 mime = "0.3.17"
 reqwest = { version = "0.11.27", optional = true }
 serde = { version = "1.0.219", features = ["derive"] }
 serde_json = "1.0.140"
 strum = { version = "0.26", features = ["derive"] }
+tempfile = "3.8"
 time = { version = "0.3.41", features = ["serde", "serde-well-known", "std"] }
 url = { version = "2.5.4", features = ["serde"] }
 utoipa = { version = "4.2.3", features = ["preserve_order", "preserve_path_order"] }
diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index 3b343459e9e..16ad859f69a 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -41,6 +41,8 @@ pub mod proxy;
 pub mod recon;
 pub mod refunds;
 pub mod relay;
+#[cfg(feature = "v2")]
+pub mod revenue_recovery_data_backfill;
 pub mod routing;
 pub mod surcharge_decision_configs;
 pub mod three_ds_decision_rule;
diff --git a/crates/api_models/src/revenue_recovery_data_backfill.rs b/crates/api_models/src/revenue_recovery_data_backfill.rs
new file mode 100644
index 00000000000..d73ae8a33c3
--- /dev/null
+++ b/crates/api_models/src/revenue_recovery_data_backfill.rs
@@ -0,0 +1,150 @@
+use std::{collections::HashMap, fs::File, io::BufReader};
+
+use actix_multipart::form::{tempfile::TempFile, MultipartForm};
+use actix_web::{HttpResponse, ResponseError};
+use common_enums::{CardNetwork, PaymentMethodType};
+use common_utils::events::ApiEventMetric;
+use csv::Reader;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+use time::Date;
+
+#[derive(Debug, Deserialize, Serialize)]
+pub struct RevenueRecoveryBackfillRequest {
+    pub bin_number: Option<Secret<String>>,
+    pub customer_id_resp: String,
+    pub connector_payment_id: Option<String>,
+    pub token: Option<Secret<String>>,
+    pub exp_date: Option<Secret<String>>,
+    pub card_network: Option<CardNetwork>,
+    pub payment_method_sub_type: Option<PaymentMethodType>,
+    pub clean_bank_name: Option<String>,
+    pub country_name: Option<String>,
+    pub daily_retry_history: Option<String>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct RevenueRecoveryDataBackfillResponse {
+    pub processed_records: usize,
+    pub failed_records: usize,
+}
+
+#[derive(Debug, Serialize)]
+pub struct CsvParsingResult {
+    pub records: Vec<RevenueRecoveryBackfillRequest>,
+    pub failed_records: Vec<CsvParsingError>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct CsvParsingError {
+    pub row_number: usize,
+    pub error: String,
+}
+
+/// Comprehensive card
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ComprehensiveCardData {
+    pub card_type: Option<String>,
+    pub card_exp_month: Option<Secret<String>>,
+    pub card_exp_year: Option<Secret<String>>,
+    pub card_network: Option<CardNetwork>,
+    pub card_issuer: Option<String>,
+    pub card_issuing_country: Option<String>,
+    pub daily_retry_history: Option<HashMap<Date, i32>>,
+}
+
+impl ApiEventMetric for RevenueRecoveryDataBackfillResponse {
+    fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+        Some(common_utils::events::ApiEventsType::Miscellaneous)
+    }
+}
+
+impl ApiEventMetric for CsvParsingResult {
+    fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+        Some(common_utils::events::ApiEventsType::Miscellaneous)
+    }
+}
+
+impl ApiEventMetric for CsvParsingError {
+    fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+        Some(common_utils::events::ApiEventsType::Miscellaneous)
+    }
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub enum BackfillError {
+    InvalidCardType(String),
+    DatabaseError(String),
+    RedisError(String),
+    CsvParsingError(String),
+    FileProcessingError(String),
+}
+
+#[derive(serde::Deserialize)]
+pub struct BackfillQuery {
+    pub cutoff_time: Option<String>,
+}
+
+impl std::fmt::Display for BackfillError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::InvalidCardType(msg) => write!(f, "Invalid card type: {}", msg),
+            Self::DatabaseError(msg) => write!(f, "Database error: {}", msg),
+            Self::RedisError(msg) => write!(f, "Redis error: {}", msg),
+            Self::CsvParsingError(msg) => write!(f, "CSV parsing error: {}", msg),
+            Self::FileProcessingError(msg) => write!(f, "File processing error: {}", msg),
+        }
+    }
+}
+
+impl std::error::Error for BackfillError {}
+
+impl ResponseError for BackfillError {
+    fn error_response(&self) -> HttpResponse {
+        HttpResponse::BadRequest().json(serde_json::json!({
+            "error": self.to_string()
+        }))
+    }
+}
+
+#[derive(Debug, MultipartForm)]
+pub struct RevenueRecoveryDataBackfillForm {
+    #[multipart(rename = "file")]
+    pub file: TempFile,
+}
+
+impl RevenueRecoveryDataBackfillForm {
+    pub fn validate_and_get_records_with_errors(&self) -> Result<CsvParsingResult, BackfillError> {
+        // Step 1: Open the file
+        let file = File::open(self.file.file.path())
+            .map_err(|error| BackfillError::FileProcessingError(error.to_string()))?;
+
+        let mut csv_reader = Reader::from_reader(BufReader::new(file));
+
+        // Step 2: Parse CSV into typed records
+        let mut records = Vec::new();
+        let mut failed_records = Vec::new();
+
+        for (row_index, record_result) in csv_reader
+            .deserialize::<RevenueRecoveryBackfillRequest>()
+            .enumerate()
+        {
+            match record_result {
+                Ok(record) => {
+                    records.push(record);
+                }
+                Err(err) => {
+                    failed_records.push(CsvParsingError {
+                        row_number: row_index + 2, // +2 because enumerate starts at 0 and CSV has header row
+                        error: err.to_string(),
+                    });
+                }
+            }
+        }
+
+        Ok(CsvParsingResult {
+            records,
+            failed_records,
+        })
+    }
+}
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index f7cb256f587..6a7e77f6beb 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -75,4 +75,6 @@ pub mod relay;
 pub mod revenue_recovery;
 
 pub mod chat;
+#[cfg(feature = "v2")]
+pub mod revenue_recovery_data_backfill;
 pub mod tokenization;
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index 0b7fb4ad062..3bdc822859f 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -1231,8 +1231,17 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
             // Create process tracker ID in the format: CALCULATE_WORKFLOW_{payment_intent_id}
             let process_tracker_id = format!("{runner}_{task}_{}", id.get_string_repr());
 
-            // Set scheduled time to 1 hour from now
-            let schedule_time = common_utils::date_time::now() + time::Duration::hours(1);
+            // Set scheduled time to current time + buffer time set in configuration
+            let schedule_time = common_utils::date_time::now()
+                + time::Duration::seconds(
+                    state
+                        .conf
+                        .revenue_recovery
+                        .recovery_timestamp
+                        .reopen_workflow_buffer_time_in_seconds,
+                );
+
+            let new_retry_count = process.retry_count + 1;
 
             // Check if a process tracker entry already exists for this payment intent
             let existing_entry = db
@@ -1244,72 +1253,41 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
                     "Failed to check for existing calculate workflow process tracker entry",
                 )?;
 
-            match existing_entry {
-                Some(existing_process) => {
-                    router_env::logger::error!(
-                        "Found existing CALCULATE_WORKFLOW task with  id: {}",
-                        existing_process.id
-                    );
-                }
-                None => {
-                    // No entry exists - create a new one
-                    router_env::logger::info!(
-                    "No existing CALCULATE_WORKFLOW task found for payment_intent_id: {}, creating new entry scheduled for 1 hour from now",
+            // No entry exists - create a new one
+            router_env::logger::info!(
+                    "No existing CALCULATE_WORKFLOW task found for payment_intent_id: {}, creating new entry... ",
                     id.get_string_repr()
                 );
 
-                    let tag = ["PCR"];
-                    let task = "CALCULATE_WORKFLOW";
-                    let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
-
-                    let process_tracker_entry = storage::ProcessTrackerNew::new(
-                        &process_tracker_id,
-                        task,
-                        runner,
-                        tag,
-                        process.tracking_data.clone(),
-                        Some(process.retry_count),
-                        schedule_time,
-                        common_types::consts::API_VERSION,
-                    )
-                    .change_context(errors::RecoveryError::ProcessTrackerFailure)
-                    .attach_printable(
-                        "Failed to construct calculate workflow process tracker entry",
-                    )?;
-
-                    // Insert into process tracker with status New
-                    db.as_scheduler()
-                        .insert_process(process_tracker_entry)
-                        .await
-                        .change_context(errors::RecoveryError::ProcessTrackerFailure)
-                        .attach_printable(
-                            "Failed to enter calculate workflow process_tracker_entry in DB",
-                        )?;
-
-                    router_env::logger::info!(
-                    "Successfully created new CALCULATE_WORKFLOW task for payment_intent_id: {}",
-                    id.get_string_repr()
-                );
-                }
-            }
+            let tag = ["PCR"];
+            let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
+
+            let process_tracker_entry = storage::ProcessTrackerNew::new(
+                &process_tracker_id,
+                task,
+                runner,
+                tag,
+                process.tracking_data.clone(),
+                Some(new_retry_count),
+                schedule_time,
+                common_types::consts::API_VERSION,
+            )
+            .change_context(errors::RecoveryError::ProcessTrackerFailure)
+            .attach_printable("Failed to construct calculate workflow process tracker entry")?;
 
-            let tracking_data = serde_json::from_value(process.tracking_data.clone())
-                .change_context(errors::RecoveryError::ValueNotFound)
-                .attach_printable("Failed to deserialize the tracking data from process tracker")?;
+            // Insert into process tracker with status New
+            db.as_scheduler()
+                .insert_process(process_tracker_entry)
+                .await
+                .change_context(errors::RecoveryError::ProcessTrackerFailure)
+                .attach_printable(
+                    "Failed to enter calculate workflow process_tracker_entry in DB",
+                )?;
 
-            // Call the existing perform_calculate_workflow function
-            Box::pin(perform_calculate_workflow(
-                state,
-                process,
-                profile,
-                merchant_context,
-                &tracking_data,
-                revenue_recovery_payment_data,
-                payment_intent,
-            ))
-            .await
-            .change_context(errors::RecoveryError::ProcessTrackerFailure)
-            .attach_printable("Failed to perform calculate workflow")?;
+            router_env::logger::info!(
+                "Successfully created new CALCULATE_WORKFLOW task for payment_intent_id: {}",
+                id.get_string_repr()
+            );
 
             logger::info!(
                 payment_id = %id.get_string_repr(),
@@ -1322,30 +1300,6 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
     Ok(())
 }
 
-/// Create tracking data for the CALCULATE_WORKFLOW
-fn create_calculate_workflow_tracking_data(
-    payment_intent: &PaymentIntent,
-    revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
-) -> RecoveryResult<storage::revenue_recovery::RevenueRecoveryWorkflowTrackingData> {
-    let tracking_data = storage::revenue_recovery::RevenueRecoveryWorkflowTrackingData {
-        merchant_id: revenue_recovery_payment_data
-            .merchant_account
-            .get_id()
-            .clone(),
-        profile_id: revenue_recovery_payment_data.profile.get_id().clone(),
-        global_payment_id: payment_intent.id.clone(),
-        payment_attempt_id: payment_intent
-            .active_attempt_id
-            .clone()
-            .ok_or(storage_impl::errors::RecoveryError::ValueNotFound)?,
-        billing_mca_id: revenue_recovery_payment_data.billing_mca.get_id().clone(),
-        revenue_recovery_retry: revenue_recovery_payment_data.retry_algorithm,
-        invoice_scheduled_time: None, // Will be set by perform_calculate_workflow
-    };
-
-    Ok(tracking_data)
-}
-
 // TODO: Move these to impl based functions
 async fn record_back_to_billing_connector(
     state: &SessionState,
diff --git a/crates/router/src/core/revenue_recovery_data_backfill.rs b/crates/router/src/core/revenue_recovery_data_backfill.rs
new file mode 100644
index 00000000000..4f32a914849
--- /dev/null
+++ b/crates/router/src/core/revenue_recovery_data_backfill.rs
@@ -0,0 +1,316 @@
+use std::collections::HashMap;
+
+use api_models::revenue_recovery_data_backfill::{
+    BackfillError, ComprehensiveCardData, RevenueRecoveryBackfillRequest,
+    RevenueRecoveryDataBackfillResponse,
+};
+use common_enums::{CardNetwork, PaymentMethodType};
+use hyperswitch_domain_models::api::ApplicationResponse;
+use masking::ExposeInterface;
+use router_env::{instrument, logger};
+use time::{format_description, Date};
+
+use crate::{
+    connection,
+    core::errors::{self, RouterResult},
+    routes::SessionState,
+    types::{domain, storage},
+};
+
+pub async fn revenue_recovery_data_backfill(
+    state: SessionState,
+    records: Vec<RevenueRecoveryBackfillRequest>,
+    cutoff_datetime: Option<time::PrimitiveDateTime>,
+) -> RouterResult<ApplicationResponse<RevenueRecoveryDataBackfillResponse>> {
+    let mut processed_records = 0;
+    let mut failed_records = 0;
+
+    // Process each record
+    for record in records {
+        match process_payment_method_record(&state, &record, cutoff_datetime).await {
+            Ok(_) => {
+                processed_records += 1;
+                logger::info!(
+                    "Successfully processed record with connector customer id: {}",
+                    record.customer_id_resp
+                );
+            }
+            Err(e) => {
+                failed_records += 1;
+                logger::error!(
+                    "Payment method backfill failed: customer_id={}, error={}",
+                    record.customer_id_resp,
+                    e
+                );
+            }
+        }
+    }
+
+    let response = RevenueRecoveryDataBackfillResponse {
+        processed_records,
+        failed_records,
+    };
+
+    logger::info!(
+        "Revenue recovery data backfill completed - Processed: {}, Failed: {}",
+        processed_records,
+        failed_records
+    );
+
+    Ok(ApplicationResponse::Json(response))
+}
+
+async fn process_payment_method_record(
+    state: &SessionState,
+    record: &RevenueRecoveryBackfillRequest,
+    cutoff_datetime: Option<time::PrimitiveDateTime>,
+) -> Result<(), BackfillError> {
+    // Build comprehensive card data from CSV record
+    let card_data = match build_comprehensive_card_data(record) {
+        Ok(data) => data,
+        Err(e) => {
+            logger::warn!(
+                "Failed to build card data for connector customer id: {}, error: {}.",
+                record.customer_id_resp,
+                e
+            );
+            ComprehensiveCardData {
+                card_type: Some("card".to_string()),
+                card_exp_month: None,
+                card_exp_year: None,
+                card_network: None,
+                card_issuer: None,
+                card_issuing_country: None,
+                daily_retry_history: None,
+            }
+        }
+    };
+    logger::info!(
+        "Built comprehensive card data - card_type: {:?}, exp_month: {}, exp_year: {}, network: {:?}, issuer: {:?}, country: {:?}, daily_retry_history: {:?}",
+        card_data.card_type,
+        card_data.card_exp_month.as_ref().map(|_| "**").unwrap_or("None"),
+        card_data.card_exp_year.as_ref().map(|_| "**").unwrap_or("None"),
+        card_data.card_network,
+        card_data.card_issuer,
+        card_data.card_issuing_country,
+        card_data.daily_retry_history
+    );
+
+    // Update Redis if token exists and is valid
+    match record.token.as_ref().map(|token| token.clone().expose()) {
+        Some(token) if !token.is_empty() => {
+            logger::info!("Updating Redis for customer: {}", record.customer_id_resp,);
+
+            storage::revenue_recovery_redis_operation::
+            RedisTokenManager::update_redis_token_with_comprehensive_card_data(
+                state,
+                &record.customer_id_resp,
+                &token,
+                &card_data,
+                cutoff_datetime,
+            )
+            .await
+            .map_err(|e| {
+                logger::error!("Redis update failed: {}", e);
+                BackfillError::RedisError(format!("Token not found in Redis: {}", e))
+            })?;
+        }
+        _ => {
+            logger::info!(
+                "Skipping Redis update - token is missing, empty or 'nan': {:?}",
+                record.token
+            );
+        }
+    }
+
+    logger::info!(
+        "Successfully completed processing for connector customer id: {}",
+        record.customer_id_resp
+    );
+    Ok(())
+}
+
+/// Parse daily retry history from CSV
+fn parse_daily_retry_history(json_str: Option<&str>) -> Option<HashMap<Date, i32>> {
+    match json_str {
+        Some(json) if !json.is_empty() => {
+            match serde_json::from_str::<HashMap<String, i32>>(json) {
+                Ok(string_retry_history) => {
+                    // Convert string dates to Date objects
+                    let format = format_description::parse("[year]-[month]-[day]")
+                        .map_err(|e| {
+                            BackfillError::CsvParsingError(format!(
+                                "Invalid date format configuration: {}",
+                                e
+                            ))
+                        })
+                        .ok()?;
+
+                    let mut date_retry_history = HashMap::new();
+
+                    for (date_str, count) in string_retry_history {
+                        match Date::parse(&date_str, &format) {
+                            Ok(date) => {
+                                date_retry_history.insert(date, count);
+                            }
+                            Err(e) => {
+                                logger::warn!(
+                                    "Failed to parse date '{}' in daily_retry_history: {}",
+                                    date_str,
+                                    e
+                                );
+                            }
+                        }
+                    }
+
+                    logger::debug!(
+                        "Successfully parsed daily_retry_history with {} entries",
+                        date_retry_history.len()
+                    );
+                    Some(date_retry_history)
+                }
+                Err(e) => {
+                    logger::warn!("Failed to parse daily_retry_history JSON '{}': {}", json, e);
+                    None
+                }
+            }
+        }
+        _ => {
+            logger::debug!("Daily retry history not present or invalid, preserving existing data");
+            None
+        }
+    }
+}
+
+/// Build comprehensive card data from CSV record
+fn build_comprehensive_card_data(
+    record: &RevenueRecoveryBackfillRequest,
+) -> Result<ComprehensiveCardData, BackfillError> {
+    // Extract card type from request, if not present then update it with 'card'
+    let card_type = Some(determine_card_type(record.payment_method_sub_type));
+
+    // Parse expiration date
+    let (exp_month, exp_year) = parse_expiration_date(
+        record
+            .exp_date
+            .as_ref()
+            .map(|date| date.clone().expose())
+            .as_deref(),
+    )?;
+
+    let card_exp_month = exp_month.map(masking::Secret::new);
+    let card_exp_year = exp_year.map(masking::Secret::new);
+
+    // Extract card network
+    let card_network = record.card_network.clone();
+
+    // Extract card issuer and issuing country
+    let card_issuer = record
+        .clean_bank_name
+        .as_ref()
+        .filter(|value| !value.is_empty())
+        .cloned();
+
+    let card_issuing_country = record
+        .country_name
+        .as_ref()
+        .filter(|value| !value.is_empty())
+        .cloned();
+
+    // Parse daily retry history
+    let daily_retry_history = parse_daily_retry_history(record.daily_retry_history.as_deref());
+
+    Ok(ComprehensiveCardData {
+        card_type,
+        card_exp_month,
+        card_exp_year,
+        card_network,
+        card_issuer,
+        card_issuing_country,
+        daily_retry_history,
+    })
+}
+
+/// Determine card type with fallback logic: payment_method_sub_type if not present -> "Card"
+fn determine_card_type(payment_method_sub_type: Option<PaymentMethodType>) -> String {
+    match payment_method_sub_type {
+        Some(card_type_enum) => {
+            let mapped_type = match card_type_enum {
+                PaymentMethodType::Credit => "credit".to_string(),
+                PaymentMethodType::Debit => "debit".to_string(),
+                PaymentMethodType::Card => "card".to_string(),
+                // For all other payment method types, default to "card"
+                _ => "card".to_string(),
+            };
+            logger::debug!(
+                "Using payment_method_sub_type enum '{:?}' -> '{}'",
+                card_type_enum,
+                mapped_type
+            );
+            mapped_type
+        }
+        None => {
+            logger::info!("In CSV payment_method_sub_type not present, defaulting to 'card'");
+            "card".to_string()
+        }
+    }
+}
+
+/// Parse expiration date
+fn parse_expiration_date(
+    exp_date: Option<&str>,
+) -> Result<(Option<String>, Option<String>), BackfillError> {
+    exp_date
+        .filter(|date| !date.is_empty())
+        .map(|date| {
+            date.split_once('/')
+                .ok_or_else(|| {
+                    logger::warn!("Unrecognized expiration date format (MM/YY expected)");
+                    BackfillError::CsvParsingError(
+                        "Invalid expiration date format: expected MM/YY".to_string(),
+                    )
+                })
+                .and_then(|(month_part, year_part)| {
+                    let month = month_part.trim();
+                    let year = year_part.trim();
+
+                    logger::debug!("Split expiration date - parsing month and year");
+
+                    // Validate and parse month
+                    let month_num = month.parse::<u8>().map_err(|_| {
+                        logger::warn!("Failed to parse month component in expiration date");
+                        BackfillError::CsvParsingError(
+                            "Invalid month format in expiration date".to_string(),
+                        )
+                    })?;
+
+                    if !(1..=12).contains(&month_num) {
+                        logger::warn!("Invalid month value in expiration date (not in range 1-12)");
+                        return Err(BackfillError::CsvParsingError(
+                            "Invalid month value in expiration date".to_string(),
+                        ));
+                    }
+
+                    // Handle year conversion
+                    let final_year = match year.len() {
+                        4 => &year[2..4], // Convert 4-digit to 2-digit
+                        2 => year,        // Already 2-digit
+                        _ => {
+                            logger::warn!(
+                                "Invalid year length in expiration date (expected 2 or 4 digits)"
+                            );
+                            return Err(BackfillError::CsvParsingError(
+                                "Invalid year format in expiration date".to_string(),
+                            ));
+                        }
+                    };
+
+                    logger::debug!("Successfully parsed expiration date... ",);
+                    Ok((Some(month.to_string()), Some(final_year.to_string())))
+                })
+        })
+        .unwrap_or_else(|| {
+            logger::debug!("Empty expiration date, returning None");
+            Ok((None, None))
+        })
+}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 00df2908f44..1d03e90ec30 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -224,7 +224,8 @@ pub fn mk_app(
                 .service(routes::UserDeprecated::server(state.clone()))
                 .service(routes::ProcessTrackerDeprecated::server(state.clone()))
                 .service(routes::ProcessTracker::server(state.clone()))
-                .service(routes::Gsm::server(state.clone()));
+                .service(routes::Gsm::server(state.clone()))
+                .service(routes::RecoveryDataBackfill::server(state.clone()));
         }
     }
 
diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs
index b8fde79e2a1..d49f81d9d99 100644
--- a/crates/router/src/routes.rs
+++ b/crates/router/src/routes.rs
@@ -48,6 +48,8 @@ pub mod profiles;
 #[cfg(feature = "recon")]
 pub mod recon;
 pub mod refunds;
+#[cfg(feature = "v2")]
+pub mod revenue_recovery_data_backfill;
 #[cfg(feature = "olap")]
 pub mod routing;
 pub mod three_ds_decision_rule;
@@ -85,8 +87,6 @@ pub use self::app::PaymentMethodSession;
 pub use self::app::Proxy;
 #[cfg(all(feature = "olap", feature = "recon", feature = "v1"))]
 pub use self::app::Recon;
-#[cfg(feature = "v2")]
-pub use self::app::Tokenization;
 pub use self::app::{
     ApiKeys, AppState, ApplePayCertificatesMigration, Authentication, Cache, Cards, Chat, Configs,
     ConnectorOnboarding, Customers, Disputes, EphemeralKey, FeatureMatrix, Files, Forex, Gsm,
@@ -99,6 +99,8 @@ pub use self::app::{
 pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents};
 #[cfg(feature = "payouts")]
 pub use self::app::{PayoutLink, Payouts};
+#[cfg(feature = "v2")]
+pub use self::app::{RecoveryDataBackfill, Tokenization};
 #[cfg(all(feature = "stripe", feature = "v1"))]
 pub use super::compatibility::stripe::StripeApis;
 #[cfg(feature = "olap")]
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index d52dc1570ce..9f27455c75c 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2970,3 +2970,19 @@ impl ProfileAcquirer {
             )
     }
 }
+
+#[cfg(feature = "v2")]
+pub struct RecoveryDataBackfill;
+#[cfg(feature = "v2")]
+impl RecoveryDataBackfill {
+    pub fn server(state: AppState) -> Scope {
+        web::scope("/v2/recovery/data-backfill")
+            .app_data(web::Data::new(state))
+            .service(
+                web::resource("").route(
+                    web::post()
+                        .to(super::revenue_recovery_data_backfill::revenue_recovery_data_backfill),
+                ),
+            )
+    }
+}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 28581198d83..76a8839a91d 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -49,6 +49,7 @@ pub enum ApiIdentifier {
     ProfileAcquirer,
     ThreeDsDecisionRule,
     GenericTokenization,
+    RecoveryDataBackfill,
 }
 
 impl From<Flow> for ApiIdentifier {
@@ -380,6 +381,8 @@ impl From<Flow> for ApiIdentifier {
             Flow::TokenizationCreate | Flow::TokenizationRetrieve | Flow::TokenizationDelete => {
                 Self::GenericTokenization
             }
+
+            Flow::RecoveryDataBackfill => Self::RecoveryDataBackfill,
         }
     }
 }
diff --git a/crates/router/src/routes/revenue_recovery_data_backfill.rs b/crates/router/src/routes/revenue_recovery_data_backfill.rs
new file mode 100644
index 00000000000..340d9a084bf
--- /dev/null
+++ b/crates/router/src/routes/revenue_recovery_data_backfill.rs
@@ -0,0 +1,67 @@
+use actix_multipart::form::MultipartForm;
+use actix_web::{web, HttpRequest, HttpResponse};
+use api_models::revenue_recovery_data_backfill::{BackfillQuery, RevenueRecoveryDataBackfillForm};
+use router_env::{instrument, tracing, Flow};
+
+use crate::{
+    core::{api_locking, revenue_recovery_data_backfill},
+    routes::AppState,
+    services::{api, authentication as auth},
+    types::domain,
+};
+
+#[instrument(skip_all, fields(flow = ?Flow::RecoveryDataBackfill))]
+pub async fn revenue_recovery_data_backfill(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    query: web::Query<BackfillQuery>,
+    MultipartForm(form): MultipartForm<RevenueRecoveryDataBackfillForm>,
+) -> HttpResponse {
+    let flow = Flow::RecoveryDataBackfill;
+
+    // Parse cutoff_time from query parameter
+    let cutoff_datetime = match query
+        .cutoff_time
+        .as_ref()
+        .map(|time_str| {
+            time::PrimitiveDateTime::parse(
+                time_str,
+                &time::format_description::well_known::Iso8601::DEFAULT,
+            )
+        })
+        .transpose()
+    {
+        Ok(datetime) => datetime,
+        Err(err) => {
+            return HttpResponse::BadRequest().json(serde_json::json!({
+                "error": format!("Invalid datetime format: {}. Use ISO8601: 2024-01-15T10:30:00", err)
+            }));
+        }
+    };
+
+    let records = match form.validate_and_get_records_with_errors() {
+        Ok(records) => records,
+        Err(e) => {
+            return HttpResponse::BadRequest().json(serde_json::json!({
+                "error": e.to_string()
+            }));
+        }
+    };
+
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        records,
+        |state, _, records, _req| {
+            revenue_recovery_data_backfill::revenue_recovery_data_backfill(
+                state,
+                records.records,
+                cutoff_datetime,
+            )
+        },
+        &auth::V2AdminApiAuth,
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
diff --git a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
index f083e8bbbed..e89db0d1aa8 100644
--- a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
+++ b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
@@ -1,9 +1,10 @@
 use std::collections::HashMap;
 
+use api_models;
 use common_enums::enums::CardNetwork;
 use common_utils::{date_time, errors::CustomResult, id_type};
 use error_stack::ResultExt;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
 use redis_interface::{DelReply, SetnxReply};
 use router_env::{instrument, logger, tracing};
 use serde::{Deserialize, Serialize};
@@ -214,7 +215,6 @@ impl RedisTokenManager {
             .await
             .change_context(get_hash_err)?;
 
-        // build the result map using iterator adapters (explicit match preserved for logging)
         let payment_processor_token_info_map: HashMap<String, PaymentProcessorTokenStatus> =
             payment_processor_tokens
                 .into_iter()
@@ -754,4 +754,93 @@ impl RedisTokenManager {
 
         Ok(token)
     }
+
+    /// Update Redis token with comprehensive card data
+    #[instrument(skip_all)]
+    pub async fn update_redis_token_with_comprehensive_card_data(
+        state: &SessionState,
+        customer_id: &str,
+        token: &str,
+        card_data: &api_models::revenue_recovery_data_backfill::ComprehensiveCardData,
+        cutoff_datetime: Option<PrimitiveDateTime>,
+    ) -> CustomResult<(), errors::StorageError> {
+        // Get existing token data
+        let mut token_map =
+            Self::get_connector_customer_payment_processor_tokens(state, customer_id).await?;
+
+        // Find the token to update
+        let existing_token = token_map.get_mut(token).ok_or_else(|| {
+            tracing::warn!(
+                customer_id = customer_id,
+                "Token not found in parsed Redis data - may be corrupted or missing for "
+            );
+            error_stack::Report::new(errors::StorageError::ValueNotFound(
+                "Token not found in Redis".to_string(),
+            ))
+        })?;
+
+        // Update the token details with new card data
+        card_data.card_type.as_ref().map(|card_type| {
+            existing_token.payment_processor_token_details.card_type = Some(card_type.clone())
+        });
+
+        card_data.card_exp_month.as_ref().map(|exp_month| {
+            existing_token.payment_processor_token_details.expiry_month = Some(exp_month.clone())
+        });
+
+        card_data.card_exp_year.as_ref().map(|exp_year| {
+            existing_token.payment_processor_token_details.expiry_year = Some(exp_year.clone())
+        });
+
+        card_data.card_network.as_ref().map(|card_network| {
+            existing_token.payment_processor_token_details.card_network = Some(card_network.clone())
+        });
+
+        card_data.card_issuer.as_ref().map(|card_issuer| {
+            existing_token.payment_processor_token_details.card_issuer = Some(card_issuer.clone())
+        });
+
+        // Update daily retry history if provided
+        card_data
+            .daily_retry_history
+            .as_ref()
+            .map(|retry_history| existing_token.daily_retry_history = retry_history.clone());
+
+        // If cutoff_datetime is provided and existing scheduled_at < cutoff_datetime, set to None
+        // If no scheduled_at value exists, leave it as None
+        existing_token.scheduled_at = existing_token
+            .scheduled_at
+            .and_then(|existing_scheduled_at| {
+                cutoff_datetime
+                    .map(|cutoff| {
+                        if existing_scheduled_at < cutoff {
+                            tracing::info!(
+                                customer_id = customer_id,
+                                existing_scheduled_at = %existing_scheduled_at,
+                                cutoff_datetime = %cutoff,
+                                "Set scheduled_at to None because existing time is before cutoff time"
+                            );
+                            None
+                        } else {
+                            Some(existing_scheduled_at)
+                        }
+                    })
+                    .unwrap_or(Some(existing_scheduled_at)) // No cutoff provided, keep existing value
+            });
+
+        // Save the updated token map back to Redis
+        Self::update_or_add_connector_customer_payment_processor_tokens(
+            state,
+            customer_id,
+            token_map,
+        )
+        .await?;
+
+        tracing::info!(
+            customer_id = customer_id,
+            "Updated Redis token data with comprehensive card data using struct"
+        );
+
+        Ok(())
+    }
 }
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index f5359d84010..0f03e26a5c8 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -652,6 +652,8 @@ pub enum Flow {
     RecoveryPaymentsCreate,
     /// Tokenization delete flow
     TokenizationDelete,
+    /// Payment method data backfill flow
+    RecoveryDataBackfill,
     /// Gift card balance check flow
     GiftCardBalanceCheck,
 }
 | 
	2025-09-01T20:39:10Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
The format of csv:-
<img width="1720" height="33" alt="Screenshot 2025-09-02 at 13 57 36" src="https://github.com/user-attachments/assets/d8e57dc8-1707-49b2-a27f-79888ee5a8b9" />
<img width="1711" height="32" alt="Screenshot 2025-09-02 at 13 57 54" src="https://github.com/user-attachments/assets/222bbb5a-0c0a-4920-ad8e-d6d931be86ad" />
<img width="1644" height="28" alt="Screenshot 2025-09-02 at 13 58 07" src="https://github.com/user-attachments/assets/5e86aa7b-e34e-40fb-bbff-742d7316d8d5" />
here `CustomerReq_ID` is the customer token and `Token` is the payment token which is used as an identifier in Redis for tokens, ("customer:{}:tokens", customer_id) is used to get token and `Token` is used to find the field which we need to update.
So, we are parsing the csv and getting the valid records and building a request per record `RevenueRecoveryBackfillRequest`, from this request we are fetching the data like expiry month, year, card type, card issuer, card network, any of these fields are `null`, we are updating them from the request.
Complexity:-
for each valid record we are doing two Redis call, one for get and another for set.
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
For Revenue recovery service, we are storing data in Redis with format 
```
HGETALL customer:fake_customer123:tokens
1) "fake_token123"
2) "{\"payment_processor_token_details\":{\"payment_processor_token\":\"fake_token123\",\"expiry_month\":\"08\",\"expiry_year\":\"26\",\"card_issuer\":\"Green Dot Bank Dba Bonneville Bank\",\"last_four_digits\":null,\"card_network\":\"Visa\",\"card_type\":\"debit\"},\"inserted_by_attempt_id\":\"12345_att_fake_entry123\",\"error_code\":\"insufficient_funds\",\"daily_retry_history\":{\"2024-05-29\":1},\"scheduled_at\":null}"
```
in last data migration `card_type` was populated as `null`, but for `Smart` retry logic we need fields like `card_type`, `card_issuer`, `card_network`.
So, inorder to work with `Smart` retry we need to backfill `card_type` data from merchant csv. 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
cURL:-
```
curl --location 'http://localhost:8080/recovery/data-backfill' \
--header 'Authorization: api_key =' \
--header 'x-profile-id: pro_PljcGfk8IckJFT1WdFsn' \
--header 'api-key:' \
--form 'file=@"/Users/aditya.c/Downloads/_first_100_rows.csv"'
```
Router log:-
<img width="1064" height="747" alt="Screenshot 2025-09-02 at 13 47 22" src="https://github.com/user-attachments/assets/723b12f4-15bf-43ea-807b-968d5e40370a" />
cURL with query param for updating scheduled at time
```
curl --location 'http://localhost:8080/v2/recovery/data-backfill?cutoff_time=2025-09-17T10%3A30%3A00' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'x-profile-id: pro_4xOQlxvKwZbLUx8ThJXJ' \
--form 'file=@"/Users/aditya.c/Downloads/sample_merged_data (1).csv"'
```
Router log:-
<img width="1044" height="369" alt="Screenshot 2025-09-17 at 17 06 56" src="https://github.com/user-attachments/assets/8f31960e-b560-4a4b-a651-831899500971" />
Redis-cli log(updating scheduledat to null if cut-off time is greater than scheduled at time):-
<img width="1040" height="160" alt="Screenshot 2025-09-17 at 17 10 31" src="https://github.com/user-attachments/assets/f144357b-e693-4686-8df4-6b28b06208eb" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	fde51e17d44e9feea3cc5866e0692a5c9adb1975 | 
	
cURL:-
```
curl --location 'http://localhost:8080/recovery/data-backfill' \
--header 'Authorization: api_key =' \
--header 'x-profile-id: pro_PljcGfk8IckJFT1WdFsn' \
--header 'api-key:' \
--form 'file=@"/Users/aditya.c/Downloads/_first_100_rows.csv"'
```
Router log:-
<img width="1064" height="747" alt="Screenshot 2025-09-02 at 13 47 22" src="https://github.com/user-attachments/assets/723b12f4-15bf-43ea-807b-968d5e40370a" />
cURL with query param for updating scheduled at time
```
curl --location 'http://localhost:8080/v2/recovery/data-backfill?cutoff_time=2025-09-17T10%3A30%3A00' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'x-profile-id: pro_4xOQlxvKwZbLUx8ThJXJ' \
--form 'file=@"/Users/aditya.c/Downloads/sample_merged_data (1).csv"'
```
Router log:-
<img width="1044" height="369" alt="Screenshot 2025-09-17 at 17 06 56" src="https://github.com/user-attachments/assets/8f31960e-b560-4a4b-a651-831899500971" />
Redis-cli log(updating scheduledat to null if cut-off time is greater than scheduled at time):-
<img width="1040" height="160" alt="Screenshot 2025-09-17 at 17 10 31" src="https://github.com/user-attachments/assets/f144357b-e693-4686-8df4-6b28b06208eb" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9247 | 
	Bug: [FEATURE]:[PAYSAFE] Integrate no 3ds card
Integrate Paysafe connector - No 3ds Cards
Flows
- Payment
- Psync
- Capture
- Void
- Refund
- Refund Sync | 
	diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 20040502e11..da17d2d3ff0 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -117,7 +117,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://live.payme.io/"
 payone.base_url = "https://payment.payone.com/"
 paypal.base_url = "https://api-m.paypal.com/"
-paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
+paysafe.base_url = "https://api.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.payu.com/api/"
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 8b1c9e2f9eb..b040182ac7e 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -132,6 +132,7 @@ pub enum RoutableConnectors {
     Payload,
     Payone,
     Paypal,
+    Paysafe,
     Paystack,
     Paytm,
     Payu,
@@ -308,6 +309,7 @@ pub enum Connector {
     Payme,
     Payone,
     Paypal,
+    Paysafe,
     Paystack,
     Paytm,
     Payu,
@@ -496,6 +498,7 @@ impl Connector {
             | Self::Payme
             | Self::Payone
             | Self::Paypal
+            | Self::Paysafe
             | Self::Paystack
             | Self::Payu
             | Self::Placetopay
@@ -670,6 +673,7 @@ impl From<RoutableConnectors> for Connector {
             RoutableConnectors::Payme => Self::Payme,
             RoutableConnectors::Payone => Self::Payone,
             RoutableConnectors::Paypal => Self::Paypal,
+            RoutableConnectors::Paysafe => Self::Paysafe,
             RoutableConnectors::Paystack => Self::Paystack,
             RoutableConnectors::Payu => Self::Payu,
             RoutableConnectors::Placetopay => Self::Placetopay,
@@ -803,6 +807,7 @@ impl TryFrom<Connector> for RoutableConnectors {
             Connector::Payme => Ok(Self::Payme),
             Connector::Payone => Ok(Self::Payone),
             Connector::Paypal => Ok(Self::Paypal),
+            Connector::Paysafe => Ok(Self::Paysafe),
             Connector::Paystack => Ok(Self::Paystack),
             Connector::Payu => Ok(Self::Payu),
             Connector::Placetopay => Ok(Self::Placetopay),
diff --git a/crates/connector_configs/src/common_config.rs b/crates/connector_configs/src/common_config.rs
index 78f85c82577..b54d9e86da8 100644
--- a/crates/connector_configs/src/common_config.rs
+++ b/crates/connector_configs/src/common_config.rs
@@ -110,6 +110,7 @@ pub struct ApiModelMetaData {
     pub merchant_configuration_id: Option<String>,
     pub tenant_id: Option<String>,
     pub platform_url: Option<String>,
+    pub account_id: Option<String>,
 }
 
 #[serde_with::skip_serializing_none]
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index e67a8136684..18da6b52498 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -149,6 +149,7 @@ pub struct ConfigMetadata {
     pub proxy_url: Option<InputData>,
     pub shop_name: Option<InputData>,
     pub merchant_funding_source: Option<InputData>,
+    pub account_id: Option<String>,
 }
 
 #[serde_with::skip_serializing_none]
@@ -481,6 +482,7 @@ impl ConnectorConfig {
             Connector::Payme => Ok(connector_data.payme),
             Connector::Payone => Err("Use get_payout_connector_config".to_string()),
             Connector::Paypal => Ok(connector_data.paypal),
+            Connector::Paysafe => Ok(connector_data.paysafe),
             Connector::Paystack => Ok(connector_data.paystack),
             Connector::Payu => Ok(connector_data.payu),
             Connector::Placetopay => Ok(connector_data.placetopay),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index ded3ee24bfd..864b220688f 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -6718,5 +6718,50 @@ api_key = "Password"
 key1 = "Username"
 
 [paysafe]
-[paysafe.connector_auth.HeaderKey]
-api_key = "API Key"
+[[paysafe.credit]]
+payment_method_type = "Mastercard"
+[[paysafe.credit]]
+payment_method_type = "Visa"
+[[paysafe.credit]]
+payment_method_type = "Interac"
+[[paysafe.credit]]
+payment_method_type = "AmericanExpress"
+[[paysafe.credit]]
+payment_method_type = "JCB"
+[[paysafe.credit]]
+payment_method_type = "DinersClub"
+[[paysafe.credit]]
+payment_method_type = "Discover"
+[[paysafe.credit]]
+payment_method_type = "CartesBancaires"
+[[paysafe.credit]]
+payment_method_type = "UnionPay"
+[[paysafe.debit]]
+payment_method_type = "Mastercard"
+[[paysafe.debit]]
+payment_method_type = "Visa"
+[[paysafe.debit]]
+payment_method_type = "Interac"
+[[paysafe.debit]]
+payment_method_type = "AmericanExpress"
+[[paysafe.debit]]
+payment_method_type = "JCB"
+[[paysafe.debit]]
+payment_method_type = "DinersClub"
+[[paysafe.debit]]
+payment_method_type = "Discover"
+[[paysafe.debit]]
+payment_method_type = "CartesBancaires"
+[[paysafe.debit]]
+payment_method_type = "UnionPay"
+[paysafe.connector_auth.BodyKey]
+api_key = "Username"
+key1 = "Password"
+[paysafe.connector_webhook_details]
+merchant_secret = "Source verification key"
+[paysafe.metadata.account_id]
+name="account_id"
+label="Payment Method Account ID"
+placeholder="Enter Account ID"
+required=true
+type="Text"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index c0332a75daa..2f9ef9019de 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -5387,5 +5387,50 @@ api_key = "Password"
 key1 = "Username"
 
 [paysafe]
-[paysafe.connector_auth.HeaderKey]
-api_key = "API Key"
+[[paysafe.credit]]
+payment_method_type = "Mastercard"
+[[paysafe.credit]]
+payment_method_type = "Visa"
+[[paysafe.credit]]
+payment_method_type = "Interac"
+[[paysafe.credit]]
+payment_method_type = "AmericanExpress"
+[[paysafe.credit]]
+payment_method_type = "JCB"
+[[paysafe.credit]]
+payment_method_type = "DinersClub"
+[[paysafe.credit]]
+payment_method_type = "Discover"
+[[paysafe.credit]]
+payment_method_type = "CartesBancaires"
+[[paysafe.credit]]
+payment_method_type = "UnionPay"
+[[paysafe.debit]]
+payment_method_type = "Mastercard"
+[[paysafe.debit]]
+payment_method_type = "Visa"
+[[paysafe.debit]]
+payment_method_type = "Interac"
+[[paysafe.debit]]
+payment_method_type = "AmericanExpress"
+[[paysafe.debit]]
+payment_method_type = "JCB"
+[[paysafe.debit]]
+payment_method_type = "DinersClub"
+[[paysafe.debit]]
+payment_method_type = "Discover"
+[[paysafe.debit]]
+payment_method_type = "CartesBancaires"
+[[paysafe.debit]]
+payment_method_type = "UnionPay"
+[paysafe.connector_auth.BodyKey]
+api_key = "Username"
+key1 = "Password"
+[paysafe.connector_webhook_details]
+merchant_secret = "Source verification key"
+[paysafe.metadata.account_id]
+name="account_id"
+label="Payment Method Account ID"
+placeholder="Enter Account ID"
+required=true
+type="Text"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 7f95cd02c50..89d5f539e73 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -6701,5 +6701,50 @@ api_key = "Password"
 key1 = "Username"
 
 [paysafe]
-[paysafe.connector_auth.HeaderKey]
-api_key = "API Key"
+[[paysafe.credit]]
+payment_method_type = "Mastercard"
+[[paysafe.credit]]
+payment_method_type = "Visa"
+[[paysafe.credit]]
+payment_method_type = "Interac"
+[[paysafe.credit]]
+payment_method_type = "AmericanExpress"
+[[paysafe.credit]]
+payment_method_type = "JCB"
+[[paysafe.credit]]
+payment_method_type = "DinersClub"
+[[paysafe.credit]]
+payment_method_type = "Discover"
+[[paysafe.credit]]
+payment_method_type = "CartesBancaires"
+[[paysafe.credit]]
+payment_method_type = "UnionPay"
+[[paysafe.debit]]
+payment_method_type = "Mastercard"
+[[paysafe.debit]]
+payment_method_type = "Visa"
+[[paysafe.debit]]
+payment_method_type = "Interac"
+[[paysafe.debit]]
+payment_method_type = "AmericanExpress"
+[[paysafe.debit]]
+payment_method_type = "JCB"
+[[paysafe.debit]]
+payment_method_type = "DinersClub"
+[[paysafe.debit]]
+payment_method_type = "Discover"
+[[paysafe.debit]]
+payment_method_type = "CartesBancaires"
+[[paysafe.debit]]
+payment_method_type = "UnionPay"
+[paysafe.connector_auth.BodyKey]
+api_key = "Username"
+key1 = "Password"
+[paysafe.connector_webhook_details]
+merchant_secret = "Source verification key"
+[paysafe.metadata.account_id]
+name="account_id"
+label="Payment Method Account ID"
+placeholder="Enter Account ID"
+required=true
+type="Text"
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
index fc76cece514..64296c2ebe6 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
@@ -2,33 +2,39 @@ pub mod transformers;
 
 use std::sync::LazyLock;
 
+use base64::Engine;
 use common_enums::enums;
 use common_utils::{
+    consts,
     errors::CustomResult,
     ext_traits::BytesExt,
     request::{Method, Request, RequestBuilder, RequestContent},
-    types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+    types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
 };
 use error_stack::{report, ResultExt};
 use hyperswitch_domain_models::{
-    payment_method_data::PaymentMethodData,
     router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
     router_flow_types::{
         access_token_auth::AccessTokenAuth,
-        payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+        payments::{
+            Authorize, Capture, PSync, PaymentMethodToken, PreProcessing, Session, SetupMandate,
+            Void,
+        },
         refunds::{Execute, RSync},
     },
     router_request_types::{
         AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
-        PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, SetupMandateRequestData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData,
+        PaymentsSyncData, RefundsData, SetupMandateRequestData,
     },
     router_response_types::{
-        ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods,
+        ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+        SupportedPaymentMethods, SupportedPaymentMethodsExt,
     },
     types::{
-        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
-        RefundSyncRouterData, RefundsRouterData,
+        PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+        PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundSyncRouterData,
+        RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -42,20 +48,24 @@ use hyperswitch_interfaces::{
     types::{self, Response},
     webhooks,
 };
-use masking::{ExposeInterface, Mask};
+use masking::{Mask, PeekInterface};
 use transformers as paysafe;
 
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{
+    constants::headers,
+    types::ResponseRouterData,
+    utils::{self, RefundsRequestData as OtherRefundsRequestData},
+};
 
 #[derive(Clone)]
 pub struct Paysafe {
-    amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+    amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
 }
 
 impl Paysafe {
     pub fn new() -> &'static Self {
         &Self {
-            amount_converter: &StringMinorUnitForConnector,
+            amount_converter: &MinorUnitForConnector,
         }
     }
 }
@@ -76,7 +86,6 @@ impl api::PaymentToken for Paysafe {}
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Paysafe
 {
-    // Not Implemented (R)
 }
 
 impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Paysafe
@@ -121,9 +130,11 @@ impl ConnectorCommon for Paysafe {
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         let auth = paysafe::PaysafeAuthType::try_from(auth_type)
             .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+        let auth_key = format!("{}:{}", auth.username.peek(), auth.password.peek());
+        let auth_header = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_key));
         Ok(vec![(
             headers::AUTHORIZATION.to_string(),
-            auth.api_key.expose().into_masked(),
+            auth_header.into_masked(),
         )])
     }
 
@@ -140,11 +151,29 @@ impl ConnectorCommon for Paysafe {
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
+        let detail_message = response
+            .error
+            .details
+            .as_ref()
+            .and_then(|d| d.first().cloned());
+        let field_error_message = response
+            .error
+            .field_errors
+            .as_ref()
+            .and_then(|f| f.first().map(|fe| fe.error.clone()));
+
+        let reason = match (detail_message, field_error_message) {
+            (Some(detail), Some(field)) => Some(format!("{detail}, {field}")),
+            (Some(detail), None) => Some(detail),
+            (None, Some(field)) => Some(field),
+            (None, None) => Some(response.error.message.clone()),
+        };
+
         Ok(ErrorResponse {
             status_code: res.status_code,
-            code: response.code,
-            message: response.message,
-            reason: response.reason,
+            code: response.error.code,
+            message: response.error.message,
+            reason,
             attempt_status: None,
             connector_transaction_id: None,
             network_advice_code: None,
@@ -156,20 +185,6 @@ impl ConnectorCommon for Paysafe {
 }
 
 impl ConnectorValidation for Paysafe {
-    fn validate_mandate_payment(
-        &self,
-        _pm_type: Option<enums::PaymentMethodType>,
-        pm_data: PaymentMethodData,
-    ) -> CustomResult<(), errors::ConnectorError> {
-        match pm_data {
-            PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
-                "validate_mandate_payment does not support cards".to_string(),
-            )
-            .into()),
-            _ => Ok(()),
-        }
-    }
-
     fn validate_psync_reference_id(
         &self,
         _data: &PaymentsSyncData,
@@ -187,7 +202,121 @@ impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> fo
 
 impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Paysafe {}
 
-impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Paysafe {}
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Paysafe {
+    // Not Implemented (R)
+    fn build_request(
+        &self,
+        _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Err(
+            errors::ConnectorError::NotImplemented("Setup Mandate flow for Paysafe".to_string())
+                .into(),
+        )
+    }
+}
+
+impl api::PaymentsPreProcessing for Paysafe {}
+
+impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>
+    for Paysafe
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsPreProcessingRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &PaymentsPreProcessingRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!("{}v1/paymenthandles", self.base_url(connectors),))
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsPreProcessingRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let minor_amount =
+            req.request
+                .minor_amount
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "minor_amount",
+                })?;
+        let currency =
+            req.request
+                .currency
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                })?;
+        let amount = utils::convert_amount(self.amount_converter, minor_amount, currency)?;
+
+        let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
+        let connector_req = paysafe::PaysafePaymentHandleRequest::try_from(&connector_router_data)?;
+
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsPreProcessingRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::PaymentsPreProcessingType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::PaymentsPreProcessingType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::PaymentsPreProcessingType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsPreProcessingRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsPreProcessingRouterData, errors::ConnectorError> {
+        let response: paysafe::PaysafePaymentHandleResponse = res
+            .response
+            .parse_struct("PaysafePaymentHandleResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
 
 impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Paysafe {
     fn get_headers(
@@ -205,9 +334,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
     fn get_url(
         &self,
         _req: &PaymentsAuthorizeRouterData,
-        _connectors: &Connectors,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        Ok(format!("{}v1/payments", self.base_url(connectors),))
     }
 
     fn get_request_body(
@@ -291,10 +420,15 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
 
     fn get_url(
         &self,
-        _req: &PaymentsSyncRouterData,
-        _connectors: &Connectors,
+        req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_payment_id = req.connector_request_reference_id.clone();
+        Ok(format!(
+            "{}v1/payments?merchantRefNum={}",
+            self.base_url(connectors),
+            connector_payment_id
+        ))
     }
 
     fn build_request(
@@ -318,9 +452,9 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
-        let response: paysafe::PaysafePaymentsResponse = res
+        let response: paysafe::PaysafePaymentsSyncResponse = res
             .response
-            .parse_struct("paysafe PaymentsSyncResponse")
+            .parse_struct("paysafe PaysafePaymentsSyncResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
@@ -355,18 +489,31 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
 
     fn get_url(
         &self,
-        _req: &PaymentsCaptureRouterData,
-        _connectors: &Connectors,
+        req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_payment_id = req.request.connector_transaction_id.clone();
+        Ok(format!(
+            "{}v1/payments/{}/settlements",
+            self.base_url(connectors),
+            connector_payment_id
+        ))
     }
 
     fn get_request_body(
         &self,
-        _req: &PaymentsCaptureRouterData,
+        req: &PaymentsCaptureRouterData,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+        let amount = utils::convert_amount(
+            self.amount_converter,
+            req.request.minor_amount_to_capture,
+            req.request.currency,
+        )?;
+
+        let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
+        let connector_req = paysafe::PaysafeCaptureRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
     fn build_request(
@@ -395,9 +542,9 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
-        let response: paysafe::PaysafePaymentsResponse = res
+        let response: paysafe::PaysafeSettlementResponse = res
             .response
-            .parse_struct("Paysafe PaymentsCaptureResponse")
+            .parse_struct("PaysafeSettlementResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
@@ -417,7 +564,97 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
     }
 }
 
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Paysafe {}
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Paysafe {
+    fn get_headers(
+        &self,
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_url(
+        &self,
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let connector_payment_id = req.request.connector_transaction_id.clone();
+        Ok(format!(
+            "{}v1/payments/{}/voidauths",
+            self.base_url(connectors),
+            connector_payment_id
+        ))
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsCancelRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let minor_amount =
+            req.request
+                .minor_amount
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "minor_amount",
+                })?;
+        let currency =
+            req.request
+                .currency
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                })?;
+        let amount = utils::convert_amount(self.amount_converter, minor_amount, currency)?;
+
+        let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
+        let connector_req = paysafe::PaysafeCaptureRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+    fn build_request(
+        &self,
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+                .attach_default_headers()
+                .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+                .set_body(types::PaymentsVoidType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsCancelRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+        let response: paysafe::VoidResponse = res
+            .response
+            .parse_struct("PaysafeVoidResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+        .change_context(errors::ConnectorError::ResponseHandlingFailed)
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
 
 impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paysafe {
     fn get_headers(
@@ -434,10 +671,15 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paysafe
 
     fn get_url(
         &self,
-        _req: &RefundsRouterData<Execute>,
-        _connectors: &Connectors,
+        req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_payment_id = req.request.connector_transaction_id.clone();
+        Ok(format!(
+            "{}v1/settlements/{}/refunds",
+            self.base_url(connectors),
+            connector_payment_id
+        ))
     }
 
     fn get_request_body(
@@ -518,10 +760,15 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Paysafe {
 
     fn get_url(
         &self,
-        _req: &RefundSyncRouterData,
-        _connectors: &Connectors,
+        req: &RefundSyncRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+        let connector_refund_id = req.request.get_connector_refund_id()?;
+        Ok(format!(
+            "{}v1/refunds/{}",
+            self.base_url(connectors),
+            connector_refund_id
+        ))
     }
 
     fn build_request(
@@ -594,12 +841,70 @@ impl webhooks::IncomingWebhook for Paysafe {
     }
 }
 
-static PAYSAFE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
-    LazyLock::new(SupportedPaymentMethods::new);
+static PAYSAFE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
+    let supported_capture_methods = vec![
+        enums::CaptureMethod::Automatic,
+        enums::CaptureMethod::Manual,
+    ];
+
+    let supported_card_network = vec![
+        common_enums::CardNetwork::Mastercard,
+        common_enums::CardNetwork::Visa,
+        common_enums::CardNetwork::Interac,
+        common_enums::CardNetwork::AmericanExpress,
+        common_enums::CardNetwork::JCB,
+        common_enums::CardNetwork::DinersClub,
+        common_enums::CardNetwork::Discover,
+        common_enums::CardNetwork::CartesBancaires,
+        common_enums::CardNetwork::UnionPay,
+    ];
+
+    let mut paysafe_supported_payment_methods = SupportedPaymentMethods::new();
+
+    paysafe_supported_payment_methods.add(
+        enums::PaymentMethod::Card,
+        enums::PaymentMethodType::Credit,
+        PaymentMethodDetails {
+            mandates: enums::FeatureStatus::NotSupported,
+            refunds: enums::FeatureStatus::Supported,
+            supported_capture_methods: supported_capture_methods.clone(),
+            specific_features: Some(
+                api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+                    api_models::feature_matrix::CardSpecificFeatures {
+                        three_ds: common_enums::FeatureStatus::NotSupported,
+                        no_three_ds: common_enums::FeatureStatus::Supported,
+                        supported_card_networks: supported_card_network.clone(),
+                    }
+                }),
+            ),
+        },
+    );
+
+    paysafe_supported_payment_methods.add(
+        enums::PaymentMethod::Card,
+        enums::PaymentMethodType::Debit,
+        PaymentMethodDetails {
+            mandates: enums::FeatureStatus::NotSupported,
+            refunds: enums::FeatureStatus::Supported,
+            supported_capture_methods: supported_capture_methods.clone(),
+            specific_features: Some(
+                api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+                    api_models::feature_matrix::CardSpecificFeatures {
+                        three_ds: common_enums::FeatureStatus::NotSupported,
+                        no_three_ds: common_enums::FeatureStatus::Supported,
+                        supported_card_networks: supported_card_network.clone(),
+                    }
+                }),
+            ),
+        },
+    );
+
+    paysafe_supported_payment_methods
+});
 
 static PAYSAFE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
     display_name: "Paysafe",
-    description: "Paysafe connector",
+    description: "Paysafe gives ambitious businesses a launchpad with safe, secure online payment solutions, and gives consumers the ability to turn their transactions into meaningful experiences.",
     connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
     integration_status: enums::ConnectorIntegrationStatus::Sandbox,
 };
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
index f1a7dbdc237..50c665a65bd 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
@@ -1,28 +1,43 @@
+use cards::CardNumber;
 use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_utils::{
+    pii::{IpAddress, SecretSerdeValue},
+    request::Method,
+    types::MinorUnit,
+};
+use error_stack::ResultExt;
 use hyperswitch_domain_models::{
     payment_method_data::PaymentMethodData,
     router_data::{ConnectorAuthType, RouterData},
     router_flow_types::refunds::{Execute, RSync},
-    router_request_types::ResponseId,
+    router_request_types::{
+        PaymentsAuthorizeData, PaymentsPreProcessingData, PaymentsSyncData, ResponseId,
+    },
     router_response_types::{PaymentsResponseData, RefundsResponseData},
-    types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+    types::{
+        PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+        PaymentsPreProcessingRouterData, RefundsRouterData,
+    },
 };
 use hyperswitch_interfaces::errors;
-use masking::Secret;
+use masking::{ExposeInterface, PeekInterface, Secret};
 use serde::{Deserialize, Serialize};
 
-use crate::types::{RefundsResponseRouterData, ResponseRouterData};
+use crate::{
+    types::{RefundsResponseRouterData, ResponseRouterData},
+    utils::{
+        self, BrowserInformationData, CardData, PaymentsAuthorizeRequestData,
+        PaymentsPreProcessingRequestData, RouterData as _,
+    },
+};
 
-//TODO: Fill the struct with respective fields
 pub struct PaysafeRouterData<T> {
-    pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+    pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
     pub router_data: T,
 }
 
-impl<T> From<(StringMinorUnit, T)> for PaysafeRouterData<T> {
-    fn from((amount, item): (StringMinorUnit, T)) -> Self {
-        //Todo :  use utils to convert the amount to the type of amount that a connector accepts
+impl<T> From<(MinorUnit, T)> for PaysafeRouterData<T> {
+    fn from((amount, item): (MinorUnit, T)) -> Self {
         Self {
             amount,
             router_data: item,
@@ -30,20 +45,273 @@ impl<T> From<(StringMinorUnit, T)> for PaysafeRouterData<T> {
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, PartialEq)]
+#[derive(Debug, Default, Serialize, Deserialize)]
+pub struct PaysafeConnectorMetadataObject {
+    pub account_id: Secret<String>,
+}
+
+impl TryFrom<&Option<SecretSerdeValue>> for PaysafeConnectorMetadataObject {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(meta_data: &Option<SecretSerdeValue>) -> Result<Self, Self::Error> {
+        let metadata: Self = utils::to_connector_meta_from_secret::<Self>(meta_data.clone())
+            .change_context(errors::ConnectorError::InvalidConnectorConfig {
+                config: "merchant_connector_account.metadata",
+            })?;
+        Ok(metadata)
+    }
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafePaymentHandleRequest {
+    pub merchant_ref_num: String,
+    pub amount: MinorUnit,
+    pub settle_with_auth: bool,
+    pub card: PaysafeCard,
+    pub currency_code: enums::Currency,
+    pub payment_type: PaysafePaymentType,
+    pub transaction_type: TransactionType,
+    pub return_links: Vec<ReturnLink>,
+    pub account_id: Secret<String>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct ReturnLink {
+    pub rel: LinkType,
+    pub href: String,
+    pub method: String,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub enum LinkType {
+    OnCompleted,
+    OnFailed,
+    OnCancelled,
+    Default,
+}
+
+#[derive(Debug, Serialize)]
+pub enum PaysafePaymentType {
+    #[serde(rename = "CARD")]
+    Card,
+}
+
+#[derive(Debug, Serialize)]
+pub enum TransactionType {
+    #[serde(rename = "PAYMENT")]
+    Payment,
+}
+
+impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePaymentHandleRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &PaysafeRouterData<&PaymentsPreProcessingRouterData>,
+    ) -> Result<Self, Self::Error> {
+        if item.router_data.is_three_ds() {
+            Err(errors::ConnectorError::NotSupported {
+                message: "Card 3DS".to_string(),
+                connector: "Paysafe",
+            })?
+        };
+        let metadata: PaysafeConnectorMetadataObject =
+            utils::to_connector_meta_from_secret(item.router_data.connector_meta_data.clone())
+                .change_context(errors::ConnectorError::InvalidConnectorConfig {
+                    config: "merchant_connector_account.metadata",
+                })?;
+        match item.router_data.request.get_payment_method_data()?.clone() {
+            PaymentMethodData::Card(req_card) => {
+                let card = PaysafeCard {
+                    card_num: req_card.card_number.clone(),
+                    card_expiry: PaysafeCardExpiry {
+                        month: req_card.card_exp_month.clone(),
+                        year: req_card.get_expiry_year_4_digit(),
+                    },
+                    cvv: if req_card.card_cvc.clone().expose().is_empty() {
+                        None
+                    } else {
+                        Some(req_card.card_cvc.clone())
+                    },
+                    holder_name: item.router_data.get_optional_billing_full_name(),
+                };
+                let account_id = metadata.account_id;
+
+                let amount = item.amount;
+                let payment_type = PaysafePaymentType::Card;
+                let transaction_type = TransactionType::Payment;
+                let redirect_url = item.router_data.request.get_router_return_url()?;
+                let return_links = vec![
+                    ReturnLink {
+                        rel: LinkType::Default,
+                        href: redirect_url.clone(),
+                        method: Method::Get.to_string(),
+                    },
+                    ReturnLink {
+                        rel: LinkType::OnCompleted,
+                        href: redirect_url.clone(),
+                        method: Method::Get.to_string(),
+                    },
+                    ReturnLink {
+                        rel: LinkType::OnFailed,
+                        href: redirect_url.clone(),
+                        method: Method::Get.to_string(),
+                    },
+                    ReturnLink {
+                        rel: LinkType::OnCancelled,
+                        href: redirect_url.clone(),
+                        method: Method::Get.to_string(),
+                    },
+                ];
+
+                Ok(Self {
+                    merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+                    amount,
+                    settle_with_auth: matches!(
+                        item.router_data.request.capture_method,
+                        Some(enums::CaptureMethod::Automatic) | None
+                    ),
+                    card,
+                    currency_code: item.router_data.request.get_currency()?,
+                    payment_type,
+                    transaction_type,
+                    return_links,
+                    account_id,
+                })
+            }
+            _ => Err(errors::ConnectorError::NotImplemented(
+                "Payment Method".to_string(),
+            ))?,
+        }
+    }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafePaymentHandleResponse {
+    pub id: String,
+    pub merchant_ref_num: String,
+    pub payment_handle_token: Secret<String>,
+    pub status: PaysafePaymentHandleStatus,
+}
+
+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum PaysafePaymentHandleStatus {
+    Initiated,
+    Payable,
+    #[default]
+    Processing,
+    Failed,
+    Expired,
+    Completed,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PaysafeMeta {
+    pub payment_handle_token: Secret<String>,
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            PaysafePaymentHandleResponse,
+            PaymentsPreProcessingData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsPreProcessingData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            PaysafePaymentHandleResponse,
+            PaymentsPreProcessingData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            preprocessing_id: Some(
+                item.response
+                    .payment_handle_token
+                    .to_owned()
+                    .peek()
+                    .to_string(),
+            ),
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::NoResponseId,
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(None),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<F, PaysafePaymentsResponse, PaymentsAuthorizeData, PaymentsResponseData>,
+    > for RouterData<F, PaymentsAuthorizeData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            PaysafePaymentsResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            status: get_paysafe_payment_status(
+                item.response.status,
+                item.data.request.capture_method,
+            ),
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(None),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
 pub struct PaysafePaymentsRequest {
-    amount: StringMinorUnit,
-    card: PaysafeCard,
+    pub merchant_ref_num: String,
+    pub amount: MinorUnit,
+    pub settle_with_auth: bool,
+    pub payment_handle_token: Secret<String>,
+    pub currency_code: enums::Currency,
+    pub customer_ip: Option<Secret<String, IpAddress>>,
 }
 
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+#[derive(Debug, Serialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
 pub struct PaysafeCard {
-    number: cards::CardNumber,
-    expiry_month: Secret<String>,
-    expiry_year: Secret<String>,
-    cvc: Secret<String>,
-    complete: bool,
+    pub card_num: CardNumber,
+    pub card_expiry: PaysafeCardExpiry,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cvv: Option<Secret<String>>,
+    pub holder_name: Option<Secret<String>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaysafeCardExpiry {
+    pub month: Secret<String>,
+    pub year: Secret<String>,
 }
 
 impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymentsRequest {
@@ -51,72 +319,278 @@ impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymen
     fn try_from(
         item: &PaysafeRouterData<&PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
-        match item.router_data.request.payment_method_data.clone() {
-            PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
-                "Card payment method not implemented".to_string(),
-            )
-            .into()),
-            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
-        }
+        if item.router_data.is_three_ds() {
+            Err(errors::ConnectorError::NotSupported {
+                message: "Card 3DS".to_string(),
+                connector: "Paysafe",
+            })?
+        };
+        let payment_handle_token = Secret::new(item.router_data.get_preprocessing_id()?);
+        let amount = item.amount;
+        let customer_ip = Some(
+            item.router_data
+                .request
+                .get_browser_info()?
+                .get_ip_address()?,
+        );
+
+        Ok(Self {
+            merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+            payment_handle_token,
+            amount,
+            settle_with_auth: item.router_data.request.is_auto_capture()?,
+            currency_code: item.router_data.request.currency,
+            customer_ip,
+        })
     }
 }
 
-//TODO: Fill the struct with respective fields
-// Auth Struct
 pub struct PaysafeAuthType {
-    pub(super) api_key: Secret<String>,
+    pub(super) username: Secret<String>,
+    pub(super) password: Secret<String>,
 }
 
 impl TryFrom<&ConnectorAuthType> for PaysafeAuthType {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
         match auth_type {
-            ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
-                api_key: api_key.to_owned(),
+            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+                username: api_key.to_owned(),
+                password: key1.to_owned(),
             }),
             _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
         }
     }
 }
-// PaymentsResponse
-//TODO: Append the remaining status flags
+
+// Paysafe Payment Status
 #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
+#[serde(rename_all = "UPPERCASE")]
 pub enum PaysafePaymentStatus {
-    Succeeded,
+    Received,
+    Completed,
+    Held,
     Failed,
     #[default]
+    Pending,
+    Cancelled,
     Processing,
 }
 
-impl From<PaysafePaymentStatus> for common_enums::AttemptStatus {
-    fn from(item: PaysafePaymentStatus) -> Self {
+pub fn get_paysafe_payment_status(
+    status: PaysafePaymentStatus,
+    capture_method: Option<common_enums::CaptureMethod>,
+) -> common_enums::AttemptStatus {
+    match status {
+        PaysafePaymentStatus::Completed => match capture_method {
+            Some(common_enums::CaptureMethod::Manual) => common_enums::AttemptStatus::Authorized,
+            Some(common_enums::CaptureMethod::Automatic) | None => {
+                common_enums::AttemptStatus::Charged
+            }
+            Some(common_enums::CaptureMethod::SequentialAutomatic)
+            | Some(common_enums::CaptureMethod::ManualMultiple)
+            | Some(common_enums::CaptureMethod::Scheduled) => {
+                common_enums::AttemptStatus::Unresolved
+            }
+        },
+        PaysafePaymentStatus::Failed => common_enums::AttemptStatus::Failure,
+        PaysafePaymentStatus::Pending
+        | PaysafePaymentStatus::Processing
+        | PaysafePaymentStatus::Received
+        | PaysafePaymentStatus::Held => common_enums::AttemptStatus::Pending,
+        PaysafePaymentStatus::Cancelled => common_enums::AttemptStatus::Voided,
+    }
+}
+
+// Paysafe Payments Response Structure
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafePaymentsSyncResponse {
+    pub payments: Vec<PaysafePaymentsResponse>,
+}
+
+// Paysafe Payments Response Structure
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafePaymentsResponse {
+    pub id: String,
+    pub merchant_ref_num: Option<String>,
+    pub status: PaysafePaymentStatus,
+    pub settlements: Option<Vec<PaysafeSettlementResponse>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeSettlementResponse {
+    pub merchant_ref_num: Option<String>,
+    pub id: String,
+    pub status: PaysafeSettlementStatus,
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<F, PaysafePaymentsSyncResponse, PaymentsSyncData, PaymentsResponseData>,
+    > for RouterData<F, PaymentsSyncData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            PaysafePaymentsSyncResponse,
+            PaymentsSyncData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let payment_handle = item
+            .response
+            .payments
+            .first()
+            .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
+        Ok(Self {
+            status: get_paysafe_payment_status(
+                payment_handle.status,
+                item.data.request.capture_method,
+            ),
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::NoResponseId,
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(None),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeCaptureRequest {
+    pub merchant_ref_num: String,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub amount: Option<MinorUnit>,
+}
+
+impl TryFrom<&PaysafeRouterData<&PaymentsCaptureRouterData>> for PaysafeCaptureRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: &PaysafeRouterData<&PaymentsCaptureRouterData>) -> Result<Self, Self::Error> {
+        let amount = Some(item.amount);
+
+        Ok(Self {
+            merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+            amount,
+        })
+    }
+}
+
+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum PaysafeSettlementStatus {
+    Received,
+    Initiated,
+    Completed,
+    Expired,
+    Failed,
+    #[default]
+    Pending,
+    Cancelled,
+}
+
+impl From<PaysafeSettlementStatus> for common_enums::AttemptStatus {
+    fn from(item: PaysafeSettlementStatus) -> Self {
         match item {
-            PaysafePaymentStatus::Succeeded => Self::Charged,
-            PaysafePaymentStatus::Failed => Self::Failure,
-            PaysafePaymentStatus::Processing => Self::Authorizing,
+            PaysafeSettlementStatus::Completed
+            | PaysafeSettlementStatus::Pending
+            | PaysafeSettlementStatus::Received => Self::Charged,
+            PaysafeSettlementStatus::Failed | PaysafeSettlementStatus::Expired => Self::Failure,
+            PaysafeSettlementStatus::Cancelled => Self::Voided,
+            PaysafeSettlementStatus::Initiated => Self::Pending,
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct PaysafePaymentsResponse {
-    status: PaysafePaymentStatus,
-    id: String,
+impl<F, T> TryFrom<ResponseRouterData<F, PaysafeSettlementResponse, T, PaymentsResponseData>>
+    for RouterData<F, T, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<F, PaysafeSettlementResponse, T, PaymentsResponseData>,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            status: common_enums::AttemptStatus::from(item.response.status),
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()),
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(None),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
+impl TryFrom<&PaysafeRouterData<&PaymentsCancelRouterData>> for PaysafeCaptureRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: &PaysafeRouterData<&PaymentsCancelRouterData>) -> Result<Self, Self::Error> {
+        let amount = Some(item.amount);
+
+        Ok(Self {
+            merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+            amount,
+        })
+    }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct VoidResponse {
+    pub merchant_ref_num: Option<String>,
+    pub id: String,
+    pub status: PaysafeVoidStatus,
+}
+
+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum PaysafeVoidStatus {
+    Received,
+    Completed,
+    Held,
+    Failed,
+    #[default]
+    Pending,
+    Cancelled,
+}
+
+impl From<PaysafeVoidStatus> for common_enums::AttemptStatus {
+    fn from(item: PaysafeVoidStatus) -> Self {
+        match item {
+            PaysafeVoidStatus::Completed
+            | PaysafeVoidStatus::Pending
+            | PaysafeVoidStatus::Received => Self::Voided,
+            PaysafeVoidStatus::Failed | PaysafeVoidStatus::Held => Self::Failure,
+            PaysafeVoidStatus::Cancelled => Self::Voided,
+        }
+    }
 }
 
-impl<F, T> TryFrom<ResponseRouterData<F, PaysafePaymentsResponse, T, PaymentsResponseData>>
+impl<F, T> TryFrom<ResponseRouterData<F, VoidResponse, T, PaymentsResponseData>>
     for RouterData<F, T, PaymentsResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: ResponseRouterData<F, PaysafePaymentsResponse, T, PaymentsResponseData>,
+        item: ResponseRouterData<F, VoidResponse, T, PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
         Ok(Self {
             status: common_enums::AttemptStatus::from(item.response.status),
             response: Ok(PaymentsResponseData::TransactionResponse {
-                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+                resource_id: ResponseId::NoResponseId,
                 redirection_data: Box::new(None),
                 mandate_reference: Box::new(None),
                 connector_metadata: None,
@@ -130,46 +604,50 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaysafePaymentsResponse, T, PaymentsRes
     }
 }
 
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
 pub struct PaysafeRefundRequest {
-    pub amount: StringMinorUnit,
+    pub merchant_ref_num: String,
+    pub amount: MinorUnit,
 }
 
 impl<F> TryFrom<&PaysafeRouterData<&RefundsRouterData<F>>> for PaysafeRefundRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(item: &PaysafeRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+        let amount = item.amount;
+
         Ok(Self {
-            amount: item.amount.to_owned(),
+            merchant_ref_num: item.router_data.request.refund_id.clone(),
+            amount,
         })
     }
 }
 
 // Type definition for Refund Response
 
-#[allow(dead_code)]
 #[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
+#[serde(rename_all = "UPPERCASE")]
 pub enum RefundStatus {
-    Succeeded,
+    Received,
+    Initiated,
+    Completed,
+    Expired,
     Failed,
     #[default]
-    Processing,
+    Pending,
+    Cancelled,
 }
 
 impl From<RefundStatus> for enums::RefundStatus {
     fn from(item: RefundStatus) -> Self {
         match item {
-            RefundStatus::Succeeded => Self::Success,
-            RefundStatus::Failed => Self::Failure,
-            RefundStatus::Processing => Self::Pending,
-            //TODO: Review mapping
+            RefundStatus::Received | RefundStatus::Completed => Self::Success,
+            RefundStatus::Failed | RefundStatus::Cancelled | RefundStatus::Expired => Self::Failure,
+            RefundStatus::Pending | RefundStatus::Initiated => Self::Pending,
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
 #[derive(Default, Debug, Clone, Serialize, Deserialize)]
 pub struct RefundResponse {
     id: String,
@@ -206,14 +684,22 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouter
     }
 }
 
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+#[derive(Debug, Serialize, Deserialize)]
 pub struct PaysafeErrorResponse {
-    pub status_code: u16,
+    pub error: Error,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Error {
     pub code: String,
     pub message: String,
-    pub reason: Option<String>,
-    pub network_advice_code: Option<String>,
-    pub network_decline_code: Option<String>,
-    pub network_error_message: Option<String>,
+    pub details: Option<Vec<String>>,
+    #[serde(rename = "fieldErrors")]
+    pub field_errors: Option<Vec<FieldError>>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct FieldError {
+    pub field: String,
+    pub error: String,
 }
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 8b87e0c098a..0535088c884 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -1664,7 +1664,6 @@ macro_rules! default_imp_for_pre_processing_steps{
 }
 
 default_imp_for_pre_processing_steps!(
-    connectors::Paysafe,
     connectors::Trustpayments,
     connectors::Silverflow,
     connectors::Vgs,
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index d34cb480800..edc6e5a42bb 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -2411,6 +2411,7 @@ pub trait PaymentsPreProcessingRequestData {
     fn get_browser_info(&self) -> Result<BrowserInformation, Error>;
     fn get_complete_authorize_url(&self) -> Result<String, Error>;
     fn connector_mandate_id(&self) -> Option<String>;
+    fn get_payment_method_data(&self) -> Result<PaymentMethodData, Error>;
 }
 
 impl PaymentsPreProcessingRequestData for PaymentsPreProcessingData {
@@ -2422,6 +2423,11 @@ impl PaymentsPreProcessingRequestData for PaymentsPreProcessingData {
             .to_owned()
             .ok_or_else(missing_field_err("payment_method_type"))
     }
+    fn get_payment_method_data(&self) -> Result<PaymentMethodData, Error> {
+        self.payment_method_data
+            .to_owned()
+            .ok_or_else(missing_field_err("payment_method_data"))
+    }
     fn get_currency(&self) -> Result<enums::Currency, Error> {
         self.currency.ok_or_else(missing_field_err("currency"))
     }
diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs
index 69e8cf96218..77e51e63f38 100644
--- a/crates/router/src/core/connector_validation.rs
+++ b/crates/router/src/core/connector_validation.rs
@@ -396,6 +396,13 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
                 paypal::transformers::PaypalAuthType::try_from(self.auth_type)?;
                 Ok(())
             }
+            api_enums::Connector::Paysafe => {
+                paysafe::transformers::PaysafeAuthType::try_from(self.auth_type)?;
+                paysafe::transformers::PaysafeConnectorMetadataObject::try_from(
+                    self.connector_meta_data,
+                )?;
+                Ok(())
+            }
             api_enums::Connector::Payone => {
                 payone::transformers::PayoneAuthType::try_from(self.auth_type)?;
                 Ok(())
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index a87d22191b6..7db83c383d8 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -6593,6 +6593,14 @@ where
                 router_data = router_data.preprocessing_steps(state, connector).await?;
 
                 (router_data, false)
+            } else if connector.connector_name == router_types::Connector::Paysafe
+                && router_data.auth_type == storage_enums::AuthenticationType::NoThreeDs
+            {
+                router_data = router_data.preprocessing_steps(state, connector).await?;
+
+                let is_error_in_response = router_data.response.is_err();
+                // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
+                (router_data, !is_error_in_response)
             } else if (connector.connector_name == router_types::Connector::Cybersource
                 || connector.connector_name == router_types::Connector::Barclaycard)
                 && is_operation_complete_authorize(&operation)
diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs
index 2f93feba334..0e809c628f1 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -424,6 +424,9 @@ impl ConnectorData {
                 enums::Connector::Paypal => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new())))
                 }
+                enums::Connector::Paysafe => {
+                    Ok(ConnectorEnum::Old(Box::new(connector::Paysafe::new())))
+                }
                 enums::Connector::Paystack => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Paystack::new())))
                 }
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index 77286011ad0..98e00bc893d 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -343,6 +343,9 @@ impl FeatureMatrixConnectorData {
                 enums::Connector::Paypal => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new())))
                 }
+                enums::Connector::Paysafe => {
+                    Ok(ConnectorEnum::Old(Box::new(connector::Paysafe::new())))
+                }
                 enums::Connector::Paystack => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Paystack::new())))
                 }
diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs
index 0688b466558..fb43e8b1360 100644
--- a/crates/router/src/types/connector_transformers.rs
+++ b/crates/router/src/types/connector_transformers.rs
@@ -110,6 +110,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
             api_enums::Connector::Payme => Self::Payme,
             api_enums::Connector::Payone => Self::Payone,
             api_enums::Connector::Paypal => Self::Paypal,
+            api_enums::Connector::Paysafe => Self::Paysafe,
             api_enums::Connector::Paystack => Self::Paystack,
             api_enums::Connector::Payu => Self::Payu,
             api_models::enums::Connector::Placetopay => Self::Placetopay,
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 1bf84848e47..f6deae24e20 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -94,7 +94,7 @@ pub struct ConnectorAuthentication {
     pub payme: Option<BodyKey>,
     pub payone: Option<HeaderKey>,
     pub paypal: Option<BodyKey>,
-    pub paysafe: Option<HeaderKey>,
+    pub paysafe: Option<BodyKey>,
     pub paystack: Option<HeaderKey>,
     pub paytm: Option<HeaderKey>,
     pub payu: Option<BodyKey>,
 | 
	2025-09-01T09:55:52Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Integrate Paysafe connector - No 3ds Cards
Flows 
- Payment
- Psync
- Capture
- Void
- Refund
- Refund Sync
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
1. Create MCA for Paysafe connector
```
curl --location 'http://localhost:8080/account/merchant_1756845023/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "paysafe",
    "business_country": "US",
    "business_label": "food",
    "connector_account_details": {
        "auth_type": "BodyKey",
         "api_key": "**", 
            "key1": "***"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
    ],
    "metadata": {
        "report_group" : "Hello",
        "merchant_config_currency":"USD",
        "account_id": "_____"
    }
}'
```
Create a Payment 
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "amount": 1500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "aaaa",
    "payment_method": "card",
    "payment_method_type": "credit",
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "payment_method_data": {
        "card": {
            "card_number": "4530910000012345", 
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "card_cvc": "111"
        }
    },
     "billing": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
      "shipping": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
        "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    }
}'
```
Response
```
{
    "payment_id": "pay_PGOFJN06yH9nEglswyFF",
    "merchant_id": "merchant_1756845023",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "paysafe",
    "client_secret": "pay_PGOFJN06yH9nEglswyFF_secret_UdTEHyTjQIGYtgESFnqe",
    "created": "2025-09-02T20:31:17.873Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1756845077,
        "expires": 1756848677,
        "secret": "epk_6ed44431aa3048fc87756aba02f4deb7"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "09ef3d4c-ef25-4234-b6a7-f0e074b16fa0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T20:46:17.873Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T20:31:19.281Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Create a Payment with capture_method as manual 
- Response
```
{
    "payment_id": "pay_NtJnAOrMkNpnmUFaSP3P",
    "merchant_id": "merchant_1756845023",
    "status": "requires_capture",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 1500,
    "amount_received": null,
    "connector": "paysafe",
    "client_secret": "pay_NtJnAOrMkNpnmUFaSP3P_secret_ScE2jv35Tp7z2ors0vSN",
    "created": "2025-09-02T20:59:00.726Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1756846740,
        "expires": 1756850340,
        "secret": "epk_725012e7f4524681a43c922269d96501"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7b6151d0-a81c-4dea-8c65-72053993f1a0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T21:14:00.726Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T20:59:02.385Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Capture the payment
Response
```
{
    "payment_id": "pay_NtJnAOrMkNpnmUFaSP3P",
    "merchant_id": "merchant_1756845023",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "paysafe",
    "client_secret": "pay_NtJnAOrMkNpnmUFaSP3P_secret_ScE2jv35Tp7z2ors0vSN",
    "created": "2025-09-02T20:59:00.726Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "f1063df1-4f29-433c-a97f-f9b3d32dac5d",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T21:14:00.726Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T20:59:27.495Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Make one more payment with capture method manual
- Then void it
Response
```
{
    "payment_id": "pay_TaErSsfUWajhzursc4jS",
    "merchant_id": "merchant_1756845023",
    "status": "cancelled",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "paysafe",
    "client_secret": "pay_TaErSsfUWajhzursc4jS_secret_l7P3CWNj0vzLmXG6TNiT",
    "created": "2025-09-02T21:00:32.402Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": "requested_by_customer",
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "2951a54a-c923-48d4-9738-5e16bb440b3e",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T21:15:32.402Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T21:00:35.862Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Refunds
Refunds can only be triggered after sometime, as the payment take some time to settle. 
according to doc - This process is typically handled in an overnight batch.
Cypress
<img width="740" height="826" alt="Screenshot 2025-09-04 at 4 45 29 PM" src="https://github.com/user-attachments/assets/1ffe7b71-bc3d-4350-8af9-b7b3cd879b2b" />
<img width="957" height="852" alt="Screenshot 2025-09-08 at 3 57 46 PM" src="https://github.com/user-attachments/assets/e7f144c2-8c20-44b0-84a5-e2b531ec59a4" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	7ad5cd5531eee612d72c938f324c08682359a313 | 
	1. Create MCA for Paysafe connector
```
curl --location 'http://localhost:8080/account/merchant_1756845023/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "paysafe",
    "business_country": "US",
    "business_label": "food",
    "connector_account_details": {
        "auth_type": "BodyKey",
         "api_key": "**", 
            "key1": "***"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
    ],
    "metadata": {
        "report_group" : "Hello",
        "merchant_config_currency":"USD",
        "account_id": "_____"
    }
}'
```
Create a Payment 
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "amount": 1500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "aaaa",
    "payment_method": "card",
    "payment_method_type": "credit",
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "payment_method_data": {
        "card": {
            "card_number": "4530910000012345", 
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "card_cvc": "111"
        }
    },
     "billing": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
      "shipping": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "박성준",
            "last_name": "박성준"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
        "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    }
}'
```
Response
```
{
    "payment_id": "pay_PGOFJN06yH9nEglswyFF",
    "merchant_id": "merchant_1756845023",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "paysafe",
    "client_secret": "pay_PGOFJN06yH9nEglswyFF_secret_UdTEHyTjQIGYtgESFnqe",
    "created": "2025-09-02T20:31:17.873Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1756845077,
        "expires": 1756848677,
        "secret": "epk_6ed44431aa3048fc87756aba02f4deb7"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "09ef3d4c-ef25-4234-b6a7-f0e074b16fa0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T20:46:17.873Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T20:31:19.281Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Create a Payment with capture_method as manual 
- Response
```
{
    "payment_id": "pay_NtJnAOrMkNpnmUFaSP3P",
    "merchant_id": "merchant_1756845023",
    "status": "requires_capture",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 1500,
    "amount_received": null,
    "connector": "paysafe",
    "client_secret": "pay_NtJnAOrMkNpnmUFaSP3P_secret_ScE2jv35Tp7z2ors0vSN",
    "created": "2025-09-02T20:59:00.726Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1756846740,
        "expires": 1756850340,
        "secret": "epk_725012e7f4524681a43c922269d96501"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7b6151d0-a81c-4dea-8c65-72053993f1a0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T21:14:00.726Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T20:59:02.385Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Capture the payment
Response
```
{
    "payment_id": "pay_NtJnAOrMkNpnmUFaSP3P",
    "merchant_id": "merchant_1756845023",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "paysafe",
    "client_secret": "pay_NtJnAOrMkNpnmUFaSP3P_secret_ScE2jv35Tp7z2ors0vSN",
    "created": "2025-09-02T20:59:00.726Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "f1063df1-4f29-433c-a97f-f9b3d32dac5d",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T21:14:00.726Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T20:59:27.495Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Make one more payment with capture method manual
- Then void it
Response
```
{
    "payment_id": "pay_TaErSsfUWajhzursc4jS",
    "merchant_id": "merchant_1756845023",
    "status": "cancelled",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "paysafe",
    "client_secret": "pay_TaErSsfUWajhzursc4jS_secret_l7P3CWNj0vzLmXG6TNiT",
    "created": "2025-09-02T21:00:32.402Z",
    "currency": "USD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "2345",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453091",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "박성준",
            "last_name": "박성준",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": "requested_by_customer",
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "2951a54a-c923-48d4-9738-5e16bb440b3e",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Dpwkpk5tMI4H6ZdYjpEW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_pliYtewxLmWuyNqYCjxg",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-02T21:15:32.402Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-02T21:00:35.862Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Refunds
Refunds can only be triggered after sometime, as the payment take some time to settle. 
according to doc - This process is typically handled in an overnight batch.
Cypress
<img width="740" height="826" alt="Screenshot 2025-09-04 at 4 45 29 PM" src="https://github.com/user-attachments/assets/1ffe7b71-bc3d-4350-8af9-b7b3cd879b2b" />
<img width="957" height="852" alt="Screenshot 2025-09-08 at 3 57 46 PM" src="https://github.com/user-attachments/assets/e7f144c2-8c20-44b0-84a5-e2b531ec59a4" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9107 | 
	Bug: add configs for Calculate job
 | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index e6bbef7fddf..0d5eb5f4fa3 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1203,7 +1203,10 @@ max_retries_per_day = 20
 max_retry_count_for_thirty_day = 20
 
 [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
-initial_timestamp_in_hours = 1          # number of hours added to start time for Decider service of Revenue Recovery
+initial_timestamp_in_seconds = 3600          # number of seconds added to start time for Decider service of Revenue Recovery
+job_schedule_buffer_time_in_seconds = 3600    # buffer time in seconds to schedule the job for Revenue Recovery
+reopen_workflow_buffer_time_in_seconds = 3600  # time in seconds to be added in scheduling for calculate workflow
+max_random_schedule_delay_in_seconds = 300  # max random delay in seconds to schedule the payment for Revenue Recovery
 
 [clone_connector_allowlist]
 merchant_ids = "merchant_ids"           # Comma-separated list of allowed merchant IDs
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 40868da8f3f..77fef227921 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -410,11 +410,14 @@ max_retries_per_day = 20
 max_retry_count_for_thirty_day = 20
 
 [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
-initial_timestamp_in_hours = 1        # number of hours added to start time for Decider service of Revenue Recovery
+initial_timestamp_in_seconds = 3600        # number of seconds added to start time for Decider service of Revenue Recovery
+job_schedule_buffer_time_in_seconds = 3600 # time in seconds to be added in schedule time as a buffer 
+reopen_workflow_buffer_time_in_seconds = 3600  # time in seconds to be added in scheduling for calculate workflow
+max_random_schedule_delay_in_seconds = 300 # max random delay in seconds to schedule the payment for Revenue Recovery
 
 [chat]
 enabled = false                                # Enable or disable chat features
 hyperswitch_ai_host = "http://0.0.0.0:8000"    # Hyperswitch ai workflow host
 
 [proxy_status_mapping]
-proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
\ No newline at end of file
+proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/development.toml b/config/development.toml
index 7db6e74568b..4f898e07570 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1302,7 +1302,10 @@ retry_algorithm_type = "cascading"
 redis_ttl_in_seconds=3888000
 
 [revenue_recovery.recovery_timestamp]
-initial_timestamp_in_hours = 1
+initial_timestamp_in_seconds = 3600
+job_schedule_buffer_time_in_seconds = 3600
+reopen_workflow_buffer_time_in_seconds = 3600
+max_random_schedule_delay_in_seconds = 300
 
 [revenue_recovery.card_config.amex]
 max_retries_per_day = 20
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index fd5a6a9a0c8..a11475d6cb6 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1219,6 +1219,11 @@ max_retry_count_for_thirty_day = 20
 max_retries_per_day = 20
 max_retry_count_for_thirty_day = 20
 
+[revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
+initial_timestamp_in_seconds = 3600        # number of seconds added to start time for Decider service of Revenue Recovery
+job_schedule_buffer_time_in_seconds = 3600  # time in seconds to be added in schedule time as a buffer 
+reopen_workflow_buffer_time_in_seconds = 60  # time in seconds to be added in scheduling for calculate workflow
+
 [clone_connector_allowlist]
 merchant_ids = "merchant_123, merchant_234"     # Comma-separated list of allowed merchant IDs
 connector_names = "stripe, adyen"               # Comma-separated list of allowed connector names
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index 206c5026a63..d63cbd5f906 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -56,8 +56,9 @@ pub async fn upsert_calculate_pcr_task(
     // Create process tracker ID in the format: CALCULATE_WORKFLOW_{payment_intent_id}
     let process_tracker_id = format!("{runner}_{task}_{}", payment_id.get_string_repr());
 
-    // Set scheduled time to 1 hour from now
-    let schedule_time = common_utils::date_time::now() + time::Duration::hours(1);
+    // Scheduled time is now because this will be the first entry in
+    // process tracker and we dont want to wait
+    let schedule_time = common_utils::date_time::now();
 
     let payment_attempt_id = payment_attempt_id
         .ok_or(error_stack::report!(
@@ -580,7 +581,13 @@ pub async fn perform_calculate_workflow(
                     update_calculate_job_schedule_time(
                         db,
                         process,
-                        time::Duration::minutes(15),
+                        time::Duration::seconds(
+                            state
+                                .conf
+                                .revenue_recovery
+                                .recovery_timestamp
+                                .job_schedule_buffer_time_in_seconds,
+                        ),
                         scheduled_token.scheduled_at,
                         &connector_customer_id,
                     )
@@ -607,7 +614,13 @@ pub async fn perform_calculate_workflow(
                             update_calculate_job_schedule_time(
                                 db,
                                 process,
-                                time::Duration::minutes(15),
+                                time::Duration::seconds(
+                                    state
+                                        .conf
+                                        .revenue_recovery
+                                        .recovery_timestamp
+                                        .job_schedule_buffer_time_in_seconds,
+                                ),
                                 Some(common_utils::date_time::now()),
                                 &connector_customer_id,
                             )
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index 1777f4cb22d..d2667cc63b0 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -1180,7 +1180,14 @@ pub async fn reopen_calculate_workflow_on_payment_failure(
             // 3. Set business status to QUEUED
             // 4. Schedule for immediate execution
             let new_retry_count = process.retry_count + 1;
-            let new_schedule_time = common_utils::date_time::now() + time::Duration::hours(1);
+            let new_schedule_time = common_utils::date_time::now()
+                + time::Duration::seconds(
+                    state
+                        .conf
+                        .revenue_recovery
+                        .recovery_timestamp
+                        .reopen_workflow_buffer_time_in_seconds,
+                );
 
             let pt_update = storage::ProcessTrackerUpdate::Update {
                 name: Some(task.to_string()),
diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs
index 3c3df991d4f..5a3f9f1bf7e 100644
--- a/crates/router/src/types/storage/revenue_recovery.rs
+++ b/crates/router/src/types/storage/revenue_recovery.rs
@@ -77,13 +77,19 @@ pub struct RevenueRecoverySettings {
 
 #[derive(Debug, serde::Deserialize, Clone)]
 pub struct RecoveryTimestamp {
-    pub initial_timestamp_in_hours: i64,
+    pub initial_timestamp_in_seconds: i64,
+    pub job_schedule_buffer_time_in_seconds: i64,
+    pub reopen_workflow_buffer_time_in_seconds: i64,
+    pub max_random_schedule_delay_in_seconds: i64,
 }
 
 impl Default for RecoveryTimestamp {
     fn default() -> Self {
         Self {
-            initial_timestamp_in_hours: 1,
+            initial_timestamp_in_seconds: 1,
+            job_schedule_buffer_time_in_seconds: 15,
+            reopen_workflow_buffer_time_in_seconds: 60,
+            max_random_schedule_delay_in_seconds: 300,
         }
     }
 }
diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs
index 4d42be64f9a..b85ebd3ff11 100644
--- a/crates/router/src/workflows/revenue_recovery.rs
+++ b/crates/router/src/workflows/revenue_recovery.rs
@@ -324,9 +324,9 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
     let start_time_primitive = payment_intent.created_at;
     let recovery_timestamp_config = &state.conf.revenue_recovery.recovery_timestamp;
 
-    let modified_start_time_primitive = start_time_primitive.saturating_add(time::Duration::hours(
-        recovery_timestamp_config.initial_timestamp_in_hours,
-    ));
+    let modified_start_time_primitive = start_time_primitive.saturating_add(
+        time::Duration::seconds(recovery_timestamp_config.initial_timestamp_in_seconds),
+    );
 
     let start_time_proto = date_time::convert_to_prost_timestamp(modified_start_time_primitive);
 
@@ -550,7 +550,8 @@ pub async fn get_token_with_schedule_time_based_on_retry_algorithm_type(
             .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
         }
     }
-    let delayed_schedule_time = scheduled_time.map(add_random_delay_to_schedule_time);
+    let delayed_schedule_time =
+        scheduled_time.map(|time| add_random_delay_to_schedule_time(state, time));
 
     Ok(delayed_schedule_time)
 }
@@ -776,10 +777,16 @@ pub async fn check_hard_decline(
 
 #[cfg(feature = "v2")]
 pub fn add_random_delay_to_schedule_time(
+    state: &SessionState,
     schedule_time: time::PrimitiveDateTime,
 ) -> time::PrimitiveDateTime {
     let mut rng = rand::thread_rng();
-    let random_secs = rng.gen_range(1..=3600);
+    let delay_limit = state
+        .conf
+        .revenue_recovery
+        .recovery_timestamp
+        .max_random_schedule_delay_in_seconds;
+    let random_secs = rng.gen_range(1..=delay_limit);
     logger::info!("Adding random delay of {random_secs} seconds to schedule time");
     schedule_time + time::Duration::seconds(random_secs)
 }
 | 
	2025-08-29T11:47:48Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add configs for calculate job
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8cfa966d34e914c8df06f000b59fdad53d3f9902 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9103 | 
	Bug: [BUG] UCS PSync call fails for Cashtocode
### Bug Description
Cashtocode does not support PSync.
When a PSync call is processed via Hyperswitch, the RouterData remains unchanged (payment status is not modified).
However, when the same PSync call goes via UCS, UCS returns an error response.
This causes inconsistent behavior between Hyperswitch and UCS flows.
### Expected Behavior
Replicate behaviour of PSync when payment was made throught Hyperswitch. 
### Actual Behavior
{
    "error": {
        "type": "api",
        "message": "Something went wrong",
        "code": "HE_00"
    }
}
### Steps To Reproduce
Make an evoucher payment for cashtocode connector via UCS, and do a PSync.
### Context For The Bug
_No response_
### Environment
router 2025.08.29.0-3-g0194b7a-dirty-0194b7a-2025-08-29T10:00:27.000000000Z
macos sequoia
rustc 1.87.0
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index 0d5eb5f4fa3..dcf5bb24fb6 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1173,6 +1173,7 @@ url = "http://localhost:8080"           # Open Router URL
 base_url = "http://localhost:8000"      # Unified Connector Service Base URL
 connection_timeout = 10                 # Connection Timeout Duration in Seconds
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+ucs_psync_disabled_connectors = "cashtocode"    # Comma-separated list of connectors to disable UCS PSync call
 
 [grpc_client.recovery_decider_client] # Revenue recovery client base url
 base_url = "http://127.0.0.1:8080" #Base URL
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 77fef227921..bfba035c1f3 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -385,6 +385,7 @@ connector_names = "connector_names"     # Comma-separated list of allowed connec
 base_url = "http://localhost:8000"      # Unified Connector Service Base URL
 connection_timeout = 10                 # Connection Timeout Duration in Seconds
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+ucs_psync_disabled_connectors = "cashtocode"    # Comma-separated list of connectors to disable UCS PSync call
 
 [revenue_recovery]
 # monitoring threshold -  120 days
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index d5d2f821eed..6dc2d098850 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -862,3 +862,4 @@ connector_list = "worldpayvantiv"
 
 [grpc_client.unified_connector_service]
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+ucs_psync_disabled_connectors = "cashtocode"    # Comma-separated list of connectors to disable UCS PSync call
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index cf08971a96e..311733923f2 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -871,4 +871,5 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 
 [grpc_client.unified_connector_service]
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+ucs_psync_disabled_connectors = "cashtocode"    # Comma-separated list of connectors to disable UCS PSync call
 
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 5625a22eeff..822d8d7dae7 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -881,3 +881,4 @@ connector_list = "worldpayvantiv"
 
 [grpc_client.unified_connector_service]
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+ucs_psync_disabled_connectors = "cashtocode"    # Comma-separated list of connectors to disable UCS PSync call
diff --git a/config/development.toml b/config/development.toml
index c838e2add1d..7320594bf1b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1295,6 +1295,7 @@ enabled = "true"
 base_url = "http://localhost:8000"
 connection_timeout = 10
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+ucs_psync_disabled_connectors = "cashtocode"    # Comma-separated list of connectors to disable UCS PSync call
 
 [revenue_recovery]
 monitoring_threshold_in_seconds = 60
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 81bb2dc8988..904238ccf5e 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -128,6 +128,10 @@ pub struct UnifiedConnectorServiceClientConfig {
     /// Set of external services/connectors available for the unified connector service
     #[serde(default, deserialize_with = "deserialize_hashset")]
     pub ucs_only_connectors: HashSet<Connector>,
+
+    /// Set of connectors for which psync is disabled in unified connector service
+    #[serde(default, deserialize_with = "deserialize_hashset")]
+    pub ucs_psync_disabled_connectors: HashSet<Connector>,
 }
 
 /// Contains the Connector Auth Type and related authentication data.
diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs
index 93a2c1ecd48..9f86b6e73bf 100644
--- a/crates/router/src/core/payments/flows/psync_flow.rs
+++ b/crates/router/src/core/payments/flows/psync_flow.rs
@@ -1,4 +1,4 @@
-use std::collections::HashMap;
+use std::{collections::HashMap, str::FromStr};
 
 use async_trait::async_trait;
 use error_stack::ResultExt;
@@ -226,6 +226,29 @@ impl Feature<api::PSync, types::PaymentsSyncData>
         merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,
         merchant_context: &domain::MerchantContext,
     ) -> RouterResult<()> {
+        let connector_name = self.connector.clone();
+        let connector_enum = common_enums::connector_enums::Connector::from_str(&connector_name)
+            .change_context(ApiErrorResponse::IncorrectConnectorNameGiven)?;
+
+        let is_ucs_psync_disabled = state
+            .conf
+            .grpc_client
+            .unified_connector_service
+            .as_ref()
+            .is_some_and(|config| {
+                config
+                    .ucs_psync_disabled_connectors
+                    .contains(&connector_enum)
+            });
+
+        if is_ucs_psync_disabled {
+            logger::info!(
+                "UCS PSync call disabled for connector: {}, skipping UCS call",
+                connector_name
+            );
+            return Ok(());
+        }
+
         let client = state
             .grpc_client
             .unified_connector_service_client
 | 
	2025-08-29T07:07:24Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Cashtocode does not support PSync.
When a PSync call is processed via Hyperswitch, the RouterData remains unchanged (payment status is not modified).
However, when the same PSync call goes via UCS, UCS returns an error response.
This causes inconsistent behavior between Hyperswitch and UCS flows.
To replicate Hyperswitch behavior when authorize was done through UCS:
- Introduced configuration "ucs_psync_disabled_connectors" under grpc_client.unified_connector_service.
- During call_unified_connector_service, we check if the connector is listed in "ucs_psync_disabled_connectors". If the connector is present, UCS PSync call is skipped, and unmodified RouterData is returned (same as Hyperswitch behavior).
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Make a evoucher payment through UCS for Cashtocode.
<details>
<summary>Enable Payments via UCS</summary>
```sh
curl --location 'http://localhost:8080/configs/' \
--header 'Content-Type: application/json' \
--header 'api-key: ' \
--header 'x-tenant-id: public' \
--data '{
    "key": "ucs_rollout_config_merchant_1756446892_cashtocode_reward_Authorize",
    "value": "1"
}'
```
</details>
<details>
<summary>Create Payment Evoucher For Cashtocode</summary>
Request
```json
{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "payment_method_data": "reward",
    "payment_method_type": "evoucher",
    "payment_method":"reward",  
    "capture_method": "automatic",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    }    
}
```
Response
```json
{
    "payment_id": "pay_zBEXBJSHcgiiBihUBZd6",
    "merchant_id": "merchant_1756640756",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_zBEXBJSHcgiiBihUBZd6_secret_OuxmlTO7YOGOVWzXAFB2",
    "created": "2025-08-31T12:04:05.954Z",
    "currency": "USD",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_zBEXBJSHcgiiBihUBZd6/merchant_1756640756/pay_zBEXBJSHcgiiBihUBZd6_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "evoucher",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "created_at": 1756641845,
        "expires": 1756645445,
        "secret": "epk_47eacc344437434e97664bd6b3e2722a"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_MrgPu8NG45h4Ea7ah7kC",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mRMHa49InsH1tw9OQKXk",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-31T12:19:05.954Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-31T12:04:06.829Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"payUrl\":\"https://cluster05.api-test.cashtocode.com/paytoken/redirect?token=ODJkYzNkOTAtZDk3Mi00MWQ1LThlMjItNTMyYzM3ZmQyZDYw\"}",
    "enable_partial_authorization": null
}
```
</details>
Do a PSync.
<details>
<summary>PSync repsponse</summary>
```json
{
    "payment_id": "pay_zBEXBJSHcgiiBihUBZd6",
    "merchant_id": "merchant_1756640756",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_zBEXBJSHcgiiBihUBZd6_secret_OuxmlTO7YOGOVWzXAFB2",
    "created": "2025-08-31T12:04:05.954Z",
    "currency": "USD",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
            "status": "authentication_pending",
            "amount": 1000,
            "order_tax_amount": null,
            "currency": "USD",
            "connector": "cashtocode",
            "error_message": null,
            "payment_method": "reward",
            "connector_transaction_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-08-31T12:04:05.955Z",
            "modified_at": "2025-08-31T12:04:43.026Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "evoucher",
            "reference_id": null,
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_zBEXBJSHcgiiBihUBZd6/merchant_1756640756/pay_zBEXBJSHcgiiBihUBZd6_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "evoucher",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_MrgPu8NG45h4Ea7ah7kC",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mRMHa49InsH1tw9OQKXk",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-31T12:19:05.954Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-31T12:04:54.483Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<img width="1203" height="51" alt="Screenshot 2025-08-31 at 5 26 20 PM" src="https://github.com/user-attachments/assets/62cc23de-bcf9-4b65-bb32-df7776c92556" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	971e17e0f3f8db7ec134b55c786ee1c7429430cd | 
	
Make a evoucher payment through UCS for Cashtocode.
<details>
<summary>Enable Payments via UCS</summary>
```sh
curl --location 'http://localhost:8080/configs/' \
--header 'Content-Type: application/json' \
--header 'api-key: ' \
--header 'x-tenant-id: public' \
--data '{
    "key": "ucs_rollout_config_merchant_1756446892_cashtocode_reward_Authorize",
    "value": "1"
}'
```
</details>
<details>
<summary>Create Payment Evoucher For Cashtocode</summary>
Request
```json
{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "payment_method_data": "reward",
    "payment_method_type": "evoucher",
    "payment_method":"reward",  
    "capture_method": "automatic",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    }    
}
```
Response
```json
{
    "payment_id": "pay_zBEXBJSHcgiiBihUBZd6",
    "merchant_id": "merchant_1756640756",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_zBEXBJSHcgiiBihUBZd6_secret_OuxmlTO7YOGOVWzXAFB2",
    "created": "2025-08-31T12:04:05.954Z",
    "currency": "USD",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_zBEXBJSHcgiiBihUBZd6/merchant_1756640756/pay_zBEXBJSHcgiiBihUBZd6_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "evoucher",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "created_at": 1756641845,
        "expires": 1756645445,
        "secret": "epk_47eacc344437434e97664bd6b3e2722a"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_MrgPu8NG45h4Ea7ah7kC",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mRMHa49InsH1tw9OQKXk",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-31T12:19:05.954Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-31T12:04:06.829Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"payUrl\":\"https://cluster05.api-test.cashtocode.com/paytoken/redirect?token=ODJkYzNkOTAtZDk3Mi00MWQ1LThlMjItNTMyYzM3ZmQyZDYw\"}",
    "enable_partial_authorization": null
}
```
</details>
Do a PSync.
<details>
<summary>PSync repsponse</summary>
```json
{
    "payment_id": "pay_zBEXBJSHcgiiBihUBZd6",
    "merchant_id": "merchant_1756640756",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_zBEXBJSHcgiiBihUBZd6_secret_OuxmlTO7YOGOVWzXAFB2",
    "created": "2025-08-31T12:04:05.954Z",
    "currency": "USD",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
            "status": "authentication_pending",
            "amount": 1000,
            "order_tax_amount": null,
            "currency": "USD",
            "connector": "cashtocode",
            "error_message": null,
            "payment_method": "reward",
            "connector_transaction_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-08-31T12:04:05.955Z",
            "modified_at": "2025-08-31T12:04:43.026Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "evoucher",
            "reference_id": null,
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null,
            "origin_zip": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_zBEXBJSHcgiiBihUBZd6/merchant_1756640756/pay_zBEXBJSHcgiiBihUBZd6_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "evoucher",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_zBEXBJSHcgiiBihUBZd6_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_MrgPu8NG45h4Ea7ah7kC",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mRMHa49InsH1tw9OQKXk",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-31T12:19:05.954Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-31T12:04:54.483Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<img width="1203" height="51" alt="Screenshot 2025-08-31 at 5 26 20 PM" src="https://github.com/user-attachments/assets/62cc23de-bcf9-4b65-bb32-df7776c92556" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9116 | 
	Bug: Connector changes for 3ds in v2
In v2, the `PreProcessing` and `CompleteAuthorize` flows will not be present.
We will introduce new flows `PreAuthenticate`, `Authenticate` and `PostAuthenticate` to better represent the domain. | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
index 0a1061e2c15..6b610c32912 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
@@ -21,21 +21,22 @@ use hyperswitch_domain_models::{
             PaymentMethodToken, Session, SetupMandate, Void,
         },
         refunds::{Execute, RSync},
-        PreProcessing,
+        Authenticate, PostAuthenticate, PreAuthenticate, PreProcessing,
     },
     router_request_types::{
         AccessTokenRequestData, CompleteAuthorizeData, MandateRevokeRequestData,
-        PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCaptureData, PaymentsIncrementalAuthorizationData, PaymentsPreProcessingData,
+        PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
+        PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsPreProcessingData,
         PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,
     },
     router_response_types::{MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData},
     types::{
-        MandateRevokeRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,
-        PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,
-        PaymentsIncrementalAuthorizationRouterData, PaymentsPreProcessingRouterData,
-        PaymentsSyncRouterData, RefundExecuteRouterData, RefundSyncRouterData,
-        SetupMandateRouterData,
+        MandateRevokeRouterData, PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData,
+        PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,
+        PaymentsIncrementalAuthorizationRouterData, PaymentsPostAuthenticateRouterData,
+        PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,
+        RefundExecuteRouterData, RefundSyncRouterData, SetupMandateRouterData,
     },
 };
 #[cfg(feature = "payouts")]
@@ -58,8 +59,9 @@ use hyperswitch_interfaces::{
     errors,
     events::connector_api_logs::ConnectorEvent,
     types::{
-        IncrementalAuthorizationType, MandateRevokeType, PaymentsAuthorizeType,
-        PaymentsCaptureType, PaymentsCompleteAuthorizeType, PaymentsPreProcessingType,
+        IncrementalAuthorizationType, MandateRevokeType, PaymentsAuthenticateType,
+        PaymentsAuthorizeType, PaymentsCaptureType, PaymentsCompleteAuthorizeType,
+        PaymentsPostAuthenticateType, PaymentsPreAuthenticateType, PaymentsPreProcessingType,
         PaymentsSyncType, PaymentsVoidType, RefundExecuteType, RefundSyncType, Response,
         SetupMandateType,
     },
@@ -393,6 +395,9 @@ where
 }
 
 impl api::Payment for Cybersource {}
+impl api::PaymentsPreAuthenticate for Cybersource {}
+impl api::PaymentsPostAuthenticate for Cybersource {}
+impl api::PaymentsAuthenticate for Cybersource {}
 impl api::PaymentAuthorize for Cybersource {}
 impl api::PaymentSync for Cybersource {}
 impl api::PaymentVoid for Cybersource {}
@@ -732,6 +737,292 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
     }
 }
 
+impl ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>
+    for Cybersource
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsPreAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+    fn get_url(
+        &self,
+        _req: &PaymentsPreAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!(
+            "{}risk/v1/authentication-setups",
+            ConnectorCommon::base_url(self, connectors)
+        ))
+    }
+    fn get_request_body(
+        &self,
+        req: &PaymentsPreAuthenticateRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let minor_amount =
+            req.request
+                .minor_amount
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "minor_amount",
+                })?;
+        let currency =
+            req.request
+                .currency
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                })?;
+
+        let amount = convert_amount(self.amount_converter, minor_amount, currency)?;
+
+        let connector_router_data = cybersource::CybersourceRouterData::from((amount, req));
+        let connector_req =
+            cybersource::CybersourceAuthSetupRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+    fn build_request(
+        &self,
+        req: &PaymentsPreAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        let request = RequestBuilder::new()
+            .method(Method::Post)
+            .url(&PaymentsPreAuthenticateType::get_url(
+                self, req, connectors,
+            )?)
+            .attach_default_headers()
+            .headers(PaymentsPreAuthenticateType::get_headers(
+                self, req, connectors,
+            )?)
+            .set_body(self.get_request_body(req, connectors)?)
+            .build();
+
+        Ok(Some(request))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsPreAuthenticateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsPreAuthenticateRouterData, errors::ConnectorError> {
+        let response: cybersource::CybersourceAuthSetupResponse = res
+            .response
+            .parse_struct("Cybersource AuthSetupResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl ConnectorIntegration<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>
+    for Cybersource
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+    fn get_url(
+        &self,
+        _req: &PaymentsAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!(
+            "{}risk/v1/authentications",
+            self.base_url(connectors)
+        ))
+    }
+    fn get_request_body(
+        &self,
+        req: &PaymentsAuthenticateRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let minor_amount =
+            req.request
+                .minor_amount
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "minor_amount",
+                })?;
+        let currency =
+            req.request
+                .currency
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                })?;
+        let amount = convert_amount(self.amount_converter, minor_amount, currency)?;
+        let connector_router_data = cybersource::CybersourceRouterData::from((amount, req));
+        let connector_req =
+            cybersource::CybersourceAuthEnrollmentRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+    fn build_request(
+        &self,
+        req: &PaymentsAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&PaymentsAuthenticateType::get_url(self, req, connectors)?)
+                .attach_default_headers()
+                .headers(PaymentsAuthenticateType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(PaymentsAuthenticateType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsAuthenticateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsAuthenticateRouterData, errors::ConnectorError> {
+        let response: cybersource::CybersourceAuthenticateResponse = res
+            .response
+            .parse_struct("Cybersource AuthEnrollmentResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>
+    for Cybersource
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsPostAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+    fn get_url(
+        &self,
+        _req: &PaymentsPostAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!(
+            "{}risk/v1/authentication-results",
+            self.base_url(connectors)
+        ))
+    }
+    fn get_request_body(
+        &self,
+        req: &PaymentsPostAuthenticateRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let minor_amount =
+            req.request
+                .minor_amount
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "minor_amount",
+                })?;
+        let currency =
+            req.request
+                .currency
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                })?;
+        let amount = convert_amount(self.amount_converter, minor_amount, currency)?;
+        let connector_router_data = cybersource::CybersourceRouterData::from((amount, req));
+        let connector_req =
+            cybersource::CybersourceAuthValidateRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+    fn build_request(
+        &self,
+        req: &PaymentsPostAuthenticateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&PaymentsPostAuthenticateType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(PaymentsPostAuthenticateType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(PaymentsPostAuthenticateType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsPostAuthenticateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsPostAuthenticateRouterData, errors::ConnectorError> {
+        let response: cybersource::CybersourceAuthenticateResponse = res
+            .response
+            .parse_struct("Cybersource AuthEnrollmentResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
 impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Cybersource {
     fn get_headers(
         &self,
@@ -926,6 +1217,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Cyb
     }
 }
 
+#[cfg(feature = "v1")]
 impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Cybersource {
     fn get_headers(
         &self,
@@ -1090,6 +1382,129 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
     }
 }
 
+#[cfg(feature = "v2")]
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Cybersource {
+    fn get_headers(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!(
+            "{}pts/v2/payments/",
+            ConnectorCommon::base_url(self, connectors)
+        ))
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let amount = convert_amount(
+            self.amount_converter,
+            req.request.minor_amount,
+            req.request.currency,
+        )?;
+        let connector_router_data = cybersource::CybersourceRouterData::from((amount, req));
+        let connector_req =
+            cybersource::CybersourcePaymentsRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        let request = RequestBuilder::new()
+            .method(Method::Post)
+            .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?)
+            .attach_default_headers()
+            .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?)
+            .set_body(self.get_request_body(req, connectors)?)
+            .build();
+
+        Ok(Some(request))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsAuthorizeRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+        let response: cybersource::CybersourcePaymentsResponse = res
+            .response
+            .parse_struct("Cybersource PaymentResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+
+    fn get_5xx_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        let response: cybersource::CybersourceServerErrorResponse = res
+            .response
+            .parse_struct("CybersourceServerErrorResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|event| event.set_response_body(&response));
+        router_env::logger::info!(error_response=?response);
+
+        let attempt_status = match response.reason {
+            Some(reason) => match reason {
+                transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure),
+                transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None,
+            },
+            None => None,
+        };
+        Ok(ErrorResponse {
+            status_code: res.status_code,
+            reason: response.status.clone(),
+            code: response
+                .status
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+            message: response
+                .message
+                .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+            attempt_status,
+            connector_transaction_id: None,
+            network_advice_code: None,
+            network_decline_code: None,
+            network_error_message: None,
+            connector_metadata: None,
+        })
+    }
+}
+
 #[cfg(feature = "payouts")]
 impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for Cybersource {
     fn get_url(
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index e39bc64c3f6..0338eb44fd8 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -34,17 +34,20 @@ use hyperswitch_domain_models::{
         SetupMandate,
     },
     router_request_types::{
-        authentication::MessageExtensionAttribute, CompleteAuthorizeData, PaymentsAuthorizeData,
-        PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSyncData,
-        ResponseId, SetupMandateRequestData,
+        authentication::MessageExtensionAttribute, CompleteAuthorizeData, PaymentsAuthenticateData,
+        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,
+        PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsPreProcessingData,
+        PaymentsSyncData, ResponseId, SetupMandateRequestData,
     },
     router_response_types::{
         MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData,
     },
     types::{
-        PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
-        PaymentsCompleteAuthorizeRouterData, PaymentsIncrementalAuthorizationRouterData,
-        PaymentsPreProcessingRouterData, RefundsRouterData, SetupMandateRouterData,
+        PaymentsAuthenticateRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,
+        PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,
+        PaymentsIncrementalAuthorizationRouterData, PaymentsPostAuthenticateRouterData,
+        PaymentsPreAuthenticateRouterData, PaymentsPreProcessingRouterData, RefundsRouterData,
+        SetupMandateRouterData,
     },
 };
 use hyperswitch_interfaces::{api, errors};
@@ -725,6 +728,16 @@ pub struct BillTo {
     email: pii::Email,
 }
 
+impl From<&CybersourceRouterData<&PaymentsPreAuthenticateRouterData>>
+    for ClientReferenceInformation
+{
+    fn from(item: &CybersourceRouterData<&PaymentsPreAuthenticateRouterData>) -> Self {
+        Self {
+            code: Some(item.router_data.connector_request_reference_id.clone()),
+        }
+    }
+}
+
 impl From<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for ClientReferenceInformation {
     fn from(item: &CybersourceRouterData<&PaymentsAuthorizeRouterData>) -> Self {
         Self {
@@ -2653,6 +2666,77 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
     }
 }
 
+impl TryFrom<&CybersourceRouterData<&PaymentsPreAuthenticateRouterData>>
+    for CybersourceAuthSetupRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &CybersourceRouterData<&PaymentsPreAuthenticateRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let payment_method_data = item
+            .router_data
+            .request
+            .payment_method_data
+            .as_ref()
+            .ok_or(errors::ConnectorError::MissingRequiredField {
+                field_name: "payment_method_data",
+            })?;
+
+        match payment_method_data.clone() {
+            PaymentMethodData::Card(ccard) => {
+                let card_type = match ccard
+                    .card_network
+                    .clone()
+                    .and_then(get_cybersource_card_type)
+                {
+                    Some(card_network) => Some(card_network.to_string()),
+                    None => ccard.get_card_issuer().ok().map(String::from),
+                };
+
+                let payment_information =
+                    PaymentInformation::Cards(Box::new(CardPaymentInformation {
+                        card: Card {
+                            number: ccard.card_number,
+                            expiration_month: ccard.card_exp_month,
+                            expiration_year: ccard.card_exp_year,
+                            security_code: Some(ccard.card_cvc),
+                            card_type,
+                            type_selection_indicator: Some("1".to_owned()),
+                        },
+                    }));
+                let client_reference_information = ClientReferenceInformation::from(item);
+                Ok(Self {
+                    payment_information,
+                    client_reference_information,
+                })
+            }
+            PaymentMethodData::Wallet(_)
+            | PaymentMethodData::CardRedirect(_)
+            | PaymentMethodData::PayLater(_)
+            | PaymentMethodData::BankRedirect(_)
+            | PaymentMethodData::BankDebit(_)
+            | PaymentMethodData::BankTransfer(_)
+            | PaymentMethodData::Crypto(_)
+            | PaymentMethodData::MandatePayment
+            | PaymentMethodData::Reward
+            | PaymentMethodData::RealTimePayment(_)
+            | PaymentMethodData::MobilePayment(_)
+            | PaymentMethodData::Upi(_)
+            | PaymentMethodData::Voucher(_)
+            | PaymentMethodData::GiftCard(_)
+            | PaymentMethodData::OpenBanking(_)
+            | PaymentMethodData::CardToken(_)
+            | PaymentMethodData::NetworkToken(_)
+            | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
+                Err(errors::ConnectorError::NotImplemented(
+                    utils::get_unimplemented_payment_method_error_message("Cybersource"),
+                )
+                .into())
+            }
+        }
+    }
+}
+
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct CybersourcePaymentsCaptureRequest {
@@ -3416,20 +3500,45 @@ impl TryFrom<&CybersourceRouterData<&PaymentsPreProcessingRouterData>>
     }
 }
 
-impl TryFrom<&CybersourceRouterData<&PaymentsCompleteAuthorizeRouterData>>
-    for CybersourcePaymentsRequest
+impl TryFrom<&CybersourceRouterData<&PaymentsAuthenticateRouterData>>
+    for CybersourceAuthEnrollmentRequest
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: &CybersourceRouterData<&PaymentsCompleteAuthorizeRouterData>,
+        item: &CybersourceRouterData<&PaymentsAuthenticateRouterData>,
     ) -> Result<Self, Self::Error> {
+        let client_reference_information = ClientReferenceInformation {
+            code: Some(item.router_data.connector_request_reference_id.clone()),
+        };
         let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or(
-            errors::ConnectorError::MissingRequiredField {
+            errors::ConnectorError::MissingConnectorRedirectionPayload {
                 field_name: "payment_method_data",
             },
         )?;
-        match payment_method_data {
-            PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
+        let payment_information = match payment_method_data {
+            PaymentMethodData::Card(ccard) => {
+                let card_type = match ccard
+                    .card_network
+                    .clone()
+                    .and_then(get_cybersource_card_type)
+                {
+                    Some(card_network) => Some(card_network.to_string()),
+                    None => ccard.get_card_issuer().ok().map(String::from),
+                };
+
+                Ok(PaymentInformation::Cards(Box::new(
+                    CardPaymentInformation {
+                        card: Card {
+                            number: ccard.card_number,
+                            expiration_month: ccard.card_exp_month,
+                            expiration_year: ccard.card_exp_year,
+                            security_code: Some(ccard.card_cvc),
+                            card_type,
+                            type_selection_indicator: Some("1".to_owned()),
+                        },
+                    },
+                )))
+            }
             PaymentMethodData::Wallet(_)
             | PaymentMethodData::CardRedirect(_)
             | PaymentMethodData::PayLater(_)
@@ -3450,113 +3559,316 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCompleteAuthorizeRouterData>>
             | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
                 Err(errors::ConnectorError::NotImplemented(
                     utils::get_unimplemented_payment_method_error_message("Cybersource"),
-                )
-                .into())
+                ))
             }
-        }
-    }
-}
-
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
-pub enum CybersourceAuthEnrollmentStatus {
-    PendingAuthentication,
-    AuthenticationSuccessful,
-    AuthenticationFailed,
-}
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CybersourceConsumerAuthValidateResponse {
-    ucaf_collection_indicator: Option<String>,
-    cavv: Option<Secret<String>>,
-    ucaf_authentication_data: Option<Secret<String>>,
-    xid: Option<String>,
-    specification_version: Option<SemanticVersion>,
-    directory_server_transaction_id: Option<Secret<String>>,
-    indicator: Option<String>,
-}
-
-#[derive(Debug, Deserialize, Serialize)]
-pub struct CybersourceThreeDSMetadata {
-    three_ds_data: CybersourceConsumerAuthValidateResponse,
-}
+        }?;
 
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CybersourceConsumerAuthInformationEnrollmentResponse {
-    access_token: Option<Secret<String>>,
-    step_up_url: Option<String>,
-    //Added to segregate the three_ds_data in a separate struct
-    #[serde(flatten)]
-    validate_response: CybersourceConsumerAuthValidateResponse,
-}
+        let redirect_response = item.router_data.request.redirect_response.clone().ok_or(
+            errors::ConnectorError::MissingRequiredField {
+                field_name: "redirect_response",
+            },
+        )?;
 
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ClientAuthCheckInfoResponse {
-    id: String,
-    client_reference_information: ClientReferenceInformation,
-    consumer_authentication_information: CybersourceConsumerAuthInformationEnrollmentResponse,
-    status: CybersourceAuthEnrollmentStatus,
-    error_information: Option<CybersourceErrorInformation>,
-}
+        let amount_details = Amount {
+            total_amount: item.amount.clone(),
+            currency: item.router_data.request.currency.ok_or(
+                errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                },
+            )?,
+        };
 
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum CybersourcePreProcessingResponse {
-    ClientAuthCheckInfo(Box<ClientAuthCheckInfoResponse>),
-    ErrorInformation(Box<CybersourceErrorInformationResponse>),
-}
+        let param = redirect_response.params.ok_or(
+            errors::ConnectorError::MissingConnectorRedirectionPayload {
+                field_name: "request.redirect_response.params",
+            },
+        )?;
 
-impl From<CybersourceAuthEnrollmentStatus> for enums::AttemptStatus {
-    fn from(item: CybersourceAuthEnrollmentStatus) -> Self {
-        match item {
-            CybersourceAuthEnrollmentStatus::PendingAuthentication => Self::AuthenticationPending,
-            CybersourceAuthEnrollmentStatus::AuthenticationSuccessful => {
-                Self::AuthenticationSuccessful
-            }
-            CybersourceAuthEnrollmentStatus::AuthenticationFailed => Self::AuthenticationFailed,
-        }
+        let reference_id = param
+            .clone()
+            .peek()
+            .split('=')
+            .next_back()
+            .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {
+                field_name: "request.redirect_response.params.reference_id",
+            })?
+            .to_string();
+        let email = item.router_data.get_billing_email().or(item
+            .router_data
+            .request
+            .email
+            .clone()
+            .ok_or_else(utils::missing_field_err("email")))?;
+        let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
+        let order_information = OrderInformationWithBill {
+            amount_details,
+            bill_to: Some(bill_to),
+        };
+        Ok(Self {
+            payment_information,
+            client_reference_information,
+            consumer_authentication_information: CybersourceConsumerAuthInformationRequest {
+                return_url: item
+                    .router_data
+                    .request
+                    .complete_authorize_url
+                    .clone()
+                    .ok_or_else(utils::missing_field_err("complete_authorize_url"))?,
+                reference_id,
+            },
+            order_information,
+        })
     }
 }
 
-impl<F>
-    TryFrom<
-        ResponseRouterData<
-            F,
-            CybersourcePreProcessingResponse,
-            PaymentsPreProcessingData,
-            PaymentsResponseData,
-        >,
-    > for RouterData<F, PaymentsPreProcessingData, PaymentsResponseData>
+impl TryFrom<&CybersourceRouterData<&PaymentsPostAuthenticateRouterData>>
+    for CybersourceAuthValidateRequest
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: ResponseRouterData<
-            F,
-            CybersourcePreProcessingResponse,
-            PaymentsPreProcessingData,
-            PaymentsResponseData,
-        >,
+        item: &CybersourceRouterData<&PaymentsPostAuthenticateRouterData>,
     ) -> Result<Self, Self::Error> {
-        match item.response {
-            CybersourcePreProcessingResponse::ClientAuthCheckInfo(info_response) => {
-                let status = enums::AttemptStatus::from(info_response.status);
-                let risk_info: Option<ClientRiskInformation> = None;
-                if utils::is_payment_failure(status) {
-                    let response = Err(get_error_response(
-                        &info_response.error_information,
-                        &None,
-                        &risk_info,
-                        Some(status),
-                        item.http_code,
-                        info_response.id.clone(),
-                    ));
+        let client_reference_information = ClientReferenceInformation {
+            code: Some(item.router_data.connector_request_reference_id.clone()),
+        };
+        let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or(
+            errors::ConnectorError::MissingConnectorRedirectionPayload {
+                field_name: "payment_method_data",
+            },
+        )?;
+        let payment_information = match payment_method_data {
+            PaymentMethodData::Card(ccard) => {
+                let card_type = match ccard
+                    .card_network
+                    .clone()
+                    .and_then(get_cybersource_card_type)
+                {
+                    Some(card_network) => Some(card_network.to_string()),
+                    None => ccard.get_card_issuer().ok().map(String::from),
+                };
 
-                    Ok(Self {
-                        status,
-                        response,
-                        ..item.data
+                Ok(PaymentInformation::Cards(Box::new(
+                    CardPaymentInformation {
+                        card: Card {
+                            number: ccard.card_number,
+                            expiration_month: ccard.card_exp_month,
+                            expiration_year: ccard.card_exp_year,
+                            security_code: Some(ccard.card_cvc),
+                            card_type,
+                            type_selection_indicator: Some("1".to_owned()),
+                        },
+                    },
+                )))
+            }
+            PaymentMethodData::Wallet(_)
+            | PaymentMethodData::CardRedirect(_)
+            | PaymentMethodData::PayLater(_)
+            | PaymentMethodData::BankRedirect(_)
+            | PaymentMethodData::BankDebit(_)
+            | PaymentMethodData::BankTransfer(_)
+            | PaymentMethodData::Crypto(_)
+            | PaymentMethodData::MandatePayment
+            | PaymentMethodData::Reward
+            | PaymentMethodData::RealTimePayment(_)
+            | PaymentMethodData::MobilePayment(_)
+            | PaymentMethodData::Upi(_)
+            | PaymentMethodData::Voucher(_)
+            | PaymentMethodData::GiftCard(_)
+            | PaymentMethodData::OpenBanking(_)
+            | PaymentMethodData::CardToken(_)
+            | PaymentMethodData::NetworkToken(_)
+            | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
+                Err(errors::ConnectorError::NotImplemented(
+                    utils::get_unimplemented_payment_method_error_message("Cybersource"),
+                ))
+            }
+        }?;
+
+        let redirect_response = item.router_data.request.redirect_response.clone().ok_or(
+            errors::ConnectorError::MissingRequiredField {
+                field_name: "redirect_response",
+            },
+        )?;
+
+        let amount_details = Amount {
+            total_amount: item.amount.clone(),
+            currency: item.router_data.request.currency.ok_or(
+                errors::ConnectorError::MissingRequiredField {
+                    field_name: "currency",
+                },
+            )?,
+        };
+
+        let redirect_payload: CybersourceRedirectionAuthResponse = redirect_response
+            .payload
+            .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {
+                field_name: "request.redirect_response.payload",
+            })?
+            .peek()
+            .clone()
+            .parse_value("CybersourceRedirectionAuthResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        let order_information = OrderInformation { amount_details };
+        Ok(Self {
+            payment_information,
+            client_reference_information,
+            consumer_authentication_information:
+                CybersourceConsumerAuthInformationValidateRequest {
+                    authentication_transaction_id: redirect_payload.transaction_id,
+                },
+            order_information,
+        })
+    }
+}
+
+impl TryFrom<&CybersourceRouterData<&PaymentsCompleteAuthorizeRouterData>>
+    for CybersourcePaymentsRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &CybersourceRouterData<&PaymentsCompleteAuthorizeRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or(
+            errors::ConnectorError::MissingRequiredField {
+                field_name: "payment_method_data",
+            },
+        )?;
+        match payment_method_data {
+            PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
+            PaymentMethodData::Wallet(_)
+            | PaymentMethodData::CardRedirect(_)
+            | PaymentMethodData::PayLater(_)
+            | PaymentMethodData::BankRedirect(_)
+            | PaymentMethodData::BankDebit(_)
+            | PaymentMethodData::BankTransfer(_)
+            | PaymentMethodData::Crypto(_)
+            | PaymentMethodData::MandatePayment
+            | PaymentMethodData::Reward
+            | PaymentMethodData::RealTimePayment(_)
+            | PaymentMethodData::MobilePayment(_)
+            | PaymentMethodData::Upi(_)
+            | PaymentMethodData::Voucher(_)
+            | PaymentMethodData::GiftCard(_)
+            | PaymentMethodData::OpenBanking(_)
+            | PaymentMethodData::CardToken(_)
+            | PaymentMethodData::NetworkToken(_)
+            | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
+                Err(errors::ConnectorError::NotImplemented(
+                    utils::get_unimplemented_payment_method_error_message("Cybersource"),
+                )
+                .into())
+            }
+        }
+    }
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum CybersourceAuthEnrollmentStatus {
+    PendingAuthentication,
+    AuthenticationSuccessful,
+    AuthenticationFailed,
+}
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CybersourceConsumerAuthValidateResponse {
+    ucaf_collection_indicator: Option<String>,
+    cavv: Option<Secret<String>>,
+    ucaf_authentication_data: Option<Secret<String>>,
+    xid: Option<String>,
+    specification_version: Option<SemanticVersion>,
+    directory_server_transaction_id: Option<Secret<String>>,
+    indicator: Option<String>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+pub struct CybersourceThreeDSMetadata {
+    three_ds_data: CybersourceConsumerAuthValidateResponse,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CybersourceConsumerAuthInformationEnrollmentResponse {
+    access_token: Option<Secret<String>>,
+    step_up_url: Option<String>,
+    //Added to segregate the three_ds_data in a separate struct
+    #[serde(flatten)]
+    validate_response: CybersourceConsumerAuthValidateResponse,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientAuthCheckInfoResponse {
+    id: String,
+    client_reference_information: ClientReferenceInformation,
+    consumer_authentication_information: CybersourceConsumerAuthInformationEnrollmentResponse,
+    status: CybersourceAuthEnrollmentStatus,
+    error_information: Option<CybersourceErrorInformation>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum CybersourcePreProcessingResponse {
+    ClientAuthCheckInfo(Box<ClientAuthCheckInfoResponse>),
+    ErrorInformation(Box<CybersourceErrorInformationResponse>),
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum CybersourceAuthenticateResponse {
+    ClientAuthCheckInfo(Box<ClientAuthCheckInfoResponse>),
+    ErrorInformation(Box<CybersourceErrorInformationResponse>),
+}
+
+impl From<CybersourceAuthEnrollmentStatus> for enums::AttemptStatus {
+    fn from(item: CybersourceAuthEnrollmentStatus) -> Self {
+        match item {
+            CybersourceAuthEnrollmentStatus::PendingAuthentication => Self::AuthenticationPending,
+            CybersourceAuthEnrollmentStatus::AuthenticationSuccessful => {
+                Self::AuthenticationSuccessful
+            }
+            CybersourceAuthEnrollmentStatus::AuthenticationFailed => Self::AuthenticationFailed,
+        }
+    }
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            CybersourcePreProcessingResponse,
+            PaymentsPreProcessingData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsPreProcessingData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            CybersourcePreProcessingResponse,
+            PaymentsPreProcessingData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            CybersourcePreProcessingResponse::ClientAuthCheckInfo(info_response) => {
+                let status = enums::AttemptStatus::from(info_response.status);
+                let risk_info: Option<ClientRiskInformation> = None;
+                if utils::is_payment_failure(status) {
+                    let response = Err(get_error_response(
+                        &info_response.error_information,
+                        &None,
+                        &risk_info,
+                        Some(status),
+                        item.http_code,
+                        info_response.id.clone(),
+                    ));
+
+                    Ok(Self {
+                        status,
+                        response,
+                        ..item.data
                     })
                 } else {
                     let connector_response_reference_id = Some(
@@ -3924,6 +4236,362 @@ pub struct ApplicationInformation {
     status: Option<CybersourcePaymentStatus>,
 }
 
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            CybersourceAuthSetupResponse,
+            PaymentsPreAuthenticateData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsPreAuthenticateData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            CybersourceAuthSetupResponse,
+            PaymentsPreAuthenticateData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            CybersourceAuthSetupResponse::ClientAuthSetupInfo(info_response) => Ok(Self {
+                status: enums::AttemptStatus::AuthenticationPending,
+                response: Ok(PaymentsResponseData::TransactionResponse {
+                    resource_id: ResponseId::NoResponseId,
+                    redirection_data: Box::new(Some(RedirectForm::CybersourceAuthSetup {
+                        access_token: info_response
+                            .consumer_authentication_information
+                            .access_token,
+                        ddc_url: info_response
+                            .consumer_authentication_information
+                            .device_data_collection_url,
+                        reference_id: info_response
+                            .consumer_authentication_information
+                            .reference_id,
+                    })),
+                    mandate_reference: Box::new(None),
+                    connector_metadata: None,
+                    network_txn_id: None,
+                    connector_response_reference_id: Some(
+                        info_response
+                            .client_reference_information
+                            .code
+                            .unwrap_or(info_response.id.clone()),
+                    ),
+                    incremental_authorization_allowed: None,
+                    charges: None,
+                }),
+                ..item.data
+            }),
+            CybersourceAuthSetupResponse::ErrorInformation(error_response) => {
+                let detailed_error_info =
+                    error_response
+                        .error_information
+                        .details
+                        .to_owned()
+                        .map(|details| {
+                            details
+                                .iter()
+                                .map(|details| format!("{} : {}", details.field, details.reason))
+                                .collect::<Vec<_>>()
+                                .join(", ")
+                        });
+
+                let reason = get_error_reason(
+                    error_response.error_information.message,
+                    detailed_error_info,
+                    None,
+                );
+                let error_message = error_response.error_information.reason;
+                Ok(Self {
+                    response: Err(ErrorResponse {
+                        code: error_message
+                            .clone()
+                            .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+                        message: error_message.unwrap_or(
+                            hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string(),
+                        ),
+                        reason,
+                        status_code: item.http_code,
+                        attempt_status: None,
+                        connector_transaction_id: Some(error_response.id.clone()),
+                        network_advice_code: None,
+                        network_decline_code: None,
+                        network_error_message: None,
+                        connector_metadata: None,
+                    }),
+                    status: enums::AttemptStatus::AuthenticationFailed,
+                    ..item.data
+                })
+            }
+        }
+    }
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            CybersourceAuthenticateResponse,
+            PaymentsAuthenticateData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsAuthenticateData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            CybersourceAuthenticateResponse,
+            PaymentsAuthenticateData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            CybersourceAuthenticateResponse::ClientAuthCheckInfo(info_response) => {
+                let status = enums::AttemptStatus::from(info_response.status);
+                let risk_info: Option<ClientRiskInformation> = None;
+                if utils::is_payment_failure(status) {
+                    let response = Err(get_error_response(
+                        &info_response.error_information,
+                        &None,
+                        &risk_info,
+                        Some(status),
+                        item.http_code,
+                        info_response.id.clone(),
+                    ));
+
+                    Ok(Self {
+                        status,
+                        response,
+                        ..item.data
+                    })
+                } else {
+                    let connector_response_reference_id = Some(
+                        info_response
+                            .client_reference_information
+                            .code
+                            .unwrap_or(info_response.id.clone()),
+                    );
+
+                    let redirection_data = match (
+                        info_response
+                            .consumer_authentication_information
+                            .access_token,
+                        info_response
+                            .consumer_authentication_information
+                            .step_up_url,
+                    ) {
+                        (Some(token), Some(step_up_url)) => {
+                            Some(RedirectForm::CybersourceConsumerAuth {
+                                access_token: token.expose(),
+                                step_up_url,
+                            })
+                        }
+                        _ => None,
+                    };
+                    let three_ds_data = serde_json::to_value(
+                        info_response
+                            .consumer_authentication_information
+                            .validate_response,
+                    )
+                    .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
+                    Ok(Self {
+                        status,
+                        response: Ok(PaymentsResponseData::TransactionResponse {
+                            resource_id: ResponseId::NoResponseId,
+                            redirection_data: Box::new(redirection_data),
+                            mandate_reference: Box::new(None),
+                            connector_metadata: Some(serde_json::json!({
+                                "three_ds_data": three_ds_data
+                            })),
+                            network_txn_id: None,
+                            connector_response_reference_id,
+                            incremental_authorization_allowed: None,
+                            charges: None,
+                        }),
+                        ..item.data
+                    })
+                }
+            }
+            CybersourceAuthenticateResponse::ErrorInformation(error_response) => {
+                let detailed_error_info =
+                    error_response
+                        .error_information
+                        .details
+                        .to_owned()
+                        .map(|details| {
+                            details
+                                .iter()
+                                .map(|details| format!("{} : {}", details.field, details.reason))
+                                .collect::<Vec<_>>()
+                                .join(", ")
+                        });
+
+                let reason = get_error_reason(
+                    error_response.error_information.message,
+                    detailed_error_info,
+                    None,
+                );
+                let error_message = error_response.error_information.reason.to_owned();
+                let response = Err(ErrorResponse {
+                    code: error_message
+                        .clone()
+                        .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+                    message: error_message
+                        .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+                    reason,
+                    status_code: item.http_code,
+                    attempt_status: None,
+                    connector_transaction_id: Some(error_response.id.clone()),
+                    network_advice_code: None,
+                    network_decline_code: None,
+                    network_error_message: None,
+                    connector_metadata: None,
+                });
+                Ok(Self {
+                    response,
+                    status: enums::AttemptStatus::AuthenticationFailed,
+                    ..item.data
+                })
+            }
+        }
+    }
+}
+
+impl<F>
+    TryFrom<
+        ResponseRouterData<
+            F,
+            CybersourceAuthenticateResponse,
+            PaymentsPostAuthenticateData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<F, PaymentsPostAuthenticateData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            CybersourceAuthenticateResponse,
+            PaymentsPostAuthenticateData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        match item.response {
+            CybersourceAuthenticateResponse::ClientAuthCheckInfo(info_response) => {
+                let status = enums::AttemptStatus::from(info_response.status);
+                let risk_info: Option<ClientRiskInformation> = None;
+                if utils::is_payment_failure(status) {
+                    let response = Err(get_error_response(
+                        &info_response.error_information,
+                        &None,
+                        &risk_info,
+                        Some(status),
+                        item.http_code,
+                        info_response.id.clone(),
+                    ));
+
+                    Ok(Self {
+                        status,
+                        response,
+                        ..item.data
+                    })
+                } else {
+                    let connector_response_reference_id = Some(
+                        info_response
+                            .client_reference_information
+                            .code
+                            .unwrap_or(info_response.id.clone()),
+                    );
+
+                    let redirection_data = match (
+                        info_response
+                            .consumer_authentication_information
+                            .access_token,
+                        info_response
+                            .consumer_authentication_information
+                            .step_up_url,
+                    ) {
+                        (Some(token), Some(step_up_url)) => {
+                            Some(RedirectForm::CybersourceConsumerAuth {
+                                access_token: token.expose(),
+                                step_up_url,
+                            })
+                        }
+                        _ => None,
+                    };
+                    let three_ds_data = serde_json::to_value(
+                        info_response
+                            .consumer_authentication_information
+                            .validate_response,
+                    )
+                    .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
+                    Ok(Self {
+                        status,
+                        response: Ok(PaymentsResponseData::TransactionResponse {
+                            resource_id: ResponseId::NoResponseId,
+                            redirection_data: Box::new(redirection_data),
+                            mandate_reference: Box::new(None),
+                            connector_metadata: Some(serde_json::json!({
+                                "three_ds_data": three_ds_data
+                            })),
+                            network_txn_id: None,
+                            connector_response_reference_id,
+                            incremental_authorization_allowed: None,
+                            charges: None,
+                        }),
+                        ..item.data
+                    })
+                }
+            }
+            CybersourceAuthenticateResponse::ErrorInformation(error_response) => {
+                let detailed_error_info =
+                    error_response
+                        .error_information
+                        .details
+                        .to_owned()
+                        .map(|details| {
+                            details
+                                .iter()
+                                .map(|details| format!("{} : {}", details.field, details.reason))
+                                .collect::<Vec<_>>()
+                                .join(", ")
+                        });
+
+                let reason = get_error_reason(
+                    error_response.error_information.message,
+                    detailed_error_info,
+                    None,
+                );
+                let error_message = error_response.error_information.reason.to_owned();
+                let response = Err(ErrorResponse {
+                    code: error_message
+                        .clone()
+                        .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
+                    message: error_message
+                        .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
+                    reason,
+                    status_code: item.http_code,
+                    attempt_status: None,
+                    connector_transaction_id: Some(error_response.id.clone()),
+                    network_advice_code: None,
+                    network_decline_code: None,
+                    network_error_message: None,
+                    connector_metadata: None,
+                });
+                Ok(Self {
+                    response,
+                    status: enums::AttemptStatus::AuthenticationFailed,
+                    ..item.data
+                })
+            }
+        }
+    }
+}
+
 impl<F>
     TryFrom<
         ResponseRouterData<
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 8b87e0c098a..c9b0f8352d9 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -55,11 +55,13 @@ use hyperswitch_domain_models::{
         CompleteAuthorizeData, ConnectorCustomerData, CreateOrderRequestData,
         DefendDisputeRequestData, DisputeSyncData, ExternalVaultProxyPaymentsData,
         FetchDisputesRequestData, MandateRevokeRequestData, PaymentsApproveData,
-        PaymentsCancelPostCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreProcessingData,
-        PaymentsRejectData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,
-        RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SubmitEvidenceRequestData,
-        UploadFileRequestData, VaultRequestData, VerifyWebhookSourceRequestData,
+        PaymentsAuthenticateData, PaymentsCancelPostCaptureData,
+        PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
+        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
+        PaymentsPreProcessingData, PaymentsRejectData, PaymentsTaxCalculationData,
+        PaymentsUpdateMetadataData, RetrieveFileRequestData, SdkPaymentsSessionUpdateData,
+        SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,
+        VerifyWebhookSourceRequestData,
     },
     router_response_types::{
         AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,
@@ -120,7 +122,8 @@ use hyperswitch_interfaces::{
             ConnectorCustomer, ExternalVaultProxyPaymentsCreateV1, PaymentApprove,
             PaymentAuthorizeSessionToken, PaymentIncrementalAuthorization, PaymentPostCaptureVoid,
             PaymentPostSessionTokens, PaymentReject, PaymentSessionUpdate, PaymentUpdateMetadata,
-            PaymentsCompleteAuthorize, PaymentsCreateOrder, PaymentsPostProcessing,
+            PaymentsAuthenticate, PaymentsCompleteAuthorize, PaymentsCreateOrder,
+            PaymentsPostAuthenticate, PaymentsPostProcessing, PaymentsPreAuthenticate,
             PaymentsPreProcessing, TaxCalculation,
         },
         revenue_recovery::RevenueRecovery,
@@ -1648,6 +1651,432 @@ default_imp_for_connector_redirect_response!(
     connectors::CtpMastercard
 );
 
+macro_rules! default_imp_for_pre_authenticate_steps{
+    ($($path:ident::$connector:ident),*)=> {
+        $(
+            impl PaymentsPreAuthenticate for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            PreAuthenticate,
+            PaymentsPreAuthenticateData,
+            PaymentsResponseData,
+        > for $path::$connector
+        {}
+    )*
+    };
+}
+
+default_imp_for_pre_authenticate_steps!(
+    connectors::Aci,
+    connectors::Adyen,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Bluesnap,
+    connectors::Boku,
+    connectors::Braintree,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Chargebee,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Helcim,
+    connectors::Hipay,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Netcetera,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Paybox,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Paypal,
+    connectors::Paystack,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Phonepe,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Signifyd,
+    connectors::Silverflow,
+    connectors::Square,
+    connectors::Stax,
+    connectors::Stripe,
+    connectors::Stripebilling,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Vgs,
+    connectors::Volt,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
+
+macro_rules! default_imp_for_authenticate_steps{
+    ($($path:ident::$connector:ident),*)=> {
+        $(
+            impl PaymentsAuthenticate for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            Authenticate,
+            PaymentsAuthenticateData,
+            PaymentsResponseData,
+        > for $path::$connector
+        {}
+    )*
+    };
+}
+
+default_imp_for_authenticate_steps!(
+    connectors::Aci,
+    connectors::Adyen,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Bluesnap,
+    connectors::Boku,
+    connectors::Braintree,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Chargebee,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Helcim,
+    connectors::Hipay,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Netcetera,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Paybox,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Paypal,
+    connectors::Paystack,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Phonepe,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Signifyd,
+    connectors::Silverflow,
+    connectors::Square,
+    connectors::Stax,
+    connectors::Stripe,
+    connectors::Stripebilling,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Vgs,
+    connectors::Volt,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
+
+macro_rules! default_imp_for_post_authenticate_steps{
+    ($($path:ident::$connector:ident),*)=> {
+        $(
+            impl PaymentsPostAuthenticate for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            PostAuthenticate,
+            PaymentsPostAuthenticateData,
+            PaymentsResponseData,
+        > for $path::$connector
+        {}
+    )*
+    };
+}
+
+default_imp_for_post_authenticate_steps!(
+    connectors::Aci,
+    connectors::Adyen,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Bluesnap,
+    connectors::Boku,
+    connectors::Braintree,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Chargebee,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Helcim,
+    connectors::Hipay,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Netcetera,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Paybox,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Paypal,
+    connectors::Paystack,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Phonepe,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Signifyd,
+    connectors::Silverflow,
+    connectors::Square,
+    connectors::Stax,
+    connectors::Stripe,
+    connectors::Stripebilling,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Vgs,
+    connectors::Volt,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
+
 macro_rules! default_imp_for_pre_processing_steps{
     ($($path:ident::$connector:ident),*)=> {
         $(
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index a9a842dcfd5..475f9499282 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -585,6 +585,123 @@ impl TryFrom<PaymentsAuthorizeData> for PaymentsPreProcessingData {
     }
 }
 
+#[derive(Debug, Clone)]
+pub struct PaymentsPreAuthenticateData {
+    pub payment_method_data: Option<PaymentMethodData>,
+    pub amount: Option<i64>,
+    pub email: Option<pii::Email>,
+    pub currency: Option<storage_enums::Currency>,
+    pub payment_method_type: Option<storage_enums::PaymentMethodType>,
+    pub router_return_url: Option<String>,
+    pub complete_authorize_url: Option<String>,
+    pub browser_info: Option<BrowserInformation>,
+    pub connector_transaction_id: Option<String>,
+    pub enrolled_for_3ds: bool,
+    pub redirect_response: Option<CompleteAuthorizeRedirectResponse>,
+
+    // New amount for amount frame work
+    pub minor_amount: Option<MinorUnit>,
+}
+
+impl TryFrom<PaymentsAuthorizeData> for PaymentsPreAuthenticateData {
+    type Error = error_stack::Report<ApiErrorResponse>;
+
+    fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> {
+        Ok(Self {
+            payment_method_data: Some(data.payment_method_data),
+            amount: Some(data.amount),
+            minor_amount: Some(data.minor_amount),
+            email: data.email,
+            currency: Some(data.currency),
+            payment_method_type: data.payment_method_type,
+            router_return_url: data.router_return_url,
+            complete_authorize_url: data.complete_authorize_url,
+            browser_info: data.browser_info,
+            connector_transaction_id: None,
+            redirect_response: None,
+            enrolled_for_3ds: data.enrolled_for_3ds,
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+pub struct PaymentsAuthenticateData {
+    pub payment_method_data: Option<PaymentMethodData>,
+    pub amount: Option<i64>,
+    pub email: Option<pii::Email>,
+    pub currency: Option<storage_enums::Currency>,
+    pub payment_method_type: Option<storage_enums::PaymentMethodType>,
+    pub router_return_url: Option<String>,
+    pub complete_authorize_url: Option<String>,
+    pub browser_info: Option<BrowserInformation>,
+    pub connector_transaction_id: Option<String>,
+    pub enrolled_for_3ds: bool,
+    pub redirect_response: Option<CompleteAuthorizeRedirectResponse>,
+
+    // New amount for amount frame work
+    pub minor_amount: Option<MinorUnit>,
+}
+
+impl TryFrom<PaymentsAuthorizeData> for PaymentsAuthenticateData {
+    type Error = error_stack::Report<ApiErrorResponse>;
+
+    fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> {
+        Ok(Self {
+            payment_method_data: Some(data.payment_method_data),
+            amount: Some(data.amount),
+            minor_amount: Some(data.minor_amount),
+            email: data.email,
+            currency: Some(data.currency),
+            payment_method_type: data.payment_method_type,
+            router_return_url: data.router_return_url,
+            complete_authorize_url: data.complete_authorize_url,
+            browser_info: data.browser_info,
+            connector_transaction_id: None,
+            redirect_response: None,
+            enrolled_for_3ds: data.enrolled_for_3ds,
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+pub struct PaymentsPostAuthenticateData {
+    pub payment_method_data: Option<PaymentMethodData>,
+    pub amount: Option<i64>,
+    pub email: Option<pii::Email>,
+    pub currency: Option<storage_enums::Currency>,
+    pub payment_method_type: Option<storage_enums::PaymentMethodType>,
+    pub router_return_url: Option<String>,
+    pub complete_authorize_url: Option<String>,
+    pub browser_info: Option<BrowserInformation>,
+    pub connector_transaction_id: Option<String>,
+    pub enrolled_for_3ds: bool,
+    pub redirect_response: Option<CompleteAuthorizeRedirectResponse>,
+
+    // New amount for amount frame work
+    pub minor_amount: Option<MinorUnit>,
+}
+
+impl TryFrom<PaymentsAuthorizeData> for PaymentsPostAuthenticateData {
+    type Error = error_stack::Report<ApiErrorResponse>;
+
+    fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> {
+        Ok(Self {
+            payment_method_data: Some(data.payment_method_data),
+            amount: Some(data.amount),
+            minor_amount: Some(data.minor_amount),
+            email: data.email,
+            currency: Some(data.currency),
+            payment_method_type: data.payment_method_type,
+            router_return_url: data.router_return_url,
+            complete_authorize_url: data.complete_authorize_url,
+            browser_info: data.browser_info,
+            connector_transaction_id: None,
+            redirect_response: None,
+            enrolled_for_3ds: data.enrolled_for_3ds,
+        })
+    }
+}
+
 impl TryFrom<CompleteAuthorizeData> for PaymentsPreProcessingData {
     type Error = error_stack::Report<ApiErrorResponse>;
 
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index bcca0ba12a9..a134befa55f 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -25,8 +25,9 @@ use crate::{
         AccessTokenAuthenticationRequestData, AccessTokenRequestData, AuthorizeSessionTokenData,
         CompleteAuthorizeData, ConnectorCustomerData, CreateOrderRequestData,
         ExternalVaultProxyPaymentsData, MandateRevokeRequestData, PaymentMethodTokenizationData,
-        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,
-        PaymentsCaptureData, PaymentsIncrementalAuthorizationData, PaymentsPostSessionTokensData,
+        PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
+        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
+        PaymentsPostAuthenticateData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
         PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,
         PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,
         SdkPaymentsSessionUpdateData, SetupMandateRequestData, VaultRequestData,
@@ -52,6 +53,12 @@ pub type PaymentsAuthorizeSessionTokenRouterData =
     RouterData<AuthorizeSessionToken, AuthorizeSessionTokenData, PaymentsResponseData>;
 pub type PaymentsPreProcessingRouterData =
     RouterData<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;
+pub type PaymentsPreAuthenticateRouterData =
+    RouterData<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>;
+pub type PaymentsAuthenticateRouterData =
+    RouterData<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>;
+pub type PaymentsPostAuthenticateRouterData =
+    RouterData<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>;
 pub type PaymentsSyncRouterData = RouterData<PSync, PaymentsSyncData, PaymentsResponseData>;
 pub type PaymentsCaptureRouterData = RouterData<Capture, PaymentsCaptureData, PaymentsResponseData>;
 pub type PaymentsCancelRouterData = RouterData<Void, PaymentsCancelData, PaymentsResponseData>;
diff --git a/crates/hyperswitch_interfaces/src/api/payments.rs b/crates/hyperswitch_interfaces/src/api/payments.rs
index b901f28a197..f4aa421240b 100644
--- a/crates/hyperswitch_interfaces/src/api/payments.rs
+++ b/crates/hyperswitch_interfaces/src/api/payments.rs
@@ -8,15 +8,16 @@ use hyperswitch_domain_models::{
             PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, Reject,
             SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
         },
-        CreateOrder, ExternalVaultProxy,
+        Authenticate, CreateOrder, ExternalVaultProxy, PostAuthenticate, PreAuthenticate,
     },
     router_request_types::{
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
         CreateOrderRequestData, ExternalVaultProxyPaymentsData, PaymentMethodTokenizationData,
-        PaymentsApproveData, PaymentsAuthorizeData, PaymentsCancelData,
+        PaymentsApproveData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
         PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreProcessingData,
-        PaymentsRejectData, PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
+        PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,
+        PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,
+        PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
         PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
     },
     router_response_types::{PaymentsResponseData, TaxCalculationResponseData},
@@ -171,6 +172,24 @@ pub trait PaymentsPreProcessing:
 {
 }
 
+/// trait PaymentsPreAuthenticate
+pub trait PaymentsPreAuthenticate:
+    api::ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>
+{
+}
+
+/// trait PaymentsAuthenticate
+pub trait PaymentsAuthenticate:
+    api::ConnectorIntegration<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>
+{
+}
+
+/// trait PaymentsPostAuthenticate
+pub trait PaymentsPostAuthenticate:
+    api::ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>
+{
+}
+
 /// trait PaymentsPostProcessing
 pub trait PaymentsPostProcessing:
     api::ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>
diff --git a/crates/hyperswitch_interfaces/src/api/payments_v2.rs b/crates/hyperswitch_interfaces/src/api/payments_v2.rs
index ea4b6428c3b..88c3e39ca40 100644
--- a/crates/hyperswitch_interfaces/src/api/payments_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/payments_v2.rs
@@ -2,19 +2,23 @@
 
 use hyperswitch_domain_models::{
     router_data_v2::PaymentFlowData,
-    router_flow_types::payments::{
-        Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,
-        CreateConnectorCustomer, CreateOrder, ExternalVaultProxy, IncrementalAuthorization, PSync,
-        PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing,
-        Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
+    router_flow_types::{
+        payments::{
+            Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,
+            CreateConnectorCustomer, CreateOrder, ExternalVaultProxy, IncrementalAuthorization,
+            PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens,
+            PreProcessing, Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
+        },
+        Authenticate, PostAuthenticate, PreAuthenticate,
     },
     router_request_types::{
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
         CreateOrderRequestData, ExternalVaultProxyPaymentsData, PaymentMethodTokenizationData,
-        PaymentsApproveData, PaymentsAuthorizeData, PaymentsCancelData,
+        PaymentsApproveData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
         PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreProcessingData,
-        PaymentsRejectData, PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
+        PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,
+        PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,
+        PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
         PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
     },
     router_response_types::{PaymentsResponseData, TaxCalculationResponseData},
@@ -199,6 +203,39 @@ pub trait PaymentsPreProcessingV2:
 {
 }
 
+/// trait PaymentsPreAuthenticateV2
+pub trait PaymentsPreAuthenticateV2:
+    ConnectorIntegrationV2<
+    PreAuthenticate,
+    PaymentFlowData,
+    PaymentsPreAuthenticateData,
+    PaymentsResponseData,
+>
+{
+}
+
+/// trait PaymentsAuthenticateV2
+pub trait PaymentsAuthenticateV2:
+    ConnectorIntegrationV2<
+    Authenticate,
+    PaymentFlowData,
+    PaymentsAuthenticateData,
+    PaymentsResponseData,
+>
+{
+}
+
+/// trait PaymentsPostAuthenticateV2
+pub trait PaymentsPostAuthenticateV2:
+    ConnectorIntegrationV2<
+    PostAuthenticate,
+    PaymentFlowData,
+    PaymentsPostAuthenticateData,
+    PaymentsResponseData,
+>
+{
+}
+
 /// trait PaymentsPostProcessingV2
 pub trait PaymentsPostProcessingV2:
     ConnectorIntegrationV2<
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index eed89fe00ba..01c1a1c82ba 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -40,9 +40,10 @@ use hyperswitch_domain_models::{
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
         CreateOrderRequestData, DefendDisputeRequestData, DisputeSyncData,
         FetchDisputesRequestData, MandateRevokeRequestData, PaymentMethodTokenizationData,
-        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,
-        PaymentsCaptureData, PaymentsIncrementalAuthorizationData, PaymentsPostProcessingData,
-        PaymentsPostSessionTokensData, PaymentsPreProcessingData, PaymentsSessionData,
+        PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
+        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
+        PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,
+        PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,
         PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,
         RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
         SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,
@@ -111,6 +112,19 @@ pub type CreateOrderType =
 /// Type alias for `ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>`
 pub type PaymentsPreProcessingType =
     dyn ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;
+
+/// Type alias for `ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>`
+pub type PaymentsPreAuthenticateType =
+    dyn ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>;
+
+/// Type alias for `ConnectorIntegration<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>`
+pub type PaymentsAuthenticateType =
+    dyn ConnectorIntegration<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>;
+
+/// Type alias for `ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>`
+pub type PaymentsPostAuthenticateType =
+    dyn ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>;
+
 /// Type alias for `ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>`
 pub type PaymentsPostProcessingType =
     dyn ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>;
 | 
	2025-08-31T00:39:56Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Add `PreAuthenticate`, `Authenticate` and `PostAuthenticate` connector integration and implement them for cybersource
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9116 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
This PR only adds the code changes without actually wiring them to APIs, so it can't be tested as is. A separate PR will add new endpoints that use these flows, they will be tested there.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8ce36a2fd513034755a1bf1aacbd3210083e07c9 | 
	
This PR only adds the code changes without actually wiring them to APIs, so it can't be tested as is. A separate PR will add new endpoints that use these flows, they will be tested there.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9092 | 
	Bug: Remove delete_merchant call from DE
 | 
	diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 7d625a78396..3e41150e05a 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1220,25 +1220,6 @@ pub async fn merchant_account_delete(
         is_deleted = is_merchant_account_deleted && is_merchant_key_store_deleted;
     }
 
-    // Call to DE here
-    #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
-    {
-        if state.conf.open_router.dynamic_routing_enabled && is_deleted {
-            merchant_account
-                .default_profile
-                .as_ref()
-                .async_map(|profile_id| {
-                    routing::helpers::delete_decision_engine_merchant(&state, profile_id)
-                })
-                .await
-                .transpose()
-                .map_err(|err| {
-                    logger::error!("Failed to delete merchant in Decision Engine {err:?}");
-                })
-                .ok();
-        }
-    }
-
     let state = state.clone();
     authentication::decision::spawn_tracked_job(
         async move {
 | 
	2025-08-28T08:21:26Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
When deleting a merchant account, the code previously included a direct call to the **Decision Engine (DE)** to remove the merchant configuration (`delete_decision_engine_merchant`). This was gated behind the `dynamic_routing` and `v1` feature flags and executed synchronously within the merchant deletion flow.
#### **Change**
* **Removed** the in-place DE cleanup logic inside `merchant_account_delete`.
* Merchant deletion in the Decision Engine will now be handled separately instead of being triggered inline.
#### **Impact**
* Merchant deletion continues to work as expected.
* Decision Engine merchant cleanup is no longer triggered directly during merchant deletion.
* Any required DE sync/cleanup should be handled through  explicit decision engine flows.
## How did you test it?
**Curls and Responses**
merchant_create
```
curl --location 'http://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
  "merchant_id": "merchant_1756372072",
  "locker_id": "m0010",
  "merchant_name": "NewAge Retailer",
  "merchant_details": {
    "primary_contact_person": "John Test",
    "primary_email": "JohnTest@test.com",
    "primary_phone": "sunt laborum",
    "secondary_contact_person": "John Test2",
    "secondary_email": "JohnTest2@test.com",
    "secondary_phone": "cillum do dolor id",
    "website": "https://www.example.com",
    "about_business": "Online Retail with a wide selection of organic products for North America",
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name":"john",
      "last_name":"Doe"
    }
  },
  "return_url": "https://google.com/success",
  "webhook_details": {
    "webhook_version": "1.0.1",
    "webhook_username": "ekart_retail",
    "webhook_password": "password_ekart@123",
    "webhook_url":"https://webhook.site",
    "payment_created_enabled": true,
    "payment_succeeded_enabled": true,
    "payment_failed_enabled": true
  },
  "sub_merchants_enabled": false,
  "parent_merchant_id":"merchant_123",
  "metadata": {
    "city": "NY",
    "unit": "245"
  },
  "primary_business_details": [
    {
      "country": "US",
      "business": "default"
    }
  ]
}'
```
 ```
{
    "merchant_id": "merchant_1756370034",
    "merchant_name": "NewAge Retailer",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "vPKpQFWxI6vvWeAClk6U0JQ01ueIluSMVrsUv7uiFQL2Vmgo4fp1zCW1qXRzX7p3",
    "redirect_to_merchant_with_http_post": false,
    "merchant_details": {
        "primary_contact_person": "John Test",
        "primary_phone": "sunt laborum",
        "primary_email": "JohnTest@test.com",
        "secondary_contact_person": "John Test2",
        "secondary_phone": "cillum do dolor id",
        "secondary_email": "JohnTest2@test.com",
        "website": "https://www.example.com",
        "about_business": "Online Retail with a wide selection of organic products for North America",
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "john",
            "last_name": "Doe",
            "origin_zip": null
        }
    },
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "payout_routing_algorithm": null,
    "sub_merchants_enabled": false,
    "parent_merchant_id": null,
    "publishable_key": "pk_dev_bb568f9c214f4428b24e81ff7173b7be",
    "metadata": {
        "city": "NY",
        "unit": "245",
        "compatible_connector": null
    },
    "locker_id": "m0010",
    "primary_business_details": [
        {
            "country": "US",
            "business": "default"
        }
    ],
    "frm_routing_algorithm": null,
    "organization_id": "org_5pSgHUtY3PbAsrEDWkij",
    "is_recon_enabled": false,
    "default_profile": "pro_t5bthtS2CtfrpA3UjL4H",
    "recon_status": "not_requested",
    "pm_collect_link_config": null,
    "product_type": "orchestration",
    "merchant_account_type": "standard"
}
```
create_sr_routing
```
curl --location 'http://localhost:8080/account/merchant_1756370034/business_profile/pro_t5bthtS2CtfrpA3UjL4H/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 200,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
```
{
    "id": "routing_usG7HRI5Ij3FoaOhOb5A",
    "profile_id": "pro_t5bthtS2CtfrpA3UjL4H",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756370043,
    "modified_at": 1756370043,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
activate
```
curl --location 'http://localhost:8080/routing/routing_usG7HRI5Ij3FoaOhOb5A/activate' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{}'
```
```
{
    "id": "routing_usG7HRI5Ij3FoaOhOb5A",
    "profile_id": "pro_t5bthtS2CtfrpA3UjL4H",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756370043,
    "modified_at": 1756370043,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
delete_merchant
```
curl --location --request DELETE 'http://localhost:8080/accounts/merchant_1756370034' \
--header 'Accept: application/json' \
--header 'api-key: test_admin'
```
```
{
    "merchant_id": "merchant_1756370034",
    "deleted": true
}
```
delete business_profile
```
curl --location --request DELETE 'http://localhost:8080/account/merchant_1756370034/business_profile/pro_t5bthtS2CtfrpA3UjL4H' \
--header 'api-key: test_admin'
```
```true```
<img width="1313" height="333" alt="Screenshot 2025-08-28 at 2 50 14 PM" src="https://github.com/user-attachments/assets/2d005743-8ccd-4592-9547-fb52adf44b64" />
Deleted from hyperswitch
<img width="670" height="52" alt="Screenshot 2025-08-28 at 2 46 31 PM" src="https://github.com/user-attachments/assets/9412c39b-5bb6-4133-b6a2-d1f401aa070f" />
<img width="667" height="48" alt="Screenshot 2025-08-28 at 2 50 27 PM" src="https://github.com/user-attachments/assets/5a9da55d-d0f3-49fe-8ac5-1cc5f4d6c9e0" />
Not deleted from DE
<img width="757" height="316" alt="Screenshot 2025-08-28 at 2 47 01 PM" src="https://github.com/user-attachments/assets/3a0a12c6-4062-48c3-8c4d-edbf85aa7a96" />
 | 
	26930a47e905baf647f218328e81529951d4f563 | 
	**Curls and Responses**
merchant_create
```
curl --location 'http://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
  "merchant_id": "merchant_1756372072",
  "locker_id": "m0010",
  "merchant_name": "NewAge Retailer",
  "merchant_details": {
    "primary_contact_person": "John Test",
    "primary_email": "JohnTest@test.com",
    "primary_phone": "sunt laborum",
    "secondary_contact_person": "John Test2",
    "secondary_email": "JohnTest2@test.com",
    "secondary_phone": "cillum do dolor id",
    "website": "https://www.example.com",
    "about_business": "Online Retail with a wide selection of organic products for North America",
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name":"john",
      "last_name":"Doe"
    }
  },
  "return_url": "https://google.com/success",
  "webhook_details": {
    "webhook_version": "1.0.1",
    "webhook_username": "ekart_retail",
    "webhook_password": "password_ekart@123",
    "webhook_url":"https://webhook.site",
    "payment_created_enabled": true,
    "payment_succeeded_enabled": true,
    "payment_failed_enabled": true
  },
  "sub_merchants_enabled": false,
  "parent_merchant_id":"merchant_123",
  "metadata": {
    "city": "NY",
    "unit": "245"
  },
  "primary_business_details": [
    {
      "country": "US",
      "business": "default"
    }
  ]
}'
```
 ```
{
    "merchant_id": "merchant_1756370034",
    "merchant_name": "NewAge Retailer",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "vPKpQFWxI6vvWeAClk6U0JQ01ueIluSMVrsUv7uiFQL2Vmgo4fp1zCW1qXRzX7p3",
    "redirect_to_merchant_with_http_post": false,
    "merchant_details": {
        "primary_contact_person": "John Test",
        "primary_phone": "sunt laborum",
        "primary_email": "JohnTest@test.com",
        "secondary_contact_person": "John Test2",
        "secondary_phone": "cillum do dolor id",
        "secondary_email": "JohnTest2@test.com",
        "website": "https://www.example.com",
        "about_business": "Online Retail with a wide selection of organic products for North America",
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "john",
            "last_name": "Doe",
            "origin_zip": null
        }
    },
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "payout_routing_algorithm": null,
    "sub_merchants_enabled": false,
    "parent_merchant_id": null,
    "publishable_key": "pk_dev_bb568f9c214f4428b24e81ff7173b7be",
    "metadata": {
        "city": "NY",
        "unit": "245",
        "compatible_connector": null
    },
    "locker_id": "m0010",
    "primary_business_details": [
        {
            "country": "US",
            "business": "default"
        }
    ],
    "frm_routing_algorithm": null,
    "organization_id": "org_5pSgHUtY3PbAsrEDWkij",
    "is_recon_enabled": false,
    "default_profile": "pro_t5bthtS2CtfrpA3UjL4H",
    "recon_status": "not_requested",
    "pm_collect_link_config": null,
    "product_type": "orchestration",
    "merchant_account_type": "standard"
}
```
create_sr_routing
```
curl --location 'http://localhost:8080/account/merchant_1756370034/business_profile/pro_t5bthtS2CtfrpA3UjL4H/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 200,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
```
{
    "id": "routing_usG7HRI5Ij3FoaOhOb5A",
    "profile_id": "pro_t5bthtS2CtfrpA3UjL4H",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756370043,
    "modified_at": 1756370043,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
activate
```
curl --location 'http://localhost:8080/routing/routing_usG7HRI5Ij3FoaOhOb5A/activate' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{}'
```
```
{
    "id": "routing_usG7HRI5Ij3FoaOhOb5A",
    "profile_id": "pro_t5bthtS2CtfrpA3UjL4H",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756370043,
    "modified_at": 1756370043,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
delete_merchant
```
curl --location --request DELETE 'http://localhost:8080/accounts/merchant_1756370034' \
--header 'Accept: application/json' \
--header 'api-key: test_admin'
```
```
{
    "merchant_id": "merchant_1756370034",
    "deleted": true
}
```
delete business_profile
```
curl --location --request DELETE 'http://localhost:8080/account/merchant_1756370034/business_profile/pro_t5bthtS2CtfrpA3UjL4H' \
--header 'api-key: test_admin'
```
```true```
<img width="1313" height="333" alt="Screenshot 2025-08-28 at 2 50 14 PM" src="https://github.com/user-attachments/assets/2d005743-8ccd-4592-9547-fb52adf44b64" />
Deleted from hyperswitch
<img width="670" height="52" alt="Screenshot 2025-08-28 at 2 46 31 PM" src="https://github.com/user-attachments/assets/9412c39b-5bb6-4133-b6a2-d1f401aa070f" />
<img width="667" height="48" alt="Screenshot 2025-08-28 at 2 50 27 PM" src="https://github.com/user-attachments/assets/5a9da55d-d0f3-49fe-8ac5-1cc5f4d6c9e0" />
Not deleted from DE
<img width="757" height="316" alt="Screenshot 2025-08-28 at 2 47 01 PM" src="https://github.com/user-attachments/assets/3a0a12c6-4062-48c3-8c4d-edbf85aa7a96" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9097 | 
	Bug: Subscription Create to return client secret and create payment intent automatically
 | 
	diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index 3b343459e9e..7c48d626f2d 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -42,6 +42,8 @@ pub mod recon;
 pub mod refunds;
 pub mod relay;
 pub mod routing;
+#[cfg(feature = "v1")]
+pub mod subscription;
 pub mod surcharge_decision_configs;
 pub mod three_ds_decision_rule;
 #[cfg(feature = "tokenization_v2")]
diff --git a/crates/api_models/src/subscription.rs b/crates/api_models/src/subscription.rs
new file mode 100644
index 00000000000..7dff21205a2
--- /dev/null
+++ b/crates/api_models/src/subscription.rs
@@ -0,0 +1,109 @@
+use common_utils::events::ApiEventMetric;
+use masking::Secret;
+use utoipa::ToSchema;
+
+// use crate::{
+//     customers::{CustomerRequest, CustomerResponse},
+//     payments::CustomerDetailsResponse,
+// };
+
+/// Request payload for creating a subscription.
+///
+/// This struct captures details required to create a subscription,
+/// including plan, profile, merchant connector, and optional customer info.
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct CreateSubscriptionRequest {
+    /// Merchant specific Unique identifier.
+    pub merchant_reference_id: Option<String>,
+
+    /// Identifier for the subscription plan.
+    pub plan_id: Option<String>,
+
+    /// Optional coupon code applied to the subscription.
+    pub coupon_code: Option<String>,
+
+    /// customer ID associated with this subscription.
+    pub customer_id: common_utils::id_type::CustomerId,
+}
+
+/// Response payload returned after successfully creating a subscription.
+///
+/// Includes details such as subscription ID, status, plan, merchant, and customer info.
+#[derive(Debug, Clone, serde::Serialize, ToSchema)]
+pub struct CreateSubscriptionResponse {
+    /// Unique identifier for the subscription.
+    pub id: common_utils::id_type::SubscriptionId,
+
+    /// Merchant specific Unique identifier.
+    pub merchant_reference_id: Option<String>,
+
+    /// Current status of the subscription.
+    pub status: SubscriptionStatus,
+
+    /// Identifier for the associated subscription plan.
+    pub plan_id: Option<String>,
+
+    /// Associated profile ID.
+    pub profile_id: common_utils::id_type::ProfileId,
+
+    /// Optional client secret used for secure client-side interactions.
+    pub client_secret: Option<Secret<String>>,
+
+    /// Merchant identifier owning this subscription.
+    pub merchant_id: common_utils::id_type::MerchantId,
+
+    /// Optional coupon code applied to this subscription.
+    pub coupon_code: Option<String>,
+
+    /// Optional customer ID associated with this subscription.
+    pub customer_id: common_utils::id_type::CustomerId,
+}
+
+/// Possible states of a subscription lifecycle.
+///
+/// - `Created`: Subscription was created but not yet activated.
+/// - `Active`: Subscription is currently active.
+/// - `InActive`: Subscription is inactive (e.g., cancelled or expired).
+#[derive(Debug, Clone, serde::Serialize, strum::EnumString, strum::Display, ToSchema)]
+pub enum SubscriptionStatus {
+    /// Subscription is active.
+    Active,
+    /// Subscription is created but not yet active.
+    Created,
+    /// Subscription is inactive.
+    InActive,
+    /// Subscription is in pending state.
+    Pending,
+}
+
+impl CreateSubscriptionResponse {
+    /// Creates a new [`CreateSubscriptionResponse`] with the given identifiers.
+    ///
+    /// By default, `client_secret`, `coupon_code`, and `customer` fields are `None`.
+    #[allow(clippy::too_many_arguments)]
+    pub fn new(
+        id: common_utils::id_type::SubscriptionId,
+        merchant_reference_id: Option<String>,
+        status: SubscriptionStatus,
+        plan_id: Option<String>,
+        profile_id: common_utils::id_type::ProfileId,
+        merchant_id: common_utils::id_type::MerchantId,
+        client_secret: Option<Secret<String>>,
+        customer_id: common_utils::id_type::CustomerId,
+    ) -> Self {
+        Self {
+            id,
+            merchant_reference_id,
+            status,
+            plan_id,
+            profile_id,
+            client_secret,
+            merchant_id,
+            coupon_code: None,
+            customer_id,
+        }
+    }
+}
+
+impl ApiEventMetric for CreateSubscriptionResponse {}
+impl ApiEventMetric for CreateSubscriptionRequest {}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index bbb1be10b80..03ceab3f9a2 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -8412,6 +8412,7 @@ pub enum Resource {
     RunRecon,
     ReconConfig,
     RevenueRecovery,
+    Subscription,
     InternalConnector,
     Theme,
 }
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index 49be22fc931..dc8f6e333a4 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -85,6 +85,7 @@ pub enum ApiEventsType {
         payment_id: Option<id_type::GlobalPaymentId>,
     },
     Routing,
+    Subscription,
     ResourceListAPI,
     #[cfg(feature = "v1")]
     PaymentRedirectionResponse {
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
index 6d73a90eab2..237ca661c10 100644
--- a/crates/common_utils/src/id_type.rs
+++ b/crates/common_utils/src/id_type.rs
@@ -17,6 +17,7 @@ mod profile_acquirer;
 mod refunds;
 mod relay;
 mod routing;
+mod subscription;
 mod tenant;
 
 use std::{borrow::Cow, fmt::Debug};
@@ -55,6 +56,7 @@ pub use self::{
     refunds::RefundReferenceId,
     relay::RelayId,
     routing::RoutingId,
+    subscription::SubscriptionId,
     tenant::TenantId,
 };
 use crate::{fp_utils::when, generate_id_with_default_len};
diff --git a/crates/common_utils/src/id_type/subscription.rs b/crates/common_utils/src/id_type/subscription.rs
new file mode 100644
index 00000000000..20f0c483fa1
--- /dev/null
+++ b/crates/common_utils/src/id_type/subscription.rs
@@ -0,0 +1,21 @@
+crate::id_type!(
+    SubscriptionId,
+    " A type for subscription_id that can be used for subscription ids"
+);
+
+crate::impl_id_type_methods!(SubscriptionId, "subscription_id");
+
+// This is to display the `SubscriptionId` as SubscriptionId(subs)
+crate::impl_debug_id_type!(SubscriptionId);
+crate::impl_try_from_cow_str_id_type!(SubscriptionId, "subscription_id");
+
+crate::impl_generate_id_id_type!(SubscriptionId, "subscription");
+crate::impl_serializable_secret_id_type!(SubscriptionId);
+crate::impl_queryable_id_type!(SubscriptionId);
+crate::impl_to_sql_from_sql_id_type!(SubscriptionId);
+
+impl crate::events::ApiEventMetric for SubscriptionId {
+    fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
+        Some(crate::events::ApiEventsType::Subscription)
+    }
+}
diff --git a/crates/diesel_models/src/query/subscription.rs b/crates/diesel_models/src/query/subscription.rs
index e25f1617873..7a6bdd19c15 100644
--- a/crates/diesel_models/src/query/subscription.rs
+++ b/crates/diesel_models/src/query/subscription.rs
@@ -19,13 +19,13 @@ impl Subscription {
     pub async fn find_by_merchant_id_subscription_id(
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
-        subscription_id: String,
+        id: String,
     ) -> StorageResult<Self> {
         generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
             conn,
             dsl::merchant_id
                 .eq(merchant_id.to_owned())
-                .and(dsl::subscription_id.eq(subscription_id.to_owned())),
+                .and(dsl::id.eq(id.to_owned())),
         )
         .await
     }
@@ -33,7 +33,7 @@ impl Subscription {
     pub async fn update_subscription_entry(
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
-        subscription_id: String,
+        id: String,
         subscription_update: SubscriptionUpdate,
     ) -> StorageResult<Self> {
         generics::generic_update_with_results::<
@@ -43,8 +43,8 @@ impl Subscription {
             _,
         >(
             conn,
-            dsl::subscription_id
-                .eq(subscription_id.to_owned())
+            dsl::id
+                .eq(id.to_owned())
                 .and(dsl::merchant_id.eq(merchant_id.to_owned())),
             subscription_update,
         )
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 271d2a79ba0..c02a9748f81 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1530,9 +1530,9 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    subscription (subscription_id, merchant_id) {
+    subscription (id) {
         #[max_length = 128]
-        subscription_id -> Varchar,
+        id -> Varchar,
         #[max_length = 128]
         status -> Varchar,
         #[max_length = 128]
@@ -1554,6 +1554,8 @@ diesel::table! {
         modified_at -> Timestamp,
         #[max_length = 64]
         profile_id -> Varchar,
+        #[max_length = 128]
+        merchant_reference_id -> Nullable<Varchar>,
     }
 }
 
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 4195475f88d..4648eed49f7 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1465,9 +1465,9 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    subscription (subscription_id, merchant_id) {
+    subscription (id) {
         #[max_length = 128]
-        subscription_id -> Varchar,
+        id -> Varchar,
         #[max_length = 128]
         status -> Varchar,
         #[max_length = 128]
@@ -1489,6 +1489,8 @@ diesel::table! {
         modified_at -> Timestamp,
         #[max_length = 64]
         profile_id -> Varchar,
+        #[max_length = 128]
+        merchant_reference_id -> Nullable<Varchar>,
     }
 }
 
diff --git a/crates/diesel_models/src/subscription.rs b/crates/diesel_models/src/subscription.rs
index b2cb6e48470..f49fef4a7be 100644
--- a/crates/diesel_models/src/subscription.rs
+++ b/crates/diesel_models/src/subscription.rs
@@ -1,5 +1,6 @@
-use common_utils::pii::SecretSerdeValue;
+use common_utils::{generate_id_with_default_len, pii::SecretSerdeValue};
 use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
+use masking::Secret;
 use serde::{Deserialize, Serialize};
 
 use crate::schema::subscription;
@@ -7,7 +8,7 @@ use crate::schema::subscription;
 #[derive(Clone, Debug, Eq, Insertable, PartialEq, Serialize, Deserialize)]
 #[diesel(table_name = subscription)]
 pub struct SubscriptionNew {
-    subscription_id: String,
+    id: common_utils::id_type::SubscriptionId,
     status: String,
     billing_processor: Option<String>,
     payment_method_id: Option<String>,
@@ -20,14 +21,15 @@ pub struct SubscriptionNew {
     created_at: time::PrimitiveDateTime,
     modified_at: time::PrimitiveDateTime,
     profile_id: common_utils::id_type::ProfileId,
+    merchant_reference_id: Option<String>,
 }
 
 #[derive(
     Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize,
 )]
-#[diesel(table_name = subscription, primary_key(subscription_id, merchant_id), check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = subscription, primary_key(id), check_for_backend(diesel::pg::Pg))]
 pub struct Subscription {
-    pub subscription_id: String,
+    pub id: common_utils::id_type::SubscriptionId,
     pub status: String,
     pub billing_processor: Option<String>,
     pub payment_method_id: Option<String>,
@@ -40,6 +42,7 @@ pub struct Subscription {
     pub created_at: time::PrimitiveDateTime,
     pub modified_at: time::PrimitiveDateTime,
     pub profile_id: common_utils::id_type::ProfileId,
+    pub merchant_reference_id: Option<String>,
 }
 
 #[derive(Clone, Debug, Eq, PartialEq, AsChangeset, router_derive::DebugAsDisplay, Deserialize)]
@@ -53,7 +56,7 @@ pub struct SubscriptionUpdate {
 impl SubscriptionNew {
     #[allow(clippy::too_many_arguments)]
     pub fn new(
-        subscription_id: String,
+        id: common_utils::id_type::SubscriptionId,
         status: String,
         billing_processor: Option<String>,
         payment_method_id: Option<String>,
@@ -64,10 +67,11 @@ impl SubscriptionNew {
         customer_id: common_utils::id_type::CustomerId,
         metadata: Option<SecretSerdeValue>,
         profile_id: common_utils::id_type::ProfileId,
+        merchant_reference_id: Option<String>,
     ) -> Self {
         let now = common_utils::date_time::now();
         Self {
-            subscription_id,
+            id,
             status,
             billing_processor,
             payment_method_id,
@@ -80,8 +84,16 @@ impl SubscriptionNew {
             created_at: now,
             modified_at: now,
             profile_id,
+            merchant_reference_id,
         }
     }
+
+    pub fn generate_and_set_client_secret(&mut self) -> Secret<String> {
+        let client_secret =
+            generate_id_with_default_len(&format!("{}_secret", self.id.get_string_repr()));
+        self.client_secret = Some(client_secret.clone());
+        Secret::new(client_secret)
+    }
 }
 
 impl SubscriptionUpdate {
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index f7cb256f587..e6c13f5344f 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -51,6 +51,8 @@ pub mod refunds_v2;
 #[cfg(feature = "v1")]
 pub mod debit_routing;
 pub mod routing;
+#[cfg(feature = "v1")]
+pub mod subscription;
 pub mod surcharge_decision_config;
 pub mod three_ds_decision_rule;
 #[cfg(feature = "olap")]
diff --git a/crates/router/src/core/subscription.rs b/crates/router/src/core/subscription.rs
new file mode 100644
index 00000000000..32c6754e2fe
--- /dev/null
+++ b/crates/router/src/core/subscription.rs
@@ -0,0 +1,65 @@
+use std::str::FromStr;
+
+use api_models::subscription::{
+    self as subscription_types, CreateSubscriptionResponse, SubscriptionStatus,
+};
+use common_utils::id_type::GenerateId;
+use diesel_models::subscription::SubscriptionNew;
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{api::ApplicationResponse, merchant_context::MerchantContext};
+use masking::Secret;
+
+use super::errors::{self, RouterResponse};
+use crate::routes::SessionState;
+
+pub async fn create_subscription(
+    state: SessionState,
+    merchant_context: MerchantContext,
+    profile_id: String,
+    request: subscription_types::CreateSubscriptionRequest,
+) -> RouterResponse<CreateSubscriptionResponse> {
+    let store = state.store.clone();
+    let db = store.as_ref();
+    let id = common_utils::id_type::SubscriptionId::generate();
+    let profile_id = common_utils::id_type::ProfileId::from_str(&profile_id).change_context(
+        errors::ApiErrorResponse::InvalidDataValue {
+            field_name: "X-Profile-Id",
+        },
+    )?;
+
+    let mut subscription = SubscriptionNew::new(
+        id,
+        SubscriptionStatus::Created.to_string(),
+        None,
+        None,
+        None,
+        None,
+        None,
+        merchant_context.get_merchant_account().get_id().clone(),
+        request.customer_id.clone(),
+        None,
+        profile_id,
+        request.merchant_reference_id,
+    );
+
+    subscription.generate_and_set_client_secret();
+    let subscription_response = db
+        .insert_subscription_entry(subscription)
+        .await
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("subscriptions: unable to insert subscription entry to database")?;
+
+    let response = CreateSubscriptionResponse::new(
+        subscription_response.id.clone(),
+        subscription_response.merchant_reference_id,
+        SubscriptionStatus::from_str(&subscription_response.status)
+            .unwrap_or(SubscriptionStatus::Created),
+        None,
+        subscription_response.profile_id,
+        subscription_response.merchant_id,
+        subscription_response.client_secret.map(Secret::new),
+        request.customer_id,
+    );
+
+    Ok(ApplicationResponse::Json(response))
+}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index d92dc311e0c..fd9c7f8a0a5 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -211,6 +211,7 @@ pub fn mk_app(
                 .service(routes::Files::server(state.clone()))
                 .service(routes::Disputes::server(state.clone()))
                 .service(routes::Blocklist::server(state.clone()))
+                .service(routes::Subscription::server(state.clone()))
                 .service(routes::Gsm::server(state.clone()))
                 .service(routes::ApplePayCertificatesMigration::server(state.clone()))
                 .service(routes::PaymentLink::server(state.clone()))
diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs
index b8fde79e2a1..f2af4631917 100644
--- a/crates/router/src/routes.rs
+++ b/crates/router/src/routes.rs
@@ -50,6 +50,8 @@ pub mod recon;
 pub mod refunds;
 #[cfg(feature = "olap")]
 pub mod routing;
+#[cfg(feature = "v1")]
+pub mod subscription;
 pub mod three_ds_decision_rule;
 pub mod tokenization;
 #[cfg(feature = "olap")]
@@ -96,7 +98,7 @@ pub use self::app::{
     User, UserDeprecated, Webhooks,
 };
 #[cfg(feature = "olap")]
-pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents};
+pub use self::app::{Blocklist, Organization, Routing, Subscription, Verify, WebhookEvents};
 #[cfg(feature = "payouts")]
 pub use self::app::{PayoutLink, Payouts};
 #[cfg(all(feature = "stripe", feature = "v1"))]
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index d52dc1570ce..1cdc2479364 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -65,7 +65,9 @@ use super::{
     profiles, relay, user, user_role,
 };
 #[cfg(feature = "v1")]
-use super::{apple_pay_certificates_migration, blocklist, payment_link, webhook_events};
+use super::{
+    apple_pay_certificates_migration, blocklist, payment_link, subscription, webhook_events,
+};
 #[cfg(any(feature = "olap", feature = "oltp"))]
 use super::{configs::*, customers, payments};
 #[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v1"))]
@@ -1163,6 +1165,22 @@ impl Routing {
     }
 }
 
+#[cfg(feature = "oltp")]
+pub struct Subscription;
+
+#[cfg(all(feature = "oltp", feature = "v1"))]
+impl Subscription {
+    pub fn server(state: AppState) -> Scope {
+        web::scope("/subscription/create")
+            .app_data(web::Data::new(state.clone()))
+            .service(web::resource("").route(
+                web::post().to(|state, req, payload| {
+                    subscription::create_subscription(state, req, payload)
+                }),
+            ))
+    }
+}
+
 pub struct Customers;
 
 #[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))]
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 28581198d83..8bbddaedc8e 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -26,6 +26,7 @@ pub enum ApiIdentifier {
     ApiKeys,
     PaymentLink,
     Routing,
+    Subscription,
     Blocklist,
     Forex,
     RustLockerMigration,
@@ -88,6 +89,8 @@ impl From<Flow> for ApiIdentifier {
             | Flow::DecisionEngineDecideGatewayCall
             | Flow::DecisionEngineGatewayFeedbackCall => Self::Routing,
 
+            Flow::CreateSubscription => Self::Subscription,
+
             Flow::RetrieveForexFlow => Self::Forex,
 
             Flow::AddToBlocklist => Self::Blocklist,
diff --git a/crates/router/src/routes/subscription.rs b/crates/router/src/routes/subscription.rs
new file mode 100644
index 00000000000..d4b716f63c0
--- /dev/null
+++ b/crates/router/src/routes/subscription.rs
@@ -0,0 +1,69 @@
+//! Analysis for usage of Subscription in Payment flows
+//!
+//! Functions that are used to perform the api level configuration and retrieval
+//! of various types under Subscriptions.
+
+use actix_web::{web, HttpRequest, HttpResponse, Responder};
+use api_models::subscription as subscription_types;
+use hyperswitch_domain_models::errors;
+use router_env::{
+    tracing::{self, instrument},
+    Flow,
+};
+
+use crate::{
+    core::{api_locking, subscription},
+    headers::X_PROFILE_ID,
+    routes::AppState,
+    services::{api as oss_api, authentication as auth, authorization::permissions::Permission},
+    types::domain,
+};
+
+#[cfg(all(feature = "oltp", feature = "v1"))]
+#[instrument(skip_all)]
+pub async fn create_subscription(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    json_payload: web::Json<subscription_types::CreateSubscriptionRequest>,
+) -> impl Responder {
+    let flow = Flow::CreateSubscription;
+    let profile_id = match req.headers().get(X_PROFILE_ID) {
+        Some(val) => val.to_str().unwrap_or_default().to_string(),
+        None => {
+            return HttpResponse::BadRequest().json(
+                errors::api_error_response::ApiErrorResponse::MissingRequiredField {
+                    field_name: "x-profile-id",
+                },
+            );
+        }
+    };
+    Box::pin(oss_api::server_wrap(
+        flow,
+        state,
+        &req,
+        json_payload.into_inner(),
+        move |state, auth: auth::AuthenticationData, payload, _| {
+            let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                domain::Context(auth.merchant_account, auth.key_store),
+            ));
+            subscription::create_subscription(
+                state,
+                merchant_context,
+                profile_id.clone(),
+                payload.clone(),
+            )
+        },
+        auth::auth_type(
+            &auth::HeaderAuth(auth::ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            }),
+            &auth::JWTAuth {
+                permission: Permission::ProfileSubscriptionWrite,
+            },
+            req.headers(),
+        ),
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rs
index 3860d343b68..6fb4b09cd5d 100644
--- a/crates/router/src/services/authorization/permissions.rs
+++ b/crates/router/src/services/authorization/permissions.rs
@@ -43,6 +43,10 @@ generate_permissions! {
             scopes: [Read, Write],
             entities: [Profile, Merchant]
         },
+        Subscription: {
+            scopes: [Read, Write],
+            entities: [Profile, Merchant]
+        },
         ThreeDsDecisionManager: {
             scopes: [Read, Write],
             entities: [Merchant, Profile]
@@ -123,6 +127,7 @@ pub fn get_resource_name(resource: Resource, entity_type: EntityType) -> Option<
             Some("Payment Processors, Payout Processors, Fraud & Risk Managers")
         }
         (Resource::Routing, _) => Some("Routing"),
+        (Resource::Subscription, _) => Some("Subscription"),
         (Resource::RevenueRecovery, _) => Some("Revenue Recovery"),
         (Resource::ThreeDsDecisionManager, _) => Some("3DS Decision Manager"),
         (Resource::SurchargeDecisionManager, _) => Some("Surcharge Decision Manager"),
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index f5359d84010..fad87204cee 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -263,6 +263,8 @@ pub enum Flow {
     RoutingUpdateDefaultConfig,
     /// Routing delete config
     RoutingDeleteConfig,
+    /// Subscription create flow,
+    CreateSubscription,
     /// Create dynamic routing
     CreateDynamicRoutingConfig,
     /// Toggle dynamic routing
diff --git a/migrations/2025-09-17-165505_update_subscription_table_with_merchant_ref_id/down.sql b/migrations/2025-09-17-165505_update_subscription_table_with_merchant_ref_id/down.sql
new file mode 100644
index 00000000000..cc002a5e7e6
--- /dev/null
+++ b/migrations/2025-09-17-165505_update_subscription_table_with_merchant_ref_id/down.sql
@@ -0,0 +1,9 @@
+ALTER TABLE subscription
+    DROP CONSTRAINT subscription_pkey,
+    DROP COLUMN merchant_reference_id;
+
+ALTER TABLE subscription
+    RENAME COLUMN id TO subscription_id;
+
+ALTER TABLE subscription
+    ADD PRIMARY KEY (subscription_id, merchant_id);
diff --git a/migrations/2025-09-17-165505_update_subscription_table_with_merchant_ref_id/up.sql b/migrations/2025-09-17-165505_update_subscription_table_with_merchant_ref_id/up.sql
new file mode 100644
index 00000000000..1d454442b81
--- /dev/null
+++ b/migrations/2025-09-17-165505_update_subscription_table_with_merchant_ref_id/up.sql
@@ -0,0 +1,9 @@
+ALTER TABLE subscription
+    DROP CONSTRAINT subscription_pkey,
+    ADD COLUMN merchant_reference_id VARCHAR(128);
+
+ALTER TABLE subscription
+    RENAME COLUMN subscription_id TO id;
+
+ALTER TABLE subscription
+    ADD PRIMARY KEY (id);
 | 
	2025-08-31T23:26:42Z | 
	## Summary
Add **Subscriptions API (v1/OLAP)** entrypoint to create a _subscription intent_ and optionally create/attach a customer, returning a `client_secret` and basic subscription payload.
- New route: `POST /subscription/create` (behind `olap` + `v1`)
- Creates a `subscription` row (using existing table) and generates a `client_secret`
- Optionally **gets or creates** a `Customer` from inline `customer` payload or `customer_id`
- Persists optional `mca_id` on the subscription row (used later for connector selection)
- Returns a typed `CreateSubscriptionResponse` with `subscription`, `client_secret`, `merchant_id`, `mca_id`, and optional `customer`, `invoice` (placeholder)
## Endpoints
### Create Subscription Intent
`POST /subscription/create`
**Auth**
- API key (HeaderAuth) + JWT (`Permission::ProfileRoutingWrite`)
**Request Body**
```json
{
    "customer_id": "{{customer_id}}"
}
```
**Behavior**
- Generates `sub_<random>` for subscription row id
- If `customer_id` provided → fetch; else if `customer` has any PII fields → **create customer** (encrypting PII); else → `400 CustomerNotFound`
- Persists subscription with:
  - `id`
  - `subscription_id` = `null` (placeholder, to be set later)
  - `mca_id` (if provided)
  - `client_secret` = generated via `SubscriptionNew::generate_client_secret()`
  - `merchant_id`, `customer_id`
  - `billing_processor`, `payment_method_id`, `metadata` = `null` (placeholders)
- Returns `200` with response below
**Success Response**
```json
{
    "id": "subscription_f8Ng47rKaB296XHolKKG",
    "merchant_reference_id": null,
    "status": "Created",
    "plan_id": null,
    "profile_id": "pro_UjmcM35TVpYh9Zb3LaZV",
    "client_secret": "subscription_f8Ng47rKaB296XHolKKG_secret_0fz5A3aa4NTcdiQF5W7i",
    "merchant_id": "merchant_1758146582",
    "coupon_code": null,
    "customer_id": "cus_jtJ8WHTHnsguskpiorEt"
}
```
---
## Implementation Notes
- **Core**
  - `crates/router/src/core/subscription.rs` – service handler
  - `crates/router/src/core/subscription/utils.rs` – helpers, request/response types
- **Routing**
  - `crates/router/src/routes/subscription.rs` – web handler (`/subscription/create`)
  - `crates/router/src/routes/app.rs` – `Subscription::server()` scope under `/subscription`
  - `crates/router/src/lib.rs` – wire route
- **Domain / DTO**
  - `hyperswitch_domain_models::router_request_types::CustomerDetails` now `Serialize`/`Deserialize`
  - `hyperswitch_domain_models::customer::Customer` derives `Serialize` (v1)
- **Storage**
  - Uses existing `subscription` table and `SubscriptionNew::generate_client_secret()`
  - No new migrations introduced in this PR
- **Customer flow**
  - If not found, creates via encrypted batch operation; respects merchant key store and storage scheme
---
## Testing
```
curl --location 'http://localhost:8080/subscription/create' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: pro_UjmcM35TVpYh9Zb3LaZV' \
--header 'api-key: dev_pPBMnOEL5SJnMfxxp2bh4du87ESZoMJNtUmn3oIS8kpCNfUJAZ2a8F832n1je5zQ' \
--data '{
    "customer_id": "cus_jtJ8WHTHnsguskpiorEt"
}'
```
Response:
```
{
    "id": "subscription_f8Ng47rKaB296XHolKKG",
    "merchant_reference_id": null,
    "status": "Created",
    "plan_id": null,
    "profile_id": "pro_UjmcM35TVpYh9Zb3LaZV",
    "client_secret": "subscription_f8Ng47rKaB296XHolKKG_secret_0fz5A3aa4NTcdiQF5W7i",
    "merchant_id": "merchant_1758146582",
    "coupon_code": null,
    "customer_id": "cus_jtJ8WHTHnsguskpiorEt"
}
```
--- | 
	85bc733d5b03df4cda4d2a03aa8362a4fd1b14d9 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9098 | 
	Bug: Subscription table and core change
 | 
	diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs
index 246807a041a..caf979b2c5f 100644
--- a/crates/diesel_models/src/lib.rs
+++ b/crates/diesel_models/src/lib.rs
@@ -44,6 +44,7 @@ pub mod relay;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 pub mod types;
 pub mod unified_translations;
 
diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs
index 7c8831b3811..17eae2427e7 100644
--- a/crates/diesel_models/src/query.rs
+++ b/crates/diesel_models/src/query.rs
@@ -39,6 +39,7 @@ pub mod relay;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 #[cfg(feature = "tokenization_v2")]
 pub mod tokenization;
 pub mod unified_translations;
diff --git a/crates/diesel_models/src/query/subscription.rs b/crates/diesel_models/src/query/subscription.rs
new file mode 100644
index 00000000000..e25f1617873
--- /dev/null
+++ b/crates/diesel_models/src/query/subscription.rs
@@ -0,0 +1,59 @@
+use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
+use error_stack::report;
+
+use super::generics;
+use crate::{
+    errors,
+    schema::subscription::dsl,
+    subscription::{Subscription, SubscriptionNew, SubscriptionUpdate},
+    PgPooledConn, StorageResult,
+};
+
+impl SubscriptionNew {
+    pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Subscription> {
+        generics::generic_insert(conn, self).await
+    }
+}
+
+impl Subscription {
+    pub async fn find_by_merchant_id_subscription_id(
+        conn: &PgPooledConn,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> StorageResult<Self> {
+        generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
+            conn,
+            dsl::merchant_id
+                .eq(merchant_id.to_owned())
+                .and(dsl::subscription_id.eq(subscription_id.to_owned())),
+        )
+        .await
+    }
+
+    pub async fn update_subscription_entry(
+        conn: &PgPooledConn,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        subscription_update: SubscriptionUpdate,
+    ) -> StorageResult<Self> {
+        generics::generic_update_with_results::<
+            <Self as HasTable>::Table,
+            SubscriptionUpdate,
+            _,
+            _,
+        >(
+            conn,
+            dsl::subscription_id
+                .eq(subscription_id.to_owned())
+                .and(dsl::merchant_id.eq(merchant_id.to_owned())),
+            subscription_update,
+        )
+        .await?
+        .first()
+        .cloned()
+        .ok_or_else(|| {
+            report!(errors::DatabaseError::NotFound)
+                .attach_printable("Error while updating subscription entry")
+        })
+    }
+}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 08675d904de..0d4564c83c3 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1465,6 +1465,36 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    subscription (id) {
+        id -> Int4,
+        #[max_length = 128]
+        subscription_id -> Varchar,
+        #[max_length = 128]
+        status -> Varchar,
+        #[max_length = 128]
+        billing_processor -> Nullable<Varchar>,
+        #[max_length = 128]
+        payment_method_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        mca_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        client_secret -> Nullable<Varchar>,
+        #[max_length = 128]
+        connector_subscription_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Varchar,
+        #[max_length = 64]
+        customer_id -> Varchar,
+        metadata -> Nullable<Jsonb>,
+        created_at -> Timestamp,
+        modified_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1650,6 +1680,7 @@ diesel::allow_tables_to_appear_in_same_query!(
     reverse_lookup,
     roles,
     routing_algorithm,
+    subscription,
     themes,
     unified_translations,
     user_authentication_methods,
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index ea3980d942a..b734e2c4bb8 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1400,6 +1400,36 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    subscription (id) {
+        id -> Int4,
+        #[max_length = 128]
+        subscription_id -> Varchar,
+        #[max_length = 128]
+        status -> Varchar,
+        #[max_length = 128]
+        billing_processor -> Nullable<Varchar>,
+        #[max_length = 128]
+        payment_method_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        mca_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        client_secret -> Nullable<Varchar>,
+        #[max_length = 128]
+        connector_subscription_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Varchar,
+        #[max_length = 64]
+        customer_id -> Varchar,
+        metadata -> Nullable<Jsonb>,
+        created_at -> Timestamp,
+        modified_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1605,6 +1635,7 @@ diesel::allow_tables_to_appear_in_same_query!(
     reverse_lookup,
     roles,
     routing_algorithm,
+    subscription,
     themes,
     tokenization,
     unified_translations,
diff --git a/crates/diesel_models/src/subscription.rs b/crates/diesel_models/src/subscription.rs
new file mode 100644
index 00000000000..0cabb6a7b44
--- /dev/null
+++ b/crates/diesel_models/src/subscription.rs
@@ -0,0 +1,93 @@
+use common_utils::pii::SecretSerdeValue;
+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
+use serde::{Deserialize, Serialize};
+
+use crate::schema::subscription;
+
+#[derive(Clone, Debug, Eq, Insertable, PartialEq, Serialize, Deserialize)]
+#[diesel(table_name = subscription)]
+pub struct SubscriptionNew {
+    subscription_id: String,
+    status: String,
+    billing_processor: Option<String>,
+    payment_method_id: Option<String>,
+    mca_id: Option<String>,
+    client_secret: Option<String>,
+    connector_subscription_id: Option<String>,
+    merchant_id: common_utils::id_type::MerchantId,
+    customer_id: common_utils::id_type::CustomerId,
+    metadata: Option<SecretSerdeValue>,
+    created_at: time::PrimitiveDateTime,
+    modified_at: time::PrimitiveDateTime,
+}
+
+#[derive(
+    Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize,
+)]
+#[diesel(table_name = subscription, primary_key(id), check_for_backend(diesel::pg::Pg))]
+pub struct Subscription {
+    #[serde(skip_serializing, skip_deserializing)]
+    pub id: i32,
+    pub subscription_id: String,
+    pub status: String,
+    pub billing_processor: Option<String>,
+    pub payment_method_id: Option<String>,
+    pub mca_id: Option<String>,
+    pub client_secret: Option<String>,
+    pub connector_subscription_id: Option<String>,
+    pub merchant_id: common_utils::id_type::MerchantId,
+    pub customer_id: common_utils::id_type::CustomerId,
+    pub metadata: Option<serde_json::Value>,
+    pub created_at: time::PrimitiveDateTime,
+    pub modified_at: time::PrimitiveDateTime,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, AsChangeset, router_derive::DebugAsDisplay, Deserialize)]
+#[diesel(table_name = subscription)]
+pub struct SubscriptionUpdate {
+    pub payment_method_id: Option<String>,
+    pub status: Option<String>,
+    pub modified_at: time::PrimitiveDateTime,
+}
+
+impl SubscriptionNew {
+    #[allow(clippy::too_many_arguments)]
+    pub fn new(
+        subscription_id: String,
+        status: String,
+        billing_processor: Option<String>,
+        payment_method_id: Option<String>,
+        mca_id: Option<String>,
+        client_secret: Option<String>,
+        connector_subscription_id: Option<String>,
+        merchant_id: common_utils::id_type::MerchantId,
+        customer_id: common_utils::id_type::CustomerId,
+        metadata: Option<SecretSerdeValue>,
+    ) -> Self {
+        let now = common_utils::date_time::now();
+        Self {
+            subscription_id,
+            status,
+            billing_processor,
+            payment_method_id,
+            mca_id,
+            client_secret,
+            connector_subscription_id,
+            merchant_id,
+            customer_id,
+            metadata,
+            created_at: now,
+            modified_at: now,
+        }
+    }
+}
+
+impl SubscriptionUpdate {
+    pub fn new(payment_method_id: Option<String>, status: Option<String>) -> Self {
+        Self {
+            payment_method_id,
+            status,
+            modified_at: common_utils::date_time::now(),
+        }
+    }
+}
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index 59c31d4b2b8..f675e316aef 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -34,6 +34,7 @@ pub mod relay;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 pub mod unified_translations;
 pub mod user;
 pub mod user_authentication_method;
@@ -143,6 +144,7 @@ pub trait StorageInterface:
     + payment_method_session::PaymentMethodsSessionInterface
     + tokenization::TokenizationInterface
     + callback_mapper::CallbackMapperInterface
+    + subscription::SubscriptionInterface
     + 'static
 {
     fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface>;
diff --git a/crates/router/src/db/subscription.rs b/crates/router/src/db/subscription.rs
new file mode 100644
index 00000000000..5242c44299b
--- /dev/null
+++ b/crates/router/src/db/subscription.rs
@@ -0,0 +1,140 @@
+use error_stack::report;
+use router_env::{instrument, tracing};
+use storage_impl::MockDb;
+
+use super::Store;
+use crate::{
+    connection,
+    core::errors::{self, CustomResult},
+    db::kafka_store::KafkaStore,
+    types::storage,
+};
+
+#[async_trait::async_trait]
+pub trait SubscriptionInterface {
+    async fn insert_subscription_entry(
+        &self,
+        subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError>;
+
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError>;
+
+    async fn update_subscription_entry(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError>;
+}
+
+#[async_trait::async_trait]
+impl SubscriptionInterface for Store {
+    #[instrument(skip_all)]
+    async fn insert_subscription_entry(
+        &self,
+        subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        subscription_new
+            .insert(&conn)
+            .await
+            .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    #[instrument(skip_all)]
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        storage::Subscription::find_by_merchant_id_subscription_id(
+            &conn,
+            merchant_id,
+            subscription_id,
+        )
+        .await
+        .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    #[instrument(skip_all)]
+    async fn update_subscription_entry(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        storage::Subscription::update_subscription_entry(&conn, merchant_id, subscription_id, data)
+            .await
+            .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+}
+
+#[async_trait::async_trait]
+impl SubscriptionInterface for MockDb {
+    #[instrument(skip_all)]
+    async fn insert_subscription_entry(
+        &self,
+        _subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        Err(errors::StorageError::MockDbError)?
+    }
+
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        _merchant_id: &common_utils::id_type::MerchantId,
+        _subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        Err(errors::StorageError::MockDbError)?
+    }
+
+    async fn update_subscription_entry(
+        &self,
+        _merchant_id: &common_utils::id_type::MerchantId,
+        _subscription_id: String,
+        _data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        Err(errors::StorageError::MockDbError)?
+    }
+}
+
+#[async_trait::async_trait]
+impl SubscriptionInterface for KafkaStore {
+    #[instrument(skip_all)]
+    async fn insert_subscription_entry(
+        &self,
+        subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        self.diesel_store
+            .insert_subscription_entry(subscription_new)
+            .await
+    }
+
+    #[instrument(skip_all)]
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        self.diesel_store
+            .find_by_merchant_id_subscription_id(merchant_id, subscription_id)
+            .await
+    }
+
+    #[instrument(skip_all)]
+    async fn update_subscription_entry(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        self.diesel_store
+            .update_subscription_entry(merchant_id, subscription_id, data)
+            .await
+    }
+}
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 70a0a344150..5d4c4a8bb29 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -41,6 +41,7 @@ pub mod revenue_recovery_redis_operation;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 pub mod unified_translations;
 pub mod user;
 pub mod user_authentication_method;
@@ -77,5 +78,5 @@ pub use self::{
     generic_link::*, gsm::*, locker_mock_up::*, mandate::*, merchant_account::*,
     merchant_connector_account::*, merchant_key_store::*, payment_link::*, payment_method::*,
     process_tracker::*, refund::*, reverse_lookup::*, role::*, routing_algorithm::*,
-    unified_translations::*, user::*, user_authentication_method::*, user_role::*,
+    subscription::*, unified_translations::*, user::*, user_authentication_method::*, user_role::*,
 };
diff --git a/crates/router/src/types/storage/subscription.rs b/crates/router/src/types/storage/subscription.rs
new file mode 100644
index 00000000000..973c2283494
--- /dev/null
+++ b/crates/router/src/types/storage/subscription.rs
@@ -0,0 +1 @@
+pub use diesel_models::subscription::{Subscription, SubscriptionNew, SubscriptionUpdate};
diff --git a/migrations/2025-08-21-110802_add_subcription_table/down.sql b/migrations/2025-08-21-110802_add_subcription_table/down.sql
new file mode 100644
index 00000000000..0979103e48c
--- /dev/null
+++ b/migrations/2025-08-21-110802_add_subcription_table/down.sql
@@ -0,0 +1 @@
+DROP table subscription;
diff --git a/migrations/2025-08-21-110802_add_subcription_table/up.sql b/migrations/2025-08-21-110802_add_subcription_table/up.sql
new file mode 100644
index 00000000000..4e5419aefd4
--- /dev/null
+++ b/migrations/2025-08-21-110802_add_subcription_table/up.sql
@@ -0,0 +1,17 @@
+CREATE TABLE subscription (
+  id SERIAL PRIMARY KEY,
+  subscription_id VARCHAR(128) NOT NULL,
+  status VARCHAR(128) NOT NULL,
+  billing_processor VARCHAR(128),
+  payment_method_id VARCHAR(128),
+  mca_id VARCHAR(128),
+  client_secret VARCHAR(128),
+  connector_subscription_id VARCHAR(128),
+  merchant_id VARCHAR(64) NOT NULL,
+  customer_id VARCHAR(64) NOT NULL,
+  metadata JSONB,
+  created_at TIMESTAMP NOT NULL,
+  modified_at TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX merchant_subscription_unique_index ON subscription (merchant_id, subscription_id);
 | 
	2025-09-01T13:07:55Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
### Additional Changes
- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
## Description
Introduce **Subscriptions** as a first-class entity in the router.  
This PR adds a `subscription` table, Diesel models, storage interfaces, and query helpers to **create**, **fetch**, and **update** subscription entries keyed by `(merchant_id, customer_id, subscription_id)`.
### What’s included
**Database (PostgreSQL)**
- New table: `subscription`
- Columns:
  - `id VARCHAR(128) PRIMARY KEY`
  - `subscription_id VARCHAR(128) NULL`
  - `billing_processor VARCHAR(128) NULL`
  - `payment_method_id VARCHAR(128) NULL`
  - `mca_id VARCHAR(128) NULL`
  - `client_secret VARCHAR(128) NULL`
  - `merchant_id VARCHAR(64) NOT NULL`
  - `customer_id VARCHAR(64) NOT NULL`
  - `metadata JSONB NULL`
  - `created_at TIMESTAMP NOT NULL`
  - `modified_at TIMESTAMP NOT NULL`
- Indexes:
  - `CREATE UNIQUE INDEX merchant_customer_subscription_unique_index ON subscription (merchant_id, customer_id, subscription_id);`
**Migrations**
- `up.sql` creates the table + unique index
- `down.sql` drops the table
**Diesel models & schema**
- `crates/diesel_models/src/schema.rs`: `subscription` table mapping
- `crates/diesel_models/src/subscription.rs`:
  - `SubscriptionNew` (insert)
  - `Subscription` (read)
  - `SubscriptionUpdate` (update: `subscription_id`, `payment_method_id`, `modified_at`)
- Query functions: `crates/diesel_models/src/query/subscription.rs`
  - `SubscriptionNew::insert`
  - `Subscription::find_by_merchant_id_customer_id_subscription_id`
  - `Subscription::update_subscription_entry`
**Router storage interface**
- Trait: `SubscriptionInterface` (`crates/router/src/db/subscription.rs`)
  - `insert_subscription_entry`
  - `find_by_merchant_id_customer_id_subscription_id`
  - `update_subscription_entry`
- Implemented for `Store`, `KafkaStore` (delegates), and `MockDb` (stubbed)
**Wiring**
- Re-exports in `crates/router/src/types/storage.rs` and module plumbing in `db.rs`, `diesel_models/src/lib.rs`, `query.rs`.
---
## Motivation and Context
Subscriptions are often provisioned/managed outside Payments, but Payments needs a lightweight mapping to:
- Track **billing processor** and connector meta (`mca_id`, `client_secret`)
- Attach or rotate **payment_method_id** per subscription
- Support **idempotent** reads keyed by merchant & customer context
This schema enables upstream orchestration to store/retrieve subscription context without coupling to payment flows.
---
## API / Contract / Config Impact
- **DB schema change**: ✅ (new table + unique index)
- **API contract**: ❌ (no external API changes in this PR)
- **Config/env**: ❌
---
### Testing
can't be performed, as in this PR we only have created the tables and not used it anywhere in the upcoming micro-prs, this will be used. however I have used it myself by making code changes, here are the screenshots.
<img width="3456" height="1182" alt="Screenshot 2025-08-26 at 20 31 13" src="https://github.com/user-attachments/assets/320f6b05-74a9-44d2-ad9a-5514431e5ca2" />
<img width="3456" height="998" alt="Screenshot 2025-08-26 at 20 31 38" src="https://github.com/user-attachments/assets/123a55a4-74bd-4aa4-812b-821a0e73caa4" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e30842892a48ff6e4bc0e7c0a4990d3e5fc50027 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9078 | 
	Bug: (connector): [Netcetera] Fix message_extension field in Netcetera Response 
### Bug Description
Currently we are not recieving field **message_extension** in Netcetera's authentication response since the struct is incorrectly declared in the transformers file. 
**Current structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_request: {
message_extension: Option<serde_json::Value>,
....
}
...
}
```
**Correct structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_response: {
message_extension: Option<serde_json::Value>,
....
}
...
}
```
### Expected Behavior
**Correct structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_response: {
message_extension: Option<serde_json::Value>,
....
}
...
}
```
we should be able to recieve message_extension field for CartesBacaires 3ds authentication payments via Cybersource
### Actual Behavior
**Current structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_request: {
message_extension: Option<serde_json::Value>,
....
}
...
}
```
we are not able to currently recieve message_extension field for CartesBacaires 3ds authentication payments via Cybersource
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
index 7427cd8cd05..0c12d7415c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
@@ -170,9 +170,9 @@ impl
                     });
 
                 let message_extension = response
-                    .authentication_request
+                    .authentication_response
+                    .message_extension
                     .as_ref()
-                    .and_then(|req| req.message_extension.as_ref())
                     .and_then(|v| match serde_json::to_value(v) {
                         Ok(val) => Some(Secret::new(val)),
                         Err(e) => {
@@ -686,7 +686,6 @@ pub struct NetceteraAuthenticationFailureResponse {
 pub struct AuthenticationRequest {
     #[serde(rename = "threeDSRequestorChallengeInd")]
     pub three_ds_requestor_challenge_ind: Option<ThreedsRequestorChallengeInd>,
-    pub message_extension: Option<serde_json::Value>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -708,6 +707,7 @@ pub struct AuthenticationResponse {
     pub ds_trans_id: Option<String>,
     pub acs_signed_content: Option<String>,
     pub trans_status_reason: Option<String>,
+    pub message_extension: Option<serde_json::Value>,
 }
 
 #[derive(Debug, Deserialize, Serialize, Clone)]
 | 
	2025-08-28T11:21:17Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [X] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR introduces the following struct fix for netcetera authentication response since `message_extension` is recieved in Netcetera's authentication response ARes and not in AReq. 
**Current structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_request: {
message_extension: Option<serde_json::Value>,
....
}
...
}
```
**Correct structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_response: {
message_extension: Option<serde_json::Value>,
....
}
...
}
```
[Ref](https://docs.3dsecure.io/3dsv2/specification_231.html#attr-ARes-messageExtension) -  3dsecure.io docs highlights **message_extension**'s correct placement i.e ARes. Adding reference to 3dsecure.io docs since Netcetera documentation is not super clear.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
`message_extension` field for Netcetera's authentication response is only available in prod
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [X] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	26930a47e905baf647f218328e81529951d4f563 | 
	
`message_extension` field for Netcetera's authentication response is only available in prod
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9085 | 
	Bug: [FEATURE] NTID Support + googlepay & applepay mandate support
### Feature Description
  -  Add NTID proxy support for nuvei. ( NOTE: Nuvei is not responding with NTID as of now hence we cant make ntid originated flow via nuvei to other connector. We are verifying NTID originated from other connector through nuvei. )
-     Extend mandate support for googlepay and applepay. ( decrypt flow only)
### Possible Implementation
Implement NTID AND wallet (GOOGLEPAY + APPLEPAY) MANDATES
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 21ac732394f..482da1feca0 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -209,9 +209,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel"
 pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,nuvei,authorizedotnet"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,nuvei,authorizedotnet"
 wallet.paypal.connector_list = "adyen,novalnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
@@ -258,7 +258,7 @@ card.credit = { connector_list = "cybersource" }            # Update Mandate sup
 card.debit = { connector_list = "cybersource" }             # Update Mandate supported payment method type and connector for card
 
 [network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
+connector_list = "adyen,archipel,cybersource,novalnet,nuvei,stripe,worldpay,worldpayvantiv"
 
 
 [payouts]
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 853ec279f66..090520d1bab 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -209,9 +209,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel"
 pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,nuvei,authorizedotnet"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,nuvei,authorizedotnet"
 wallet.paypal.connector_list = "adyen,novalnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
@@ -258,7 +258,7 @@ card.credit = { connector_list = "cybersource" }            # Update Mandate sup
 card.debit = { connector_list = "cybersource" }             # Update Mandate supported payment method type and connector for card
 
 [network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,stripe,worldpayvantiv"
+connector_list = "adyen,archipel,stripe,nuvei,worldpayvantiv"
 
 [payouts]
 payout_eligibility = true            # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index dbd5e87e520..92ea9264cca 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -216,9 +216,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel"
 pay_later.klarna.connector_list = "adyen"
-wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet"
+wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,nuvei,authorizedotnet"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet"
+wallet.google_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,nuvei,authorizedotnet"
 wallet.paypal.connector_list = "adyen,novalnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
@@ -265,7 +265,7 @@ card.credit = { connector_list = "cybersource" }            # Update Mandate sup
 card.debit = { connector_list = "cybersource" }             # Update Mandate supported payment method type and connector for card
 
 [network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
+connector_list = "adyen,archipel,cybersource,novalnet,nuvei,stripe,worldpay,worldpayvantiv"
 
 
 [payouts]
diff --git a/config/development.toml b/config/development.toml
index 1215c323628..c8da369704b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1048,9 +1048,9 @@ bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
 card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
 pay_later.klarna.connector_list = "adyen,aci"
-wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo,worldpayvantiv"
+wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nuvei,nexinets,novalnet,authorizedotnet,wellsfargo,worldpayvantiv"
 wallet.samsung_pay.connector_list = "cybersource"
-wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,authorizedotnet,wellsfargo,worldpayvantiv"
+wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet,nuvei,authorizedotnet,wellsfargo,worldpayvantiv"
 wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal,authorizedotnet"
 wallet.momo.connector_list = "adyen"
 wallet.kakao_pay.connector_list = "adyen"
@@ -1073,7 +1073,7 @@ card.credit = { connector_list = "cybersource" }
 card.debit = { connector_list = "cybersource" }
 
 [network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
+connector_list = "adyen,archipel,cybersource,novalnet,nuvei,stripe,worldpay,worldpayvantiv"
 
 [connector_request_reference_id_config]
 merchant_ids_send_payment_id_as_connector_request_id = []
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 8fda86c4512..259495d0545 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -114,7 +114,12 @@ impl ConnectorValidation for Nuvei {
         pm_type: Option<enums::PaymentMethodType>,
         pm_data: PaymentMethodData,
     ) -> CustomResult<(), errors::ConnectorError> {
-        let mandate_supported_pmd = std::collections::HashSet::from([PaymentMethodDataType::Card]);
+        let mandate_supported_pmd = std::collections::HashSet::from([
+            PaymentMethodDataType::Card,
+            PaymentMethodDataType::GooglePay,
+            PaymentMethodDataType::ApplePay,
+            PaymentMethodDataType::NetworkTransactionIdAndCardDetails,
+        ]);
         is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
     }
 }
@@ -709,7 +714,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
+
         event_builder.map(|i| i.set_response_body(&response));
+
         router_env::logger::info!(connector_response=?response);
         RouterData::try_from(ResponseRouterData {
             response,
@@ -1286,7 +1293,7 @@ static NUVEI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = Lazy
         enums::PaymentMethod::Wallet,
         enums::PaymentMethodType::ApplePay,
         PaymentMethodDetails {
-            mandates: enums::FeatureStatus::NotSupported,
+            mandates: enums::FeatureStatus::Supported,
             refunds: enums::FeatureStatus::Supported,
             supported_capture_methods: supported_capture_methods.clone(),
             specific_features: None,
@@ -1296,7 +1303,7 @@ static NUVEI_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = Lazy
         enums::PaymentMethod::Wallet,
         enums::PaymentMethodType::GooglePay,
         PaymentMethodDetails {
-            mandates: enums::FeatureStatus::NotSupported,
+            mandates: enums::FeatureStatus::Supported,
             refunds: enums::FeatureStatus::Supported,
             supported_capture_methods: supported_capture_methods.clone(),
             specific_features: None,
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index fa9c3e4d499..e260934852e 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1,4 +1,4 @@
-use common_enums::{enums, CaptureMethod, FutureUsage, PaymentChannel};
+use common_enums::{enums, CaptureMethod, CardNetwork, FutureUsage, PaymentChannel};
 use common_types::payments::{ApplePayPaymentData, GpayTokenizationData};
 use common_utils::{
     crypto::{self, GenerateDigest},
@@ -14,8 +14,8 @@ use error_stack::ResultExt;
 use hyperswitch_domain_models::{
     address::Address,
     payment_method_data::{
-        self, ApplePayWalletData, BankRedirectData, GooglePayWalletData, PayLaterData,
-        PaymentMethodData, WalletData,
+        self, ApplePayWalletData, BankRedirectData, CardDetailsForNetworkTransactionId,
+        GooglePayWalletData, PayLaterData, PaymentMethodData, WalletData,
     },
     router_data::{
         AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData,
@@ -76,6 +76,7 @@ trait NuveiAuthorizePreprocessingCommon {
     fn get_related_transaction_id(&self) -> Option<String>;
     fn get_complete_authorize_url(&self) -> Option<String>;
     fn get_is_moto(&self) -> Option<bool>;
+    fn get_ntid(&self) -> Option<String>;
     fn get_connector_mandate_id(&self) -> Option<String>;
     fn get_return_url_required(
         &self,
@@ -182,13 +183,18 @@ impl NuveiAuthorizePreprocessingCommon for SetupMandateRequestData {
         (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some())
             && self.setup_future_usage == Some(FutureUsage::OffSession)
     }
+    fn get_ntid(&self) -> Option<String> {
+        None
+    }
 }
 
 impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
     fn get_browser_info(&self) -> Option<BrowserInformation> {
         self.browser_info.clone()
     }
-
+    fn get_ntid(&self) -> Option<String> {
+        self.get_optional_network_transaction_id()
+    }
     fn get_related_transaction_id(&self) -> Option<String> {
         self.related_transaction_id.clone()
     }
@@ -328,6 +334,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
     fn get_is_partial_approval(&self) -> Option<PartialApprovalFlag> {
         None
     }
+
+    fn get_ntid(&self) -> Option<String> {
+        None
+    }
 }
 
 #[derive(Debug, Serialize, Default, Deserialize)]
@@ -396,6 +406,7 @@ pub struct NuveiPaymentsRequest {
     pub url_details: Option<UrlDetails>,
     pub amount_details: Option<NuvieAmountDetails>,
     pub is_partial_approval: Option<PartialApprovalFlag>,
+    pub external_scheme_details: Option<ExternalSchemeDetails>,
 }
 
 #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@@ -886,7 +897,12 @@ struct GooglePayInfoCamelCase {
     card_details: Secret<String>,
     assurance_details: Option<GooglePayAssuranceDetailsCamelCase>,
 }
-
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ExternalSchemeDetails {
+    transaction_id: Secret<String>, // This is sensitive information
+    brand: Option<CardNetwork>,
+}
 #[derive(Serialize, Debug)]
 #[serde(rename_all = "camelCase")]
 struct GooglePayAssuranceDetailsCamelCase {
@@ -919,176 +935,203 @@ struct ApplePayPaymentMethodCamelCase {
     #[serde(rename = "type")]
     pm_type: Secret<String>,
 }
-
-impl TryFrom<GooglePayWalletData> for NuveiPaymentsRequest {
-    type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(gpay_data: GooglePayWalletData) -> Result<Self, Self::Error> {
-        match gpay_data.tokenization_data {
-            GpayTokenizationData::Decrypted(ref gpay_predecrypt_data) => Ok(Self {
-                payment_option: PaymentOption {
-                    card: Some(Card {
-                        brand: Some(gpay_data.info.card_network.clone()),
-                        card_number: Some(
-                            gpay_predecrypt_data
-                                .application_primary_account_number
-                                .clone(),
-                        ),
-                        last4_digits: Some(Secret::new(
-                            gpay_predecrypt_data
-                                .application_primary_account_number
-                                .clone()
-                                .get_last4(),
-                        )),
-                        expiration_month: Some(gpay_predecrypt_data.card_exp_month.clone()),
-                        expiration_year: Some(gpay_predecrypt_data.card_exp_year.clone()),
-                        external_token: Some(ExternalToken {
-                            external_token_provider: ExternalTokenProvider::GooglePay,
-                            mobile_token: None,
-                            cryptogram: gpay_predecrypt_data.cryptogram.clone(),
-                            eci_provider: gpay_predecrypt_data.eci_indicator.clone(),
-                        }),
-                        ..Default::default()
+fn get_googlepay_info<F, Req>(
+    item: &RouterData<F, Req, PaymentsResponseData>,
+    gpay_data: &GooglePayWalletData,
+) -> Result<NuveiPaymentsRequest, error_stack::Report<errors::ConnectorError>>
+where
+    Req: NuveiAuthorizePreprocessingCommon,
+{
+    let is_rebilling = if item.request.is_customer_initiated_mandate_payment() {
+        Some("0".to_string())
+    } else {
+        None
+    };
+    match gpay_data.tokenization_data {
+        GpayTokenizationData::Decrypted(ref gpay_predecrypt_data) => Ok(NuveiPaymentsRequest {
+            is_rebilling,
+            payment_option: PaymentOption {
+                card: Some(Card {
+                    brand: Some(gpay_data.info.card_network.clone()),
+                    card_number: Some(
+                        gpay_predecrypt_data
+                            .application_primary_account_number
+                            .clone(),
+                    ),
+                    last4_digits: Some(Secret::new(
+                        gpay_predecrypt_data
+                            .application_primary_account_number
+                            .clone()
+                            .get_last4(),
+                    )),
+                    expiration_month: Some(gpay_predecrypt_data.card_exp_month.clone()),
+                    expiration_year: Some(gpay_predecrypt_data.card_exp_year.clone()),
+                    external_token: Some(ExternalToken {
+                        external_token_provider: ExternalTokenProvider::GooglePay,
+                        mobile_token: None,
+                        cryptogram: gpay_predecrypt_data.cryptogram.clone(),
+                        eci_provider: gpay_predecrypt_data.eci_indicator.clone(),
                     }),
                     ..Default::default()
-                },
+                }),
                 ..Default::default()
-            }),
-            GpayTokenizationData::Encrypted(encrypted_data) => Ok(Self {
-                payment_option: PaymentOption {
-                    card: Some(Card {
-                        external_token: Some(ExternalToken {
-                            external_token_provider: ExternalTokenProvider::GooglePay,
-
-                            mobile_token: {
-                                let (token_type, token) = (
-                                    encrypted_data.token_type.clone(),
-                                    encrypted_data.token.clone(),
-                                );
-
-                                let google_pay: GooglePayCamelCase = GooglePayCamelCase {
-                                    pm_type: Secret::new(gpay_data.pm_type.clone()),
-                                    description: Secret::new(gpay_data.description.clone()),
-                                    info: GooglePayInfoCamelCase {
-                                        card_network: Secret::new(
-                                            gpay_data.info.card_network.clone(),
-                                        ),
-                                        card_details: Secret::new(
-                                            gpay_data.info.card_details.clone(),
-                                        ),
-                                        assurance_details: gpay_data
-                                            .info
-                                            .assurance_details
-                                            .as_ref()
-                                            .map(|details| GooglePayAssuranceDetailsCamelCase {
-                                                card_holder_authenticated: details
-                                                    .card_holder_authenticated,
-                                                account_verified: details.account_verified,
-                                            }),
-                                    },
-                                    tokenization_data: GooglePayTokenizationDataCamelCase {
-                                        token_type: token_type.into(),
-                                        token: token.into(),
-                                    },
-                                };
-                                Some(Secret::new(
-                                    google_pay.encode_to_string_of_json().change_context(
-                                        errors::ConnectorError::RequestEncodingFailed,
-                                    )?,
-                                ))
-                            },
-                            cryptogram: None,
-                            eci_provider: None,
-                        }),
-                        ..Default::default()
+            },
+            ..Default::default()
+        }),
+        GpayTokenizationData::Encrypted(ref encrypted_data) => Ok(NuveiPaymentsRequest {
+            is_rebilling,
+            payment_option: PaymentOption {
+                card: Some(Card {
+                    external_token: Some(ExternalToken {
+                        external_token_provider: ExternalTokenProvider::GooglePay,
+
+                        mobile_token: {
+                            let (token_type, token) = (
+                                encrypted_data.token_type.clone(),
+                                encrypted_data.token.clone(),
+                            );
+
+                            let google_pay: GooglePayCamelCase = GooglePayCamelCase {
+                                pm_type: Secret::new(gpay_data.pm_type.clone()),
+                                description: Secret::new(gpay_data.description.clone()),
+                                info: GooglePayInfoCamelCase {
+                                    card_network: Secret::new(gpay_data.info.card_network.clone()),
+                                    card_details: Secret::new(gpay_data.info.card_details.clone()),
+                                    assurance_details: gpay_data
+                                        .info
+                                        .assurance_details
+                                        .as_ref()
+                                        .map(|details| GooglePayAssuranceDetailsCamelCase {
+                                            card_holder_authenticated: details
+                                                .card_holder_authenticated,
+                                            account_verified: details.account_verified,
+                                        }),
+                                },
+                                tokenization_data: GooglePayTokenizationDataCamelCase {
+                                    token_type: token_type.into(),
+                                    token: token.into(),
+                                },
+                            };
+                            Some(Secret::new(
+                                google_pay.encode_to_string_of_json().change_context(
+                                    errors::ConnectorError::RequestEncodingFailed,
+                                )?,
+                            ))
+                        },
+                        cryptogram: None,
+                        eci_provider: None,
                     }),
                     ..Default::default()
-                },
+                }),
                 ..Default::default()
-            }),
-        }
+            },
+            ..Default::default()
+        }),
     }
 }
-impl TryFrom<ApplePayWalletData> for NuveiPaymentsRequest {
-    type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(apple_pay_data: ApplePayWalletData) -> Result<Self, Self::Error> {
-        match apple_pay_data.payment_data {
-            ApplePayPaymentData::Decrypted(apple_pay_predecrypt_data) => Ok(Self {
-                payment_option: PaymentOption {
-                    card: Some(Card {
-                        brand:Some(apple_pay_data.payment_method.network.clone()),
-                        card_number: Some(
-                            apple_pay_predecrypt_data
-                                .application_primary_account_number
-                                .clone(),
-                        ),
-                        last4_digits: Some(Secret::new(
-                            apple_pay_predecrypt_data
-                                .application_primary_account_number
-                                .get_last4(),
-                        )),
-                        expiration_month: Some(
+
+fn get_applepay_info<F, Req>(
+    item: &RouterData<F, Req, PaymentsResponseData>,
+    apple_pay_data: &ApplePayWalletData,
+) -> Result<NuveiPaymentsRequest, error_stack::Report<errors::ConnectorError>>
+where
+    Req: NuveiAuthorizePreprocessingCommon,
+{
+    let is_rebilling = if item.request.is_customer_initiated_mandate_payment() {
+        Some("0".to_string())
+    } else {
+        None
+    };
+    match apple_pay_data.payment_data {
+        ApplePayPaymentData::Decrypted(ref apple_pay_predecrypt_data) => Ok(NuveiPaymentsRequest {
+           is_rebilling,
+            payment_option: PaymentOption {
+                card: Some(Card {
+                    brand: Some(apple_pay_data.payment_method.network.clone()),
+                    card_number: Some(
+                        apple_pay_predecrypt_data
+                            .application_primary_account_number
+                            .clone(),
+                    ),
+                    last4_digits: Some(Secret::new(
+                        apple_pay_predecrypt_data
+                            .application_primary_account_number
+                            .get_last4(),
+                    )),
+                    expiration_month: Some(
+                        apple_pay_predecrypt_data
+                            .application_expiration_month
+                            .clone(),
+                    ),
+                    expiration_year: Some(
+                        apple_pay_predecrypt_data
+                            .application_expiration_year
+                            .clone(),
+                    ),
+                    external_token: Some(ExternalToken {
+                        external_token_provider: ExternalTokenProvider::ApplePay,
+                        mobile_token: None,
+                        cryptogram: Some(
                             apple_pay_predecrypt_data
-                                .application_expiration_month
+                                .payment_data
+                                .online_payment_cryptogram
                                 .clone(),
                         ),
-                        expiration_year: Some(
+                        eci_provider: Some(
                             apple_pay_predecrypt_data
-                                .application_expiration_year
-                                .clone(),
+                                .payment_data
+                                .eci_indicator.clone()
+                                .ok_or_else(missing_field_err(
+                                "payment_method_data.wallet.apple_pay.payment_data.eci_indicator",
+                            ))?,
                         ),
-                        external_token: Some(ExternalToken {
-                            external_token_provider: ExternalTokenProvider::ApplePay,
-                            mobile_token: None,
-                            cryptogram: Some(
-                                apple_pay_predecrypt_data
-                                    .payment_data
-                                    .online_payment_cryptogram,
-                            ),
-                            eci_provider: Some(
-                                apple_pay_predecrypt_data
-                                    .payment_data
-                                    .eci_indicator
-                                    .ok_or_else(missing_field_err("payment_method_data.wallet.apple_pay.payment_data.eci_indicator"))?,
-                            ),
-                        }),
-                        ..Default::default()
                     }),
                     ..Default::default()
-                },
+                }),
                 ..Default::default()
-            }),
-            ApplePayPaymentData::Encrypted(encrypted_data) => Ok(Self {
-                payment_option: PaymentOption {
-                    card: Some(Card {
-                        external_token: Some(ExternalToken {
-                            external_token_provider: ExternalTokenProvider::ApplePay,
-                            mobile_token: {
-                                let apple_pay: ApplePayCamelCase = ApplePayCamelCase {
-                                     payment_data:encrypted_data.into(),
-                                     payment_method: ApplePayPaymentMethodCamelCase {
-                                         display_name: Secret::new(apple_pay_data.payment_method.display_name.clone()),
-                                         network: Secret::new(apple_pay_data.payment_method.network.clone()),
-                                         pm_type: Secret::new(apple_pay_data.payment_method.pm_type.clone()),
-                                     },
-                                     transaction_identifier: Secret::new(apple_pay_data.transaction_identifier.clone()),
-                                    };
-
-                                Some(Secret::new(
-                                    apple_pay.encode_to_string_of_json().change_context(
-                                        errors::ConnectorError::RequestEncodingFailed,
-                                    )?,
-                                ))
-                            },
-                            cryptogram: None,
-                            eci_provider: None,
-                        }),
-                        ..Default::default()
+            },
+            ..Default::default()
+        }),
+        ApplePayPaymentData::Encrypted(ref encrypted_data) => Ok(NuveiPaymentsRequest {
+           is_rebilling,
+            payment_option: PaymentOption {
+                card: Some(Card {
+                    external_token: Some(ExternalToken {
+                        external_token_provider: ExternalTokenProvider::ApplePay,
+                        mobile_token: {
+                            let apple_pay: ApplePayCamelCase = ApplePayCamelCase {
+                                payment_data: encrypted_data.to_string().into(),
+                                payment_method: ApplePayPaymentMethodCamelCase {
+                                    display_name: Secret::new(
+                                        apple_pay_data.payment_method.display_name.clone(),
+                                    ),
+                                    network: Secret::new(
+                                        apple_pay_data.payment_method.network.clone(),
+                                    ),
+                                    pm_type: Secret::new(
+                                        apple_pay_data.payment_method.pm_type.clone(),
+                                    ),
+                                },
+                                transaction_identifier: Secret::new(
+                                    apple_pay_data.transaction_identifier.clone(),
+                                ),
+                            };
+
+                            Some(Secret::new(
+                                apple_pay.encode_to_string_of_json().change_context(
+                                    errors::ConnectorError::RequestEncodingFailed,
+                                )?,
+                            ))
+                        },
+                        cryptogram: None,
+                        eci_provider: None,
                     }),
                     ..Default::default()
-                },
+                }),
                 ..Default::default()
-            }),
-        }
+            },
+            ..Default::default()
+        }),
     }
 }
 
@@ -1336,6 +1379,52 @@ where
     })
 }
 
+fn get_ntid_card_info<F, Req>(
+    router_data: &RouterData<F, Req, PaymentsResponseData>,
+    data: CardDetailsForNetworkTransactionId,
+) -> Result<NuveiPaymentsRequest, error_stack::Report<errors::ConnectorError>>
+where
+    Req: NuveiAuthorizePreprocessingCommon,
+{
+    let external_scheme_details = Some(ExternalSchemeDetails {
+        transaction_id: router_data
+            .request
+            .get_ntid()
+            .ok_or_else(missing_field_err("network_transaction_id"))
+            .attach_printable("Nuvei unable to find NTID for MIT")?
+            .into(),
+        brand: Some(
+            data.card_network
+                .ok_or_else(missing_field_err("recurring_details.data.card_network"))?,
+        ),
+    });
+    let payment_option: PaymentOption = PaymentOption {
+        card: Some(Card {
+            card_number: Some(data.card_number),
+            card_holder_name: data.card_holder_name,
+            expiration_month: Some(data.card_exp_month),
+            expiration_year: Some(data.card_exp_year),
+            ..Default::default() // CVV should be disabled by nuvei fo
+        }),
+        redirect_url: None,
+        user_payment_option_id: None,
+        alternative_payment_method: None,
+        billing_address: None,
+        shipping_address: None,
+    };
+    let is_rebilling = if router_data.request.is_customer_initiated_mandate_payment() {
+        Some("0".to_string())
+    } else {
+        None
+    };
+    Ok(NuveiPaymentsRequest {
+        external_scheme_details,
+        payment_option,
+        is_rebilling,
+        ..Default::default()
+    })
+}
+
 impl<F, Req> TryFrom<(&RouterData<F, Req, PaymentsResponseData>, String)> for NuveiPaymentsRequest
 where
     Req: NuveiAuthorizePreprocessingCommon,
@@ -1348,9 +1437,12 @@ where
         let request_data = match item.request.get_payment_method_data_required()?.clone() {
             PaymentMethodData::Card(card) => get_card_info(item, &card),
             PaymentMethodData::MandatePayment => Self::try_from(item),
+            PaymentMethodData::CardDetailsForNetworkTransactionId(data) => {
+                get_ntid_card_info(item, data)
+            }
             PaymentMethodData::Wallet(wallet) => match wallet {
-                WalletData::GooglePay(gpay_data) => Self::try_from(gpay_data),
-                WalletData::ApplePay(apple_pay_data) => Ok(Self::try_from(apple_pay_data)?),
+                WalletData::GooglePay(gpay_data) => get_googlepay_info(item, &gpay_data),
+                WalletData::ApplePay(apple_pay_data) => get_applepay_info(item, &apple_pay_data),
                 WalletData::PaypalRedirect(_) => Self::foreign_try_from((
                     AlternativePaymentMethodType::Expresscheckout,
                     None,
@@ -1463,13 +1555,10 @@ where
             | PaymentMethodData::GiftCard(_)
             | PaymentMethodData::OpenBanking(_)
             | PaymentMethodData::CardToken(_)
-            | PaymentMethodData::NetworkToken(_)
-            | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
-                Err(errors::ConnectorError::NotImplemented(
-                    utils::get_unimplemented_payment_method_error_message("nuvei"),
-                )
-                .into())
-            }
+            | PaymentMethodData::NetworkToken(_) => Err(errors::ConnectorError::NotImplemented(
+                utils::get_unimplemented_payment_method_error_message("nuvei"),
+            )
+            .into()),
         }?;
         let currency = item.request.get_currency_required()?;
         let request = Self::try_from(NuveiPaymentRequestData {
 | 
	2025-08-29T04:32:45Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
1. Add NTID proxy support for nuvei. ( NOTE: Nuvei is not responding with NTID as of now hence we cant make ntid originated flow via nuvei to other connector. We are verifying NTID originated from other connector through nuvei. )
2. Extend mandate support for googlepay and applepay. ( decrypt flow only) 
## test 
### 1. NTID Proxy flow
1. Enable `is_connector_agnostic_mit_enabled` for business profile.
```sh
curl --location 'localhost:8080/account/merchant_1756365601/business_profile/pro_081OLMJnVwN9FKpv728n' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_DtdoS2OQrXtZtx2ORkcSVGmwPs6fnV73boCOqv3XkXZa4RdYAxu8MEEIzIVplGQi' \
--data '{
 "is_connector_agnostic_mit_enabled":true
}'
```
<details>
<summary> Make a mandate payment via cybersource to get ntid </summary>
## Request
```json
{
    "amount": 0,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "singh",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "connector": [
        "cybersource"
    ],
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "setup_future_usage": "off_session",
    "payment_type": "setup_mandate",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}
```
## response
```json
{
    "payment_id": "pay_xmji3uvqkwBFMjMBxRAZ",
    "merchant_id": "merchant_1756365601",
    "status": "processing",
    "amount": 0,
    "net_amount": 0,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_xmji3uvqkwBFMjMBxRAZ_secret_LyBJlTjcQFbIqyIviNiG",
    "created": "2025-08-29T04:10:34.820Z",
    "currency": "USD",
    "customer_id": "singh",
    "customer": {
        "id": "singh",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_B4GiWHRdxg3g3BjsvoWY",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": [
        {
            "sku": null,
            "upc": null,
            "brand": null,
            "amount": 0,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "description": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "total_amount": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "unit_discount_amount": null
        }
    ],
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "singh",
        "created_at": 1756440634,
        "expires": 1756444234,
        "secret": "epk_7eb79d3657f24ff285bd9a532dc966f3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7564406363016111504807",
    "frm_message": null,
    "metadata": {},
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_xmji3uvqkwBFMjMBxRAZ_1",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_iXmGyeq1jo6FcvXLsQ78",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T04:25:34.819Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_DIW13s8bZ8neb24aSnov",
    "network_transaction_id": "016150703802094",
    "payment_method_status": "inactive",
    "updated": "2025-08-29T04:10:37.227Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
<summary> Make a proxy call with nuvei with cybersource obtained ntid </summary>
##  Request
```json
{
    "amount": 10023,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
 
    "payment_method": "card",
    "payment_method_type": "credit",
    "off_session": true,
    "recurring_details": {
        "type": "network_transaction_id_and_card_details",
        "data": {
            "card_number": "4242424242424242",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_network":"VISA",
            "network_transaction_id": "016150703802094"
        }
    }
}
```
## Response
```json
{
    "payment_id": "pay_75VJuP2CMXo3Z43zThif",
    "merchant_id": "merchant_1756365601",
    "status": "succeeded",
    "amount": 10023,
    "net_amount": 10023,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 10023,
    "connector": "nuvei",
    "client_secret": "pay_75VJuP2CMXo3Z43zThif_secret_rHK1wcFimQTTTjwb6A72",
    "created": "2025-08-29T04:17:33.772Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": null,
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1756441053,
        "expires": 1756444653,
        "secret": "epk_9107d76964ea44bb821a5a44eeabf189"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016800600",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "8321086111",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T04:32:33.772Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-29T04:17:35.842Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
### 2. NTID confirm via nuvei using payment token
<details>
<summary>  Create a on session payment via cybersource</summary>
## Request
```json
{
    "amount": 390,
    "currency": "USD",
    "confirm": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "singh",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "connector": [
        "cybersource"
    ],
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "setup_future_usage": "on_session",
    "payment_type": "setup_mandate",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}
```
## Response
```json
{
    "payment_id": "pay_1ImanuhWyquBc95H6hns",
    "merchant_id": "merchant_1756365601",
    "status": "requires_confirmation",
    "amount": 390,
    "net_amount": 390,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_1ImanuhWyquBc95H6hns_secret_llGkXJVaZI2TYZHvHI7v",
    "created": "2025-08-29T05:48:04.092Z",
    "currency": "USD",
    "customer_id": "singh",
    "customer": {
        "id": "singh",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_oq7VkgN5Ao3OAXnX190c",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": [
        {
            "sku": null,
            "upc": null,
            "brand": null,
            "amount": 0,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "description": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "total_amount": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "unit_discount_amount": null
        }
    ],
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "singh",
        "created_at": 1756446484,
        "expires": 1756450084,
        "secret": "epk_607f5a2355114e88b1e75523be174604"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {},
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T06:03:04.092Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-29T05:48:04.118Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
 
<details>
<summary> Confirm via nuvei passing the payment token </summary>
## Request
```sh
curl --location --globoff '{{baseUrl}}/payments/{{payment_id}}/confirm' \
--header 'api-key: api-key' \
--header 'Content-Type: application/json' \
--data '{
    "payment_method": "card",
    "routing": {
        "type": "single",
        "data": {
            "connector": "nuvei",
            "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc"
        }
    },
    "payment_token": "token_dWdH51U5LEGh7XA1qntS"
    
}'
```
## Response
```json
{
    "payment_id": "pay_1ImanuhWyquBc95H6hns",
    "merchant_id": "merchant_1756365601",
    "status": "succeeded",
    "amount": 390,
    "net_amount": 390,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 390,
    "connector": "nuvei",
    "client_secret": "pay_1ImanuhWyquBc95H6hns_secret_llGkXJVaZI2TYZHvHI7v",
    "created": "2025-08-29T05:48:04.092Z",
    "currency": "USD",
    "customer_id": "singh",
    "customer": {
        "id": "singh",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_oq7VkgN5Ao3OAXnX190c",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": [
        {
            "sku": null,
            "upc": null,
            "brand": null,
            "amount": 0,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "description": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "total_amount": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "unit_discount_amount": null
        }
    ],
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016803027",
    "frm_message": null,
    "metadata": {},
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8321797111",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T06:03:04.092Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": null,
        "time_zone": null,
        "ip_address": "::1",
        "os_version": null,
        "user_agent": null,
        "color_depth": null,
        "device_model": null,
        "java_enabled": null,
        "screen_width": null,
        "accept_header": null,
        "screen_height": null,
        "accept_language": "en",
        "java_script_enabled": null
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-29T05:48:19.225Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
### 3. Google pay mandates
<details>
<summary>Google pay Mandates </summary>
## Googlepay Mandate Request
```json
{
    "amount": 12,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
        "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    // "order_tax_amount": 100,
    "setup_future_usage": "off_session",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "UA",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        },
        "email":"test@gmail.com"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "tokenization_data": {
                    "application_primary_account_number": "4761*********1390",
                    "card_exp_month": "12",
                    "card_exp_year": "25",
                    "cryptogram": "ejJ******************U=",
                    "eci_indicator": "5"
                },
                "info": {
                    "card_details": "Discover 9319",
                    "card_network": "VISA"
                },
                "description": "something"
            }
        }
    }
}
```
## Response
```json
{
    "payment_id": "pay_iywIHCV5A8QA4mtOWyGt",
    "merchant_id": "merchant_1756365601",
    "status": "succeeded",
    "amount": 0,
    "net_amount": 0,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 0,
    "connector": "nuvei",
    "client_secret": "pay_iywIHCV5A8QA4mtOWyGt_secret_p1YwZ5CEGkcNI5Gb07m1",
    "created": "2025-08-29T05:53:15.386Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "Discover 9319",
                "card_network": "VISA",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "UA",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": "test@gmail.com"
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1756446795,
        "expires": 1756450395,
        "secret": "epk_56c83dfed43e4766bdc0b4de08459f5b"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016803203",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8321860111",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T06:08:15.386Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_jovQAOvn8XLwQg9OunFi",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-29T05:53:17.641Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2117920111",
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
 ## Mandate request using payment_method_id
```json
{
    "amount": 333,
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "{{payment_method_id}}"//pass the payment method id here
    },
       "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    }
}
```
## Mandate Response 
```JSON
{
    "payment_id": "pay_QuQhI84yF81WPOAlV0LU",
    "merchant_id": "merchant_1756365601",
    "status": "succeeded",
    "amount": 333,
    "net_amount": 333,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 333,
    "connector": "nuvei",
    "client_secret": "pay_QuQhI84yF81WPOAlV0LU_secret_wtlIXP9sC20TnmhOQPUv",
    "created": "2025-08-29T05:54:22.157Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "Discover 9319",
                "card_network": "VISA",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1756446862,
        "expires": 1756450462,
        "secret": "epk_ed76e2ce25ec45c5959e2219bfc2c686"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016803225",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8321866111",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T06:09:22.157Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_jovQAOvn8XLwQg9OunFi",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-29T05:54:24.044Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2117920111",
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
### 4. Applepay mandate
<details>
<summary> Apple pay mandates </summary>
## applepay mandate request
```json
{
    "amount": 1,
    "currency": "EUR",
    "confirm": true,
    // "order_tax_amount": 100,
    // "setup_future_usage": "off_session",
    // "payment_type":"setup_mandate",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    // "order_tax_amount": 100,
    "setup_future_usage": "off_session",
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        },
        "email": "nithingowdan77@gmail.com"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": {
                    "application_primary_account_number": "42*****2",
                    "application_expiration_month": "09",
                    "application_expiration_year": "30",
                    "application_brand": "VISA",
                    "payment_data": {
                        "online_payment_cryptogram": "Ar******A",
                        "eci_indicator": "7"
                    }
                },
                "payment_method": {
                    "display_name": "Discover 9319",
                    "network": "VISA",
                    "type": "debit"
                },
                "transaction_identifier": "c635c5b3af900d*******ee65ec7afd988a678194751"
            }
        }
    }
}
```
## Response
```json
{
    "payment_id": "pay_m3H9lmnjHemVrTDl86Ra",
    "merchant_id": "merchant_1756365601",
    "status": "succeeded",
    "amount": 1,
    "net_amount": 1,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1,
    "connector": "nuvei",
    "client_secret": "pay_m3H9lmnjHemVrTDl86Ra_secret_0nQUY9G0znF1u8ZghnO0",
    "created": "2025-08-29T05:59:23.232Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "9319",
                "card_network": "VISA",
                "type": "debit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": "nithingowdan77@gmail.com"
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1756447163,
        "expires": 1756450763,
        "secret": "epk_ff4001bc18034075a9ea2c1cea803978"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016803352",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8321903111",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T06:14:23.232Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_ojHZfjBQMQscy9fSih5M",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-29T05:59:29.451Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2109690111",
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
## MIT using payment method id
### Request
```json
{
    "amount": 333,
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "{{payment_method_id}}"//pass the payment method id here
    },
       "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    }
}
```
### Response
```json
{
    "payment_id": "pay_V80VZo4t4Cimc1AjRECd",
    "merchant_id": "merchant_1756365601",
    "status": "succeeded",
    "amount": 333,
    "net_amount": 333,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 333,
    "connector": "nuvei",
    "client_secret": "pay_V80VZo4t4Cimc1AjRECd_secret_8H3jqd3Fl0Wa6qVrxocf",
    "created": "2025-08-29T06:01:47.718Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "9319",
                "card_network": "VISA",
                "type": "debit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1756447307,
        "expires": 1756450907,
        "secret": "epk_fcc84a432dec4a869b1cac1e7a034147"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016803458",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8321949111",
    "payment_link": null,
    "profile_id": "pro_Gb5wEfhtfFlPj8H5vses",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RFiJ87uP0hCqNImMBrZc",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-29T06:16:47.718Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_ojHZfjBQMQscy9fSih5M",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-29T06:01:52.065Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2109690111",
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
 | 
	9f0cd51cabb281de82b00734b532fea3cf6205fe | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9101 | 
	Bug: Gift Card Balance check API for split payments
We need to add an API to check balance for gift card.
This API will be called by the SDK and based on the gift card balance and transaction amount, we will collect either only gift card details or gift card details + another payment method | 
	diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
index 2571ca53816..8a0af806334 100644
--- a/crates/api_models/src/events/payment.rs
+++ b/crates/api_models/src/events/payment.rs
@@ -181,6 +181,13 @@ impl ApiEventMetric for PaymentsCreateIntentRequest {
     }
 }
 
+#[cfg(feature = "v2")]
+impl ApiEventMetric for payments::GiftCardBalanceCheckResponse {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        None
+    }
+}
+
 #[cfg(feature = "v2")]
 impl ApiEventMetric for PaymentsRequest {
     fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 52f75bbe8be..62390067d3b 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -664,6 +664,23 @@ pub struct PaymentsIntentResponse {
     pub payment_type: api_enums::PaymentType,
 }
 
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct GiftCardBalanceCheckResponse {
+    /// Global Payment Id for the payment
+    #[schema(value_type = String)]
+    pub payment_id: id_type::GlobalPaymentId,
+    /// The balance of the gift card
+    pub balance: MinorUnit,
+    /// The currency of the Gift Card
+    #[schema(value_type = Currency)]
+    pub currency: common_enums::Currency,
+    /// Whether the gift card balance is enough for the transaction (Used for split payments case)
+    pub needs_additional_pm_data: bool,
+    /// Transaction amount left after subtracting gift card balance (Used for split payments)
+    pub remaining_amount: MinorUnit,
+}
+
 #[cfg(feature = "v2")]
 #[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
 pub struct AmountDetails {
@@ -5768,6 +5785,17 @@ pub struct PaymentsConfirmIntentRequest {
     pub return_raw_connector_response: Option<bool>,
 }
 
+// Serialize is implemented because, this will be serialized in the api events.
+// Usually request types should not have serialize implemented.
+//
+/// Request for Gift Card balance check
+#[cfg(feature = "v2")]
+#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct PaymentsGiftCardBalanceCheckRequest {
+    pub gift_card_data: GiftCardData,
+}
+
 #[cfg(feature = "v2")]
 #[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
 #[serde(deny_unknown_fields)]
diff --git a/crates/common_utils/src/id_type/global_id/payment.rs b/crates/common_utils/src/id_type/global_id/payment.rs
index 94ffbed57af..b6d62689ec5 100644
--- a/crates/common_utils/src/id_type/global_id/payment.rs
+++ b/crates/common_utils/src/id_type/global_id/payment.rs
@@ -36,6 +36,11 @@ impl GlobalPaymentId {
     ) -> String {
         format!("{runner}_{task}_{}", self.get_string_repr())
     }
+
+    /// Generate a key for gift card connector
+    pub fn get_gift_card_connector_key(&self) -> String {
+        format!("gift_mca_{}", self.get_string_repr())
+    }
 }
 
 // TODO: refactor the macro to include this id use case as well
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs
index 47f2eefeafc..a07986ba18e 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs
@@ -25,24 +25,25 @@ use hyperswitch_domain_models::{
             Void,
         },
         refunds::{Execute, RSync},
-        Accept, Defend, Evidence, Retrieve, Upload,
+        Accept, Defend, Evidence, GiftCardBalanceCheck, Retrieve, Upload,
     },
     router_request_types::{
         AcceptDisputeRequestData, AccessTokenRequestData, DefendDisputeRequestData,
-        PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, RetrieveFileRequestData, SetupMandateRequestData, SubmitEvidenceRequestData,
-        SyncRequestType, UploadFileRequestData,
+        GiftCardBalanceCheckRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData,
+        PaymentsSyncData, RefundsData, RetrieveFileRequestData, SetupMandateRequestData,
+        SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData,
     },
     router_response_types::{
-        AcceptDisputeResponse, ConnectorInfo, DefendDisputeResponse, PaymentMethodDetails,
-        PaymentsResponseData, RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
-        SupportedPaymentMethods, SupportedPaymentMethodsExt, UploadFileResponse,
+        AcceptDisputeResponse, ConnectorInfo, DefendDisputeResponse,
+        GiftCardBalanceCheckResponseData, PaymentMethodDetails, PaymentsResponseData,
+        RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse, SupportedPaymentMethods,
+        SupportedPaymentMethodsExt, UploadFileResponse,
     },
     types::{
         PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
-        PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundsRouterData,
-        SetupMandateRouterData,
+        PaymentsGiftCardBalanceCheckRouterData, PaymentsPreProcessingRouterData,
+        PaymentsSyncRouterData, RefundsRouterData, SetupMandateRouterData,
     },
 };
 #[cfg(feature = "payouts")]
@@ -69,8 +70,8 @@ use hyperswitch_interfaces::{
     events::connector_api_logs::ConnectorEvent,
     types::{
         AcceptDisputeType, DefendDisputeType, PaymentsAuthorizeType, PaymentsCaptureType,
-        PaymentsPreProcessingType, PaymentsSyncType, PaymentsVoidType, RefundExecuteType, Response,
-        SetupMandateType, SubmitEvidenceType,
+        PaymentsGiftCardBalanceCheckType, PaymentsPreProcessingType, PaymentsSyncType,
+        PaymentsVoidType, RefundExecuteType, Response, SetupMandateType, SubmitEvidenceType,
     },
     webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
 };
@@ -416,6 +417,7 @@ impl api::PaymentCapture for Adyen {}
 impl api::MandateSetup for Adyen {}
 impl api::ConnectorAccessToken for Adyen {}
 impl api::PaymentToken for Adyen {}
+impl api::PaymentsGiftCardBalanceCheck for Adyen {}
 
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Adyen
@@ -1164,6 +1166,114 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Ad
     }
 }
 
+impl
+    ConnectorIntegration<
+        GiftCardBalanceCheck,
+        GiftCardBalanceCheckRequestData,
+        GiftCardBalanceCheckResponseData,
+    > for Adyen
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsGiftCardBalanceCheckRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+        let mut header = vec![(
+            headers::CONTENT_TYPE.to_string(),
+            PaymentsGiftCardBalanceCheckType::get_content_type(self)
+                .to_string()
+                .into(),
+        )];
+        let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+        header.append(&mut api_key);
+        Ok(header)
+    }
+
+    fn get_url(
+        &self,
+        req: &PaymentsGiftCardBalanceCheckRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let endpoint = build_env_specific_endpoint(
+            self.base_url(connectors),
+            req.test_mode,
+            &req.connector_meta_data,
+        )?;
+        Ok(format!(
+            "{endpoint}{ADYEN_API_VERSION}/paymentMethods/balance",
+        ))
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsGiftCardBalanceCheckRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_req = adyen::AdyenBalanceRequest::try_from(req)?;
+
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsGiftCardBalanceCheckRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&PaymentsGiftCardBalanceCheckType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(PaymentsGiftCardBalanceCheckType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(PaymentsGiftCardBalanceCheckType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsGiftCardBalanceCheckRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsGiftCardBalanceCheckRouterData, errors::ConnectorError> {
+        let response: adyen::AdyenBalanceResponse = res
+            .response
+            .parse_struct("AdyenBalanceResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+        .change_context(errors::ConnectorError::ResponseHandlingFailed)
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+
+    fn get_5xx_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
 impl api::Payouts for Adyen {}
 #[cfg(feature = "payouts")]
 impl api::PayoutCancel for Adyen {}
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 4858e70b6fc..6b679f40b1f 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -27,14 +27,19 @@ use hyperswitch_domain_models::{
     router_data::{
         ConnectorAuthType, ErrorResponse, PaymentMethodBalance, PaymentMethodToken, RouterData,
     },
-    router_request_types::{PaymentsPreProcessingData, ResponseId, SubmitEvidenceRequestData},
+    router_flow_types::GiftCardBalanceCheck,
+    router_request_types::{
+        GiftCardBalanceCheckRequestData, PaymentsPreProcessingData, ResponseId,
+        SubmitEvidenceRequestData,
+    },
     router_response_types::{
-        AcceptDisputeResponse, DefendDisputeResponse, MandateReference, PaymentsResponseData,
-        RedirectForm, RefundsResponseData, SubmitEvidenceResponse,
+        AcceptDisputeResponse, DefendDisputeResponse, GiftCardBalanceCheckResponseData,
+        MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData,
+        SubmitEvidenceResponse,
     },
     types::{
         PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
-        PaymentsPreProcessingRouterData, RefundsRouterData,
+        PaymentsGiftCardBalanceCheckRouterData, PaymentsPreProcessingRouterData, RefundsRouterData,
     },
 };
 #[cfg(feature = "payouts")]
@@ -1805,6 +1810,41 @@ impl TryFrom<&PaymentsPreProcessingRouterData> for AdyenBalanceRequest<'_> {
     }
 }
 
+impl TryFrom<&PaymentsGiftCardBalanceCheckRouterData> for AdyenBalanceRequest<'_> {
+    type Error = Error;
+    fn try_from(item: &PaymentsGiftCardBalanceCheckRouterData) -> Result<Self, Self::Error> {
+        let payment_method = match &item.request.payment_method_data {
+            PaymentMethodData::GiftCard(gift_card_data) => match gift_card_data.as_ref() {
+                GiftCardData::Givex(gift_card_data) => {
+                    let balance_pm = BalancePmData {
+                        number: gift_card_data.number.clone(),
+                        cvc: gift_card_data.cvc.clone(),
+                    };
+                    Ok(AdyenPaymentMethod::PaymentMethodBalance(Box::new(
+                        balance_pm,
+                    )))
+                }
+                GiftCardData::PaySafeCard {} | GiftCardData::BhnCardNetwork(_) => {
+                    Err(errors::ConnectorError::FlowNotSupported {
+                        flow: "Balance".to_string(),
+                        connector: "adyen".to_string(),
+                    })
+                }
+            },
+            _ => Err(errors::ConnectorError::FlowNotSupported {
+                flow: "Balance".to_string(),
+                connector: "adyen".to_string(),
+            }),
+        }?;
+
+        let auth_type = AdyenAuthType::try_from(&item.connector_auth_type)?;
+        Ok(Self {
+            payment_method,
+            merchant_account: auth_type.merchant_account,
+        })
+    }
+}
+
 impl From<&PaymentsAuthorizeRouterData> for AdyenShopperInteraction {
     fn from(item: &PaymentsAuthorizeRouterData) -> Self {
         match item.request.off_session {
@@ -3929,6 +3969,40 @@ impl<F>
     }
 }
 
+impl
+    TryFrom<
+        ResponseRouterData<
+            GiftCardBalanceCheck,
+            AdyenBalanceResponse,
+            GiftCardBalanceCheckRequestData,
+            GiftCardBalanceCheckResponseData,
+        >,
+    >
+    for RouterData<
+        GiftCardBalanceCheck,
+        GiftCardBalanceCheckRequestData,
+        GiftCardBalanceCheckResponseData,
+    >
+{
+    type Error = Error;
+    fn try_from(
+        item: ResponseRouterData<
+            GiftCardBalanceCheck,
+            AdyenBalanceResponse,
+            GiftCardBalanceCheckRequestData,
+            GiftCardBalanceCheckResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            response: Ok(GiftCardBalanceCheckResponseData {
+                balance: item.response.balance.value,
+                currency: item.response.balance.currency,
+            }),
+            ..item.data
+        })
+    }
+}
+
 pub fn get_adyen_response(
     response: AdyenResponse,
     is_capture_manual: bool,
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 1e404df7f97..8b742d71026 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -35,9 +35,9 @@ use hyperswitch_domain_models::{
         mandate_revoke::MandateRevoke,
         payments::{
             Approve, AuthorizeSessionToken, CalculateTax, CompleteAuthorize,
-            CreateConnectorCustomer, CreateOrder, IncrementalAuthorization, PostCaptureVoid,
-            PostProcessing, PostSessionTokens, PreProcessing, Reject, SdkSessionUpdate,
-            UpdateMetadata,
+            CreateConnectorCustomer, CreateOrder, GiftCardBalanceCheck, IncrementalAuthorization,
+            PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, Reject,
+            SdkSessionUpdate, UpdateMetadata,
         },
         subscriptions::GetSubscriptionPlans,
         webhooks::VerifyWebhookSource,
@@ -56,8 +56,8 @@ use hyperswitch_domain_models::{
         AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AuthorizeSessionTokenData,
         CompleteAuthorizeData, ConnectorCustomerData, CreateOrderRequestData,
         DefendDisputeRequestData, DisputeSyncData, ExternalVaultProxyPaymentsData,
-        FetchDisputesRequestData, MandateRevokeRequestData, PaymentsApproveData,
-        PaymentsAuthenticateData, PaymentsCancelPostCaptureData,
+        FetchDisputesRequestData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,
+        PaymentsApproveData, PaymentsAuthenticateData, PaymentsCancelPostCaptureData,
         PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
         PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
         PaymentsPreProcessingData, PaymentsRejectData, PaymentsTaxCalculationData,
@@ -68,9 +68,10 @@ use hyperswitch_domain_models::{
     router_response_types::{
         subscriptions::GetSubscriptionPlansResponse, AcceptDisputeResponse,
         AuthenticationResponseData, DefendDisputeResponse, DisputeSyncResponse,
-        FetchDisputesResponse, MandateRevokeResponseData, PaymentsResponseData,
-        RetrieveFileResponse, SubmitEvidenceResponse, TaxCalculationResponseData,
-        UploadFileResponse, VaultResponseData, VerifyWebhookSourceResponseData,
+        FetchDisputesResponse, GiftCardBalanceCheckResponseData, MandateRevokeResponseData,
+        PaymentsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
+        TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
+        VerifyWebhookSourceResponseData,
     },
 };
 #[cfg(feature = "frm")]
@@ -125,8 +126,8 @@ use hyperswitch_interfaces::{
             PaymentAuthorizeSessionToken, PaymentIncrementalAuthorization, PaymentPostCaptureVoid,
             PaymentPostSessionTokens, PaymentReject, PaymentSessionUpdate, PaymentUpdateMetadata,
             PaymentsAuthenticate, PaymentsCompleteAuthorize, PaymentsCreateOrder,
-            PaymentsPostAuthenticate, PaymentsPostProcessing, PaymentsPreAuthenticate,
-            PaymentsPreProcessing, TaxCalculation,
+            PaymentsGiftCardBalanceCheck, PaymentsPostAuthenticate, PaymentsPostProcessing,
+            PaymentsPreAuthenticate, PaymentsPreProcessing, TaxCalculation,
         },
         revenue_recovery::RevenueRecovery,
         subscriptions::{GetSubscriptionPlansFlow, Subscriptions},
@@ -7797,6 +7798,149 @@ default_imp_for_external_vault_insert!(
     connectors::Zsl
 );
 
+macro_rules! default_imp_for_gift_card_balance_check {
+    ($($path:ident::$connector:ident),*) => {
+        $(
+            impl PaymentsGiftCardBalanceCheck for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            GiftCardBalanceCheck,
+            GiftCardBalanceCheckRequestData,
+            GiftCardBalanceCheckResponseData,
+        > for $path::$connector
+        {}
+    )*
+    };
+}
+default_imp_for_gift_card_balance_check!(
+    connectors::Aci,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Bluesnap,
+    connectors::Boku,
+    connectors::Braintree,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Chargebee,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Cybersource,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Helcim,
+    connectors::Hipay,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Netcetera,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Paybox,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Paypal,
+    connectors::Paystack,
+    connectors::Paysafe,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Peachpayments,
+    connectors::Phonepe,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Signifyd,
+    connectors::Silverflow,
+    connectors::Square,
+    connectors::Stax,
+    connectors::Stripe,
+    connectors::Stripebilling,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Vgs,
+    connectors::Volt,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
+
 macro_rules! default_imp_for_external_vault_retrieve {
     ($($path:ident::$connector:ident),*) => {
         $(
@@ -8622,6 +8766,18 @@ impl<const T: u8> ConnectorIntegration<Dsync, DisputeSyncData, DisputeSyncRespon
 {
 }
 
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> PaymentsGiftCardBalanceCheck for connectors::DummyConnector<T> {}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+    ConnectorIntegration<
+        GiftCardBalanceCheck,
+        GiftCardBalanceCheckRequestData,
+        GiftCardBalanceCheckResponseData,
+    > for connectors::DummyConnector<T>
+{
+}
+
 #[cfg(feature = "dummy_connector")]
 impl<const T: u8> PaymentsPreProcessing for connectors::DummyConnector<T> {}
 #[cfg(feature = "dummy_connector")]
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 836ad796a05..01c42dfe63f 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -3,8 +3,8 @@ use hyperswitch_domain_models::{
     router_data_v2::{
         flow_common_types::{
             BillingConnectorInvoiceSyncFlowData, BillingConnectorPaymentsSyncFlowData,
-            DisputesFlowData, InvoiceRecordBackData, MandateRevokeFlowData, PaymentFlowData,
-            RefundFlowData, WebhookSourceVerifyData,
+            DisputesFlowData, GiftCardBalanceCheckFlowData, InvoiceRecordBackData,
+            MandateRevokeFlowData, PaymentFlowData, RefundFlowData, WebhookSourceVerifyData,
         },
         AccessTokenFlowData, AuthenticationTokenFlowData, ExternalAuthenticationFlowData,
         FilesFlowData, VaultConnectorFlowData,
@@ -18,9 +18,10 @@ use hyperswitch_domain_models::{
         mandate_revoke::MandateRevoke,
         payments::{
             Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,
-            CreateConnectorCustomer, CreateOrder, ExternalVaultProxy, IncrementalAuthorization,
-            PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens,
-            PreProcessing, Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
+            CreateConnectorCustomer, CreateOrder, ExternalVaultProxy, GiftCardBalanceCheck,
+            IncrementalAuthorization, PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing,
+            PostSessionTokens, PreProcessing, Reject, SdkSessionUpdate, Session, SetupMandate,
+            UpdateMetadata, Void,
         },
         refunds::{Execute, RSync},
         revenue_recovery::{
@@ -39,10 +40,10 @@ use hyperswitch_domain_models::{
         AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AccessTokenRequestData,
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
         CreateOrderRequestData, DefendDisputeRequestData, DisputeSyncData,
-        ExternalVaultProxyPaymentsData, FetchDisputesRequestData, MandateRevokeRequestData,
-        PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthorizeData,
-        PaymentsCancelData, PaymentsCancelPostCaptureData, PaymentsCaptureData,
-        PaymentsIncrementalAuthorizationData, PaymentsPostProcessingData,
+        ExternalVaultProxyPaymentsData, FetchDisputesRequestData, GiftCardBalanceCheckRequestData,
+        MandateRevokeRequestData, PaymentMethodTokenizationData, PaymentsApproveData,
+        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,
+        PaymentsCaptureData, PaymentsIncrementalAuthorizationData, PaymentsPostProcessingData,
         PaymentsPostSessionTokensData, PaymentsPreProcessingData, PaymentsRejectData,
         PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
         PaymentsUpdateMetadataData, RefundsData, RetrieveFileRequestData,
@@ -55,9 +56,9 @@ use hyperswitch_domain_models::{
             InvoiceRecordBackResponse,
         },
         AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,
-        DisputeSyncResponse, FetchDisputesResponse, MandateRevokeResponseData,
-        PaymentsResponseData, RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
-        TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
+        DisputeSyncResponse, FetchDisputesResponse, GiftCardBalanceCheckResponseData,
+        MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData, RetrieveFileResponse,
+        SubmitEvidenceResponse, TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
         VerifyWebhookSourceResponseData,
     },
 };
@@ -108,8 +109,8 @@ use hyperswitch_interfaces::{
             PaymentCreateOrderV2, PaymentIncrementalAuthorizationV2, PaymentPostCaptureVoidV2,
             PaymentPostSessionTokensV2, PaymentRejectV2, PaymentSessionUpdateV2, PaymentSessionV2,
             PaymentSyncV2, PaymentTokenV2, PaymentUpdateMetadataV2, PaymentV2, PaymentVoidV2,
-            PaymentsCompleteAuthorizeV2, PaymentsPostProcessingV2, PaymentsPreProcessingV2,
-            TaxCalculationV2,
+            PaymentsCompleteAuthorizeV2, PaymentsGiftCardBalanceCheckV2, PaymentsPostProcessingV2,
+            PaymentsPreProcessingV2, TaxCalculationV2,
         },
         refunds_v2::{RefundExecuteV2, RefundSyncV2, RefundV2},
         revenue_recovery_v2::{
@@ -147,6 +148,7 @@ macro_rules! default_imp_for_new_connector_integration_payment {
             impl PaymentTokenV2 for $path::$connector{}
             impl ConnectorCustomerV2 for $path::$connector{}
             impl PaymentsPreProcessingV2 for $path::$connector{}
+            impl PaymentsGiftCardBalanceCheckV2 for $path::$connector{}
             impl PaymentsPostProcessingV2 for $path::$connector{}
             impl TaxCalculationV2 for $path::$connector{}
             impl PaymentSessionUpdateV2 for $path::$connector{}
@@ -216,6 +218,12 @@ macro_rules! default_imp_for_new_connector_integration_payment {
                 PaymentsPreProcessingData,
                 PaymentsResponseData,
             > for $path::$connector{}
+            impl ConnectorIntegrationV2<
+            GiftCardBalanceCheck,
+            GiftCardBalanceCheckFlowData,
+            GiftCardBalanceCheckRequestData,
+            GiftCardBalanceCheckResponseData,
+        > for $path::$connector{}
             impl ConnectorIntegrationV2<
             PostProcessing,
             PaymentFlowData,
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 7e72bfa023f..471d2227640 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -170,6 +170,9 @@ pub struct VaultConnectorFlowData {
     pub merchant_id: common_utils::id_type::MerchantId,
 }
 
+#[derive(Debug, Clone)]
+pub struct GiftCardBalanceCheckFlowData;
+
 #[derive(Debug, Clone)]
 pub struct ExternalVaultProxyFlowData {
     pub merchant_id: common_utils::id_type::MerchantId,
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
index eece6330e33..2b0e8b42046 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
@@ -85,3 +85,6 @@ pub struct PaymentGetListAttempts;
 
 #[derive(Debug, Clone)]
 pub struct ExternalVaultProxy;
+
+#[derive(Debug, Clone)]
+pub struct GiftCardBalanceCheck;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index b97675006ed..0a91a9207e0 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -555,6 +555,13 @@ pub struct PaymentsPreProcessingData {
     pub minor_amount: Option<MinorUnit>,
 }
 
+#[derive(Debug, Clone)]
+pub struct GiftCardBalanceCheckRequestData {
+    pub payment_method_data: PaymentMethodData,
+    pub currency: Option<storage_enums::Currency>,
+    pub minor_amount: Option<MinorUnit>,
+}
+
 impl TryFrom<PaymentsAuthorizeData> for PaymentsPreProcessingData {
     type Error = error_stack::Report<ApiErrorResponse>;
 
diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs
index cc766a00ba8..7ee0574178c 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types.rs
@@ -86,6 +86,12 @@ pub enum PaymentsResponseData {
     },
 }
 
+#[derive(Debug, Clone)]
+pub struct GiftCardBalanceCheckResponseData {
+    pub balance: MinorUnit,
+    pub currency: common_enums::Currency,
+}
+
 #[derive(Debug, Clone)]
 pub struct TaxCalculationResponseData {
     pub order_tax_amount: MinorUnit,
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index 683e2842837..15b1a3086a6 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -9,9 +9,9 @@ use crate::{
         Authenticate, AuthenticationConfirmation, Authorize, AuthorizeSessionToken,
         BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, CalculateTax, Capture,
         CompleteAuthorize, CreateConnectorCustomer, CreateOrder, Execute, ExternalVaultProxy,
-        IncrementalAuthorization, PSync, PaymentMethodToken, PostAuthenticate, PostCaptureVoid,
-        PostSessionTokens, PreAuthenticate, PreProcessing, RSync, SdkSessionUpdate, Session,
-        SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,
+        GiftCardBalanceCheck, IncrementalAuthorization, PSync, PaymentMethodToken,
+        PostAuthenticate, PostCaptureVoid, PostSessionTokens, PreAuthenticate, PreProcessing,
+        RSync, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,
     },
     router_request_types::{
         revenue_recovery::{
@@ -26,14 +26,14 @@ use crate::{
         },
         AccessTokenAuthenticationRequestData, AccessTokenRequestData, AuthorizeSessionTokenData,
         CompleteAuthorizeData, ConnectorCustomerData, CreateOrderRequestData,
-        ExternalVaultProxyPaymentsData, MandateRevokeRequestData, PaymentMethodTokenizationData,
-        PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostAuthenticateData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
-        PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,
-        PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,
-        SdkPaymentsSessionUpdateData, SetupMandateRequestData, VaultRequestData,
-        VerifyWebhookSourceRequestData,
+        ExternalVaultProxyPaymentsData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,
+        PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCancelPostCaptureData, PaymentsCaptureData,
+        PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
+        PaymentsPostSessionTokensData, PaymentsPreAuthenticateData, PaymentsPreProcessingData,
+        PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
+        PaymentsUpdateMetadataData, RefundsData, SdkPaymentsSessionUpdateData,
+        SetupMandateRequestData, VaultRequestData, VerifyWebhookSourceRequestData,
     },
     router_response_types::{
         revenue_recovery::{
@@ -41,8 +41,9 @@ use crate::{
             InvoiceRecordBackResponse,
         },
         subscriptions::GetSubscriptionPlansResponse,
-        MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData,
-        TaxCalculationResponseData, VaultResponseData, VerifyWebhookSourceResponseData,
+        GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
+        RefundsResponseData, TaxCalculationResponseData, VaultResponseData,
+        VerifyWebhookSourceResponseData,
     },
 };
 #[cfg(feature = "payouts")]
@@ -85,6 +86,11 @@ pub type AccessTokenAuthenticationRouterData = RouterData<
     AccessTokenAuthenticationRequestData,
     AccessTokenAuthenticationResponse,
 >;
+pub type PaymentsGiftCardBalanceCheckRouterData = RouterData<
+    GiftCardBalanceCheck,
+    GiftCardBalanceCheckRequestData,
+    GiftCardBalanceCheckResponseData,
+>;
 pub type RefreshTokenRouterData = RouterData<AccessTokenAuth, AccessTokenRequestData, AccessToken>;
 pub type PaymentsPostSessionTokensRouterData =
     RouterData<PostSessionTokens, PaymentsPostSessionTokensData, PaymentsResponseData>;
diff --git a/crates/hyperswitch_interfaces/src/api/payments.rs b/crates/hyperswitch_interfaces/src/api/payments.rs
index f4aa421240b..2120d3cf063 100644
--- a/crates/hyperswitch_interfaces/src/api/payments.rs
+++ b/crates/hyperswitch_interfaces/src/api/payments.rs
@@ -8,19 +8,23 @@ use hyperswitch_domain_models::{
             PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, Reject,
             SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
         },
-        Authenticate, CreateOrder, ExternalVaultProxy, PostAuthenticate, PreAuthenticate,
+        Authenticate, CreateOrder, ExternalVaultProxy, GiftCardBalanceCheck, PostAuthenticate,
+        PreAuthenticate,
     },
     router_request_types::{
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
-        CreateOrderRequestData, ExternalVaultProxyPaymentsData, PaymentMethodTokenizationData,
-        PaymentsApproveData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,
-        PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,
-        PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
-        PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
+        CreateOrderRequestData, ExternalVaultProxyPaymentsData, GiftCardBalanceCheckRequestData,
+        PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthenticateData,
+        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,
+        PaymentsCaptureData, PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
+        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
+        PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData,
+        PaymentsTaxCalculationData, PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData,
+        SetupMandateRequestData,
+    },
+    router_response_types::{
+        GiftCardBalanceCheckResponseData, PaymentsResponseData, TaxCalculationResponseData,
     },
-    router_response_types::{PaymentsResponseData, TaxCalculationResponseData},
 };
 
 use crate::api;
@@ -51,6 +55,7 @@ pub trait Payment:
     + PaymentUpdateMetadata
     + PaymentsCreateOrder
     + ExternalVaultProxyPaymentsCreateV1
+    + PaymentsGiftCardBalanceCheck
 {
 }
 
@@ -207,3 +212,13 @@ pub trait ExternalVaultProxyPaymentsCreateV1:
     api::ConnectorIntegration<ExternalVaultProxy, ExternalVaultProxyPaymentsData, PaymentsResponseData>
 {
 }
+
+/// trait PaymentsGiftCardBalanceCheck
+pub trait PaymentsGiftCardBalanceCheck:
+    api::ConnectorIntegration<
+    GiftCardBalanceCheck,
+    GiftCardBalanceCheckRequestData,
+    GiftCardBalanceCheckResponseData,
+>
+{
+}
diff --git a/crates/hyperswitch_interfaces/src/api/payments_v2.rs b/crates/hyperswitch_interfaces/src/api/payments_v2.rs
index 88c3e39ca40..c0681670ebc 100644
--- a/crates/hyperswitch_interfaces/src/api/payments_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/payments_v2.rs
@@ -1,7 +1,7 @@
 //! Payments V2 interface
 
 use hyperswitch_domain_models::{
-    router_data_v2::PaymentFlowData,
+    router_data_v2::{flow_common_types::GiftCardBalanceCheckFlowData, PaymentFlowData},
     router_flow_types::{
         payments::{
             Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,
@@ -9,19 +9,22 @@ use hyperswitch_domain_models::{
             PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens,
             PreProcessing, Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
         },
-        Authenticate, PostAuthenticate, PreAuthenticate,
+        Authenticate, GiftCardBalanceCheck, PostAuthenticate, PreAuthenticate,
     },
     router_request_types::{
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
-        CreateOrderRequestData, ExternalVaultProxyPaymentsData, PaymentMethodTokenizationData,
-        PaymentsApproveData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,
-        PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,
-        PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,
-        PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
+        CreateOrderRequestData, ExternalVaultProxyPaymentsData, GiftCardBalanceCheckRequestData,
+        PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthenticateData,
+        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,
+        PaymentsCaptureData, PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
+        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
+        PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData,
+        PaymentsTaxCalculationData, PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData,
+        SetupMandateRequestData,
+    },
+    router_response_types::{
+        GiftCardBalanceCheckResponseData, PaymentsResponseData, TaxCalculationResponseData,
     },
-    router_response_types::{PaymentsResponseData, TaxCalculationResponseData},
 };
 
 use crate::api::{
@@ -203,6 +206,17 @@ pub trait PaymentsPreProcessingV2:
 {
 }
 
+/// trait PaymentsGiftCardBalanceCheckV2
+pub trait PaymentsGiftCardBalanceCheckV2:
+    ConnectorIntegrationV2<
+    GiftCardBalanceCheck,
+    GiftCardBalanceCheckFlowData,
+    GiftCardBalanceCheckRequestData,
+    GiftCardBalanceCheckResponseData,
+>
+{
+}
+
 /// trait PaymentsPreAuthenticateV2
 pub trait PaymentsPreAuthenticateV2:
     ConnectorIntegrationV2<
@@ -235,7 +249,6 @@ pub trait PaymentsPostAuthenticateV2:
 >
 {
 }
-
 /// trait PaymentsPostProcessingV2
 pub trait PaymentsPostProcessingV2:
     ConnectorIntegrationV2<
@@ -285,5 +298,6 @@ pub trait PaymentV2:
     + PaymentUpdateMetadataV2
     + PaymentCreateOrderV2
     + ExternalVaultProxyPaymentsCreate
+    + PaymentsGiftCardBalanceCheckV2
 {
 }
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 288ec0db952..32818ca5d4b 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -12,8 +12,9 @@ use hyperswitch_domain_models::{
             AccessTokenFlowData, AuthenticationTokenFlowData, BillingConnectorInvoiceSyncFlowData,
             BillingConnectorPaymentsSyncFlowData, DisputesFlowData, ExternalAuthenticationFlowData,
             ExternalVaultProxyFlowData, FilesFlowData, GetSubscriptionPlansData,
-            InvoiceRecordBackData, MandateRevokeFlowData, PaymentFlowData, RefundFlowData,
-            UasFlowData, VaultConnectorFlowData, WebhookSourceVerifyData,
+            GiftCardBalanceCheckFlowData, InvoiceRecordBackData, MandateRevokeFlowData,
+            PaymentFlowData, RefundFlowData, UasFlowData, VaultConnectorFlowData,
+            WebhookSourceVerifyData,
         },
         RouterDataV2,
     },
@@ -167,6 +168,45 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for AccessTo
     }
 }
 
+impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
+    for GiftCardBalanceCheckFlowData
+{
+    fn from_old_router_data(
+        old_router_data: &RouterData<T, Req, Resp>,
+    ) -> CustomResult<RouterDataV2<T, Self, Req, Resp>, ConnectorError>
+    where
+        Self: Sized,
+    {
+        let resource_common_data = Self;
+        Ok(RouterDataV2 {
+            flow: std::marker::PhantomData,
+            tenant_id: old_router_data.tenant_id.clone(),
+            resource_common_data,
+            connector_auth_type: old_router_data.connector_auth_type.clone(),
+            request: old_router_data.request.clone(),
+            response: old_router_data.response.clone(),
+        })
+    }
+
+    fn to_old_router_data(
+        new_router_data: RouterDataV2<T, Self, Req, Resp>,
+    ) -> CustomResult<RouterData<T, Req, Resp>, ConnectorError>
+    where
+        Self: Sized,
+    {
+        let request = new_router_data.request.clone();
+        let response = new_router_data.response.clone();
+        let mut router_data = get_default_router_data(
+            new_router_data.tenant_id.clone(),
+            "gift card balance check",
+            request,
+            response,
+        );
+        router_data.connector_auth_type = new_router_data.connector_auth_type;
+        Ok(router_data)
+    }
+}
+
 impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentFlowData {
     fn from_old_router_data(
         old_router_data: &RouterData<T, Req, Resp>,
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index e263735b8af..3afe6405315 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -25,7 +25,7 @@ use hyperswitch_domain_models::{
             ExternalVaultRetrieveFlow,
         },
         webhooks::VerifyWebhookSource,
-        AccessTokenAuthentication, BillingConnectorInvoiceSync,
+        AccessTokenAuthentication, BillingConnectorInvoiceSync, GiftCardBalanceCheck,
     },
     router_request_types::{
         revenue_recovery::{
@@ -41,12 +41,13 @@ use hyperswitch_domain_models::{
         AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AccessTokenRequestData,
         AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
         CreateOrderRequestData, DefendDisputeRequestData, DisputeSyncData,
-        FetchDisputesRequestData, MandateRevokeRequestData, PaymentMethodTokenizationData,
-        PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData,
-        PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,
-        PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,
-        PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,
+        FetchDisputesRequestData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,
+        PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCancelPostCaptureData, PaymentsCaptureData,
+        PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
+        PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
+        PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,
+        PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,
         RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
         SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,
         VerifyWebhookSourceRequestData,
@@ -58,8 +59,9 @@ use hyperswitch_domain_models::{
         },
         subscriptions::GetSubscriptionPlansResponse,
         AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
-        MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData, RetrieveFileResponse,
-        SubmitEvidenceResponse, TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
+        GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
+        RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
+        TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
         VerifyWebhookSourceResponseData,
     },
 };
@@ -140,6 +142,12 @@ pub type PaymentsPreAuthorizeType = dyn ConnectorIntegration<
     AuthorizeSessionTokenData,
     PaymentsResponseData,
 >;
+/// Type alias for `ConnectorIntegration<GiftCardBalanceCheck, GiftCardBalanceCheckRequestData, GiftCardBalanceCheckResponseData>`
+pub type PaymentsGiftCardBalanceCheckType = dyn ConnectorIntegration<
+    GiftCardBalanceCheck,
+    GiftCardBalanceCheckRequestData,
+    GiftCardBalanceCheckResponseData,
+>;
 /// Type alias for `ConnectorIntegration<InitPayment, PaymentsAuthorizeData, PaymentsResponseData>`
 pub type PaymentsInitType =
     dyn ConnectorIntegration<InitPayment, PaymentsAuthorizeData, PaymentsResponseData>;
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 71fe216322d..3942d01abf2 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -128,6 +128,7 @@ Never share your secret api keys. Keep them guarded and secure.
         routes::payments::payments_connector_session,
         routes::payments::list_payment_methods,
         routes::payments::payments_list,
+        routes::payments::payment_check_gift_card_balance,
 
         //Routes for payment methods
         routes::payment_method::create_payment_method_api,
@@ -543,6 +544,8 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::payments::RequestSurchargeDetails,
         api_models::payments::PaymentRevenueRecoveryMetadata,
         api_models::payments::BillingConnectorPaymentDetails,
+        api_models::payments::GiftCardBalanceCheckResponse,
+        api_models::payments::PaymentsGiftCardBalanceCheckRequest,
         api_models::enums::PaymentConnectorTransmission,
         api_models::enums::TriggeredBy,
         api_models::payments::PaymentAttemptResponse,
diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs
index d3abd208e9a..026f4d6cc03 100644
--- a/crates/openapi/src/routes/payments.rs
+++ b/crates/openapi/src/routes/payments.rs
@@ -1268,3 +1268,30 @@ pub fn list_payment_methods() {}
     security(("api_key" = []), ("jwt_key" = []))
 )]
 pub fn payments_list() {}
+
+/// Payments - Gift Card Balance Check
+///
+/// Check the balance of the provided gift card. This endpoint also returns whether the gift card balance is enough to cover the entire amount or another payment method is needed
+#[cfg(feature = "v2")]
+#[utoipa::path(
+    get,
+    path = "/v2/payments/{id}/check-gift-card-balance",
+    params(
+        ("id" = String, Path, description = "The global payment id"),
+        (
+          "X-Profile-Id" = String, Header,
+          description = "Profile ID associated to the payment intent",
+          example = "pro_abcdefghijklmnop"
+        ),
+    ),
+    request_body(
+      content = PaymentsGiftCardBalanceCheckRequest,
+    ),
+    responses(
+        (status = 200, description = "Get the Gift Card Balance", body = GiftCardBalanceCheckResponse),
+    ),
+    tag = "Payments",
+    operation_id = "Retrieve Gift Card Balance",
+    security(("publishable_key" = []))
+)]
+pub fn payment_check_gift_card_balance() {}
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index 0fe3e57f872..f7cb256f587 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -24,6 +24,8 @@ pub mod external_service_auth;
 pub mod files;
 #[cfg(feature = "frm")]
 pub mod fraud_check;
+#[cfg(feature = "v2")]
+pub mod gift_card;
 pub mod gsm;
 pub mod health_check;
 #[cfg(feature = "v1")]
diff --git a/crates/router/src/core/gift_card.rs b/crates/router/src/core/gift_card.rs
new file mode 100644
index 00000000000..d1c89eafdbb
--- /dev/null
+++ b/crates/router/src/core/gift_card.rs
@@ -0,0 +1,179 @@
+use std::marker::PhantomData;
+
+#[cfg(feature = "v2")]
+use api_models::payments::{GiftCardBalanceCheckResponse, PaymentsGiftCardBalanceCheckRequest};
+use common_enums::CallConnectorAction;
+#[cfg(feature = "v2")]
+use common_utils::id_type;
+use common_utils::types::MinorUnit;
+use error_stack::ResultExt;
+#[cfg(feature = "v2")]
+use hyperswitch_domain_models::payments::HeaderPayload;
+use hyperswitch_domain_models::{
+    router_data_v2::{flow_common_types::GiftCardBalanceCheckFlowData, RouterDataV2},
+    router_flow_types::GiftCardBalanceCheck,
+    router_request_types::GiftCardBalanceCheckRequestData,
+    router_response_types::GiftCardBalanceCheckResponseData,
+};
+use hyperswitch_interfaces::connector_integration_interface::RouterDataConversion;
+
+use crate::db::errors::StorageErrorExt;
+#[cfg(feature = "v2")]
+use crate::{
+    core::{
+        errors::{self, RouterResponse},
+        payments::helpers,
+    },
+    routes::{app::ReqState, SessionState},
+    services,
+    types::{api, domain},
+};
+
+#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments)]
+pub async fn payments_check_gift_card_balance_core(
+    state: SessionState,
+    merchant_context: domain::MerchantContext,
+    profile: domain::Profile,
+    _req_state: ReqState,
+    req: PaymentsGiftCardBalanceCheckRequest,
+    _header_payload: HeaderPayload,
+    payment_id: id_type::GlobalPaymentId,
+) -> RouterResponse<GiftCardBalanceCheckResponse> {
+    let db = state.store.as_ref();
+
+    let key_manager_state = &(&state).into();
+
+    let storage_scheme = merchant_context.get_merchant_account().storage_scheme;
+    let payment_intent = db
+        .find_payment_intent_by_id(
+            key_manager_state,
+            &payment_id,
+            merchant_context.get_merchant_key_store(),
+            storage_scheme,
+        )
+        .await
+        .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+
+    let redis_conn = db
+        .get_redis_conn()
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Could not get redis connection")?;
+
+    let gift_card_connector_id: String = redis_conn
+        .get_key(&payment_id.get_gift_card_connector_key().as_str().into())
+        .await
+        .attach_printable("Failed to fetch gift card connector from redis")
+        .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+            message: "No connector found with Gift Card Support".to_string(),
+        })?;
+
+    let gift_card_connector_id = id_type::MerchantConnectorAccountId::wrap(gift_card_connector_id)
+        .attach_printable("Failed to deserialize MCA")
+        .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+            message: "No connector found with Gift Card Support".to_string(),
+        })?;
+
+    let merchant_connector_account =
+        domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
+            helpers::get_merchant_connector_account_v2(
+                &state,
+                merchant_context.get_merchant_key_store(),
+                Some(&gift_card_connector_id),
+            )
+            .await
+            .attach_printable(
+                "failed to fetch merchant connector account for gift card balance check",
+            )?,
+        ));
+
+    let connector_name = merchant_connector_account
+        .get_connector_name()
+        .ok_or(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Connector name not present for gift card balance check")?; // always get the connector name from this call
+
+    let connector_data = api::ConnectorData::get_connector_by_name(
+        &state.conf.connectors,
+        &connector_name.to_string(),
+        api::GetToken::Connector,
+        merchant_connector_account.get_mca_id(),
+    )
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed to get the connector data")?;
+
+    let connector_auth_type = merchant_connector_account
+        .get_connector_account_details()
+        .change_context(errors::ApiErrorResponse::InternalServerError)?;
+
+    let resource_common_data = GiftCardBalanceCheckFlowData;
+
+    let router_data: RouterDataV2<
+        GiftCardBalanceCheck,
+        GiftCardBalanceCheckFlowData,
+        GiftCardBalanceCheckRequestData,
+        GiftCardBalanceCheckResponseData,
+    > = RouterDataV2 {
+        flow: PhantomData,
+        resource_common_data,
+        tenant_id: state.tenant.tenant_id.clone(),
+        connector_auth_type,
+        request: GiftCardBalanceCheckRequestData {
+            payment_method_data: domain::PaymentMethodData::GiftCard(Box::new(
+                req.gift_card_data.into(),
+            )),
+            currency: Some(payment_intent.amount_details.currency),
+            minor_amount: Some(payment_intent.amount_details.order_amount),
+        },
+        response: Err(hyperswitch_domain_models::router_data::ErrorResponse::default()),
+    };
+
+    let old_router_data = GiftCardBalanceCheckFlowData::to_old_router_data(router_data)
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable(
+            "Cannot construct router data for making the gift card balance check api call",
+        )?;
+    let connector_integration: services::BoxedGiftCardBalanceCheckIntegrationInterface<
+        GiftCardBalanceCheck,
+        GiftCardBalanceCheckRequestData,
+        GiftCardBalanceCheckResponseData,
+    > = connector_data.connector.get_connector_integration();
+
+    let connector_response = services::execute_connector_processing_step(
+        &state,
+        connector_integration,
+        &old_router_data,
+        CallConnectorAction::Trigger,
+        None,
+        None,
+    )
+    .await
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed while calling gift card balance check connector api")?;
+
+    let gift_card_balance = connector_response
+        .response
+        .map_err(|_| errors::ApiErrorResponse::UnprocessableEntity {
+            message: "Error while fetching gift card balance".to_string(),
+        })
+        .attach_printable("Connector returned invalid response")?;
+
+    let balance = gift_card_balance.balance;
+    let currency = gift_card_balance.currency;
+    let remaining_amount =
+        if (payment_intent.amount_details.order_amount - balance).is_greater_than(0) {
+            payment_intent.amount_details.order_amount - balance
+        } else {
+            MinorUnit::zero()
+        };
+    let needs_additional_pm_data = remaining_amount.is_greater_than(0);
+
+    let resp = GiftCardBalanceCheckResponse {
+        payment_id: payment_intent.id.clone(),
+        balance,
+        currency,
+        needs_additional_pm_data,
+        remaining_amount,
+    };
+
+    Ok(services::ApplicationResponse::Json(resp))
+}
diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs
index 36a8120fd18..9a2a809ba89 100644
--- a/crates/router/src/core/payments/payment_methods.rs
+++ b/crates/router/src/core/payments/payment_methods.rs
@@ -78,6 +78,7 @@ pub async fn list_payment_methods(
                 &req,
                 &payment_intent,
             ).await?
+            .store_gift_card_mca_in_redis(&payment_id, db, &profile).await
             .merge_and_transform()
             .get_required_fields(RequiredFieldsInput::new(state.conf.required_fields.clone(), payment_intent.setup_future_usage))
             .perform_surcharge_calculation()
@@ -189,6 +190,50 @@ impl FilteredPaymentMethodsEnabled {
             .collect();
         MergedEnabledPaymentMethodTypes(values)
     }
+    async fn store_gift_card_mca_in_redis(
+        self,
+        payment_id: &id_type::GlobalPaymentId,
+        db: &dyn crate::db::StorageInterface,
+        profile: &domain::Profile,
+    ) -> Self {
+        let gift_card_connector_id = self
+            .0
+            .iter()
+            .find(|item| item.payment_method == common_enums::PaymentMethod::GiftCard)
+            .map(|item| &item.merchant_connector_id);
+
+        if let Some(gift_card_mca) = gift_card_connector_id {
+            let gc_key = payment_id.get_gift_card_connector_key();
+            let redis_expiry = profile
+                .get_order_fulfillment_time()
+                .unwrap_or(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME);
+
+            let redis_conn = db
+                .get_redis_conn()
+                .map_err(|redis_error| logger::error!(?redis_error))
+                .ok();
+
+            if let Some(rc) = redis_conn {
+                rc.set_key_with_expiry(
+                    &gc_key.as_str().into(),
+                    gift_card_mca.get_string_repr().to_string(),
+                    redis_expiry,
+                )
+                .await
+                .attach_printable("Failed to store gift card mca_id in redis")
+                .unwrap_or_else(|error| {
+                    logger::error!(?error);
+                })
+            };
+        } else {
+            logger::error!(
+                "Could not find any configured MCA supporting gift card for payment_id -> {}",
+                payment_id.get_string_repr()
+            );
+        }
+
+        self
+    }
 }
 
 /// Element container to hold the filtered payment methods with payment_experience and connectors merged for a pm_subtype
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index f12730d7b63..d52dc1570ce 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -737,6 +737,10 @@ impl Payments {
                 )
                 .service(
                     web::resource("/capture").route(web::post().to(payments::payments_capture)),
+                )
+                .service(
+                    web::resource("/check-gift-card-balance")
+                        .route(web::post().to(payments::payment_check_gift_card_balance)),
                 ),
         );
 
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index c3efb561b42..28581198d83 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -163,6 +163,7 @@ impl From<Flow> for ApiIdentifier {
             | Flow::PaymentsConfirmIntent
             | Flow::PaymentsCreateIntent
             | Flow::PaymentsGetIntent
+            | Flow::GiftCardBalanceCheck
             | Flow::PaymentsPostSessionTokens
             | Flow::PaymentsUpdateMetadata
             | Flow::PaymentsUpdateIntent
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 1136e9f84a6..6f29b4cb5d9 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -11,6 +11,8 @@ use router_env::{env, instrument, logger, tracing, types, Flow};
 
 use super::app::ReqState;
 #[cfg(feature = "v2")]
+use crate::core::gift_card;
+#[cfg(feature = "v2")]
 use crate::core::revenue_recovery::api as recovery;
 use crate::{
     self as app,
@@ -2984,6 +2986,69 @@ pub async fn payment_confirm_intent(
     .await
 }
 
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::GiftCardBalanceCheck, payment_id))]
+pub async fn payment_check_gift_card_balance(
+    state: web::Data<app::AppState>,
+    req: actix_web::HttpRequest,
+    json_payload: web::Json<api_models::payments::PaymentsGiftCardBalanceCheckRequest>,
+    path: web::Path<common_utils::id_type::GlobalPaymentId>,
+) -> impl Responder {
+    let flow = Flow::GiftCardBalanceCheck;
+
+    let global_payment_id = path.into_inner();
+    tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
+
+    let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
+        global_payment_id: global_payment_id.clone(),
+        payload: json_payload.into_inner(),
+    };
+
+    let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
+        Ok(headers) => headers,
+        Err(err) => {
+            return api::log_and_return_error_response(err);
+        }
+    };
+
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        internal_payload,
+        |state, auth: auth::AuthenticationData, req, req_state| async {
+            let payment_id = req.global_payment_id;
+            let request = req.payload;
+
+            let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                domain::Context(auth.merchant_account, auth.key_store),
+            ));
+            Box::pin(gift_card::payments_check_gift_card_balance_core(
+                state,
+                merchant_context,
+                auth.profile,
+                req_state,
+                request,
+                header_payload.clone(),
+                payment_id,
+            ))
+            .await
+        },
+        auth::api_or_client_auth(
+            &auth::V2ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            },
+            &auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
+                global_payment_id,
+            )),
+            req.headers(),
+        ),
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
+
 #[cfg(feature = "v2")]
 #[instrument(skip_all, fields(flow = ?Flow::ProxyConfirmIntent, payment_id))]
 pub async fn proxy_confirm_intent(
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 28928307646..e7e03a5f322 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -129,6 +129,9 @@ pub type BoxedBillingConnectorPaymentsSyncIntegrationInterface<T, Req, Res> =
 pub type BoxedVaultConnectorIntegrationInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<T, common_types::VaultConnectorFlowData, Req, Res>;
 
+pub type BoxedGiftCardBalanceCheckIntegrationInterface<T, Req, Res> =
+    BoxedConnectorIntegrationInterface<T, common_types::GiftCardBalanceCheckFlowData, Req, Res>;
+
 /// Handle UCS webhook response processing
 fn handle_ucs_response<T, Req, Resp>(
     router_data: types::RouterData<T, Req, Resp>,
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 2345469a4e1..f5359d84010 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -652,6 +652,8 @@ pub enum Flow {
     RecoveryPaymentsCreate,
     /// Tokenization delete flow
     TokenizationDelete,
+    /// Gift card balance check flow
+    GiftCardBalanceCheck,
 }
 
 /// Trait for providing generic behaviour to flow metric
 | 
	2025-08-29T09:47:19Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Added `check-gift-card-balance` API
- Added `GiftCardBalanceCheck` flow for connectors and implemented it for Adyen
- Updated PML flow to store gift card enabled MCA in redis
<img width="2314" height="1286" alt="image" src="https://github.com/user-attachments/assets/50087048-1ac5-459f-84ee-d6af7cdbfcae" />
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
This change is required for supporting split payments. SDK will call this endpoint and based on the gift card balance and transaction amount it will either collect Gift card details only or Gift card + another payment method.
Closes #9101 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Create-Intent Call
2. PML for payments call
3. Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_019937e3515f7462b97fe6f5f6901191/check-gift-card-balance' \
--header 'api-key: dev_vzsdTpwwx2h18nUXDFGPaIJmPifOT7zsX9DkCIA3FZQyJgny7c7MrV6RTdgStgOB' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_qAkCNwFOT6asT6ENbmFn' \
--header 'Authorization: publishable-key=pk_dev_433fd28e6bd24a6bb79527cde2af25e1, client-secret=cs_019937e351c171f19b62d7c44802d53e' \
--data '{
    "gift_card_data": {
        "givex": {
            "number": "6036280000000000000",
            "cvc": "123"
        }
    }
}'
```
Response:
```
{
    "payment_id": "12345_pay_019937e3515f7462b97fe6f5f6901191",
    "balance": 5000,
    "currency": "EUR",
    "needs_additional_pm_data": false,
    "remaining_amount": 0
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f3ab3d63f69279af9254f15eba5654c0680a0747 | 
	
1. Create-Intent Call
2. PML for payments call
3. Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_019937e3515f7462b97fe6f5f6901191/check-gift-card-balance' \
--header 'api-key: dev_vzsdTpwwx2h18nUXDFGPaIJmPifOT7zsX9DkCIA3FZQyJgny7c7MrV6RTdgStgOB' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_qAkCNwFOT6asT6ENbmFn' \
--header 'Authorization: publishable-key=pk_dev_433fd28e6bd24a6bb79527cde2af25e1, client-secret=cs_019937e351c171f19b62d7c44802d53e' \
--data '{
    "gift_card_data": {
        "givex": {
            "number": "6036280000000000000",
            "cvc": "123"
        }
    }
}'
```
Response:
```
{
    "payment_id": "12345_pay_019937e3515f7462b97fe6f5f6901191",
    "balance": 5000,
    "currency": "EUR",
    "needs_additional_pm_data": false,
    "remaining_amount": 0
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9099 | 
	Bug: Subscription confirm API
 | 
	diff --git a/crates/api_models/src/subscription.rs b/crates/api_models/src/subscription.rs
index 7dff21205a2..4ed14a9c64e 100644
--- a/crates/api_models/src/subscription.rs
+++ b/crates/api_models/src/subscription.rs
@@ -1,7 +1,13 @@
-use common_utils::events::ApiEventMetric;
+use common_types::payments::CustomerAcceptance;
+use common_utils::{errors::ValidationError, events::ApiEventMetric, types::MinorUnit};
 use masking::Secret;
 use utoipa::ToSchema;
 
+use crate::{
+    enums as api_enums,
+    payments::{Address, PaymentMethodDataRequest},
+};
+
 // use crate::{
 //     customers::{CustomerRequest, CustomerResponse},
 //     payments::CustomerDetailsResponse,
@@ -63,7 +69,14 @@ pub struct CreateSubscriptionResponse {
 ///
 /// - `Created`: Subscription was created but not yet activated.
 /// - `Active`: Subscription is currently active.
-/// - `InActive`: Subscription is inactive (e.g., cancelled or expired).
+/// - `InActive`: Subscription is inactive.
+/// - `Pending`: Subscription is pending activation.
+/// - `Trial`: Subscription is in a trial period.
+/// - `Paused`: Subscription is paused.
+/// - `Unpaid`: Subscription is unpaid.
+/// - `Onetime`: Subscription is a one-time payment.
+/// - `Cancelled`: Subscription has been cancelled.
+/// - `Failed`: Subscription has failed.
 #[derive(Debug, Clone, serde::Serialize, strum::EnumString, strum::Display, ToSchema)]
 pub enum SubscriptionStatus {
     /// Subscription is active.
@@ -74,6 +87,18 @@ pub enum SubscriptionStatus {
     InActive,
     /// Subscription is in pending state.
     Pending,
+    /// Subscription is in trial state.
+    Trial,
+    /// Subscription is paused.
+    Paused,
+    /// Subscription is unpaid.
+    Unpaid,
+    /// Subscription is a one-time payment.
+    Onetime,
+    /// Subscription is cancelled.
+    Cancelled,
+    /// Subscription has failed.
+    Failed,
 }
 
 impl CreateSubscriptionResponse {
@@ -107,3 +132,141 @@ impl CreateSubscriptionResponse {
 
 impl ApiEventMetric for CreateSubscriptionResponse {}
 impl ApiEventMetric for CreateSubscriptionRequest {}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct PaymentDetails {
+    pub payment_method: api_enums::PaymentMethod,
+    pub payment_method_type: Option<api_enums::PaymentMethodType>,
+    pub payment_method_data: PaymentMethodDataRequest,
+    pub setup_future_usage: Option<api_enums::FutureUsage>,
+    pub customer_acceptance: Option<CustomerAcceptance>,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct PaymentResponseData {
+    pub payment_id: common_utils::id_type::PaymentId,
+    pub status: api_enums::IntentStatus,
+    pub amount: MinorUnit,
+    pub currency: api_enums::Currency,
+    pub connector: Option<String>,
+}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct ConfirmSubscriptionRequest {
+    /// Client secret for SDK based interaction.
+    pub client_secret: Option<String>,
+
+    /// Amount to be charged for the invoice.
+    pub amount: MinorUnit,
+
+    /// Currency for the amount.
+    pub currency: api_enums::Currency,
+
+    /// Identifier for the associated plan_id.
+    pub plan_id: Option<String>,
+
+    /// Identifier for the associated item_price_id for the subscription.
+    pub item_price_id: Option<String>,
+
+    /// Idenctifier for the coupon code for the subscription.
+    pub coupon_code: Option<String>,
+
+    /// Identifier for customer.
+    pub customer_id: common_utils::id_type::CustomerId,
+
+    /// Billing address for the subscription.
+    pub billing_address: Option<Address>,
+
+    /// Payment details for the invoice.
+    pub payment_details: PaymentDetails,
+}
+
+impl ConfirmSubscriptionRequest {
+    pub fn get_item_price_id(&self) -> Result<String, error_stack::Report<ValidationError>> {
+        self.item_price_id.clone().ok_or(error_stack::report!(
+            ValidationError::MissingRequiredField {
+                field_name: "item_price_id".to_string()
+            }
+        ))
+    }
+
+    pub fn get_billing_address(&self) -> Result<Address, error_stack::Report<ValidationError>> {
+        self.billing_address.clone().ok_or(error_stack::report!(
+            ValidationError::MissingRequiredField {
+                field_name: "billing_address".to_string()
+            }
+        ))
+    }
+}
+
+impl ApiEventMetric for ConfirmSubscriptionRequest {}
+
+#[derive(Debug, Clone, serde::Serialize, ToSchema)]
+pub struct ConfirmSubscriptionResponse {
+    /// Unique identifier for the subscription.
+    pub id: common_utils::id_type::SubscriptionId,
+
+    /// Merchant specific Unique identifier.
+    pub merchant_reference_id: Option<String>,
+
+    /// Current status of the subscription.
+    pub status: SubscriptionStatus,
+
+    /// Identifier for the associated subscription plan.
+    pub plan_id: Option<String>,
+
+    /// Identifier for the associated item_price_id for the subscription.
+    pub price_id: Option<String>,
+
+    /// Optional coupon code applied to this subscription.
+    pub coupon: Option<String>,
+
+    /// Associated profile ID.
+    pub profile_id: common_utils::id_type::ProfileId,
+
+    /// Payment details for the invoice.
+    pub payment: Option<PaymentResponseData>,
+
+    /// Customer ID associated with this subscription.
+    pub customer_id: Option<common_utils::id_type::CustomerId>,
+
+    /// Invoice Details for the subscription.
+    pub invoice: Option<Invoice>,
+}
+
+#[derive(Debug, Clone, serde::Serialize, ToSchema)]
+pub struct Invoice {
+    /// Unique identifier for the invoice.
+    pub id: common_utils::id_type::InvoiceId,
+
+    /// Unique identifier for the subscription.
+    pub subscription_id: common_utils::id_type::SubscriptionId,
+
+    /// Identifier for the merchant.
+    pub merchant_id: common_utils::id_type::MerchantId,
+
+    /// Identifier for the profile.
+    pub profile_id: common_utils::id_type::ProfileId,
+
+    /// Identifier for the merchant connector account.
+    pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+
+    /// Identifier for the Payment.
+    pub payment_intent_id: Option<common_utils::id_type::PaymentId>,
+
+    /// Identifier for the Payment method.
+    pub payment_method_id: Option<String>,
+
+    /// Identifier for the Customer.
+    pub customer_id: common_utils::id_type::CustomerId,
+
+    /// Invoice amount.
+    pub amount: MinorUnit,
+
+    /// Currency for the invoice payment.
+    pub currency: api_enums::Currency,
+
+    /// Status of the invoice.
+    pub status: String,
+}
+
+impl ApiEventMetric for ConfirmSubscriptionResponse {}
diff --git a/crates/diesel_models/src/invoice.rs b/crates/diesel_models/src/invoice.rs
index 57024d0730a..8ffd54c288d 100644
--- a/crates/diesel_models/src/invoice.rs
+++ b/crates/diesel_models/src/invoice.rs
@@ -34,21 +34,21 @@ pub struct InvoiceNew {
     check_for_backend(diesel::pg::Pg)
 )]
 pub struct Invoice {
-    id: common_utils::id_type::InvoiceId,
-    subscription_id: common_utils::id_type::SubscriptionId,
-    merchant_id: common_utils::id_type::MerchantId,
-    profile_id: common_utils::id_type::ProfileId,
-    merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
-    payment_intent_id: Option<common_utils::id_type::PaymentId>,
-    payment_method_id: Option<String>,
-    customer_id: common_utils::id_type::CustomerId,
-    amount: MinorUnit,
-    currency: String,
-    status: String,
-    provider_name: Connector,
-    metadata: Option<SecretSerdeValue>,
-    created_at: time::PrimitiveDateTime,
-    modified_at: time::PrimitiveDateTime,
+    pub id: common_utils::id_type::InvoiceId,
+    pub subscription_id: common_utils::id_type::SubscriptionId,
+    pub merchant_id: common_utils::id_type::MerchantId,
+    pub profile_id: common_utils::id_type::ProfileId,
+    pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+    pub payment_intent_id: Option<common_utils::id_type::PaymentId>,
+    pub payment_method_id: Option<String>,
+    pub customer_id: common_utils::id_type::CustomerId,
+    pub amount: MinorUnit,
+    pub currency: String,
+    pub status: String,
+    pub provider_name: Connector,
+    pub metadata: Option<SecretSerdeValue>,
+    pub created_at: time::PrimitiveDateTime,
+    pub modified_at: time::PrimitiveDateTime,
 }
 
 #[derive(Clone, Debug, Eq, PartialEq, AsChangeset, Deserialize)]
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index b761dc9ebbf..167c2a337ba 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -16,7 +16,7 @@ use error_stack::ResultExt;
 use hyperswitch_domain_models::{revenue_recovery, router_data_v2::RouterDataV2};
 use hyperswitch_domain_models::{
     router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
-    router_data_v2::flow_common_types::SubscriptionCreateData,
+    router_data_v2::flow_common_types::{SubscriptionCreateData, SubscriptionCustomerData},
     router_flow_types::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
@@ -131,13 +131,28 @@ impl ConnectorIntegration<SubscriptionCreate, SubscriptionCreateRequest, Subscri
     ) -> CustomResult<String, errors::ConnectorError> {
         let metadata: chargebee::ChargebeeMetadata =
             utils::to_connector_meta_from_secret(req.connector_meta_data.clone())?;
-        let url = self
-            .base_url(connectors)
-            .to_string()
-            .replace("{{merchant_endpoint_prefix}}", metadata.site.peek());
+
+        let site = metadata.site.peek();
+
+        let mut base = self.base_url(connectors).to_string();
+
+        base = base.replace("{{merchant_endpoint_prefix}}", site);
+        base = base.replace("$", site);
+
+        if base.contains("{{merchant_endpoint_prefix}}") || base.contains('$') {
+            return Err(errors::ConnectorError::InvalidConnectorConfig {
+                config: "Chargebee base_url has an unresolved placeholder (expected `$` or `{{merchant_endpoint_prefix}}`).",
+            }
+            .into());
+        }
+
+        if !base.ends_with('/') {
+            base.push('/');
+        }
+
         let customer_id = &req.request.customer_id.get_string_repr().to_string();
         Ok(format!(
-            "{url}v2/customers/{customer_id}/subscription_for_items"
+            "{base}v2/customers/{customer_id}/subscription_for_items"
         ))
     }
 
@@ -217,6 +232,17 @@ impl
     // Not Implemented (R)
 }
 
+impl
+    ConnectorIntegrationV2<
+        CreateConnectorCustomer,
+        SubscriptionCustomerData,
+        ConnectorCustomerData,
+        PaymentsResponseData,
+    > for Chargebee
+{
+    // Not Implemented (R)
+}
+
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Chargebee
 {
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 572cb082a45..953dfdca788 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -1039,7 +1039,20 @@ pub struct ChargebeeCustomerCreateRequest {
     #[serde(rename = "first_name")]
     pub name: Option<Secret<String>>,
     pub email: Option<Email>,
-    pub billing_address: Option<api_models::payments::AddressDetails>,
+    #[serde(rename = "billing_address[first_name]")]
+    pub billing_address_first_name: Option<Secret<String>>,
+    #[serde(rename = "billing_address[last_name]")]
+    pub billing_address_last_name: Option<Secret<String>>,
+    #[serde(rename = "billing_address[line1]")]
+    pub billing_address_line1: Option<Secret<String>>,
+    #[serde(rename = "billing_address[city]")]
+    pub billing_address_city: Option<String>,
+    #[serde(rename = "billing_address[state]")]
+    pub billing_address_state: Option<Secret<String>>,
+    #[serde(rename = "billing_address[zip]")]
+    pub billing_address_zip: Option<Secret<String>>,
+    #[serde(rename = "billing_address[country]")]
+    pub billing_address_country: Option<String>,
 }
 
 impl TryFrom<&ChargebeeRouterData<&hyperswitch_domain_models::types::ConnectorCustomerRouterData>>
@@ -1062,7 +1075,34 @@ impl TryFrom<&ChargebeeRouterData<&hyperswitch_domain_models::types::ConnectorCu
                 .clone(),
             name: req.name.clone(),
             email: req.email.clone(),
-            billing_address: req.billing_address.clone(),
+            billing_address_first_name: req
+                .billing_address
+                .as_ref()
+                .and_then(|address| address.first_name.clone()),
+            billing_address_last_name: req
+                .billing_address
+                .as_ref()
+                .and_then(|address| address.last_name.clone()),
+            billing_address_line1: req
+                .billing_address
+                .as_ref()
+                .and_then(|addr| addr.line1.clone()),
+            billing_address_city: req
+                .billing_address
+                .as_ref()
+                .and_then(|addr| addr.city.clone()),
+            billing_address_country: req
+                .billing_address
+                .as_ref()
+                .and_then(|addr| addr.country.map(|country| country.to_string())),
+            billing_address_state: req
+                .billing_address
+                .as_ref()
+                .and_then(|addr| addr.state.clone()),
+            billing_address_zip: req
+                .billing_address
+                .as_ref()
+                .and_then(|addr| addr.zip.clone()),
         })
     }
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index 738a7026c8d..bfa9a50a99a 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -12,7 +12,7 @@ use hyperswitch_domain_models::{
     router_data_v2::{
         flow_common_types::{
             GetSubscriptionEstimateData, GetSubscriptionPlanPricesData, GetSubscriptionPlansData,
-            SubscriptionCreateData,
+            SubscriptionCreateData, SubscriptionCustomerData,
         },
         UasFlowData,
     },
@@ -24,6 +24,7 @@ use hyperswitch_domain_models::{
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
+        CreateConnectorCustomer,
     },
     router_request_types::{
         subscriptions::{
@@ -35,10 +36,14 @@ use hyperswitch_domain_models::{
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
             UasPreAuthenticationRequestData,
         },
+        ConnectorCustomerData,
     },
-    router_response_types::subscriptions::{
-        GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
-        GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+    router_response_types::{
+        subscriptions::{
+            GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+        },
+        PaymentsResponseData,
     },
 };
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
@@ -156,6 +161,7 @@ impl
 impl api::revenue_recovery_v2::RevenueRecoveryV2 for Recurly {}
 impl api::subscriptions_v2::SubscriptionsV2 for Recurly {}
 impl api::subscriptions_v2::GetSubscriptionPlansV2 for Recurly {}
+impl api::subscriptions_v2::SubscriptionConnectorCustomerV2 for Recurly {}
 
 impl
     ConnectorIntegrationV2<
@@ -167,6 +173,16 @@ impl
 {
 }
 
+impl
+    ConnectorIntegrationV2<
+        CreateConnectorCustomer,
+        SubscriptionCustomerData,
+        ConnectorCustomerData,
+        PaymentsResponseData,
+    > for Recurly
+{
+}
+
 impl api::subscriptions_v2::GetSubscriptionPlanPricesV2 for Recurly {}
 
 impl
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 095e2a392c5..42c2398582c 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -1547,6 +1547,21 @@ impl Profile {
                 Cow::Borrowed(common_types::consts::DEFAULT_PAYOUT_WEBHOOK_TRIGGER_STATUSES)
             })
     }
+
+    pub fn get_billing_processor_id(
+        &self,
+    ) -> CustomResult<
+        common_utils::id_type::MerchantConnectorAccountId,
+        api_error_response::ApiErrorResponse,
+    > {
+        self.billing_processor_id
+            .to_owned()
+            .ok_or(error_stack::report!(
+                api_error_response::ApiErrorResponse::MissingRequiredField {
+                    field_name: "billing_processor_id"
+                }
+            ))
+    }
 }
 
 #[cfg(feature = "v2")]
diff --git a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
index 830b90fc763..f096ba78632 100644
--- a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
+++ b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
@@ -321,6 +321,8 @@ pub enum ApiErrorResponse {
     },
     #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Tokenization record not found for the given token_id {id}")]
     TokenizationRecordNotFound { id: String },
+    #[error(error_type = ErrorType::ConnectorError, code = "CE_00", message = "Subscription operation: {operation} failed with connector")]
+    SubscriptionError { operation: String },
 }
 
 #[derive(Clone)]
@@ -710,6 +712,9 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
             Self::TokenizationRecordNotFound{ id } => {
                 AER::NotFound(ApiError::new("HE", 2, format!("Tokenization record not found for the given token_id '{id}' "), None))
             }
+            Self::SubscriptionError { operation } => {
+                AER::BadRequest(ApiError::new("CE", 9, format!("Subscription operation: {operation} failed with connector"), None))
+            }
         }
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 40be24722a5..245d57064b9 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -151,13 +151,24 @@ pub struct FilesFlowData {
 pub struct InvoiceRecordBackData;
 
 #[derive(Debug, Clone)]
-pub struct SubscriptionCreateData;
+pub struct SubscriptionCustomerData {
+    pub connector_meta_data: Option<pii::SecretSerdeValue>,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateData {
+    pub connector_meta_data: Option<pii::SecretSerdeValue>,
+}
 
 #[derive(Debug, Clone)]
-pub struct GetSubscriptionPlansData;
+pub struct GetSubscriptionPlansData {
+    pub connector_meta_data: Option<pii::SecretSerdeValue>,
+}
 
 #[derive(Debug, Clone)]
-pub struct GetSubscriptionPlanPricesData;
+pub struct GetSubscriptionPlanPricesData {
+    pub connector_meta_data: Option<pii::SecretSerdeValue>,
+}
 
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionEstimateData;
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
index f480765effa..73b80b82075 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
@@ -13,7 +13,7 @@ pub struct SubscriptionCreateResponse {
     pub created_at: Option<PrimitiveDateTime>,
 }
 
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Copy)]
 pub enum SubscriptionStatus {
     Pending,
     Trial,
@@ -25,6 +25,22 @@ pub enum SubscriptionStatus {
     Failed,
 }
 
+#[cfg(feature = "v1")]
+impl From<SubscriptionStatus> for api_models::subscription::SubscriptionStatus {
+    fn from(status: SubscriptionStatus) -> Self {
+        match status {
+            SubscriptionStatus::Pending => Self::Pending,
+            SubscriptionStatus::Trial => Self::Trial,
+            SubscriptionStatus::Active => Self::Active,
+            SubscriptionStatus::Paused => Self::Paused,
+            SubscriptionStatus::Unpaid => Self::Unpaid,
+            SubscriptionStatus::Onetime => Self::Onetime,
+            SubscriptionStatus::Cancelled => Self::Cancelled,
+            SubscriptionStatus::Failed => Self::Failed,
+        }
+    }
+}
+
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlansResponse {
     pub list: Vec<SubscriptionPlans>,
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
index 09f25918c56..47a8b4484a1 100644
--- a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
@@ -2,30 +2,35 @@
 use hyperswitch_domain_models::{
     router_data_v2::flow_common_types::{
         GetSubscriptionEstimateData, GetSubscriptionPlanPricesData, GetSubscriptionPlansData,
-        SubscriptionCreateData,
+        SubscriptionCreateData, SubscriptionCustomerData,
     },
-    router_flow_types::subscriptions::{
-        GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
-        SubscriptionCreate,
+    router_flow_types::{
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
+        CreateConnectorCustomer, GetSubscriptionEstimate,
     },
-    router_request_types::subscriptions::{
-        GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
-        GetSubscriptionPlansRequest, SubscriptionCreateRequest,
+    router_request_types::{
+        subscriptions::{
+            GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+            GetSubscriptionPlansRequest, SubscriptionCreateRequest,
+        },
+        ConnectorCustomerData,
     },
-    router_response_types::subscriptions::{
-        GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
-        GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+    router_response_types::{
+        subscriptions::{
+            GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+        },
+        PaymentsResponseData,
     },
 };
 
-use super::payments_v2::ConnectorCustomerV2;
 use crate::connector_integration_v2::ConnectorIntegrationV2;
 
 /// trait SubscriptionsV2
 pub trait SubscriptionsV2:
     GetSubscriptionPlansV2
     + SubscriptionsCreateV2
-    + ConnectorCustomerV2
+    + SubscriptionConnectorCustomerV2
     + GetSubscriptionPlanPricesV2
     + GetSubscriptionEstimateV2
 {
@@ -64,6 +69,16 @@ pub trait SubscriptionsCreateV2:
 {
 }
 
+/// trait SubscriptionConnectorCustomerV2
+pub trait SubscriptionConnectorCustomerV2:
+    ConnectorIntegrationV2<
+    CreateConnectorCustomer,
+    SubscriptionCustomerData,
+    ConnectorCustomerData,
+    PaymentsResponseData,
+>
+{
+}
 /// trait GetSubscriptionEstimate for V2
 pub trait GetSubscriptionEstimateV2:
     ConnectorIntegrationV2<
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 3d3219a33f8..ed83c8235f1 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -14,7 +14,7 @@ use hyperswitch_domain_models::{
             ExternalVaultProxyFlowData, FilesFlowData, GetSubscriptionPlanPricesData,
             GetSubscriptionPlansData, GiftCardBalanceCheckFlowData, InvoiceRecordBackData,
             MandateRevokeFlowData, PaymentFlowData, RefundFlowData, SubscriptionCreateData,
-            UasFlowData, VaultConnectorFlowData, WebhookSourceVerifyData,
+            SubscriptionCustomerData, UasFlowData, VaultConnectorFlowData, WebhookSourceVerifyData,
         },
         RouterDataV2,
     },
@@ -846,7 +846,9 @@ macro_rules! default_router_data_conversion {
             where
                 Self: Sized,
             {
-                let resource_common_data = Self {};
+                let resource_common_data = Self {
+                    connector_meta_data: old_router_data.connector_meta_data.clone(),
+                };
                 Ok(RouterDataV2 {
                     flow: std::marker::PhantomData,
                     tenant_id: old_router_data.tenant_id.clone(),
@@ -863,16 +865,19 @@ macro_rules! default_router_data_conversion {
             where
                 Self: Sized,
             {
-                let router_data = get_default_router_data(
+                let Self {
+                    connector_meta_data,
+                } = new_router_data.resource_common_data;
+                let mut router_data = get_default_router_data(
                     new_router_data.tenant_id.clone(),
                     stringify!($flow_name),
                     new_router_data.request,
                     new_router_data.response,
                 );
-                Ok(RouterData {
-                    connector_auth_type: new_router_data.connector_auth_type.clone(),
-                    ..router_data
-                })
+                router_data.connector_meta_data = connector_meta_data;
+                router_data.connector_auth_type = new_router_data.connector_auth_type;
+
+                Ok(router_data)
             }
         }
     };
@@ -880,6 +885,7 @@ macro_rules! default_router_data_conversion {
 default_router_data_conversion!(GetSubscriptionPlansData);
 default_router_data_conversion!(GetSubscriptionPlanPricesData);
 default_router_data_conversion!(SubscriptionCreateData);
+default_router_data_conversion!(SubscriptionCustomerData);
 
 impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowData {
     fn from_old_router_data(
diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs
index a30f8d4c565..a0bec1a5a1b 100644
--- a/crates/router/src/compatibility/stripe/errors.rs
+++ b/crates/router/src/compatibility/stripe/errors.rs
@@ -285,6 +285,8 @@ pub enum StripeErrorCode {
     PlatformUnauthorizedRequest,
     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "Profile Acquirer not found")]
     ProfileAcquirerNotFound,
+    #[error(error_type = StripeErrorType::HyperswitchError, code = "Subscription Error", message = "Subscription operation: {operation} failed with connector")]
+    SubscriptionError { operation: String },
     // [#216]: https://github.com/juspay/hyperswitch/issues/216
     // Implement the remaining stripe error codes
 
@@ -697,6 +699,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
                 object: "tokenization record".to_owned(),
                 id,
             },
+            errors::ApiErrorResponse::SubscriptionError { operation } => {
+                Self::SubscriptionError { operation }
+            }
         }
     }
 }
@@ -781,7 +786,8 @@ impl actix_web::ResponseError for StripeErrorCode {
             | Self::WebhookProcessingError
             | Self::InvalidTenant
             | Self::ExternalVaultFailed
-            | Self::AmountConversionFailed { .. } => StatusCode::INTERNAL_SERVER_ERROR,
+            | Self::AmountConversionFailed { .. }
+            | Self::SubscriptionError { .. } => StatusCode::INTERNAL_SERVER_ERROR,
             Self::ReturnUrlUnavailable => StatusCode::SERVICE_UNAVAILABLE,
             Self::ExternalConnectorError { status_code, .. } => {
                 StatusCode::from_u16(*status_code).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)
diff --git a/crates/router/src/core/subscription.rs b/crates/router/src/core/subscription.rs
index 32c6754e2fe..b5c760ad3ec 100644
--- a/crates/router/src/core/subscription.rs
+++ b/crates/router/src/core/subscription.rs
@@ -1,16 +1,31 @@
 use std::str::FromStr;
 
-use api_models::subscription::{
-    self as subscription_types, CreateSubscriptionResponse, SubscriptionStatus,
+use api_models::{
+    enums as api_enums,
+    subscription::{self as subscription_types, CreateSubscriptionResponse, SubscriptionStatus},
 };
-use common_utils::id_type::GenerateId;
+use common_utils::{ext_traits::ValueExt, id_type::GenerateId, pii};
 use diesel_models::subscription::SubscriptionNew;
 use error_stack::ResultExt;
-use hyperswitch_domain_models::{api::ApplicationResponse, merchant_context::MerchantContext};
+use hyperswitch_domain_models::{
+    api::ApplicationResponse,
+    merchant_context::MerchantContext,
+    router_data_v2::flow_common_types::{SubscriptionCreateData, SubscriptionCustomerData},
+    router_request_types::{subscriptions as subscription_request_types, ConnectorCustomerData},
+    router_response_types::{
+        subscriptions as subscription_response_types, ConnectorCustomerResponseData,
+        PaymentsResponseData,
+    },
+};
 use masking::Secret;
 
 use super::errors::{self, RouterResponse};
-use crate::routes::SessionState;
+use crate::{
+    core::payments as payments_core, routes::SessionState, services, types::api as api_types,
+};
+
+pub const SUBSCRIPTION_CONNECTOR_ID: &str = "DefaultSubscriptionConnectorId";
+pub const SUBSCRIPTION_PAYMENT_ID: &str = "DefaultSubscriptionPaymentId";
 
 pub async fn create_subscription(
     state: SessionState,
@@ -63,3 +78,544 @@ pub async fn create_subscription(
 
     Ok(ApplicationResponse::Json(response))
 }
+
+pub async fn confirm_subscription(
+    state: SessionState,
+    merchant_context: MerchantContext,
+    profile_id: String,
+    request: subscription_types::ConfirmSubscriptionRequest,
+    subscription_id: common_utils::id_type::SubscriptionId,
+) -> RouterResponse<subscription_types::ConfirmSubscriptionResponse> {
+    let profile_id = common_utils::id_type::ProfileId::from_str(&profile_id).change_context(
+        errors::ApiErrorResponse::InvalidDataValue {
+            field_name: "X-Profile-Id",
+        },
+    )?;
+
+    let key_manager_state = &(&state).into();
+    let merchant_key_store = merchant_context.get_merchant_key_store();
+
+    let profile = state
+        .store
+        .find_business_profile_by_profile_id(key_manager_state, merchant_key_store, &profile_id)
+        .await
+        .change_context(errors::ApiErrorResponse::ProfileNotFound {
+            id: profile_id.get_string_repr().to_string(),
+        })?;
+
+    let customer = state
+        .store
+        .find_customer_by_customer_id_merchant_id(
+            key_manager_state,
+            &request.customer_id,
+            merchant_context.get_merchant_account().get_id(),
+            merchant_key_store,
+            merchant_context.get_merchant_account().storage_scheme,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::CustomerNotFound)
+        .attach_printable("subscriptions: unable to fetch customer from database")?;
+
+    let handler = SubscriptionHandler::new(state, merchant_context, request, profile);
+
+    let mut subscription_entry = handler
+        .find_subscription(subscription_id.get_string_repr().to_string())
+        .await?;
+
+    let billing_handler = subscription_entry.get_billing_handler(customer).await?;
+    let invoice_handler = subscription_entry.get_invoice_handler().await?;
+
+    let _customer_create_response = billing_handler
+        .create_customer_on_connector(&handler.state)
+        .await?;
+
+    let subscription_create_response = billing_handler
+        .create_subscription_on_connector(&handler.state)
+        .await?;
+
+    // let payment_response = invoice_handler.create_cit_payment().await?;
+
+    let invoice_entry = invoice_handler
+        .create_invoice_entry(
+            &handler.state,
+            subscription_entry.profile.get_billing_processor_id()?,
+            None,
+            billing_handler.request.amount,
+            billing_handler.request.currency.to_string(),
+            common_enums::connector_enums::InvoiceStatus::InvoiceCreated,
+            billing_handler.connector_data.connector_name,
+            None,
+        )
+        .await?;
+
+    // invoice_entry
+    //     .create_invoice_record_back_job(&payment_response)
+    //     .await?;
+
+    subscription_entry
+        .update_subscription_status(
+            SubscriptionStatus::from(subscription_create_response.status).to_string(),
+        )
+        .await?;
+
+    let response = subscription_entry
+        .generate_response(&invoice_entry, subscription_create_response.status)?;
+
+    Ok(ApplicationResponse::Json(response))
+}
+
+pub struct SubscriptionHandler {
+    state: SessionState,
+    merchant_context: MerchantContext,
+    request: subscription_types::ConfirmSubscriptionRequest,
+    profile: hyperswitch_domain_models::business_profile::Profile,
+}
+
+impl SubscriptionHandler {
+    pub fn new(
+        state: SessionState,
+        merchant_context: MerchantContext,
+        request: subscription_types::ConfirmSubscriptionRequest,
+        profile: hyperswitch_domain_models::business_profile::Profile,
+    ) -> Self {
+        Self {
+            state,
+            merchant_context,
+            request,
+            profile,
+        }
+    }
+    pub async fn find_subscription(
+        &self,
+        subscription_id: String,
+    ) -> errors::RouterResult<SubscriptionWithHandler<'_>> {
+        let subscription = self
+            .state
+            .store
+            .find_by_merchant_id_subscription_id(
+                self.merchant_context.get_merchant_account().get_id(),
+                subscription_id.clone(),
+            )
+            .await
+            .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+                message: format!("subscription not found for id: {subscription_id}"),
+            })?;
+
+        Ok(SubscriptionWithHandler {
+            handler: self,
+            subscription,
+            profile: self.profile.clone(),
+        })
+    }
+}
+pub struct SubscriptionWithHandler<'a> {
+    handler: &'a SubscriptionHandler,
+    subscription: diesel_models::subscription::Subscription,
+    profile: hyperswitch_domain_models::business_profile::Profile,
+}
+
+impl<'a> SubscriptionWithHandler<'a> {
+    fn generate_response(
+        &self,
+        invoice: &diesel_models::invoice::Invoice,
+        // _payment_response: &subscription_types::PaymentResponseData,
+        status: subscription_response_types::SubscriptionStatus,
+    ) -> errors::RouterResult<subscription_types::ConfirmSubscriptionResponse> {
+        Ok(subscription_types::ConfirmSubscriptionResponse {
+            id: self.subscription.id.clone(),
+            merchant_reference_id: self.subscription.merchant_reference_id.clone(),
+            status: SubscriptionStatus::from(status),
+            plan_id: None,
+            profile_id: self.subscription.profile_id.to_owned(),
+            payment: None,
+            customer_id: Some(self.subscription.customer_id.clone()),
+            price_id: None,
+            coupon: None,
+            invoice: Some(subscription_types::Invoice {
+                id: invoice.id.clone(),
+                subscription_id: invoice.subscription_id.clone(),
+                merchant_id: invoice.merchant_id.clone(),
+                profile_id: invoice.profile_id.clone(),
+                merchant_connector_id: invoice.merchant_connector_id.clone(),
+                payment_intent_id: invoice.payment_intent_id.clone(),
+                payment_method_id: invoice.payment_method_id.clone(),
+                customer_id: invoice.customer_id.clone(),
+                amount: invoice.amount,
+                currency: api_enums::Currency::from_str(invoice.currency.as_str())
+                    .change_context(errors::ApiErrorResponse::InvalidDataValue {
+                        field_name: "currency",
+                    })
+                    .attach_printable(format!(
+                        "unable to parse currency name {currency:?}",
+                        currency = invoice.currency
+                    ))?,
+                status: invoice.status.clone(),
+            }),
+        })
+    }
+
+    async fn update_subscription_status(&mut self, status: String) -> errors::RouterResult<()> {
+        let db = self.handler.state.store.as_ref();
+        let updated_subscription = db
+            .update_subscription_entry(
+                self.handler
+                    .merchant_context
+                    .get_merchant_account()
+                    .get_id(),
+                self.subscription.id.get_string_repr().to_string(),
+                diesel_models::subscription::SubscriptionUpdate::new(None, Some(status)),
+            )
+            .await
+            .change_context(errors::ApiErrorResponse::SubscriptionError {
+                operation: "Subscription Update".to_string(),
+            })
+            .attach_printable("subscriptions: unable to update subscription entry in database")?;
+
+        self.subscription = updated_subscription;
+
+        Ok(())
+    }
+
+    pub async fn get_billing_handler(
+        &self,
+        customer: hyperswitch_domain_models::customer::Customer,
+    ) -> errors::RouterResult<BillingHandler> {
+        let mca_id = self.profile.get_billing_processor_id()?;
+
+        let billing_processor_mca = self
+            .handler
+            .state
+            .store
+            .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
+                &(&self.handler.state).into(),
+                self.handler
+                    .merchant_context
+                    .get_merchant_account()
+                    .get_id(),
+                &mca_id,
+                self.handler.merchant_context.get_merchant_key_store(),
+            )
+            .await
+            .change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+                id: mca_id.get_string_repr().to_string(),
+            })?;
+
+        let connector_name = billing_processor_mca.connector_name.clone();
+
+        let auth_type: hyperswitch_domain_models::router_data::ConnectorAuthType =
+            payments_core::helpers::MerchantConnectorAccountType::DbVal(Box::new(
+                billing_processor_mca.clone(),
+            ))
+            .get_connector_account_details()
+            .parse_value("ConnectorAuthType")
+            .change_context(errors::ApiErrorResponse::InvalidDataFormat {
+                field_name: "connector_account_details".to_string(),
+                expected_format: "auth_type and api_key".to_string(),
+            })?;
+
+        let connector_data = api_types::ConnectorData::get_connector_by_name(
+            &self.handler.state.conf.connectors,
+            &connector_name,
+            api_types::GetToken::Connector,
+            Some(billing_processor_mca.get_id()),
+        )
+        .change_context(errors::ApiErrorResponse::IncorrectConnectorNameGiven)
+        .attach_printable(
+            "invalid connector name received in billing merchant connector account",
+        )?;
+
+        let connector_enum =
+            common_enums::connector_enums::Connector::from_str(connector_name.as_str())
+                .change_context(errors::ApiErrorResponse::InternalServerError)
+                .attach_printable(format!("unable to parse connector name {connector_name:?}"))?;
+
+        let connector_params =
+            hyperswitch_domain_models::connector_endpoints::Connectors::get_connector_params(
+                &self.handler.state.conf.connectors,
+                connector_enum,
+            )
+            .change_context(errors::ApiErrorResponse::ConfigNotFound)
+            .attach_printable(format!(
+                "cannot find connector params for this connector {connector_name} in this flow",
+            ))?;
+
+        Ok(BillingHandler {
+            subscription: self.subscription.clone(),
+            auth_type,
+            connector_data,
+            connector_params,
+            request: self.handler.request.clone(),
+            connector_metadata: billing_processor_mca.metadata.clone(),
+            customer,
+        })
+    }
+
+    pub async fn get_invoice_handler(&self) -> errors::RouterResult<InvoiceHandler> {
+        Ok(InvoiceHandler {
+            subscription: self.subscription.clone(),
+        })
+    }
+}
+
+pub struct BillingHandler {
+    subscription: diesel_models::subscription::Subscription,
+    auth_type: hyperswitch_domain_models::router_data::ConnectorAuthType,
+    connector_data: api_types::ConnectorData,
+    connector_params: hyperswitch_domain_models::connector_endpoints::ConnectorParams,
+    connector_metadata: Option<pii::SecretSerdeValue>,
+    customer: hyperswitch_domain_models::customer::Customer,
+    request: subscription_types::ConfirmSubscriptionRequest,
+}
+
+pub struct InvoiceHandler {
+    subscription: diesel_models::subscription::Subscription,
+}
+
+#[allow(clippy::todo)]
+impl InvoiceHandler {
+    #[allow(clippy::too_many_arguments)]
+    pub async fn create_invoice_entry(
+        self,
+        state: &SessionState,
+        merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+        payment_intent_id: Option<common_utils::id_type::PaymentId>,
+        amount: common_utils::types::MinorUnit,
+        currency: String,
+        status: common_enums::connector_enums::InvoiceStatus,
+        provider_name: common_enums::connector_enums::Connector,
+        metadata: Option<pii::SecretSerdeValue>,
+    ) -> errors::RouterResult<diesel_models::invoice::Invoice> {
+        let invoice_new = diesel_models::invoice::InvoiceNew::new(
+            self.subscription.id.to_owned(),
+            self.subscription.merchant_id.to_owned(),
+            self.subscription.profile_id.to_owned(),
+            merchant_connector_id,
+            payment_intent_id,
+            self.subscription.payment_method_id.clone(),
+            self.subscription.customer_id.to_owned(),
+            amount,
+            currency,
+            status,
+            provider_name,
+            metadata,
+        );
+
+        let invoice = state
+            .store
+            .insert_invoice_entry(invoice_new)
+            .await
+            .change_context(errors::ApiErrorResponse::SubscriptionError {
+                operation: "Subscription Confirm".to_string(),
+            })
+            .attach_printable("invoices: unable to insert invoice entry to database")?;
+
+        Ok(invoice)
+    }
+
+    pub async fn create_cit_payment(
+        &self,
+    ) -> errors::RouterResult<subscription_types::PaymentResponseData> {
+        // Create a CIT payment for the invoice
+        todo!("Create a CIT payment for the invoice")
+    }
+
+    pub async fn create_invoice_record_back_job(
+        &self,
+        // _invoice: &subscription_types::Invoice,
+        _payment_response: &subscription_types::PaymentResponseData,
+    ) -> errors::RouterResult<()> {
+        // Create an invoice job entry based on payment status
+        todo!("Create an invoice job entry based on payment status")
+    }
+}
+
+#[allow(clippy::todo)]
+impl BillingHandler {
+    pub async fn create_customer_on_connector(
+        &self,
+        state: &SessionState,
+    ) -> errors::RouterResult<ConnectorCustomerResponseData> {
+        let customer_req = ConnectorCustomerData {
+            email: self.customer.email.clone().map(pii::Email::from),
+            payment_method_data: self
+                .request
+                .payment_details
+                .payment_method_data
+                .payment_method_data
+                .clone()
+                .map(|pmd| pmd.into()),
+            description: None,
+            phone: None,
+            name: None,
+            preprocessing_id: None,
+            split_payments: None,
+            setup_future_usage: None,
+            customer_acceptance: None,
+            customer_id: Some(self.subscription.customer_id.to_owned()),
+            billing_address: self
+                .request
+                .billing_address
+                .as_ref()
+                .and_then(|add| add.address.clone())
+                .and_then(|addr| addr.into()),
+        };
+        let router_data = self.build_router_data(
+            state,
+            customer_req,
+            SubscriptionCustomerData {
+                connector_meta_data: self.connector_metadata.clone(),
+            },
+        )?;
+        let connector_integration = self.connector_data.connector.get_connector_integration();
+
+        let response = Box::pin(self.call_connector(
+            state,
+            router_data,
+            "create customer on connector",
+            connector_integration,
+        ))
+        .await?;
+
+        match response {
+            Ok(response_data) => match response_data {
+                PaymentsResponseData::ConnectorCustomerResponse(customer_response) => {
+                    Ok(customer_response)
+                }
+                _ => Err(errors::ApiErrorResponse::SubscriptionError {
+                    operation: "Subscription Customer Create".to_string(),
+                }
+                .into()),
+            },
+            Err(err) => Err(errors::ApiErrorResponse::ExternalConnectorError {
+                code: err.code,
+                message: err.message,
+                connector: self.connector_data.connector_name.to_string(),
+                status_code: err.status_code,
+                reason: err.reason,
+            }
+            .into()),
+        }
+    }
+    pub async fn create_subscription_on_connector(
+        &self,
+        state: &SessionState,
+    ) -> errors::RouterResult<subscription_response_types::SubscriptionCreateResponse> {
+        let subscription_item = subscription_request_types::SubscriptionItem {
+            item_price_id: self.request.get_item_price_id().change_context(
+                errors::ApiErrorResponse::MissingRequiredField {
+                    field_name: "item_price_id",
+                },
+            )?,
+            quantity: Some(1),
+        };
+        let subscription_req = subscription_request_types::SubscriptionCreateRequest {
+            subscription_id: self.subscription.id.to_owned(),
+            customer_id: self.subscription.customer_id.to_owned(),
+            subscription_items: vec![subscription_item],
+            billing_address: self.request.get_billing_address().change_context(
+                errors::ApiErrorResponse::MissingRequiredField {
+                    field_name: "billing_address",
+                },
+            )?,
+            auto_collection: subscription_request_types::SubscriptionAutoCollection::Off,
+            connector_params: self.connector_params.clone(),
+        };
+
+        let router_data = self.build_router_data(
+            state,
+            subscription_req,
+            SubscriptionCreateData {
+                connector_meta_data: self.connector_metadata.clone(),
+            },
+        )?;
+        let connector_integration = self.connector_data.connector.get_connector_integration();
+
+        let response = self
+            .call_connector(
+                state,
+                router_data,
+                "create subscription on connector",
+                connector_integration,
+            )
+            .await?;
+
+        match response {
+            Ok(response_data) => Ok(response_data),
+            Err(err) => Err(errors::ApiErrorResponse::ExternalConnectorError {
+                code: err.code,
+                message: err.message,
+                connector: self.connector_data.connector_name.to_string(),
+                status_code: err.status_code,
+                reason: err.reason,
+            }
+            .into()),
+        }
+    }
+
+    async fn call_connector<F, ResourceCommonData, Req, Resp>(
+        &self,
+        state: &SessionState,
+        router_data: hyperswitch_domain_models::router_data_v2::RouterDataV2<
+            F,
+            ResourceCommonData,
+            Req,
+            Resp,
+        >,
+        operation_name: &str,
+        connector_integration: hyperswitch_interfaces::connector_integration_interface::BoxedConnectorIntegrationInterface<F, ResourceCommonData, Req, Resp>,
+    ) -> errors::RouterResult<Result<Resp, hyperswitch_domain_models::router_data::ErrorResponse>>
+    where
+        F: Clone + std::fmt::Debug + 'static,
+        Req: Clone + std::fmt::Debug + 'static,
+        Resp: Clone + std::fmt::Debug + 'static,
+        ResourceCommonData:
+            hyperswitch_interfaces::connector_integration_interface::RouterDataConversion<
+                    F,
+                    Req,
+                    Resp,
+                > + Clone
+                + 'static,
+    {
+        let old_router_data = ResourceCommonData::to_old_router_data(router_data).change_context(
+            errors::ApiErrorResponse::SubscriptionError {
+                operation: { operation_name.to_string() },
+            },
+        )?;
+
+        let router_resp = services::execute_connector_processing_step(
+            state,
+            connector_integration,
+            &old_router_data,
+            payments_core::CallConnectorAction::Trigger,
+            None,
+            None,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::SubscriptionError {
+            operation: operation_name.to_string(),
+        })
+        .attach_printable(format!(
+            "Failed while in subscription operation: {operation_name}"
+        ))?;
+
+        Ok(router_resp.response)
+    }
+
+    fn build_router_data<F, ResourceCommonData, Req, Resp>(
+        &self,
+        state: &SessionState,
+        req: Req,
+        resource_common_data: ResourceCommonData,
+    ) -> errors::RouterResult<
+        hyperswitch_domain_models::router_data_v2::RouterDataV2<F, ResourceCommonData, Req, Resp>,
+    > {
+        Ok(hyperswitch_domain_models::router_data_v2::RouterDataV2 {
+            flow: std::marker::PhantomData,
+            connector_auth_type: self.auth_type.clone(),
+            resource_common_data,
+            tenant_id: state.tenant.tenant_id.clone(),
+            request: req,
+            response: Err(hyperswitch_domain_models::router_data::ErrorResponse::default()),
+        })
+    }
+}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 1de0029f767..0d7da850f11 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1174,13 +1174,21 @@ pub struct Subscription;
 #[cfg(all(feature = "oltp", feature = "v1"))]
 impl Subscription {
     pub fn server(state: AppState) -> Scope {
-        web::scope("/subscription/create")
-            .app_data(web::Data::new(state.clone()))
-            .service(web::resource("").route(
+        let route = web::scope("/subscription").app_data(web::Data::new(state.clone()));
+
+        route
+            .service(web::resource("/create").route(
                 web::post().to(|state, req, payload| {
                     subscription::create_subscription(state, req, payload)
                 }),
             ))
+            .service(
+                web::resource("/{subscription_id}/confirm").route(web::post().to(
+                    |state, req, id, payload| {
+                        subscription::confirm_subscription(state, req, id, payload)
+                    },
+                )),
+            )
     }
 }
 
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 992edb61c35..c0c670f3eee 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -88,7 +88,7 @@ impl From<Flow> for ApiIdentifier {
             | Flow::DecisionEngineDecideGatewayCall
             | Flow::DecisionEngineGatewayFeedbackCall => Self::Routing,
 
-            Flow::CreateSubscription => Self::Subscription,
+            Flow::CreateSubscription | Flow::ConfirmSubscription => Self::Subscription,
 
             Flow::RetrieveForexFlow => Self::Forex,
             Flow::AddToBlocklist => Self::Blocklist,
diff --git a/crates/router/src/routes/subscription.rs b/crates/router/src/routes/subscription.rs
index d4b716f63c0..aacf03392be 100644
--- a/crates/router/src/routes/subscription.rs
+++ b/crates/router/src/routes/subscription.rs
@@ -67,3 +67,55 @@ pub async fn create_subscription(
     ))
     .await
 }
+
+#[cfg(all(feature = "olap", feature = "v1"))]
+#[instrument(skip_all)]
+pub async fn confirm_subscription(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    subscription_id: web::Path<common_utils::id_type::SubscriptionId>,
+    json_payload: web::Json<subscription_types::ConfirmSubscriptionRequest>,
+) -> impl Responder {
+    let flow = Flow::ConfirmSubscription;
+    let subscription_id = subscription_id.into_inner();
+    let profile_id = match req.headers().get(X_PROFILE_ID) {
+        Some(val) => val.to_str().unwrap_or_default().to_string(),
+        None => {
+            return HttpResponse::BadRequest().json(
+                errors::api_error_response::ApiErrorResponse::MissingRequiredField {
+                    field_name: "x-profile-id",
+                },
+            );
+        }
+    };
+    Box::pin(oss_api::server_wrap(
+        flow,
+        state,
+        &req,
+        json_payload.into_inner(),
+        |state, auth: auth::AuthenticationData, payload, _| {
+            let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                domain::Context(auth.merchant_account, auth.key_store),
+            ));
+            subscription::confirm_subscription(
+                state,
+                merchant_context,
+                profile_id.clone(),
+                payload.clone(),
+                subscription_id.clone(),
+            )
+        },
+        auth::auth_type(
+            &auth::HeaderAuth(auth::ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            }),
+            &auth::JWTAuth {
+                permission: Permission::ProfileSubscriptionWrite,
+            },
+            req.headers(),
+        ),
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index d8f5f1a3a3b..b2582d7e3fe 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -3,6 +3,7 @@ use std::{fmt::Debug, marker::PhantomData, str::FromStr, sync::Arc, time::Durati
 use async_trait::async_trait;
 use common_utils::{id_type::GenerateId, pii::Email};
 use error_stack::Report;
+use hyperswitch_domain_models::router_data_v2::flow_common_types::PaymentFlowData;
 use masking::Secret;
 use router::{
     configs::settings::Settings,
@@ -117,7 +118,8 @@ pub trait ConnectorActions: Connector {
         payment_data: Option<types::ConnectorCustomerData>,
         payment_info: Option<PaymentInfo>,
     ) -> Result<types::ConnectorCustomerRouterData, Report<ConnectorError>> {
-        let integration = self.get_data().connector.get_connector_integration();
+        let integration: BoxedConnectorIntegrationInterface<_, PaymentFlowData, _, _> =
+            self.get_data().connector.get_connector_integration();
         let request = self.generate_data(
             types::ConnectorCustomerData {
                 ..(payment_data.unwrap_or(CustomerType::default().0))
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 50c47489108..1bbc2605f6b 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -265,6 +265,8 @@ pub enum Flow {
     RoutingDeleteConfig,
     /// Subscription create flow,
     CreateSubscription,
+    /// Subscription confirm flow,
+    ConfirmSubscription,
     /// Create dynamic routing
     CreateDynamicRoutingConfig,
     /// Toggle dynamic routing
diff --git a/migrations/2025-09-23-112547_add_billing_processor_in_connector_type/down.sql b/migrations/2025-09-23-112547_add_billing_processor_in_connector_type/down.sql
new file mode 100644
index 00000000000..d0b08278125
--- /dev/null
+++ b/migrations/2025-09-23-112547_add_billing_processor_in_connector_type/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+SELECT(1);
\ No newline at end of file
diff --git a/migrations/2025-09-23-112547_add_billing_processor_in_connector_type/up.sql b/migrations/2025-09-23-112547_add_billing_processor_in_connector_type/up.sql
new file mode 100644
index 00000000000..0201e3753f1
--- /dev/null
+++ b/migrations/2025-09-23-112547_add_billing_processor_in_connector_type/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TYPE "ConnectorType"
+ADD VALUE 'billing_processor';
\ No newline at end of file
 | 
	2025-09-10T15:31:58Z | 
	This pull request introduces a new subscription feature to the codebase, adding comprehensive support for subscription management via new API models, endpoints, and supporting logic. The changes include new data models, API routes, core business logic for creating and confirming subscriptions, and integration with customer management. The implementation is gated behind the `v1` and `olap` feature flags.
**New Subscription Feature**
* Added `subscription` module to `api_models`, including request and response types, core data structures (`Subscription`, `Invoice`), and helper functions for mapping customer data.
* Introduced a new `Subscription` resource to the global `Resource` enum for system-wide referencing.
**Core Logic and Utilities**
* Implemented core business logic in `core/subscription.rs` for creating and confirming subscriptions, including customer handling, client secret generation, and placeholder billing processor integration.
* Added utility functions in `core/subscription/utils.rs` for customer retrieval/creation and extracting customer details from subscription requests.
* Updated customer helper function signature in payouts to allow broader usage in subscription flows.
**Database and Model Changes**
* Added client secret generation to the `SubscriptionNew` model in `diesel_models`, supporting secure subscription creation. [[1]](diffhunk://#diff-18a18c6db4052184eddf2b35c376f2eff90d566c06c6d2fbc4aea751852b0f3aR85-R94) [[2]](diffhunk://#diff-18a18c6db4052184eddf2b35c376f2eff90d566c06c6d2fbc4aea751852b0f3aL1-R1)
**API Routing and Integration**
* Registered new subscription endpoints in the API routes and application server, enabling `/subscription` and `/subscription/{subscription_id}/confirm` endpoints for managing subscriptions. [[1]](diffhunk://#diff-a6e49b399ffdee83dd322b3cb8bee170c65fb9c6e2e52c14222ec310f6927c54R1164-R1186) [[2]](diffhunk://#diff-911527e4effff636e27a7c44689ecc4a5c37963f0e9198193eacb52e1488cab5R212) [[3]](diffhunk://#diff-7e1080d750a904d5d9ea4a8041a6b210d2b0c1fa9e45207500824f0dad7fbc51R53-R54) [[4]](diffhunk://#diff-7e1080d750a904d5d9ea4a8041a6b210d2b0c1fa9e45207500824f0dad7fbc51L99-R101) [[5]](diffhunk://#diff-a6e49b399ffdee83dd322b3cb8bee170c65fb9c6e2e52c14222ec310f6927c54L68-R70)
* Added subscription module references to core and feature-gated module lists for proper compilation and integration. [[1]](diffhunk://#diff-77a35e04ebe8b59efecf0b6a986e706e15170eb486b847e8c8c55514c5e55486R45-R46) [[2]](diffhunk://#diff-3f92a5ed20c7decce0129ef9eb838b87bae76de2197e8efa267657c26f590f4bR52-R53)
* Updated API identifier enums to include `Subscription` for locking and routing utilities.] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. create a customer
```
curl --location 'http://localhost:8080/customers' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Ske75Nx2J7qtHsP8cc7pFx5k4dccYBedM6UAExaLOdHCkji3uVWSqfmZ0Qz0Tnyj' \
--data-raw '{
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "First customer",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
2. create a subscription
```
curl --location 'http://localhost:8080/subscription/create' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: pro_X16mQSHipgRuWbTEMkMp' \
--header 'api-key: dev_Ske75Nx2J7qtHsP8cc7pFx5k4dccYBedM6UAExaLOdHCkji3uVWSqfmZ0Qz0Tnyj' \
--data '{
    "customer_id": "cus_NdHhw4wwWyYXSldO9oYE"
}'
```
response - 
```
{"id":"subscription_wBV1G9dhh6EBhTOTXRBA","merchant_reference_id":null,"status":"Created","plan_id":null,"profile_id":"pro_X16mQSHipgRuWbTEMkMp","client_secret":"subscription_wBV1G9dhh6EBhTOTXRBA_secret_6W89VL1bl5C3esgbxpJp","merchant_id":"merchant_1758626894","coupon_code":null,"customer_id":"cus_NdHhw4wwWyYXSldO9oYE"}
```
3. Confirm subscription
```
curl --location 'http://localhost:8080/subscription/subscription_wBV1G9dhh6EBhTOTXRBA/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Profile-Id: pro_2WzEeiNyj8fSCObXqo36' \
--header 'api-key: dev_Ske75Nx2J7qtHsP8cc7pFx5k4dccYBedM6UAExaLOdHCkji3uVWSqfmZ0Qz0Tnyj' \
--data '{
    "amount": 14100,
    "currency": "INR",
    "item_price_id": "cbdemo_enterprise-suite-INR-Daily",
    "customer_id": "cus_NdHhw4wwWyYXSldO9oYE",
    "billing_address": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_details": {
        "payment_method": "card",
        "payment_method_type": "credit",
        "payment_method_data": {
            "card": {
                "card_number": "4242424242424242",
                "card_exp_month": "10",
                "card_exp_year": "25",
                "card_holder_name": "joseph Doe",
                "card_cvc": "123"
            }
        },
        "setup_future_usage": "off_session",
        "customer_acceptance": {
            "acceptance_type": "online",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "127.0.0.1",
                "user_agent": "amet irure esse"
            }
        }
    }
}'
```
Response - 
```
{"id":"subscription_wBV1G9dhh6EBhTOTXRBA","merchant_reference_id":null,"status":"Active","plan_id":null,"price_id":null,"coupon":null,"profile_id":"pro_X16mQSHipgRuWbTEMkMp","payment":null,"customer_id":"cus_NdHhw4wwWyYXSldO9oYE","invoice":{"id":"invoice_0XANlbhMp2V7wUvWRhhJ","subscription_id":"subscription_wBV1G9dhh6EBhTOTXRBA","merchant_id":"merchant_1758626894","profile_id":"pro_X16mQSHipgRuWbTEMkMp","merchant_connector_id":"mca_eN6JxSK2NkuT0wSYAH5s","payment_intent_id":null,"payment_method_id":null,"customer_id":"cus_NdHhw4wwWyYXSldO9oYE","amount":14100,"currency":"INR","status":"InvoiceCreated"}}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	b26e845198407f3672a7f80d8eea670419858e0e | 
	
1. create a customer
```
curl --location 'http://localhost:8080/customers' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Ske75Nx2J7qtHsP8cc7pFx5k4dccYBedM6UAExaLOdHCkji3uVWSqfmZ0Qz0Tnyj' \
--data-raw '{
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "First customer",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
2. create a subscription
```
curl --location 'http://localhost:8080/subscription/create' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: pro_X16mQSHipgRuWbTEMkMp' \
--header 'api-key: dev_Ske75Nx2J7qtHsP8cc7pFx5k4dccYBedM6UAExaLOdHCkji3uVWSqfmZ0Qz0Tnyj' \
--data '{
    "customer_id": "cus_NdHhw4wwWyYXSldO9oYE"
}'
```
response - 
```
{"id":"subscription_wBV1G9dhh6EBhTOTXRBA","merchant_reference_id":null,"status":"Created","plan_id":null,"profile_id":"pro_X16mQSHipgRuWbTEMkMp","client_secret":"subscription_wBV1G9dhh6EBhTOTXRBA_secret_6W89VL1bl5C3esgbxpJp","merchant_id":"merchant_1758626894","coupon_code":null,"customer_id":"cus_NdHhw4wwWyYXSldO9oYE"}
```
3. Confirm subscription
```
curl --location 'http://localhost:8080/subscription/subscription_wBV1G9dhh6EBhTOTXRBA/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Profile-Id: pro_2WzEeiNyj8fSCObXqo36' \
--header 'api-key: dev_Ske75Nx2J7qtHsP8cc7pFx5k4dccYBedM6UAExaLOdHCkji3uVWSqfmZ0Qz0Tnyj' \
--data '{
    "amount": 14100,
    "currency": "INR",
    "item_price_id": "cbdemo_enterprise-suite-INR-Daily",
    "customer_id": "cus_NdHhw4wwWyYXSldO9oYE",
    "billing_address": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_details": {
        "payment_method": "card",
        "payment_method_type": "credit",
        "payment_method_data": {
            "card": {
                "card_number": "4242424242424242",
                "card_exp_month": "10",
                "card_exp_year": "25",
                "card_holder_name": "joseph Doe",
                "card_cvc": "123"
            }
        },
        "setup_future_usage": "off_session",
        "customer_acceptance": {
            "acceptance_type": "online",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "127.0.0.1",
                "user_agent": "amet irure esse"
            }
        }
    }
}'
```
Response - 
```
{"id":"subscription_wBV1G9dhh6EBhTOTXRBA","merchant_reference_id":null,"status":"Active","plan_id":null,"price_id":null,"coupon":null,"profile_id":"pro_X16mQSHipgRuWbTEMkMp","payment":null,"customer_id":"cus_NdHhw4wwWyYXSldO9oYE","invoice":{"id":"invoice_0XANlbhMp2V7wUvWRhhJ","subscription_id":"subscription_wBV1G9dhh6EBhTOTXRBA","merchant_id":"merchant_1758626894","profile_id":"pro_X16mQSHipgRuWbTEMkMp","merchant_connector_id":"mca_eN6JxSK2NkuT0wSYAH5s","payment_intent_id":null,"payment_method_id":null,"customer_id":"cus_NdHhw4wwWyYXSldO9oYE","amount":14100,"currency":"INR","status":"InvoiceCreated"}}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9072 | 
	Bug: [BUG] Additional amount gets added again during incremental authorization
### Bug Description
Additional amount gets added again during incremental authorization
### Expected Behavior
Additional amount should get added once only during payments-create call
### Actual Behavior
Additional amount gets added again during incremental authorization
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 4d1ae8bb920..c1ed78b5773 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -1089,6 +1089,10 @@ impl NetAmount {
             + self.tax_on_surcharge.unwrap_or_default()
     }
 
+    pub fn get_additional_amount(&self) -> MinorUnit {
+        self.get_total_amount() - self.get_order_amount()
+    }
+
     pub fn set_order_amount(&mut self, order_amount: MinorUnit) {
         self.order_amount = order_amount;
     }
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 830186eeaad..a4ef1bdac82 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -421,7 +421,8 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsIncrementalAu
                         Some(
                             storage::PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate {
                                 net_amount: hyperswitch_domain_models::payments::payment_attempt::NetAmount::new(
-                                    incremental_authorization_details.total_amount,
+                                    // Internally, `NetAmount` is computed as (order_amount + additional_amount), so we subtract here to avoid double-counting.
+                                    incremental_authorization_details.total_amount - payment_data.payment_attempt.net_amount.get_additional_amount(),
                                     None,
                                     None,
                                     None,
@@ -432,7 +433,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsIncrementalAu
                         ),
                         Some(
                             storage::PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate {
-                                amount: incremental_authorization_details.total_amount,
+                                amount: incremental_authorization_details.total_amount - payment_data.payment_attempt.net_amount.get_additional_amount(),
                             },
                         ),
                     )
 | 
	2025-08-27T16:11:09Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/9072)
## Description
<!-- Describe your changes in detail -->
Fixed net_amount on Incremental Authorization Update. Additional amount gets added again during incremental authorization. Additional amount should get added once only during payments-create call
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
1. Payments - Create Call (with Shipping Cost):
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_LrNckNcOPFASn7VpEoEhyyiRB48cyo9t1csS7YCdWl3jXZgegV7BLdyIZi0ZrS6Z' \
--data-raw '
{
    "amount": 6500,
    "shipping_cost": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}
'
```
Response:
```
{
    "payment_id": "pay_upjMvDYu9WjajAzyRlXo",
    "merchant_id": "merchant_1756308166",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6600,
    "shipping_cost": 100,
    "amount_capturable": 6600,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_upjMvDYu9WjajAzyRlXo_secret_1G2kKy9iAhTmwNQa5k93",
    "created": "2025-08-27T15:47:52.956Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1756309672,
        "expires": 1756313272,
        "secret": "epk_4f4fb7f0092d42289f9cd9bc7eadeff2"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3S0lZlE9cSvqiivY0lSuXawj",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3S0lZlE9cSvqiivY0lSuXawj",
    "payment_link": null,
    "profile_id": "pro_fW5H3dRoivQsyI9e3xgm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_bLPtb7IYMPK6HwBo25Sf",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-27T16:02:52.956Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "561027010586901",
    "payment_method_status": null,
    "updated": "2025-08-27T15:47:53.993Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
2. Incremental Authorization
Request:
```
curl --location 'http://localhost:8080/payments/pay_upjMvDYu9WjajAzyRlXo/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_LrNckNcOPFASn7VpEoEhyyiRB48cyo9t1csS7YCdWl3jXZgegV7BLdyIZi0ZrS6Z' \
--data '{
  "amount": 6700
}'
```
Response:
```
{
    "payment_id": "pay_upjMvDYu9WjajAzyRlXo",
    "merchant_id": "merchant_1756308166",
    "status": "requires_capture",
    "amount": 6600,
    "net_amount": 6700,
    "shipping_cost": 100,
    "amount_capturable": 6700,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_upjMvDYu9WjajAzyRlXo_secret_wd5Y8MKQvldzNS07lJg9",
    "created": "2025-08-27T16:09:46.666Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3S0luxE9cSvqiivY19yeqwRn",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3S0luxE9cSvqiivY19yeqwRn",
    "payment_link": null,
    "profile_id": "pro_fW5H3dRoivQsyI9e3xgm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_bLPtb7IYMPK6HwBo25Sf",
    "incremental_authorization_allowed": true,
    "authorization_count": 1,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_sz8ljqdlMKe2dckB5YzK_1",
            "amount": 6700,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6600
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-27T16:24:46.666Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "561027010586901",
    "payment_method_status": null,
    "updated": "2025-08-27T16:09:50.595Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	cf64d2a9dcef422e7d080e21a7e8644694337a51 | 
	
Postman Test
1. Payments - Create Call (with Shipping Cost):
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_LrNckNcOPFASn7VpEoEhyyiRB48cyo9t1csS7YCdWl3jXZgegV7BLdyIZi0ZrS6Z' \
--data-raw '
{
    "amount": 6500,
    "shipping_cost": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}
'
```
Response:
```
{
    "payment_id": "pay_upjMvDYu9WjajAzyRlXo",
    "merchant_id": "merchant_1756308166",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6600,
    "shipping_cost": 100,
    "amount_capturable": 6600,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_upjMvDYu9WjajAzyRlXo_secret_1G2kKy9iAhTmwNQa5k93",
    "created": "2025-08-27T15:47:52.956Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1756309672,
        "expires": 1756313272,
        "secret": "epk_4f4fb7f0092d42289f9cd9bc7eadeff2"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3S0lZlE9cSvqiivY0lSuXawj",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3S0lZlE9cSvqiivY0lSuXawj",
    "payment_link": null,
    "profile_id": "pro_fW5H3dRoivQsyI9e3xgm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_bLPtb7IYMPK6HwBo25Sf",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-27T16:02:52.956Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "561027010586901",
    "payment_method_status": null,
    "updated": "2025-08-27T15:47:53.993Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
2. Incremental Authorization
Request:
```
curl --location 'http://localhost:8080/payments/pay_upjMvDYu9WjajAzyRlXo/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_LrNckNcOPFASn7VpEoEhyyiRB48cyo9t1csS7YCdWl3jXZgegV7BLdyIZi0ZrS6Z' \
--data '{
  "amount": 6700
}'
```
Response:
```
{
    "payment_id": "pay_upjMvDYu9WjajAzyRlXo",
    "merchant_id": "merchant_1756308166",
    "status": "requires_capture",
    "amount": 6600,
    "net_amount": 6700,
    "shipping_cost": 100,
    "amount_capturable": 6700,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_upjMvDYu9WjajAzyRlXo_secret_wd5Y8MKQvldzNS07lJg9",
    "created": "2025-08-27T16:09:46.666Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3S0luxE9cSvqiivY19yeqwRn",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3S0luxE9cSvqiivY19yeqwRn",
    "payment_link": null,
    "profile_id": "pro_fW5H3dRoivQsyI9e3xgm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_bLPtb7IYMPK6HwBo25Sf",
    "incremental_authorization_allowed": true,
    "authorization_count": 1,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_sz8ljqdlMKe2dckB5YzK_1",
            "amount": 6700,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6600
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-27T16:24:46.666Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "561027010586901",
    "payment_method_status": null,
    "updated": "2025-08-27T16:09:50.595Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9074 | 
	Bug: Batch update payment methods API
We need to make update payment methods API which can update the fields of the records in payment methods table. It will consume a CSV file which will have batch update entries. Currently it should only update connector_mandate_id, network_transaction_id and mandate_status. | 
	diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 135e0ddc248..5803a5c6876 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -285,6 +285,14 @@ pub struct PaymentMethodMigrateResponse {
     pub network_transaction_id_migrated: Option<bool>,
 }
 
+#[derive(Debug, serde::Serialize, ToSchema)]
+pub struct PaymentMethodRecordUpdateResponse {
+    pub payment_method_id: String,
+    pub status: common_enums::PaymentMethodStatus,
+    pub network_transaction_id: Option<String>,
+    pub connector_mandate_details: Option<pii::SecretSerdeValue>,
+}
+
 #[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
 pub struct PaymentsMandateReference(
     pub HashMap<id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>,
@@ -2640,6 +2648,28 @@ pub struct PaymentMethodRecord {
     pub network_token_requestor_ref_id: Option<String>,
 }
 
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
+pub struct UpdatePaymentMethodRecord {
+    pub payment_method_id: String,
+    pub status: Option<common_enums::PaymentMethodStatus>,
+    pub network_transaction_id: Option<String>,
+    pub line_number: Option<i64>,
+    pub payment_instrument_id: Option<masking::Secret<String>>,
+    pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+}
+
+#[derive(Debug, serde::Serialize)]
+pub struct PaymentMethodUpdateResponse {
+    pub payment_method_id: String,
+    pub status: Option<common_enums::PaymentMethodStatus>,
+    pub network_transaction_id: Option<String>,
+    pub connector_mandate_details: Option<pii::SecretSerdeValue>,
+    pub update_status: UpdateStatus,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub update_error: Option<String>,
+    pub line_number: Option<i64>,
+}
+
 #[derive(Debug, Default, serde::Serialize)]
 pub struct PaymentMethodMigrationResponse {
     pub line_number: Option<i64>,
@@ -2667,6 +2697,13 @@ pub enum MigrationStatus {
     Failed,
 }
 
+#[derive(Debug, Default, serde::Serialize)]
+pub enum UpdateStatus {
+    Success,
+    #[default]
+    Failed,
+}
+
 impl PaymentMethodRecord {
     fn create_address(&self) -> Option<payments::AddressDetails> {
         if self.billing_address_first_name.is_some()
@@ -2725,6 +2762,12 @@ type PaymentMethodMigrationResponseType = (
     PaymentMethodRecord,
 );
 
+#[cfg(feature = "v1")]
+type PaymentMethodUpdateResponseType = (
+    Result<PaymentMethodRecordUpdateResponse, String>,
+    UpdatePaymentMethodRecord,
+);
+
 #[cfg(feature = "v1")]
 impl From<PaymentMethodMigrationResponseType> for PaymentMethodMigrationResponse {
     fn from((response, record): PaymentMethodMigrationResponseType) -> Self {
@@ -2755,6 +2798,32 @@ impl From<PaymentMethodMigrationResponseType> for PaymentMethodMigrationResponse
     }
 }
 
+#[cfg(feature = "v1")]
+impl From<PaymentMethodUpdateResponseType> for PaymentMethodUpdateResponse {
+    fn from((response, record): PaymentMethodUpdateResponseType) -> Self {
+        match response {
+            Ok(res) => Self {
+                payment_method_id: res.payment_method_id,
+                status: Some(res.status),
+                network_transaction_id: res.network_transaction_id,
+                connector_mandate_details: res.connector_mandate_details,
+                update_status: UpdateStatus::Success,
+                update_error: None,
+                line_number: record.line_number,
+            },
+            Err(e) => Self {
+                payment_method_id: record.payment_method_id,
+                status: record.status,
+                network_transaction_id: record.network_transaction_id,
+                connector_mandate_details: None,
+                update_status: UpdateStatus::Failed,
+                update_error: Some(e),
+                line_number: record.line_number,
+            },
+        }
+    }
+}
+
 impl
     TryFrom<(
         &PaymentMethodRecord,
diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs
index 79d6865b727..34fff64e7d9 100644
--- a/crates/diesel_models/src/payment_method.rs
+++ b/crates/diesel_models/src/payment_method.rs
@@ -245,6 +245,11 @@ pub enum PaymentMethodUpdate {
         connector_mandate_details: Option<pii::SecretSerdeValue>,
         network_transaction_id: Option<Secret<String>>,
     },
+    ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
+        connector_mandate_details: Option<pii::SecretSerdeValue>,
+        network_transaction_id: Option<String>,
+        status: Option<storage_enums::PaymentMethodStatus>,
+    },
 }
 
 #[cfg(feature = "v2")]
@@ -673,6 +678,29 @@ impl From<PaymentMethodUpdate> for PaymentMethodUpdateInternal {
                 network_token_payment_method_data: None,
                 scheme: None,
             },
+            PaymentMethodUpdate::ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
+                connector_mandate_details,
+                network_transaction_id,
+                status,
+            } => Self {
+                metadata: None,
+                payment_method_data: None,
+                last_used_at: None,
+                status,
+                locker_id: None,
+                network_token_requestor_reference_id: None,
+                payment_method: None,
+                connector_mandate_details: connector_mandate_details
+                    .map(|mandate_details| mandate_details.expose()),
+                network_transaction_id,
+                updated_by: None,
+                payment_method_issuer: None,
+                payment_method_type: None,
+                last_modified: common_utils::date_time::now(),
+                network_token_locker_id: None,
+                network_token_payment_method_data: None,
+                scheme: None,
+            },
         }
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs
index 0fa3d5b4e07..003998d9ccc 100644
--- a/crates/hyperswitch_domain_models/src/payment_methods.rs
+++ b/crates/hyperswitch_domain_models/src/payment_methods.rs
@@ -12,7 +12,7 @@ use common_utils::{
     id_type, pii, type_name,
     types::keymanager,
 };
-use diesel_models::{enums as storage_enums, PaymentMethodUpdate};
+pub use diesel_models::{enums as storage_enums, PaymentMethodUpdate};
 use error_stack::ResultExt;
 #[cfg(feature = "v1")]
 use masking::ExposeInterface;
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 3a072e12cc7..06622842281 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -1,4 +1,5 @@
 pub mod cards;
+pub mod migration;
 pub mod network_tokenization;
 pub mod surcharge_decision_configs;
 #[cfg(feature = "v1")]
diff --git a/crates/router/src/core/payment_methods/migration.rs b/crates/router/src/core/payment_methods/migration.rs
new file mode 100644
index 00000000000..d802e432ec1
--- /dev/null
+++ b/crates/router/src/core/payment_methods/migration.rs
@@ -0,0 +1,257 @@
+use actix_multipart::form::{self, bytes, text};
+use api_models::payment_methods as pm_api;
+use common_utils::{errors::CustomResult, id_type};
+use csv::Reader;
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+    api::ApplicationResponse, errors::api_error_response as errors, merchant_context,
+    payment_methods::PaymentMethodUpdate,
+};
+use masking::PeekInterface;
+use rdkafka::message::ToBytes;
+use router_env::logger;
+
+use crate::{core::errors::StorageErrorExt, routes::SessionState};
+
+type PmMigrationResult<T> = CustomResult<ApplicationResponse<T>, errors::ApiErrorResponse>;
+
+#[cfg(feature = "v1")]
+pub async fn update_payment_methods(
+    state: &SessionState,
+    payment_methods: Vec<pm_api::UpdatePaymentMethodRecord>,
+    merchant_id: &id_type::MerchantId,
+    merchant_context: &merchant_context::MerchantContext,
+) -> PmMigrationResult<Vec<pm_api::PaymentMethodUpdateResponse>> {
+    let mut result = Vec::with_capacity(payment_methods.len());
+
+    for record in payment_methods {
+        let update_res =
+            update_payment_method_record(state, record.clone(), merchant_id, merchant_context)
+                .await;
+        let res = match update_res {
+            Ok(ApplicationResponse::Json(response)) => Ok(response),
+            Err(e) => Err(e.to_string()),
+            _ => Err("Failed to update payment method".to_string()),
+        };
+
+        result.push(pm_api::PaymentMethodUpdateResponse::from((res, record)));
+    }
+    Ok(ApplicationResponse::Json(result))
+}
+
+#[cfg(feature = "v1")]
+pub async fn update_payment_method_record(
+    state: &SessionState,
+    req: pm_api::UpdatePaymentMethodRecord,
+    merchant_id: &id_type::MerchantId,
+    merchant_context: &merchant_context::MerchantContext,
+) -> CustomResult<
+    ApplicationResponse<pm_api::PaymentMethodRecordUpdateResponse>,
+    errors::ApiErrorResponse,
+> {
+    use std::collections::HashMap;
+
+    use common_enums::enums;
+    use common_utils::pii;
+    use hyperswitch_domain_models::mandates::{
+        CommonMandateReference, PaymentsMandateReference, PaymentsMandateReferenceRecord,
+        PayoutsMandateReference, PayoutsMandateReferenceRecord,
+    };
+
+    let db = &*state.store;
+    let payment_method_id = req.payment_method_id.clone();
+    let network_transaction_id = req.network_transaction_id.clone();
+    let status = req.status;
+
+    let payment_method = db
+        .find_payment_method(
+            &state.into(),
+            merchant_context.get_merchant_key_store(),
+            &payment_method_id,
+            merchant_context.get_merchant_account().storage_scheme,
+        )
+        .await
+        .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?;
+
+    if payment_method.merchant_id != *merchant_id {
+        return Err(errors::ApiErrorResponse::InvalidRequestData {
+                    message: "Merchant ID in the request does not match the Merchant ID in the payment method record.".to_string(),
+                }.into());
+    }
+
+    // Process mandate details when both payment_instrument_id and merchant_connector_id are present
+    let pm_update = match (&req.payment_instrument_id, &req.merchant_connector_id) {
+        (Some(payment_instrument_id), Some(merchant_connector_id)) => {
+            let mandate_details = payment_method
+                .get_common_mandate_reference()
+                .change_context(errors::ApiErrorResponse::InternalServerError)
+                .attach_printable("Failed to deserialize to Payment Mandate Reference ")?;
+
+            let mca = db
+                .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
+                    &state.into(),
+                    merchant_context.get_merchant_account().get_id(),
+                    merchant_connector_id,
+                    merchant_context.get_merchant_key_store(),
+                )
+                .await
+                .to_not_found_response(
+                    errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+                        id: merchant_connector_id.get_string_repr().to_string(),
+                    },
+                )?;
+
+            let updated_connector_mandate_details = match mca.connector_type {
+                enums::ConnectorType::PayoutProcessor => {
+                    // Handle PayoutsMandateReference
+                    let mut existing_payouts_mandate = mandate_details
+                        .payouts
+                        .unwrap_or_else(|| PayoutsMandateReference(HashMap::new()));
+
+                    // Create new payout mandate record
+                    let new_payout_record = PayoutsMandateReferenceRecord {
+                        transfer_method_id: Some(payment_instrument_id.peek().to_string()),
+                    };
+
+                    // Check if record exists for this merchant_connector_id
+                    if let Some(existing_record) =
+                        existing_payouts_mandate.0.get_mut(merchant_connector_id)
+                    {
+                        if let Some(transfer_method_id) = &new_payout_record.transfer_method_id {
+                            existing_record.transfer_method_id = Some(transfer_method_id.clone());
+                        }
+                    } else {
+                        // Insert new record in connector_mandate_details
+                        existing_payouts_mandate
+                            .0
+                            .insert(merchant_connector_id.clone(), new_payout_record);
+                    }
+
+                    // Create updated CommonMandateReference preserving payments section
+                    CommonMandateReference {
+                        payments: mandate_details.payments,
+                        payouts: Some(existing_payouts_mandate),
+                    }
+                }
+                _ => {
+                    // Handle PaymentsMandateReference
+                    let mut existing_payments_mandate = mandate_details
+                        .payments
+                        .unwrap_or_else(|| PaymentsMandateReference(HashMap::new()));
+
+                    // Check if record exists for this merchant_connector_id
+                    if let Some(existing_record) =
+                        existing_payments_mandate.0.get_mut(merchant_connector_id)
+                    {
+                        existing_record.connector_mandate_id =
+                            payment_instrument_id.peek().to_string();
+                    } else {
+                        // Insert new record in connector_mandate_details
+                        existing_payments_mandate.0.insert(
+                            merchant_connector_id.clone(),
+                            PaymentsMandateReferenceRecord {
+                                connector_mandate_id: payment_instrument_id.peek().to_string(),
+                                payment_method_type: None,
+                                original_payment_authorized_amount: None,
+                                original_payment_authorized_currency: None,
+                                mandate_metadata: None,
+                                connector_mandate_status: None,
+                                connector_mandate_request_reference_id: None,
+                            },
+                        );
+                    }
+
+                    // Create updated CommonMandateReference preserving payouts section
+                    CommonMandateReference {
+                        payments: Some(existing_payments_mandate),
+                        payouts: mandate_details.payouts,
+                    }
+                }
+            };
+
+            let connector_mandate_details_value = updated_connector_mandate_details
+                .get_mandate_details_value()
+                .map_err(|err| {
+                    logger::error!("Failed to get get_mandate_details_value : {:?}", err);
+                    errors::ApiErrorResponse::MandateUpdateFailed
+                })?;
+
+            PaymentMethodUpdate::ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
+                connector_mandate_details: Some(pii::SecretSerdeValue::new(
+                    connector_mandate_details_value,
+                )),
+                network_transaction_id,
+                status,
+            }
+        }
+        _ => {
+            // Update only network_transaction_id and status
+            PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate {
+                network_transaction_id,
+                status,
+            }
+        }
+    };
+
+    let response = db
+        .update_payment_method(
+            &state.into(),
+            merchant_context.get_merchant_key_store(),
+            payment_method,
+            pm_update,
+            merchant_context.get_merchant_account().storage_scheme,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable(format!(
+            "Failed to update payment method for existing pm_id: {payment_method_id:?} in db",
+        ))?;
+
+    logger::debug!("Payment method updated in db");
+
+    Ok(ApplicationResponse::Json(
+        pm_api::PaymentMethodRecordUpdateResponse {
+            payment_method_id: response.payment_method_id,
+            status: response.status,
+            network_transaction_id: response.network_transaction_id,
+            connector_mandate_details: response
+                .connector_mandate_details
+                .map(pii::SecretSerdeValue::new),
+        },
+    ))
+}
+
+#[derive(Debug, form::MultipartForm)]
+pub struct PaymentMethodsUpdateForm {
+    #[multipart(limit = "1MB")]
+    pub file: bytes::Bytes,
+
+    pub merchant_id: text::Text<id_type::MerchantId>,
+}
+
+fn parse_update_csv(data: &[u8]) -> csv::Result<Vec<pm_api::UpdatePaymentMethodRecord>> {
+    let mut csv_reader = Reader::from_reader(data);
+    let mut records = Vec::new();
+    let mut id_counter = 0;
+    for result in csv_reader.deserialize() {
+        let mut record: pm_api::UpdatePaymentMethodRecord = result?;
+        id_counter += 1;
+        record.line_number = Some(id_counter);
+        records.push(record);
+    }
+    Ok(records)
+}
+
+type UpdateValidationResult =
+    Result<(id_type::MerchantId, Vec<pm_api::UpdatePaymentMethodRecord>), errors::ApiErrorResponse>;
+
+impl PaymentMethodsUpdateForm {
+    pub fn validate_and_get_payment_method_records(self) -> UpdateValidationResult {
+        let records = parse_update_csv(self.file.data.to_bytes()).map_err(|e| {
+            errors::ApiErrorResponse::PreconditionFailed {
+                message: e.to_string(),
+            }
+        })?;
+        Ok((self.merchant_id.clone(), records))
+    }
+}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 690a4337351..c48fcd1fec1 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1429,6 +1429,10 @@ impl PaymentMethods {
                     web::resource("/migrate-batch")
                         .route(web::post().to(payment_methods::migrate_payment_methods)),
                 )
+                .service(
+                    web::resource("/update-batch")
+                        .route(web::post().to(payment_methods::update_payment_methods)),
+                )
                 .service(
                     web::resource("/tokenize-card")
                         .route(web::post().to(payment_methods::tokenize_card_api)),
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 27b66e5bb54..0c42909b457 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -121,6 +121,7 @@ impl From<Flow> for ApiIdentifier {
 
             Flow::PaymentMethodsCreate
             | Flow::PaymentMethodsMigrate
+            | Flow::PaymentMethodsBatchUpdate
             | Flow::PaymentMethodsList
             | Flow::CustomerPaymentMethodsList
             | Flow::GetPaymentMethodTokenData
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 08b84e40977..7aa1ba949ba 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -21,7 +21,7 @@ use crate::{
     core::{
         api_locking,
         errors::{self, utils::StorageErrorExt},
-        payment_methods::{self as payment_methods_routes, cards},
+        payment_methods::{self as payment_methods_routes, cards, migration as update_migration},
     },
     services::{self, api, authentication as auth, authorization::permissions::Permission},
     types::{
@@ -413,6 +413,46 @@ pub async fn migrate_payment_methods(
     .await
 }
 
+#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))]
+#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsBatchUpdate))]
+pub async fn update_payment_methods(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    MultipartForm(form): MultipartForm<update_migration::PaymentMethodsUpdateForm>,
+) -> HttpResponse {
+    let flow = Flow::PaymentMethodsBatchUpdate;
+    let (merchant_id, records) = match form.validate_and_get_payment_method_records() {
+        Ok((merchant_id, records)) => (merchant_id, records),
+        Err(e) => return api::log_and_return_error_response(e.into()),
+    };
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        records,
+        |state, _, req, _| {
+            let merchant_id = merchant_id.clone();
+            async move {
+                let (key_store, merchant_account) =
+                    get_merchant_account(&state, &merchant_id).await?;
+                let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                    domain::Context(merchant_account.clone(), key_store.clone()),
+                ));
+                Box::pin(update_migration::update_payment_methods(
+                    &state,
+                    req,
+                    &merchant_id,
+                    &merchant_context,
+                ))
+                .await
+            }
+        },
+        &auth::AdminApiAuth,
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
+
 #[cfg(feature = "v1")]
 #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSave))]
 pub async fn save_payment_method_api(
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index b758d98f498..ae5f34fd78f 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -118,6 +118,8 @@ pub enum Flow {
     PaymentMethodsCreate,
     /// Payment methods migrate flow.
     PaymentMethodsMigrate,
+    /// Payment methods batch update flow.
+    PaymentMethodsBatchUpdate,
     /// Payment methods list flow.
     PaymentMethodsList,
     /// Payment method save flow
 | 
	2025-08-28T05:46:42Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
We need to make update payment methods API which can update the fields of the records in payment methods table. It will consume a CSV file which will have batch update entries. Currently it should only update connector_mandate_id, network_transaction_id and mandate_status.
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Frequent DB updates on payment methods table due to ongoing migrations of merchants.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
```
curl --location 'http://localhost:8080/payment_methods/update-batch' \
--header 'api-key: test_admin' \
--form 'file=@"/Users/mrudul.vajpayee/Downloads/update_sample.csv"' \
--form 'merchant_id="merchant_1756355489"'
```
Sample output:
```
[
    {
        "payment_method_id": "pm_RsWnXeiOhlaVseKdk0Mm",
        "status": "active",
        "network_transaction_id": "063AF598E0A5C5",
        "connector_mandate_details": {
            "payouts": {
                "mca_SbUFb1h4NfixAWFaLQeT": {
                    "transfer_method_id": "ARM-678ab3997b16cb7cd"
                }
            },
            "mca_Qwuqfidvy2Lk2y0PbvFa": {
                "mandate_metadata": null,
                "payment_method_type": "google_pay",
                "connector_mandate_id": "2D5D6F0E961E639BE063AF598E0A9A32",
                "connector_mandate_status": "active",
                "original_payment_authorized_amount": 20000,
                "original_payment_authorized_currency": "EUR",
                "connector_mandate_request_reference_id": "ytlaTEEjkONzieVl0k"
            },
            "mca_xHIYFXMCUsYTZIZ1rwgY": {
                "mandate_metadata": null,
                "payment_method_type": null,
                "connector_mandate_id": "6D981A0542DDF0EBE063AF598E0A5C5E",
                "connector_mandate_status": null,
                "original_payment_authorized_amount": null,
                "original_payment_authorized_currency": null,
                "connector_mandate_request_reference_id": null
            }
        },
        "update_status": "Success",
        "line_number": 1
    },
    {
        "payment_method_id": "pm_RsWnXeiOhlaVseKdk0Mm",
        "status": "active",
        "network_transaction_id": "063AF598E0A5C5",
        "connector_mandate_details": {
            "payouts": {
                "mca_SbUFb1h4NfixAWFaLQeT": {
                    "transfer_method_id": "ARM-678ab3997b16cb7cd"
                }
            },
            "mca_Qwuqfidvy2Lk2y0PbvFa": {
                "mandate_metadata": null,
                "payment_method_type": "google_pay",
                "connector_mandate_id": "2D5D6F0E961E639BE063AF598E0A9A32",
                "connector_mandate_status": "active",
                "original_payment_authorized_amount": 20000,
                "original_payment_authorized_currency": "EUR",
                "connector_mandate_request_reference_id": "ytlaTEEjkONzieVl0k"
            },
            "mca_xHIYFXMCUsYTZIZ1rwgY": {
                "mandate_metadata": null,
                "payment_method_type": null,
                "connector_mandate_id": "6D981A0542DDF0EBE063AF598E0A5C5E",
                "connector_mandate_status": null,
                "original_payment_authorized_amount": null,
                "original_payment_authorized_currency": null,
                "connector_mandate_request_reference_id": null
            }
        },
        "update_status": "Success",
        "line_number": 2
    },
    {
        "payment_method_id": "pm_RsWnXeiOhlaVseKdk0Mm",
        "status": "active",
        "network_transaction_id": "063AF598E0A5C5",
        "connector_mandate_details": {
            "payouts": {
                "mca_SbUFb1h4NfixAWFaLQeT": {
                    "transfer_method_id": "ARM-678ab3997b16cb7cd"
                }
            },
            "mca_Qwuqfidvy2Lk2y0PbvFa": {
                "mandate_metadata": null,
                "payment_method_type": "google_pay",
                "connector_mandate_id": "2D5D6F0E961E639BE063AF598E0A9A32",
                "connector_mandate_status": "active",
                "original_payment_authorized_amount": 20000,
                "original_payment_authorized_currency": "EUR",
                "connector_mandate_request_reference_id": "ytlaTEEjkONzieVl0k"
            },
            "mca_xHIYFXMCUsYTZIZ1rwgY": {
                "mandate_metadata": null,
                "payment_method_type": null,
                "connector_mandate_id": "6D981A0542DDF0EBE063AF598E0A5C5E",
                "connector_mandate_status": null,
                "original_payment_authorized_amount": null,
                "original_payment_authorized_currency": null,
                "connector_mandate_request_reference_id": null
            }
        },
        "update_status": "Success",
        "line_number": 3
    }
]
```
[update_sample.csv](https://github.com/user-attachments/files/22072833/update_sample.csv)
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	10cf161d14810cc9c6320933909e9cd3bfdc41ca | 
	
```
curl --location 'http://localhost:8080/payment_methods/update-batch' \
--header 'api-key: test_admin' \
--form 'file=@"/Users/mrudul.vajpayee/Downloads/update_sample.csv"' \
--form 'merchant_id="merchant_1756355489"'
```
Sample output:
```
[
    {
        "payment_method_id": "pm_RsWnXeiOhlaVseKdk0Mm",
        "status": "active",
        "network_transaction_id": "063AF598E0A5C5",
        "connector_mandate_details": {
            "payouts": {
                "mca_SbUFb1h4NfixAWFaLQeT": {
                    "transfer_method_id": "ARM-678ab3997b16cb7cd"
                }
            },
            "mca_Qwuqfidvy2Lk2y0PbvFa": {
                "mandate_metadata": null,
                "payment_method_type": "google_pay",
                "connector_mandate_id": "2D5D6F0E961E639BE063AF598E0A9A32",
                "connector_mandate_status": "active",
                "original_payment_authorized_amount": 20000,
                "original_payment_authorized_currency": "EUR",
                "connector_mandate_request_reference_id": "ytlaTEEjkONzieVl0k"
            },
            "mca_xHIYFXMCUsYTZIZ1rwgY": {
                "mandate_metadata": null,
                "payment_method_type": null,
                "connector_mandate_id": "6D981A0542DDF0EBE063AF598E0A5C5E",
                "connector_mandate_status": null,
                "original_payment_authorized_amount": null,
                "original_payment_authorized_currency": null,
                "connector_mandate_request_reference_id": null
            }
        },
        "update_status": "Success",
        "line_number": 1
    },
    {
        "payment_method_id": "pm_RsWnXeiOhlaVseKdk0Mm",
        "status": "active",
        "network_transaction_id": "063AF598E0A5C5",
        "connector_mandate_details": {
            "payouts": {
                "mca_SbUFb1h4NfixAWFaLQeT": {
                    "transfer_method_id": "ARM-678ab3997b16cb7cd"
                }
            },
            "mca_Qwuqfidvy2Lk2y0PbvFa": {
                "mandate_metadata": null,
                "payment_method_type": "google_pay",
                "connector_mandate_id": "2D5D6F0E961E639BE063AF598E0A9A32",
                "connector_mandate_status": "active",
                "original_payment_authorized_amount": 20000,
                "original_payment_authorized_currency": "EUR",
                "connector_mandate_request_reference_id": "ytlaTEEjkONzieVl0k"
            },
            "mca_xHIYFXMCUsYTZIZ1rwgY": {
                "mandate_metadata": null,
                "payment_method_type": null,
                "connector_mandate_id": "6D981A0542DDF0EBE063AF598E0A5C5E",
                "connector_mandate_status": null,
                "original_payment_authorized_amount": null,
                "original_payment_authorized_currency": null,
                "connector_mandate_request_reference_id": null
            }
        },
        "update_status": "Success",
        "line_number": 2
    },
    {
        "payment_method_id": "pm_RsWnXeiOhlaVseKdk0Mm",
        "status": "active",
        "network_transaction_id": "063AF598E0A5C5",
        "connector_mandate_details": {
            "payouts": {
                "mca_SbUFb1h4NfixAWFaLQeT": {
                    "transfer_method_id": "ARM-678ab3997b16cb7cd"
                }
            },
            "mca_Qwuqfidvy2Lk2y0PbvFa": {
                "mandate_metadata": null,
                "payment_method_type": "google_pay",
                "connector_mandate_id": "2D5D6F0E961E639BE063AF598E0A9A32",
                "connector_mandate_status": "active",
                "original_payment_authorized_amount": 20000,
                "original_payment_authorized_currency": "EUR",
                "connector_mandate_request_reference_id": "ytlaTEEjkONzieVl0k"
            },
            "mca_xHIYFXMCUsYTZIZ1rwgY": {
                "mandate_metadata": null,
                "payment_method_type": null,
                "connector_mandate_id": "6D981A0542DDF0EBE063AF598E0A5C5E",
                "connector_mandate_status": null,
                "original_payment_authorized_amount": null,
                "original_payment_authorized_currency": null,
                "connector_mandate_request_reference_id": null
            }
        },
        "update_status": "Success",
        "line_number": 3
    }
]
```
[update_sample.csv](https://github.com/user-attachments/files/22072833/update_sample.csv)
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9067 | 
	Bug: Use SignatureKey as auth_type for VGS connector
We need to collect a 3rd key (vault_id) apart from `username` and `password` in case of VGS for SDK use case | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
index 4915e2da400..4f996c2ffbe 100644
--- a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
@@ -74,15 +74,22 @@ impl<F> TryFrom<&VaultRouterData<F>> for VgsInsertRequest {
 pub struct VgsAuthType {
     pub(super) username: Secret<String>,
     pub(super) password: Secret<String>,
+    // vault_id is used in sessions API
+    pub(super) _vault_id: Secret<String>,
 }
 
 impl TryFrom<&ConnectorAuthType> for VgsAuthType {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
         match auth_type {
-            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+            ConnectorAuthType::SignatureKey {
+                api_key,
+                key1,
+                api_secret,
+            } => Ok(Self {
                 username: api_key.to_owned(),
                 password: key1.to_owned(),
+                _vault_id: api_secret.to_owned(),
             }),
             _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
         }
 | 
	2025-08-26T11:35:27Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Change VGS auth type from BodyKey to SignatureKey
### Additional Changes
- [] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9067 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Request:
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_v2_WmQmWko8QabakxqCypsz' \
--header 'x-profile-id: pro_vnTuyThRZPNGRWjIHrIt' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "vault_processor",
    "connector_name": "vgs",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "[REDACTED]",
        "key1": "[REDACTED]",
        "api_secret": "[REDACTED]"
    },
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "profile_id": "pro_vnTuyThRZPNGRWjIHrIt"
}'
Response:
```json
{
    "connector_type": "vault_processor",
    "connector_name": "vgs",
    "connector_label": "vgs_businesss",
    "id": "mca_VsS4aBqNwMcPptFn4ZPL",
    "profile_id": "pro_vnTuyThRZPNGRWjIHrIt",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "US********************q4",
        "key1": "ca********************************07",
        "api_secret": "st*ff"
    },
    "payment_methods_enabled": null,
    "connector_webhook_details": {
        "merchant_secret": "",
        "additional_secret": null
    },
    "metadata": null,
    "disabled": false,
    "frm_configs": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null,
    "feature_metadata": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	30925ca5dd51be93e33ac4492b85c2322263b3fc | 
	
Request:
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_v2_WmQmWko8QabakxqCypsz' \
--header 'x-profile-id: pro_vnTuyThRZPNGRWjIHrIt' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "vault_processor",
    "connector_name": "vgs",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "[REDACTED]",
        "key1": "[REDACTED]",
        "api_secret": "[REDACTED]"
    },
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "profile_id": "pro_vnTuyThRZPNGRWjIHrIt"
}'
Response:
```json
{
    "connector_type": "vault_processor",
    "connector_name": "vgs",
    "connector_label": "vgs_businesss",
    "id": "mca_VsS4aBqNwMcPptFn4ZPL",
    "profile_id": "pro_vnTuyThRZPNGRWjIHrIt",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "US********************q4",
        "key1": "ca********************************07",
        "api_secret": "st*ff"
    },
    "payment_methods_enabled": null,
    "connector_webhook_details": {
        "merchant_secret": "",
        "additional_secret": null
    },
    "metadata": null,
    "disabled": false,
    "frm_configs": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null,
    "feature_metadata": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9065 | 
	Bug: [FEATURE] Add payment type to Get Intent Response (v2)
### Feature Description
We need to return `payment_type` in `Get Intent`. Required by SDK
### Possible Implementation
Add a field `payment_type` to Get Intent Response
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 5660819cea8..fefbbed0f03 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -654,6 +654,10 @@ pub struct PaymentsIntentResponse {
     /// Whether to perform external authentication (if applicable)
     #[schema(value_type = External3dsAuthenticationRequest)]
     pub request_external_three_ds_authentication: common_enums::External3dsAuthenticationRequest,
+
+    /// The type of the payment that differentiates between normal and various types of mandate payments
+    #[schema(value_type = PaymentType)]
+    pub payment_type: api_enums::PaymentType,
 }
 
 #[cfg(feature = "v2")]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index cdd552da14c..4e27e75470b 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2146,6 +2146,24 @@ where
     ) -> RouterResponse<Self> {
         let payment_intent = payment_data.get_payment_intent();
         let client_secret = payment_data.get_client_secret();
+
+        let is_cit_transaction = payment_intent.setup_future_usage.is_off_session();
+
+        let mandate_type = if payment_intent.customer_present
+            == common_enums::PresenceOfCustomerDuringPayment::Absent
+        {
+            Some(api::MandateTransactionType::RecurringMandateTransaction)
+        } else if is_cit_transaction {
+            Some(api::MandateTransactionType::NewMandateTransaction)
+        } else {
+            None
+        };
+
+        let payment_type = helpers::infer_payment_type(
+            payment_intent.amount_details.order_amount.into(),
+            mandate_type.as_ref(),
+        );
+
         Ok(services::ApplicationResponse::JsonWithHeaders((
             Self {
                 id: payment_intent.id.clone(),
@@ -2199,6 +2217,7 @@ where
                 frm_metadata: payment_intent.frm_metadata.clone(),
                 request_external_three_ds_authentication: payment_intent
                     .request_external_three_ds_authentication,
+                payment_type,
             },
             vec![],
         )))
 | 
	2025-08-26T11:00:47Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Add `payment_type` to Payments Get Intent response
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9065 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Request:
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_5DkqRwXafcKhIFXyzwGtSjrnqsQuFWELuWJsepMgoRrjY1AxF7lhtNGeeja9BEHt' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_RAH6QGkLhuQfmi97QhPZ' \
--header 'Authorization: api-key=dev_5DkqRwXafcKhIFXyzwGtSjrnqsQuFWELuWJsepMgoRrjY1AxF7lhtNGeeja9BEHt' \
--data-raw '{
	"amount_details": {
		"order_amount": 1000,
		"currency": "USD"
	},
	"capture_method": "automatic",
	"authentication_type": "three_ds",
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 1000
		}
	],
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		},
		"email": "user@gmail.com"
	},
	"shipping": {
		"address": {
			"first_name": "John",
			"last_name": "Dough",
			"city": "Karwar",
			"zip": "571201",
			"state": "California",
			"country": "US"
		},
		"email": "example@example.com",
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		}
	},
    
	"customer_id": "12345_cus_0198e5ff10ea7622abbf89f383110c99"
}'
```
Response:
```json
{
    "id": "12345_pay_0198e5ff18b77a63ab0e91be36d6f9b7",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 1000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": "cs_0198e5ff18c57d729ec8fbbb03141331",
    "profile_id": "pro_RAH6QGkLhuQfmi97QhPZ",
    "merchant_reference_id": null,
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "user@gmail.com"
    },
    "shipping": {
        "address": {
            "city": "Karwar",
            "country": "US",
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": "571201",
            "state": "California",
            "first_name": "John",
            "last_name": "Dough",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "example@example.com"
    },
    "customer_id": "12345_cus_0198e5ff10ea7622abbf89f383110c99",
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 1000,
            "tax_rate": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "product_img_link": null,
            "product_id": null,
            "category": null,
            "sub_category": null,
            "brand": null,
            "product_type": null,
            "product_tax_code": null,
            "description": null,
            "sku": null,
            "upc": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "total_amount": null,
            "unit_discount_amount": null
        }
    ],
    "allowed_payment_method_types": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "expires_on": "2025-08-26T11:04:17.247Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip",
    "payment_type": "normal"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	30925ca5dd51be93e33ac4492b85c2322263b3fc | 
	
Request:
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_5DkqRwXafcKhIFXyzwGtSjrnqsQuFWELuWJsepMgoRrjY1AxF7lhtNGeeja9BEHt' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_RAH6QGkLhuQfmi97QhPZ' \
--header 'Authorization: api-key=dev_5DkqRwXafcKhIFXyzwGtSjrnqsQuFWELuWJsepMgoRrjY1AxF7lhtNGeeja9BEHt' \
--data-raw '{
	"amount_details": {
		"order_amount": 1000,
		"currency": "USD"
	},
	"capture_method": "automatic",
	"authentication_type": "three_ds",
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 1000
		}
	],
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		},
		"email": "user@gmail.com"
	},
	"shipping": {
		"address": {
			"first_name": "John",
			"last_name": "Dough",
			"city": "Karwar",
			"zip": "571201",
			"state": "California",
			"country": "US"
		},
		"email": "example@example.com",
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		}
	},
    
	"customer_id": "12345_cus_0198e5ff10ea7622abbf89f383110c99"
}'
```
Response:
```json
{
    "id": "12345_pay_0198e5ff18b77a63ab0e91be36d6f9b7",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 1000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": "cs_0198e5ff18c57d729ec8fbbb03141331",
    "profile_id": "pro_RAH6QGkLhuQfmi97QhPZ",
    "merchant_reference_id": null,
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "user@gmail.com"
    },
    "shipping": {
        "address": {
            "city": "Karwar",
            "country": "US",
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": "571201",
            "state": "California",
            "first_name": "John",
            "last_name": "Dough",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "example@example.com"
    },
    "customer_id": "12345_cus_0198e5ff10ea7622abbf89f383110c99",
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 1000,
            "tax_rate": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "product_img_link": null,
            "product_id": null,
            "category": null,
            "sub_category": null,
            "brand": null,
            "product_type": null,
            "product_tax_code": null,
            "description": null,
            "sku": null,
            "upc": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "total_amount": null,
            "unit_discount_amount": null
        }
    ],
    "allowed_payment_method_types": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "expires_on": "2025-08-26T11:04:17.247Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip",
    "payment_type": "normal"
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9063 | 
	Bug: Change Underscore(_) to hyphen(-) in payment link locale.
Change Underscore(_) to hyphen(-) in payment link locale. | 
	diff --git a/crates/router/src/core/payment_link/locale.js b/crates/router/src/core/payment_link/locale.js
index 1b2d5c4108b..46103ea9fc5 100644
--- a/crates/router/src/core/payment_link/locale.js
+++ b/crates/router/src/core/payment_link/locale.js
@@ -3,11 +3,11 @@ The languages supported by locale.js are:
  1) English (en)
  2) Hebrew (he)
  3) French (fr)
- 4) British English (en_gb)
+ 4) British English (en-gb)
  5) Arabic (ar)
  6) Japanese (ja)
  7) German (de)
- 8) Belgian French (fr_be)
+ 8) Belgian French (fr-be)
  9) Spanish (es)
  10) Catalan (ca)
  11) Portuguese (pt)
@@ -17,7 +17,7 @@ The languages supported by locale.js are:
  15) Swedish (sv)
  16) Russian (ru)
  17) Chinese (zh)
- 19) Traditional Chinese (zh_hant)
+ 19) Traditional Chinese (zh-hant)
 */
 const locales = {
     en: {
@@ -119,7 +119,7 @@ const locales = {
       errorCode: "Code d'erreur",
       errorMessage: "Message d'erreur"
     },
-    en_gb: {
+    "en-gb": {
       expiresOn: "Link expires on: ",
       refId: "Ref Id: ",
       requestedBy: "Requested by ",
@@ -151,7 +151,6 @@ const locales = {
       notAllowed: "You are not allowed to view this content.",
       errorCode: "Error code",
       errorMessage: "Error Message"
-      
     },
     ar: {
       expiresOn: "الرابط ينتهي في: ",
@@ -252,7 +251,7 @@ const locales = {
       errorCode: "Fehlercode",
       errorMessage: "Fehlermeldung"
     },
-    fr_be: {
+    "fr-be": {
       expiresOn: "Le lien expire le: ",
       refId: "ID de référence: ",
       requestedBy: "Demandé par ",
@@ -284,7 +283,6 @@ const locales = {
       notAllowed: "Vous n'êtes pas autorisé à voir ce contenu.",
       errorCode: "Code d'erreur",
       errorMessage: "Message d'erreur"
-      
     },
     es: {
       expiresOn: "El enlace expira el: ",
@@ -384,7 +382,6 @@ const locales = {
       notAllowed: "Você não tem permissão para ver este conteúdo.",
       errorCode: "Código de erro",
       errorMessage: "Mensagem de erro"
-
     },
     it: {
       expiresOn: "Link scade il: ",
@@ -584,7 +581,7 @@ const locales = {
       errorCode: "错误代码",
       errorMessage: "错误信息"
     },
-    zh_hant: {
+    "zh-hant": {
       expiresOn: "連結到期日期:",
       refId: "參考編號:",
       requestedBy: "請求者 ",
@@ -628,10 +625,11 @@ function getLanguage(localeStr) {
   var language = parts[0];
   var country = parts.length > 1 ? parts[1] : null;
 
-  var key = `${language}_${country}`;
+  var key = language + '-' + country;
   switch (key) {
-    case 'en_gb': return 'en_gb';
-    case 'fr_be': return 'fr_be';
+    case 'en-gb': return 'en-gb';
+    case 'fr-be': return 'fr-be';
+    case 'zh-hant': return 'zh-hant';
     default: return language;
   }
 }
 | 
	2025-08-26T10:04:02Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Change Underscore(_) to hyphen(-) in payment link locale according to ISO standards.
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
We need to follow ISO standards when accepting the locale for payment links.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: **' \
--header 'Accept-Language: zh-hant' \
--data '{
    "amount": 10,
    "setup_future_usage": "off_session",
    "currency": "EUR",
    "payment_link": true,
    "session_expiry": 60,
    "return_url": "https://google.com",
    "payment_link_config": {
        "theme": "#14356f",
        "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg",
        "seller_name": "Zurich Inc."
    }
}'
```
```
zh-hant - should see traditional chinese
zh_hant - english
zh-hant-abcdef - traditional chinese
zh - simplified chinese
Zh - simplified chinese
ZH-HANT - traditional chinese
zh-abcdef - simplified chinese
```
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/a1c25820-6e50-480f-96f6-5a831a856bfd" />
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/1db9322d-601e-49df-bf2f-6e5f1911d4cd" />
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/d934116c-a24a-479d-86e6-9f0b25028400" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8446ffbf5992a97d79d129cade997effc60fcd85 | 
	
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: **' \
--header 'Accept-Language: zh-hant' \
--data '{
    "amount": 10,
    "setup_future_usage": "off_session",
    "currency": "EUR",
    "payment_link": true,
    "session_expiry": 60,
    "return_url": "https://google.com",
    "payment_link_config": {
        "theme": "#14356f",
        "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg",
        "seller_name": "Zurich Inc."
    }
}'
```
```
zh-hant - should see traditional chinese
zh_hant - english
zh-hant-abcdef - traditional chinese
zh - simplified chinese
Zh - simplified chinese
ZH-HANT - traditional chinese
zh-abcdef - simplified chinese
```
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/a1c25820-6e50-480f-96f6-5a831a856bfd" />
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/1db9322d-601e-49df-bf2f-6e5f1911d4cd" />
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/d934116c-a24a-479d-86e6-9f0b25028400" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9082 | 
	Bug: [FEATURE] Payment void endpoint for v2
### Feature Description
Add  support for Payment Cancel in V2.
### Possible Implementation
Add V2 payments_cancel flow by completing GetTracker, UpdateTracker, and Domain traits for payment cancel endpoint.
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
index 8a0af806334..ad107225177 100644
--- a/crates/api_models/src/events/payment.rs
+++ b/crates/api_models/src/events/payment.rs
@@ -238,6 +238,22 @@ impl ApiEventMetric for payments::PaymentsResponse {
     }
 }
 
+#[cfg(feature = "v2")]
+impl ApiEventMetric for payments::PaymentsCancelRequest {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        None
+    }
+}
+
+#[cfg(feature = "v2")]
+impl ApiEventMetric for payments::PaymentsCancelResponse {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        Some(ApiEventsType::Payment {
+            payment_id: self.id.clone(),
+        })
+    }
+}
+
 #[cfg(feature = "v1")]
 impl ApiEventMetric for payments::PaymentsResponse {
     fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 62390067d3b..43bd9c2a119 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -4873,6 +4873,56 @@ pub struct PaymentsCaptureResponse {
     pub amount: PaymentAmountDetailsResponse,
 }
 
+#[cfg(feature = "v2")]
+#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
+pub struct PaymentsCancelRequest {
+    /// The reason for the payment cancel
+    pub cancellation_reason: Option<String>,
+}
+
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, serde::Serialize, ToSchema)]
+pub struct PaymentsCancelResponse {
+    /// The unique identifier for the payment
+    pub id: id_type::GlobalPaymentId,
+
+    /// Status of the payment
+    #[schema(value_type = IntentStatus, example = "cancelled")]
+    pub status: common_enums::IntentStatus,
+
+    /// Cancellation reason for the payment cancellation
+    #[schema(example = "Requested by merchant")]
+    pub cancellation_reason: Option<String>,
+
+    /// Amount details related to the payment
+    pub amount: PaymentAmountDetailsResponse,
+
+    /// The unique identifier for the customer associated with the payment
+    pub customer_id: Option<id_type::GlobalCustomerId>,
+
+    /// The connector used for the payment
+    #[schema(example = "stripe")]
+    pub connector: Option<api_enums::Connector>,
+
+    #[schema(example = "2022-09-10T10:11:12Z")]
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub created: PrimitiveDateTime,
+
+    /// The payment method type for this payment attempt
+    #[schema(value_type = Option<PaymentMethod>, example = "wallet")]
+    pub payment_method_type: Option<api_enums::PaymentMethod>,
+
+    #[schema(value_type = Option<PaymentMethodType>, example = "apple_pay")]
+    pub payment_method_subtype: Option<api_enums::PaymentMethodType>,
+
+    /// List of payment attempts associated with payment intent
+    pub attempts: Option<Vec<PaymentAttemptResponse>>,
+
+    /// The url to which user must be redirected to after completion of the purchase
+    #[schema(value_type = Option<String>)]
+    pub return_url: Option<common_utils::types::Url>,
+}
+
 #[derive(Default, Clone, Debug, Eq, PartialEq, serde::Serialize)]
 pub struct UrlDetails {
     pub url: String,
@@ -8210,6 +8260,7 @@ pub struct PaymentsCompleteAuthorizeRequest {
     pub threeds_method_comp_ind: Option<ThreeDsCompletionIndicator>,
 }
 
+#[cfg(feature = "v1")]
 #[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
 pub struct PaymentsCancelRequest {
     /// The identifier for the payment
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index d42b9d8d108..49d5ff79ab8 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -862,7 +862,7 @@ pub struct PaymentAttemptUpdateInternal {
     pub connector_payment_id: Option<ConnectorTransactionId>,
     pub connector_payment_data: Option<String>,
     pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
-    // cancellation_reason: Option<String>,
+    pub cancellation_reason: Option<String>,
     pub modified_at: PrimitiveDateTime,
     pub browser_info: Option<serde_json::Value>,
     // payment_token: Option<String>,
@@ -914,6 +914,7 @@ impl PaymentAttemptUpdateInternal {
             modified_at,
             browser_info,
             error_code,
+            cancellation_reason,
             connector_metadata,
             error_reason,
             amount_capturable,
@@ -1404,6 +1405,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
                     network_advice_code: None,
                     network_error_message: None,
                     connector_request_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::ErrorUpdate {
@@ -1451,6 +1453,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
                     network_error_message: None,
                     connector_request_reference_id: None,
                     connector_response_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::UnresolvedResponseUpdate {
@@ -1496,6 +1499,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
                     network_advice_code: None,
                     network_error_message: None,
                     connector_request_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::PreprocessingUpdate {
@@ -1539,6 +1543,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
                     network_advice_code: None,
                     network_error_message: None,
                     connector_request_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::ConnectorResponse {
@@ -1578,6 +1583,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
                     network_error_message: None,
                     connector_request_reference_id: None,
                     connector_response_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::ManualUpdate {
@@ -1622,6 +1628,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
                     network_error_message: None,
                     connector_request_reference_id: None,
                     connector_response_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
         }
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index c8ac34f8613..20abea03b56 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -991,6 +991,17 @@ where
     pub payment_attempt: PaymentAttempt,
 }
 
+#[cfg(feature = "v2")]
+#[derive(Clone)]
+pub struct PaymentCancelData<F>
+where
+    F: Clone,
+{
+    pub flow: PhantomData<F>,
+    pub payment_intent: PaymentIntent,
+    pub payment_attempt: PaymentAttempt,
+}
+
 #[cfg(feature = "v2")]
 impl<F> PaymentStatusData<F>
 where
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 7f8b9020618..7eba77e6294 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -2044,6 +2044,11 @@ pub enum PaymentAttemptUpdate {
         updated_by: String,
         connector_payment_id: Option<String>,
     },
+    VoidUpdate {
+        status: storage_enums::AttemptStatus,
+        cancellation_reason: Option<String>,
+        updated_by: String,
+    },
 }
 
 #[cfg(feature = "v2")]
@@ -2849,6 +2854,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 network_error_message: None,
                 connector_request_reference_id,
                 connector_response_reference_id,
+                cancellation_reason: None,
             },
             PaymentAttemptUpdate::ErrorUpdate {
                 status,
@@ -2890,6 +2896,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                     network_error_message: error.network_error_message,
                     connector_request_reference_id: None,
                     connector_response_reference_id: None,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::ConfirmIntentResponse(confirm_intent_response_update) => {
@@ -2937,6 +2944,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                     network_error_message: None,
                     connector_request_reference_id: None,
                     connector_response_reference_id,
+                    cancellation_reason: None,
                 }
             }
             PaymentAttemptUpdate::SyncUpdate {
@@ -2970,6 +2978,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 network_error_message: None,
                 connector_request_reference_id: None,
                 connector_response_reference_id: None,
+                cancellation_reason: None,
             },
             PaymentAttemptUpdate::CaptureUpdate {
                 status,
@@ -3002,6 +3011,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 network_error_message: None,
                 connector_request_reference_id: None,
                 connector_response_reference_id: None,
+                cancellation_reason: None,
             },
             PaymentAttemptUpdate::PreCaptureUpdate {
                 amount_to_capture,
@@ -3033,6 +3043,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 network_error_message: None,
                 connector_request_reference_id: None,
                 connector_response_reference_id: None,
+                cancellation_reason: None,
             },
             PaymentAttemptUpdate::ConfirmIntentTokenized {
                 status,
@@ -3068,6 +3079,40 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 network_error_message: None,
                 connector_request_reference_id: None,
                 connector_response_reference_id: None,
+                cancellation_reason: None,
+            },
+            PaymentAttemptUpdate::VoidUpdate {
+                status,
+                cancellation_reason,
+                updated_by,
+            } => Self {
+                status: Some(status),
+                cancellation_reason,
+                error_message: None,
+                error_code: None,
+                modified_at: common_utils::date_time::now(),
+                browser_info: None,
+                error_reason: None,
+                updated_by,
+                merchant_connector_id: None,
+                unified_code: None,
+                unified_message: None,
+                connector_payment_id: None,
+                connector_payment_data: None,
+                connector: None,
+                redirection_data: None,
+                connector_metadata: None,
+                amount_capturable: None,
+                amount_to_capture: None,
+                connector_token_details: None,
+                authentication_type: None,
+                feature_metadata: None,
+                network_advice_code: None,
+                network_decline_code: None,
+                network_error_message: None,
+                connector_request_reference_id: None,
+                connector_response_reference_id: None,
+                payment_method_id: None,
             },
         }
     }
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 8cd3be165e0..776b6e2d4cf 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -387,6 +387,11 @@ pub enum PaymentIntentUpdate {
     },
     /// UpdateIntent
     UpdateIntent(Box<PaymentIntentUpdateFields>),
+    /// VoidUpdate for payment cancellation
+    VoidUpdate {
+        status: common_enums::IntentStatus,
+        updated_by: String,
+    },
 }
 
 #[cfg(feature = "v2")]
@@ -803,6 +808,45 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal
                 force_3ds_challenge: None,
                 is_iframe_redirection_enabled: None,
             }),
+            PaymentIntentUpdate::VoidUpdate { status, updated_by } => Ok(Self {
+                status: Some(status),
+                amount_captured: None,
+                active_attempt_id: None,
+                prerouting_algorithm: None,
+                modified_at: common_utils::date_time::now(),
+                amount: None,
+                currency: None,
+                shipping_cost: None,
+                tax_details: None,
+                skip_external_tax_calculation: None,
+                surcharge_applicable: None,
+                surcharge_amount: None,
+                tax_on_surcharge: None,
+                routing_algorithm_id: None,
+                capture_method: None,
+                authentication_type: None,
+                billing_address: None,
+                shipping_address: None,
+                customer_present: None,
+                description: None,
+                return_url: None,
+                setup_future_usage: None,
+                apply_mit_exemption: None,
+                statement_descriptor: None,
+                order_details: None,
+                allowed_payment_method_types: None,
+                metadata: None,
+                connector_metadata: None,
+                feature_metadata: None,
+                payment_link_config: None,
+                request_incremental_authorization: None,
+                session_expiry: None,
+                frm_metadata: None,
+                request_external_three_ds_authentication: None,
+                updated_by,
+                force_3ds_challenge: None,
+                is_iframe_redirection_enabled: None,
+            }),
         }
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index e975423d9ff..ad778e9aa74 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -1814,3 +1814,65 @@ impl
         }
     }
 }
+
+#[cfg(feature = "v2")]
+impl
+    TrackerPostUpdateObjects<
+        router_flow_types::Void,
+        router_request_types::PaymentsCancelData,
+        payments::PaymentCancelData<router_flow_types::Void>,
+    >
+    for RouterData<
+        router_flow_types::Void,
+        router_request_types::PaymentsCancelData,
+        router_response_types::PaymentsResponseData,
+    >
+{
+    fn get_payment_intent_update(
+        &self,
+        _payment_data: &payments::PaymentCancelData<router_flow_types::Void>,
+        storage_scheme: common_enums::MerchantStorageScheme,
+    ) -> PaymentIntentUpdate {
+        let intent_status = common_enums::IntentStatus::from(self.status);
+        PaymentIntentUpdate::VoidUpdate {
+            status: intent_status,
+            updated_by: storage_scheme.to_string(),
+        }
+    }
+
+    fn get_payment_attempt_update(
+        &self,
+        payment_data: &payments::PaymentCancelData<router_flow_types::Void>,
+        storage_scheme: common_enums::MerchantStorageScheme,
+    ) -> PaymentAttemptUpdate {
+        PaymentAttemptUpdate::VoidUpdate {
+            status: self.status,
+            cancellation_reason: payment_data.payment_attempt.cancellation_reason.clone(),
+            updated_by: storage_scheme.to_string(),
+        }
+    }
+
+    fn get_amount_capturable(
+        &self,
+        _payment_data: &payments::PaymentCancelData<router_flow_types::Void>,
+    ) -> Option<MinorUnit> {
+        // For void operations, no amount is capturable
+        Some(MinorUnit::zero())
+    }
+
+    fn get_captured_amount(
+        &self,
+        _payment_data: &payments::PaymentCancelData<router_flow_types::Void>,
+    ) -> Option<MinorUnit> {
+        // For void operations, no amount is captured
+        Some(MinorUnit::zero())
+    }
+
+    fn get_attempt_status_for_db_update(
+        &self,
+        _payment_data: &payments::PaymentCancelData<router_flow_types::Void>,
+    ) -> common_enums::AttemptStatus {
+        // For void operations, return Voided status
+        common_enums::AttemptStatus::Voided
+    }
+}
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 32818ca5d4b..1b451692bdd 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -324,6 +324,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentF
         router_data.apple_pay_flow = apple_pay_flow;
         router_data.connector_response = connector_response;
         router_data.payment_method_status = payment_method_status;
+        router_data.connector_auth_type = new_router_data.connector_auth_type;
         Ok(router_data)
     }
 }
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index f7f445d1b6a..e40830404b3 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -48,8 +48,8 @@ use futures::future::join_all;
 use helpers::{decrypt_paze_token, ApplePayData};
 #[cfg(feature = "v2")]
 use hyperswitch_domain_models::payments::{
-    PaymentAttemptListData, PaymentCaptureData, PaymentConfirmData, PaymentIntentData,
-    PaymentStatusData,
+    PaymentAttemptListData, PaymentCancelData, PaymentCaptureData, PaymentConfirmData,
+    PaymentIntentData, PaymentStatusData,
 };
 #[cfg(feature = "v2")]
 use hyperswitch_domain_models::router_response_types::RedirectForm;
@@ -10638,6 +10638,8 @@ pub trait OperationSessionSetters<F> {
         &mut self,
         connector_request_reference_id: String,
     );
+    #[cfg(feature = "v2")]
+    fn set_cancellation_reason(&mut self, cancellation_reason: Option<String>);
 }
 
 #[cfg(feature = "v1")]
@@ -11290,6 +11292,10 @@ impl<F: Clone> OperationSessionSetters<F> for PaymentIntentData<F> {
     ) {
         todo!()
     }
+
+    fn set_cancellation_reason(&mut self, cancellation_reason: Option<String>) {
+        todo!()
+    }
 }
 
 #[cfg(feature = "v2")]
@@ -11597,6 +11603,10 @@ impl<F: Clone> OperationSessionSetters<F> for PaymentConfirmData<F> {
     ) {
         todo!()
     }
+
+    fn set_cancellation_reason(&mut self, cancellation_reason: Option<String>) {
+        todo!()
+    }
 }
 
 #[cfg(feature = "v2")]
@@ -11899,6 +11909,10 @@ impl<F: Clone> OperationSessionSetters<F> for PaymentStatusData<F> {
     ) {
         todo!()
     }
+
+    fn set_cancellation_reason(&mut self, cancellation_reason: Option<String>) {
+        todo!()
+    }
 }
 
 #[cfg(feature = "v2")]
@@ -12204,6 +12218,10 @@ impl<F: Clone> OperationSessionSetters<F> for PaymentCaptureData<F> {
     ) {
         todo!()
     }
+
+    fn set_cancellation_reason(&mut self, cancellation_reason: Option<String>) {
+        todo!()
+    }
 }
 
 #[cfg(feature = "v2")]
@@ -12371,3 +12389,311 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentAttemptListData<F> {
         todo!()
     }
 }
+
+#[cfg(feature = "v2")]
+impl<F: Clone> OperationSessionGetters<F> for PaymentCancelData<F> {
+    #[track_caller]
+    fn get_payment_attempt(&self) -> &storage::PaymentAttempt {
+        &self.payment_attempt
+    }
+    fn list_payments_attempts(&self) -> &Vec<storage::PaymentAttempt> {
+        todo!()
+    }
+    fn get_client_secret(&self) -> &Option<Secret<String>> {
+        todo!()
+    }
+    fn get_payment_intent(&self) -> &storage::PaymentIntent {
+        &self.payment_intent
+    }
+
+    fn get_merchant_connector_details(
+        &self,
+    ) -> Option<common_types::domain::MerchantConnectorAuthDetails> {
+        todo!()
+    }
+
+    fn get_payment_method_info(&self) -> Option<&domain::PaymentMethod> {
+        todo!()
+    }
+
+    fn get_payment_method_token(&self) -> Option<&PaymentMethodToken> {
+        todo!()
+    }
+
+    fn get_mandate_id(&self) -> Option<&payments_api::MandateIds> {
+        todo!()
+    }
+
+    // what is this address find out and not required remove this
+    fn get_address(&self) -> &PaymentAddress {
+        todo!()
+    }
+
+    fn get_creds_identifier(&self) -> Option<&str> {
+        None
+    }
+
+    fn get_token(&self) -> Option<&str> {
+        todo!()
+    }
+
+    fn get_multiple_capture_data(&self) -> Option<&types::MultipleCaptureData> {
+        todo!()
+    }
+
+    fn get_payment_link_data(&self) -> Option<api_models::payments::PaymentLinkResponse> {
+        todo!()
+    }
+
+    fn get_ephemeral_key(&self) -> Option<ephemeral_key::EphemeralKey> {
+        todo!()
+    }
+
+    fn get_setup_mandate(&self) -> Option<&MandateData> {
+        todo!()
+    }
+
+    fn get_poll_config(&self) -> Option<router_types::PollConfig> {
+        todo!()
+    }
+
+    fn get_authentication(
+        &self,
+    ) -> Option<&hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore>
+    {
+        todo!()
+    }
+
+    fn get_frm_message(&self) -> Option<FraudCheck> {
+        todo!()
+    }
+
+    fn get_refunds(&self) -> Vec<diesel_refund::Refund> {
+        todo!()
+    }
+
+    fn get_disputes(&self) -> Vec<storage::Dispute> {
+        todo!()
+    }
+
+    fn get_authorizations(&self) -> Vec<diesel_models::authorization::Authorization> {
+        todo!()
+    }
+
+    fn get_attempts(&self) -> Option<Vec<storage::PaymentAttempt>> {
+        todo!()
+    }
+
+    fn get_recurring_details(&self) -> Option<&RecurringDetails> {
+        todo!()
+    }
+
+    fn get_payment_intent_profile_id(&self) -> Option<&id_type::ProfileId> {
+        todo!()
+    }
+
+    fn get_currency(&self) -> storage_enums::Currency {
+        todo!()
+    }
+
+    fn get_amount(&self) -> api::Amount {
+        todo!()
+    }
+
+    fn get_payment_attempt_connector(&self) -> Option<&str> {
+        todo!()
+    }
+
+    fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId> {
+        todo!()
+    }
+
+    fn get_connector_customer_id(&self) -> Option<String> {
+        todo!()
+    }
+
+    fn get_billing_address(&self) -> Option<hyperswitch_domain_models::address::Address> {
+        todo!()
+    }
+
+    fn get_payment_method_data(&self) -> Option<&domain::PaymentMethodData> {
+        todo!()
+    }
+
+    fn get_sessions_token(&self) -> Vec<api::SessionToken> {
+        todo!()
+    }
+
+    fn get_token_data(&self) -> Option<&storage::PaymentTokenData> {
+        todo!()
+    }
+
+    fn get_mandate_connector(&self) -> Option<&MandateConnectorDetails> {
+        todo!()
+    }
+
+    fn get_force_sync(&self) -> Option<bool> {
+        todo!()
+    }
+
+    fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
+        todo!()
+    }
+
+    fn get_optional_payment_attempt(&self) -> Option<&storage::PaymentAttempt> {
+        None
+    }
+
+    fn get_pre_routing_result(
+        &self,
+    ) -> Option<HashMap<enums::PaymentMethodType, domain::PreRoutingConnectorChoice>> {
+        None
+    }
+
+    fn get_optional_external_vault_session_details(&self) -> Option<api::VaultSessionDetails> {
+        todo!()
+    }
+}
+
+#[cfg(feature = "v2")]
+impl<F: Clone> OperationSessionSetters<F> for PaymentCancelData<F> {
+    fn set_payment_intent(&mut self, payment_intent: storage::PaymentIntent) {
+        self.payment_intent = payment_intent;
+    }
+
+    fn set_client_secret(&mut self, _client_secret: Option<Secret<String>>) {
+        todo!()
+    }
+
+    fn set_payment_attempt(&mut self, payment_attempt: storage::PaymentAttempt) {
+        self.payment_attempt = payment_attempt;
+    }
+
+    fn set_payment_method_data(&mut self, _payment_method_data: Option<domain::PaymentMethodData>) {
+        todo!()
+    }
+
+    fn set_payment_method_token(&mut self, _payment_method_token: Option<PaymentMethodToken>) {
+        todo!()
+    }
+
+    fn set_email_if_not_present(&mut self, _email: pii::Email) {
+        todo!()
+    }
+
+    fn set_payment_method_id_in_attempt(&mut self, _payment_method_id: Option<String>) {
+        todo!()
+    }
+
+    fn set_pm_token(&mut self, _token: String) {
+        !todo!()
+    }
+
+    fn set_connector_customer_id(&mut self, _customer_id: Option<String>) {
+        // TODO: handle this case. Should we add connector_customer_id in PaymentCancelData?
+    }
+
+    fn push_sessions_token(&mut self, _token: api::SessionToken) {
+        todo!()
+    }
+
+    fn set_surcharge_details(&mut self, _surcharge_details: Option<types::SurchargeDetails>) {
+        todo!()
+    }
+
+    fn set_merchant_connector_id_in_attempt(
+        &mut self,
+        _merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+    ) {
+        todo!()
+    }
+
+    fn set_card_network(&mut self, _card_network: enums::CardNetwork) {
+        todo!()
+    }
+
+    fn set_co_badged_card_data(
+        &mut self,
+        _debit_routing_output: &api_models::open_router::DebitRoutingOutput,
+    ) {
+        todo!()
+    }
+
+    fn set_frm_message(&mut self, _frm_message: FraudCheck) {
+        todo!()
+    }
+
+    fn set_payment_intent_status(&mut self, status: storage_enums::IntentStatus) {
+        self.payment_intent.status = status;
+    }
+
+    fn set_authentication_type_in_attempt(
+        &mut self,
+        _authentication_type: Option<enums::AuthenticationType>,
+    ) {
+        todo!()
+    }
+
+    fn set_recurring_mandate_payment_data(
+        &mut self,
+        _recurring_mandate_payment_data:
+            hyperswitch_domain_models::router_data::RecurringMandatePaymentData,
+    ) {
+        todo!()
+    }
+
+    fn set_mandate_id(&mut self, _mandate_id: api_models::payments::MandateIds) {
+        todo!()
+    }
+
+    fn set_setup_future_usage_in_payment_intent(
+        &mut self,
+        setup_future_usage: storage_enums::FutureUsage,
+    ) {
+        todo!()
+    }
+
+    fn set_prerouting_algorithm_in_payment_intent(
+        &mut self,
+        prerouting_algorithm: storage::PaymentRoutingInfo,
+    ) {
+        self.payment_intent.prerouting_algorithm = Some(prerouting_algorithm);
+    }
+
+    fn set_connector_in_payment_attempt(&mut self, _connector: Option<String>) {
+        todo!()
+    }
+
+    fn set_connector_request_reference_id(&mut self, _reference_id: Option<String>) {
+        todo!()
+    }
+
+    fn set_connector_response_reference_id(&mut self, _reference_id: Option<String>) {
+        todo!()
+    }
+
+    fn set_vault_session_details(
+        &mut self,
+        _external_vault_session_details: Option<api::VaultSessionDetails>,
+    ) {
+        todo!()
+    }
+
+    fn set_routing_approach_in_attempt(
+        &mut self,
+        _routing_approach: Option<enums::RoutingApproach>,
+    ) {
+        todo!()
+    }
+
+    fn set_connector_request_reference_id_in_payment_attempt(
+        &mut self,
+        _connector_request_reference_id: String,
+    ) {
+        todo!()
+    }
+
+    fn set_cancellation_reason(&mut self, cancellation_reason: Option<String>) {
+        self.payment_attempt.cancellation_reason = cancellation_reason;
+    }
+}
diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs
index a452a165c7d..1190cef2441 100644
--- a/crates/router/src/core/payments/flows/cancel_flow.rs
+++ b/crates/router/src/core/payments/flows/cancel_flow.rs
@@ -10,26 +10,11 @@ use crate::{
     services,
     types::{self, api, domain},
 };
-
+#[cfg(feature = "v1")]
 #[async_trait]
 impl ConstructFlowSpecificData<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
     for PaymentData<api::Void>
 {
-    #[cfg(feature = "v2")]
-    async fn construct_router_data<'a>(
-        &self,
-        _state: &SessionState,
-        _connector_id: &str,
-        _merchant_context: &domain::MerchantContext,
-        _customer: &Option<domain::Customer>,
-        _merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
-        _merchant_recipient_data: Option<types::MerchantRecipientData>,
-        _header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
-    ) -> RouterResult<types::PaymentsCancelRouterData> {
-        todo!()
-    }
-
-    #[cfg(feature = "v1")]
     async fn construct_router_data<'a>(
         &self,
         state: &SessionState,
@@ -56,6 +41,34 @@ impl ConstructFlowSpecificData<api::Void, types::PaymentsCancelData, types::Paym
         .await
     }
 }
+#[cfg(feature = "v2")]
+#[async_trait]
+impl ConstructFlowSpecificData<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
+    for hyperswitch_domain_models::payments::PaymentCancelData<api::Void>
+{
+    async fn construct_router_data<'a>(
+        &self,
+        state: &SessionState,
+        connector_id: &str,
+        merchant_context: &domain::MerchantContext,
+        customer: &Option<domain::Customer>,
+        merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
+        merchant_recipient_data: Option<types::MerchantRecipientData>,
+        header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
+    ) -> RouterResult<types::PaymentsCancelRouterData> {
+        Box::pin(transformers::construct_router_data_for_cancel(
+            state,
+            self.clone(),
+            connector_id,
+            merchant_context,
+            customer,
+            merchant_connector_account,
+            merchant_recipient_data,
+            header_payload,
+        ))
+        .await
+    }
+}
 
 #[async_trait]
 impl Feature<api::Void, types::PaymentsCancelData>
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 2d8488ab6cc..11c26b5c54b 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -58,6 +58,9 @@ pub mod payment_get;
 #[cfg(feature = "v2")]
 pub mod payment_capture_v2;
 
+#[cfg(feature = "v2")]
+pub mod payment_cancel_v2;
+
 use api_models::enums::FrmSuggestion;
 #[cfg(all(feature = "v1", feature = "dynamic_routing"))]
 use api_models::routing::RoutableConnectorChoice;
diff --git a/crates/router/src/core/payments/operations/payment_cancel_v2.rs b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
new file mode 100644
index 00000000000..e54de6cb793
--- /dev/null
+++ b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
@@ -0,0 +1,352 @@
+use std::marker::PhantomData;
+
+use api_models::enums::FrmSuggestion;
+use async_trait::async_trait;
+use common_enums;
+use common_utils::{ext_traits::AsyncExt, id_type::GlobalPaymentId};
+use error_stack::ResultExt;
+use router_env::{instrument, tracing};
+
+use super::{
+    BoxedOperation, Domain, GetTracker, Operation, OperationSessionSetters, UpdateTracker,
+    ValidateRequest, ValidateStatusForOperation,
+};
+use crate::{
+    core::{
+        errors::{self, CustomResult, RouterResult, StorageErrorExt},
+        payments::operations,
+    },
+    routes::{app::ReqState, SessionState},
+    types::{
+        self,
+        api::{self, ConnectorCallType, PaymentIdTypeExt},
+        domain,
+        storage::{self, enums},
+        PaymentsCancelData,
+    },
+    utils::OptionExt,
+};
+
+#[derive(Debug, Clone, Copy)]
+pub struct PaymentsCancel;
+
+type BoxedCancelOperation<'b, F> = BoxedOperation<
+    'b,
+    F,
+    api::PaymentsCancelRequest,
+    hyperswitch_domain_models::payments::PaymentCancelData<F>,
+>;
+
+// Manual Operation trait implementation for V2
+impl<F: Send + Clone + Sync> Operation<F, api::PaymentsCancelRequest> for &PaymentsCancel {
+    type Data = hyperswitch_domain_models::payments::PaymentCancelData<F>;
+
+    fn to_validate_request(
+        &self,
+    ) -> RouterResult<&(dyn ValidateRequest<F, api::PaymentsCancelRequest, Self::Data> + Send + Sync)>
+    {
+        Ok(*self)
+    }
+
+    fn to_get_tracker(
+        &self,
+    ) -> RouterResult<&(dyn GetTracker<F, Self::Data, api::PaymentsCancelRequest> + Send + Sync)>
+    {
+        Ok(*self)
+    }
+
+    fn to_domain(&self) -> RouterResult<&(dyn Domain<F, api::PaymentsCancelRequest, Self::Data>)> {
+        Ok(*self)
+    }
+
+    fn to_update_tracker(
+        &self,
+    ) -> RouterResult<&(dyn UpdateTracker<F, Self::Data, api::PaymentsCancelRequest> + Send + Sync)>
+    {
+        Ok(*self)
+    }
+}
+
+#[automatically_derived]
+impl<F: Send + Clone + Sync> Operation<F, api::PaymentsCancelRequest> for PaymentsCancel {
+    type Data = hyperswitch_domain_models::payments::PaymentCancelData<F>;
+
+    fn to_validate_request(
+        &self,
+    ) -> RouterResult<&(dyn ValidateRequest<F, api::PaymentsCancelRequest, Self::Data> + Send + Sync)>
+    {
+        Ok(self)
+    }
+
+    fn to_get_tracker(
+        &self,
+    ) -> RouterResult<&(dyn GetTracker<F, Self::Data, api::PaymentsCancelRequest> + Send + Sync)>
+    {
+        Ok(self)
+    }
+
+    fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsCancelRequest, Self::Data>> {
+        Ok(self)
+    }
+
+    fn to_update_tracker(
+        &self,
+    ) -> RouterResult<&(dyn UpdateTracker<F, Self::Data, api::PaymentsCancelRequest> + Send + Sync)>
+    {
+        Ok(self)
+    }
+}
+
+#[cfg(feature = "v2")]
+impl<F: Send + Clone + Sync>
+    ValidateRequest<
+        F,
+        api::PaymentsCancelRequest,
+        hyperswitch_domain_models::payments::PaymentCancelData<F>,
+    > for PaymentsCancel
+{
+    #[instrument(skip_all)]
+    fn validate_request(
+        &self,
+        _request: &api::PaymentsCancelRequest,
+        merchant_context: &domain::MerchantContext,
+    ) -> RouterResult<operations::ValidateResult> {
+        Ok(operations::ValidateResult {
+            merchant_id: merchant_context.get_merchant_account().get_id().to_owned(),
+            storage_scheme: merchant_context.get_merchant_account().storage_scheme,
+            requeue: false,
+        })
+    }
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<F: Send + Clone + Sync>
+    GetTracker<
+        F,
+        hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        api::PaymentsCancelRequest,
+    > for PaymentsCancel
+{
+    #[instrument(skip_all)]
+    async fn get_trackers<'a>(
+        &'a self,
+        state: &'a SessionState,
+        payment_id: &common_utils::id_type::GlobalPaymentId,
+        request: &api::PaymentsCancelRequest,
+        merchant_context: &domain::MerchantContext,
+        profile: &domain::Profile,
+        _header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
+    ) -> RouterResult<
+        operations::GetTrackerResponse<hyperswitch_domain_models::payments::PaymentCancelData<F>>,
+    > {
+        let db = &*state.store;
+        let key_manager_state = &state.into();
+
+        let merchant_id = merchant_context.get_merchant_account().get_id();
+        let storage_scheme = merchant_context.get_merchant_account().storage_scheme;
+        let payment_intent = db
+            .find_payment_intent_by_id(
+                key_manager_state,
+                payment_id,
+                merchant_context.get_merchant_key_store(),
+                storage_scheme,
+            )
+            .await
+            .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+            .attach_printable("Failed to find payment intent for cancellation")?;
+
+        self.validate_status_for_operation(payment_intent.status)?;
+
+        let active_attempt_id = payment_intent.active_attempt_id.as_ref().ok_or_else(|| {
+            errors::ApiErrorResponse::InvalidRequestData {
+                message: "Payment cancellation not possible - no active payment attempt found"
+                    .to_string(),
+            }
+        })?;
+
+        let payment_attempt = db
+            .find_payment_attempt_by_id(
+                key_manager_state,
+                merchant_context.get_merchant_key_store(),
+                active_attempt_id,
+                storage_scheme,
+            )
+            .await
+            .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+            .attach_printable("Failed to find payment attempt for cancellation")?;
+
+        let mut payment_data = hyperswitch_domain_models::payments::PaymentCancelData {
+            flow: PhantomData,
+            payment_intent,
+            payment_attempt,
+        };
+
+        payment_data.set_cancellation_reason(request.cancellation_reason.clone());
+
+        let get_trackers_response = operations::GetTrackerResponse { payment_data };
+
+        Ok(get_trackers_response)
+    }
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<F: Clone + Send + Sync>
+    UpdateTracker<
+        F,
+        hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        api::PaymentsCancelRequest,
+    > for PaymentsCancel
+{
+    #[instrument(skip_all)]
+    async fn update_trackers<'b>(
+        &'b self,
+        state: &'b SessionState,
+        req_state: ReqState,
+        mut payment_data: hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        _customer: Option<domain::Customer>,
+        storage_scheme: enums::MerchantStorageScheme,
+        _updated_customer: Option<storage::CustomerUpdate>,
+        merchant_key_store: &domain::MerchantKeyStore,
+        _frm_suggestion: Option<FrmSuggestion>,
+        _header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+    ) -> RouterResult<(
+        BoxedCancelOperation<'b, F>,
+        hyperswitch_domain_models::payments::PaymentCancelData<F>,
+    )>
+    where
+        F: 'b + Send,
+    {
+        let db = &*state.store;
+        let key_manager_state = &state.into();
+
+        let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::VoidUpdate {
+            status: enums::AttemptStatus::VoidInitiated,
+            cancellation_reason: payment_data.payment_attempt.cancellation_reason.clone(),
+            updated_by: storage_scheme.to_string(),
+        };
+
+        let updated_payment_attempt = db
+            .update_payment_attempt(
+                key_manager_state,
+                merchant_key_store,
+                payment_data.payment_attempt.clone(),
+                payment_attempt_update,
+                storage_scheme,
+            )
+            .await
+            .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+            .attach_printable("Failed to update payment attempt for cancellation")?;
+        payment_data.set_payment_attempt(updated_payment_attempt);
+
+        Ok((Box::new(self), payment_data))
+    }
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<F: Send + Clone + Sync>
+    Domain<F, api::PaymentsCancelRequest, hyperswitch_domain_models::payments::PaymentCancelData<F>>
+    for PaymentsCancel
+{
+    async fn get_customer_details<'a>(
+        &'a self,
+        _state: &SessionState,
+        _payment_data: &mut hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        _merchant_key_store: &domain::MerchantKeyStore,
+        _storage_scheme: enums::MerchantStorageScheme,
+    ) -> CustomResult<(BoxedCancelOperation<'a, F>, Option<domain::Customer>), errors::StorageError>
+    {
+        Ok((Box::new(*self), None))
+    }
+
+    async fn make_pm_data<'a>(
+        &'a self,
+        _state: &'a SessionState,
+        _payment_data: &mut hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        _storage_scheme: enums::MerchantStorageScheme,
+        _merchant_key_store: &domain::MerchantKeyStore,
+        _customer: &Option<domain::Customer>,
+        _business_profile: &domain::Profile,
+        _should_retry_with_pan: bool,
+    ) -> RouterResult<(
+        BoxedCancelOperation<'a, F>,
+        Option<domain::PaymentMethodData>,
+        Option<String>,
+    )> {
+        Ok((Box::new(*self), None, None))
+    }
+
+    async fn perform_routing<'a>(
+        &'a self,
+        _merchant_context: &domain::MerchantContext,
+        _business_profile: &domain::Profile,
+        state: &SessionState,
+        payment_data: &mut hyperswitch_domain_models::payments::PaymentCancelData<F>,
+    ) -> RouterResult<api::ConnectorCallType> {
+        let payment_attempt = &payment_data.payment_attempt;
+        let connector = payment_attempt
+            .connector
+            .as_ref()
+            .get_required_value("connector")
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("Connector not found for payment cancellation")?;
+
+        let merchant_connector_id = payment_attempt
+            .merchant_connector_id
+            .as_ref()
+            .get_required_value("merchant_connector_id")
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("Merchant connector ID not found for payment cancellation")?;
+
+        let connector_data = api::ConnectorData::get_connector_by_name(
+            &state.conf.connectors,
+            connector,
+            api::GetToken::Connector,
+            Some(merchant_connector_id.to_owned()),
+        )
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Invalid connector name received")?;
+
+        Ok(api::ConnectorCallType::PreDetermined(connector_data.into()))
+    }
+}
+
+impl ValidateStatusForOperation for PaymentsCancel {
+    fn validate_status_for_operation(
+        &self,
+        intent_status: common_enums::IntentStatus,
+    ) -> Result<(), errors::ApiErrorResponse> {
+        match intent_status {
+            common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
+            | common_enums::IntentStatus::PartiallyCapturedAndCapturable
+            | common_enums::IntentStatus::RequiresCapture => Ok(()),
+            common_enums::IntentStatus::Succeeded
+            | common_enums::IntentStatus::Failed
+            | common_enums::IntentStatus::Cancelled
+            | common_enums::IntentStatus::CancelledPostCapture
+            | common_enums::IntentStatus::Processing
+            | common_enums::IntentStatus::RequiresCustomerAction
+            | common_enums::IntentStatus::RequiresMerchantAction
+            | common_enums::IntentStatus::RequiresPaymentMethod
+            | common_enums::IntentStatus::RequiresConfirmation
+            | common_enums::IntentStatus::PartiallyCaptured
+            | common_enums::IntentStatus::Conflicted
+            | common_enums::IntentStatus::Expired => {
+                Err(errors::ApiErrorResponse::PaymentUnexpectedState {
+                    current_flow: format!("{self:?}"),
+                    field_name: "status".to_string(),
+                    current_value: intent_status.to_string(),
+                    states: [
+                        common_enums::IntentStatus::RequiresCapture,
+                        common_enums::IntentStatus::PartiallyCapturedAndCapturable,
+                        common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture,
+                    ]
+                    .map(|enum_value| enum_value.to_string())
+                    .join(", "),
+                })
+            }
+        }
+    }
+}
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 2b1d1024e76..410c546eeda 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -3232,3 +3232,83 @@ fn get_total_amount_captured<F: Clone, T: types::Capturable>(
         }
     }
 }
+
+#[cfg(feature = "v2")]
+impl<F: Send + Clone + Sync> Operation<F, types::PaymentsCancelData> for PaymentResponse {
+    type Data = hyperswitch_domain_models::payments::PaymentCancelData<F>;
+    fn to_post_update_tracker(
+        &self,
+    ) -> RouterResult<
+        &(dyn PostUpdateTracker<F, Self::Data, types::PaymentsCancelData> + Send + Sync),
+    > {
+        Ok(self)
+    }
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<F: Clone + Send + Sync>
+    PostUpdateTracker<
+        F,
+        hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        types::PaymentsCancelData,
+    > for PaymentResponse
+{
+    async fn update_tracker<'b>(
+        &'b self,
+        state: &'b SessionState,
+        mut payment_data: hyperswitch_domain_models::payments::PaymentCancelData<F>,
+        router_data: types::RouterData<F, types::PaymentsCancelData, types::PaymentsResponseData>,
+        key_store: &domain::MerchantKeyStore,
+        storage_scheme: enums::MerchantStorageScheme,
+    ) -> RouterResult<hyperswitch_domain_models::payments::PaymentCancelData<F>>
+    where
+        F: 'b + Send + Sync,
+        types::RouterData<F, types::PaymentsCancelData, types::PaymentsResponseData>:
+            hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<
+                F,
+                types::PaymentsCancelData,
+                hyperswitch_domain_models::payments::PaymentCancelData<F>,
+            >,
+    {
+        let db = &*state.store;
+        let key_manager_state = &state.into();
+
+        use hyperswitch_domain_models::router_data::TrackerPostUpdateObjects;
+
+        let payment_intent_update =
+            router_data.get_payment_intent_update(&payment_data, storage_scheme);
+
+        let updated_payment_intent = db
+            .update_payment_intent(
+                key_manager_state,
+                payment_data.payment_intent.clone(),
+                payment_intent_update,
+                key_store,
+                storage_scheme,
+            )
+            .await
+            .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+            .attach_printable("Error while updating the payment_intent")?;
+
+        let payment_attempt_update =
+            router_data.get_payment_attempt_update(&payment_data, storage_scheme);
+
+        let updated_payment_attempt = db
+            .update_payment_attempt(
+                key_manager_state,
+                key_store,
+                payment_data.payment_attempt.clone(),
+                payment_attempt_update,
+                storage_scheme,
+            )
+            .await
+            .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+            .attach_printable("Error while updating the payment_attempt")?;
+
+        payment_data.set_payment_intent(updated_payment_intent);
+        payment_data.set_payment_attempt(updated_payment_attempt);
+
+        Ok(payment_data)
+    }
+}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index f799fdebbfe..47733f64e36 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1,5 +1,7 @@
 use std::{fmt::Debug, marker::PhantomData, str::FromStr};
 
+#[cfg(feature = "v2")]
+use api_models::enums as api_enums;
 use api_models::payments::{
     Address, ConnectorMandateReferenceId, CustomerDetails, CustomerDetailsResponse, FrmMessage,
     MandateIds, NetworkDetails, RequestSurchargeDetails,
@@ -21,16 +23,19 @@ use diesel_models::{
     },
 };
 use error_stack::{report, ResultExt};
-#[cfg(feature = "v2")]
-use hyperswitch_domain_models::ApiModelToDieselModelConvertor;
 use hyperswitch_domain_models::{payments::payment_intent::CustomerData, router_request_types};
 #[cfg(feature = "v2")]
+use hyperswitch_domain_models::{
+    router_data_v2::{flow_common_types, RouterDataV2},
+    ApiModelToDieselModelConvertor,
+};
+#[cfg(feature = "v2")]
 use hyperswitch_interfaces::api::ConnectorSpecifications;
 #[cfg(feature = "v2")]
 use hyperswitch_interfaces::connector_integration_interface::RouterDataConversion;
-#[cfg(feature = "v2")]
-use masking::PeekInterface;
 use masking::{ExposeInterface, Maskable, Secret};
+#[cfg(feature = "v2")]
+use masking::{ExposeOptionInterface, PeekInterface};
 use router_env::{instrument, tracing};
 
 use super::{flows::Feature, types::AuthenticationData, OperationSessionGetters, PaymentData};
@@ -200,7 +205,7 @@ pub async fn construct_external_vault_proxy_router_data_v2<'a>(
     customer_id: Option<common_utils::id_type::CustomerId>,
     header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
 ) -> RouterResult<
-    hyperswitch_domain_models::router_data_v2::RouterDataV2<
+    RouterDataV2<
         api::ExternalVaultProxy,
         hyperswitch_domain_models::router_data_v2::ExternalVaultProxyFlowData,
         types::ExternalVaultProxyPaymentsData,
@@ -685,11 +690,12 @@ pub async fn construct_external_vault_proxy_payment_router_data<'a>(
     .await?;
 
     // Convert RouterDataV2 to old RouterData (v1) using the existing RouterDataConversion trait
-    let router_data = hyperswitch_domain_models::router_data_v2::flow_common_types::ExternalVaultProxyFlowData::to_old_router_data(router_data_v2)
-    .change_context(errors::ApiErrorResponse::InternalServerError)
-        .attach_printable(
-            "Cannot construct router data for making the unified connector service call",
-        )?;
+    let router_data =
+        flow_common_types::ExternalVaultProxyFlowData::to_old_router_data(router_data_v2)
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable(
+                "Cannot construct router data for making the unified connector service call",
+            )?;
 
     Ok(router_data)
 }
@@ -991,6 +997,163 @@ pub async fn construct_router_data_for_psync<'a>(
     Ok(router_data)
 }
 
+#[cfg(feature = "v2")]
+#[instrument(skip_all)]
+#[allow(clippy::too_many_arguments)]
+pub async fn construct_cancel_router_data_v2<'a>(
+    state: &'a SessionState,
+    merchant_account: &domain::MerchantAccount,
+    merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
+    payment_data: &hyperswitch_domain_models::payments::PaymentCancelData<api::Void>,
+    request: types::PaymentsCancelData,
+    connector_request_reference_id: String,
+    customer_id: Option<common_utils::id_type::CustomerId>,
+    header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
+) -> RouterResult<
+    RouterDataV2<
+        api::Void,
+        flow_common_types::PaymentFlowData,
+        types::PaymentsCancelData,
+        types::PaymentsResponseData,
+    >,
+> {
+    let auth_type: types::ConnectorAuthType = merchant_connector_account
+        .get_connector_account_details()
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed while parsing value for ConnectorAuthType")?;
+
+    let payment_cancel_data = flow_common_types::PaymentFlowData {
+        merchant_id: merchant_account.get_id().clone(),
+        customer_id,
+        connector_customer: None,
+        payment_id: payment_data
+            .payment_attempt
+            .payment_id
+            .get_string_repr()
+            .to_owned(),
+        attempt_id: payment_data
+            .payment_attempt
+            .get_id()
+            .get_string_repr()
+            .to_owned(),
+        status: payment_data.payment_attempt.status,
+        payment_method: payment_data.payment_attempt.payment_method_type,
+        description: payment_data
+            .payment_intent
+            .description
+            .as_ref()
+            .map(|description| description.get_string_repr())
+            .map(ToOwned::to_owned),
+        address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
+        auth_type: payment_data.payment_attempt.authentication_type,
+        connector_meta_data: merchant_connector_account.get_metadata(),
+        amount_captured: None,
+        minor_amount_captured: None,
+        access_token: None,
+        session_token: None,
+        reference_id: None,
+        payment_method_token: None,
+        recurring_mandate_payment_data: None,
+        preprocessing_id: payment_data.payment_attempt.preprocessing_step_id.clone(),
+        payment_method_balance: None,
+        connector_api_version: None,
+        connector_request_reference_id,
+        test_mode: Some(true),
+        connector_http_status_code: None,
+        external_latency: None,
+        apple_pay_flow: None,
+        connector_response: None,
+        payment_method_status: None,
+    };
+
+    let router_data_v2 = RouterDataV2 {
+        flow: PhantomData,
+        tenant_id: state.tenant.tenant_id.clone(),
+        resource_common_data: payment_cancel_data,
+        connector_auth_type: auth_type,
+        request,
+        response: Err(hyperswitch_domain_models::router_data::ErrorResponse::default()),
+    };
+
+    Ok(router_data_v2)
+}
+
+#[cfg(feature = "v2")]
+#[instrument(skip_all)]
+#[allow(clippy::too_many_arguments)]
+pub async fn construct_router_data_for_cancel<'a>(
+    state: &'a SessionState,
+    payment_data: hyperswitch_domain_models::payments::PaymentCancelData<
+        hyperswitch_domain_models::router_flow_types::Void,
+    >,
+    connector_id: &str,
+    merchant_context: &domain::MerchantContext,
+    customer: &'a Option<domain::Customer>,
+    merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
+    _merchant_recipient_data: Option<types::MerchantRecipientData>,
+    header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
+) -> RouterResult<types::PaymentsCancelRouterData> {
+    fp_utils::when(merchant_connector_account.is_disabled(), || {
+        Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)
+    })?;
+
+    // TODO: Take Globalid and convert to connector reference id
+    let customer_id = customer
+        .to_owned()
+        .map(|customer| common_utils::id_type::CustomerId::try_from(customer.id.clone()))
+        .transpose()
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable(
+            "Invalid global customer generated, not able to convert to reference id",
+        )?;
+    let payment_intent = payment_data.get_payment_intent();
+    let attempt = payment_data.get_payment_attempt();
+    let connector_request_reference_id = payment_data
+        .payment_attempt
+        .connector_request_reference_id
+        .clone()
+        .ok_or(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("connector_request_reference_id not found in payment_attempt")?;
+
+    let request = types::PaymentsCancelData {
+        amount: Some(attempt.amount_details.get_net_amount().get_amount_as_i64()),
+        currency: Some(payment_intent.amount_details.currency),
+        connector_transaction_id: attempt
+            .get_connector_payment_id()
+            .unwrap_or_default()
+            .to_string(),
+        cancellation_reason: attempt.cancellation_reason.clone(),
+        connector_meta: attempt.connector_metadata.clone().expose_option(),
+        browser_info: None,
+        metadata: None,
+        minor_amount: Some(attempt.amount_details.get_net_amount()),
+        webhook_url: None,
+        capture_method: Some(payment_intent.capture_method),
+    };
+
+    // Construct RouterDataV2 for cancel operation
+    let router_data_v2 = construct_cancel_router_data_v2(
+        state,
+        merchant_context.get_merchant_account(),
+        merchant_connector_account,
+        &payment_data,
+        request,
+        connector_request_reference_id.clone(),
+        customer_id.clone(),
+        header_payload.clone(),
+    )
+    .await?;
+
+    // Convert RouterDataV2 to old RouterData (v1) using the existing RouterDataConversion trait
+    let router_data = flow_common_types::PaymentFlowData::to_old_router_data(router_data_v2)
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable(
+            "Cannot construct router data for making the unified connector service call",
+        )?;
+
+    Ok(router_data)
+}
+
 #[cfg(feature = "v2")]
 #[instrument(skip_all)]
 #[allow(clippy::too_many_arguments)]
@@ -1978,6 +2141,63 @@ where
     }
 }
 
+#[cfg(feature = "v2")]
+impl<F> GenerateResponse<api_models::payments::PaymentsCancelResponse>
+    for hyperswitch_domain_models::payments::PaymentCancelData<F>
+where
+    F: Clone,
+{
+    fn generate_response(
+        self,
+        state: &SessionState,
+        connector_http_status_code: Option<u16>,
+        external_latency: Option<u128>,
+        is_latency_header_enabled: Option<bool>,
+        merchant_context: &domain::MerchantContext,
+        profile: &domain::Profile,
+        _connector_response_data: Option<common_types::domain::ConnectorResponseData>,
+    ) -> RouterResponse<api_models::payments::PaymentsCancelResponse> {
+        let payment_intent = &self.payment_intent;
+        let payment_attempt = &self.payment_attempt;
+
+        let amount = api_models::payments::PaymentAmountDetailsResponse::foreign_from((
+            &payment_intent.amount_details,
+            &payment_attempt.amount_details,
+        ));
+
+        let connector = payment_attempt
+            .connector
+            .as_ref()
+            .and_then(|conn| api_enums::Connector::from_str(conn).ok());
+        let response = api_models::payments::PaymentsCancelResponse {
+            id: payment_intent.id.clone(),
+            status: payment_intent.status,
+            cancellation_reason: payment_attempt.cancellation_reason.clone(),
+            amount,
+            customer_id: payment_intent.customer_id.clone(),
+            connector,
+            created: payment_intent.created_at,
+            payment_method_type: Some(payment_attempt.payment_method_type),
+            payment_method_subtype: Some(payment_attempt.payment_method_subtype),
+            attempts: None,
+            return_url: payment_intent.return_url.clone(),
+        };
+
+        let headers = connector_http_status_code
+            .map(|status_code| {
+                vec![(
+                    X_CONNECTOR_HTTP_STATUS_CODE.to_string(),
+                    Maskable::new_normal(status_code.to_string()),
+                )]
+            })
+            .unwrap_or_default();
+
+        Ok(services::ApplicationResponse::JsonWithHeaders((
+            response, headers,
+        )))
+    }
+}
+
 #[cfg(feature = "v1")]
 impl<F, Op, D> ToResponse<F, D, Op> for api::PaymentsResponse
 where
@@ -4550,7 +4770,55 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCancelDa
     type Error = error_stack::Report<errors::ApiErrorResponse>;
 
     fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {
-        todo!()
+        let payment_data = additional_data.payment_data;
+        let connector = api::ConnectorData::get_connector_by_name(
+            &additional_data.state.conf.connectors,
+            &additional_data.connector_name,
+            api::GetToken::Connector,
+            payment_data.payment_attempt.merchant_connector_id.clone(),
+        )?;
+        let browser_info: Option<types::BrowserInformation> = payment_data
+            .payment_attempt
+            .browser_info
+            .clone()
+            .map(types::BrowserInformation::from);
+
+        let amount = payment_data.payment_attempt.amount_details.get_net_amount();
+
+        let router_base_url = &additional_data.router_base_url;
+        let attempt = &payment_data.payment_attempt;
+
+        let merchant_connector_account_id = payment_data
+            .payment_attempt
+            .merchant_connector_id
+            .as_ref()
+            .map(|mca_id| mca_id.get_string_repr())
+            .ok_or(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+        let webhook_url: Option<_> = Some(helpers::create_webhook_url(
+            router_base_url,
+            &attempt.merchant_id,
+            merchant_connector_account_id,
+        ));
+        let capture_method = payment_data.payment_intent.capture_method;
+        Ok(Self {
+            amount: Some(amount.get_amount_as_i64()), // This should be removed once we start moving to connector module
+            minor_amount: Some(amount),
+            currency: Some(payment_data.payment_intent.amount_details.currency),
+            connector_transaction_id: connector
+                .connector
+                .connector_transaction_id(&payment_data.payment_attempt)?
+                .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?,
+            cancellation_reason: payment_data.payment_attempt.cancellation_reason,
+            connector_meta: payment_data
+                .payment_attempt
+                .connector_metadata
+                .clone()
+                .expose_option(),
+            browser_info,
+            metadata: payment_data.payment_intent.metadata.expose_option(),
+            webhook_url,
+            capture_method: Some(capture_method),
+        })
     }
 }
 
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index d52dc1570ce..dd4bb55c3e4 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -741,7 +741,8 @@ impl Payments {
                 .service(
                     web::resource("/check-gift-card-balance")
                         .route(web::post().to(payments::payment_check_gift_card_balance)),
-                ),
+                )
+                .service(web::resource("/cancel").route(web::post().to(payments::payments_cancel))),
         );
 
         route
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 6f29b4cb5d9..c1970b64c28 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -1529,6 +1529,84 @@ pub async fn payments_cancel(
     .await
 }
 
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::PaymentsCancel, payment_id))]
+pub async fn payments_cancel(
+    state: web::Data<app::AppState>,
+    req: actix_web::HttpRequest,
+    json_payload: web::Json<payment_types::PaymentsCancelRequest>,
+    path: web::Path<common_utils::id_type::GlobalPaymentId>,
+) -> impl Responder {
+    let flow = Flow::PaymentsCancel;
+    let global_payment_id = path.into_inner();
+
+    tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
+
+    let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
+        global_payment_id: global_payment_id.clone(),
+        payload: json_payload.into_inner(),
+    };
+
+    let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
+        Ok(headers) => headers,
+        Err(err) => {
+            return api::log_and_return_error_response(err);
+        }
+    };
+
+    let locking_action = internal_payload.get_locking_input(flow.clone());
+
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        internal_payload,
+        |state, auth: auth::AuthenticationData, req, req_state| async {
+            let payment_id = req.global_payment_id;
+            let request = req.payload;
+
+            let operation = payments::operations::payment_cancel_v2::PaymentsCancel;
+            let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                domain::Context(auth.merchant_account, auth.key_store),
+            ));
+
+            Box::pin(payments::payments_core::<
+                hyperswitch_domain_models::router_flow_types::Void,
+                api_models::payments::PaymentsCancelResponse,
+                _,
+                _,
+                _,
+                hyperswitch_domain_models::payments::PaymentCancelData<
+                    hyperswitch_domain_models::router_flow_types::Void,
+                >,
+            >(
+                state,
+                req_state,
+                merchant_context,
+                auth.profile,
+                operation,
+                request,
+                payment_id,
+                payments::CallConnectorAction::Trigger,
+                header_payload.clone(),
+            ))
+            .await
+        },
+        auth::auth_type(
+            &auth::V2ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            },
+            &auth::JWTAuth {
+                permission: Permission::ProfilePaymentWrite,
+            },
+            req.headers(),
+        ),
+        locking_action,
+    ))
+    .await
+}
+
 #[cfg(feature = "v1")]
 #[instrument(skip_all, fields(flow = ?Flow::PaymentsCancelPostCapture, payment_id))]
 pub async fn payments_cancel_post_capture(
 | 
	2025-08-29T06:04:40Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add V2 payments_cancel flow by endpoint `{{baseUrl}}/v2/payments/:payment_id/cancel`.A payment can be cancelled when the status is RequiresCapture, PartiallyAuthorizedAndRequiresCapture, or PartiallyCapturedAndCapturable.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0199568c7d307cb093a2f9d517fec5cc/cancel' \
--header 'X-Profile-Id: pro_ICrZFKL8QL6GlxNOuGiT' \
--header 'Authorization: api-key=dev_lLeDL7DZk8Vf8vF7PTd53ces09iGYEerHYDBQzle5s1N1QPpzj3pKViOnv7VsQd5' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_lLeDL7DZk8Vf8vF7PTd53ces09iGYEerHYDBQzle5s1N1QPpzj3pKViOnv7VsQd5' \
--data '{
    "cancellation_reason": "Requested by Merchant"
}'
```
Response:
```
{
    "id": "12345_pay_019956bfbb0472f28d713b8190b897b7",
    "status": "cancelled",
    "cancellation_reason": "Requested by Merchant",
    "amount": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 100,
        "amount_captured": 0
    },
    "customer_id": "12345_cus_0199568c731e77d2960fde597ad801ac",
    "connector": "authorizedotnet",
    "created": "2025-09-17T08:17:09.937Z",
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "attempts": null,
    "return_url": null
}
```
<img width="1314" height="1037" alt="image" src="https://github.com/user-attachments/assets/3e72e0fe-b0a5-46d8-9102-d8431518773d" />
<img width="3600" height="2508" alt="image" src="https://github.com/user-attachments/assets/fe1e4fbe-454a-4684-b009-820c9281b1b1" />
<img width="1228" height="426" alt="image" src="https://github.com/user-attachments/assets/73117c2d-600a-4ee4-bcbd-a43c5b7c55cd" />
closes #9082 
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	213165968462168a59d5c56423a7c10aa04fc186 | 
	
Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0199568c7d307cb093a2f9d517fec5cc/cancel' \
--header 'X-Profile-Id: pro_ICrZFKL8QL6GlxNOuGiT' \
--header 'Authorization: api-key=dev_lLeDL7DZk8Vf8vF7PTd53ces09iGYEerHYDBQzle5s1N1QPpzj3pKViOnv7VsQd5' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_lLeDL7DZk8Vf8vF7PTd53ces09iGYEerHYDBQzle5s1N1QPpzj3pKViOnv7VsQd5' \
--data '{
    "cancellation_reason": "Requested by Merchant"
}'
```
Response:
```
{
    "id": "12345_pay_019956bfbb0472f28d713b8190b897b7",
    "status": "cancelled",
    "cancellation_reason": "Requested by Merchant",
    "amount": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 100,
        "amount_captured": 0
    },
    "customer_id": "12345_cus_0199568c731e77d2960fde597ad801ac",
    "connector": "authorizedotnet",
    "created": "2025-09-17T08:17:09.937Z",
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "attempts": null,
    "return_url": null
}
```
<img width="1314" height="1037" alt="image" src="https://github.com/user-attachments/assets/3e72e0fe-b0a5-46d8-9102-d8431518773d" />
<img width="3600" height="2508" alt="image" src="https://github.com/user-attachments/assets/fe1e4fbe-454a-4684-b009-820c9281b1b1" />
<img width="1228" height="426" alt="image" src="https://github.com/user-attachments/assets/73117c2d-600a-4ee4-bcbd-a43c5b7c55cd" />
closes #9082 
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9056 | 
	Bug: Create Subscription with autocollection off
Request to Subscription Povider to create subscription
curl --location 'https://site/api/v2/customers/AzyUM7UusAXA7mMT/subscription_for_items' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic =' \
--data-urlencode 'billing_address%5Bline1%5D=PO Box 9999' \
--data-urlencode 'billing_address%5Bcity%5D=Walnut' \
--data-urlencode 'billing_address%5Bzip%5D=91789' \
--data-urlencode 'billing_address%5Bcountry%5D=US' \
--data-urlencode 'subscription_items%5Bitem_price_id%5D%5B0%5D=cbdemo_enterprise-suite-monthly' \
--data-urlencode 'auto_collection=off'
Response from Subscription Provider
```
{
    "subscription": {
        "id": "AzyvCyUut31wPEoY",
        "billing_period": 1,
        "billing_period_unit": "month",
        "auto_collection": "off",
        "customer_id": "AzyUM7UusAXA7mMT",
        "status": "active",
        "current_term_start": 1756123927,
        "current_term_end": 1758802327,
        "next_billing_at": 1758802327,
        "created_at": 1756123927,
        "started_at": 1756123927,
        "activated_at": 1756123927,
        "updated_at": 1756123927,
        "has_scheduled_changes": false,
        "channel": "web",
        "resource_version": 1756123927399,
        "deleted": false,
        "object": "subscription",
        "currency_code": "INR",
        "subscription_items": [
            {
                "item_price_id": "cbdemo_enterprise-suite-monthly",
                "item_type": "plan",
                "quantity": 1,
                "unit_price": 14100,
                "amount": 14100,
                "free_quantity": 0,
                "object": "subscription_item"
            }
        ],
        "due_invoices_count": 1,
        "due_since": 1756123927,
        "total_dues": 14100,
        "mrr": 0,
        "has_scheduled_advance_invoices": false
    },
    "customer": {
        "id": "AzyUM7UusAXA7mMT",
        "first_name": "John",
        "last_name": "Doe",
        "email": "john@test.com",
        "auto_collection": "on",
        "net_term_days": 0,
        "allow_direct_debit": false,
        "created_at": 1756110939,
        "taxability": "taxable",
        "updated_at": 1756110939,
        "locale": "fr-CA",
        "pii_cleared": "active",
        "channel": "web",
        "resource_version": 1756110939077,
        "deleted": false,
        "object": "customer",
        "billing_address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "PO Box 9999",
            "city": "Walnut",
            "state_code": "CA",
            "state": "California",
            "country": "US",
            "zip": "91789",
            "validation_status": "not_validated",
            "object": "billing_address"
        },
        "card_status": "no_card",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "excess_payments": 0,
        "unbilled_charges": 0,
        "preferred_currency_code": "INR",
        "mrr": 0
    },
    "invoice": {
        "id": "48",
        "customer_id": "AzyUM7UusAXA7mMT",
        "subscription_id": "AzyvCyUut31wPEoY",
        "recurring": true,
        "status": "payment_due",
        "date": 1756123927,
        "due_date": 1756123927,
        "net_term_days": 0,
        "price_type": "tax_exclusive",
        "exchange_rate": 1.0,
        "total": 14100,
        "amount_due": 14100,
        "amount_adjusted": 0,
        "amount_paid": 0,
        "write_off_amount": 0,
        "credits_applied": 0,
        "updated_at": 1756123927,
        "resource_version": 1756123927364,
        "deleted": false,
        "object": "invoice",
        "first_invoice": true,
        "amount_to_collect": 14100,
        "round_off_amount": 0,
        "new_sales_amount": 14100,
        "has_advance_charges": false,
        "currency_code": "INR",
        "base_currency_code": "INR",
        "generated_at": 1756123927,
        "is_gifted": false,
        "term_finalized": true,
        "channel": "web",
        "tax": 0,
        "line_items": [
            {
                "id": "li_AzyvCyUut31yqEoa",
                "date_from": 1756123927,
                "date_to": 1758802327,
                "unit_amount": 14100,
                "quantity": 1,
                "amount": 14100,
                "pricing_model": "flat_fee",
                "is_taxed": false,
                "tax_amount": 0,
                "object": "line_item",
                "subscription_id": "AzyvCyUut31wPEoY",
                "customer_id": "AzyUM7UusAXA7mMT",
                "description": "Enterprise Suite Monthly",
                "entity_type": "plan_item_price",
                "entity_id": "cbdemo_enterprise-suite-monthly",
                "tax_exempt_reason": "tax_not_configured",
                "discount_amount": 0,
                "item_level_discount_amount": 0
            }
        ],
        "sub_total": 14100,
        "linked_payments": [],
        "applied_credits": [],
        "adjustment_credit_notes": [],
        "issued_credit_notes": [],
        "linked_orders": [],
        "dunning_attempts": [],
        "billing_address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "PO Box 9999",
            "city": "Walnut",
            "state_code": "CA",
            "state": "California",
            "country": "US",
            "zip": "91789",
            "validation_status": "not_validated",
            "object": "billing_address"
        },
        "site_details_at_creation": {
            "timezone": "Asia/Calcutta"
        }
    }
}
```
Common Status for Chargebee Recurly and Stripe Billing
```
Common Status	    Chargebee	    Recurly	        Stripe Billing
Pending	            Future	        -	            incomplete, 
Trial	            InTrial	        -	            trialing
Active	            Active	        ACTIVE	        active
Paused	            Paused	        PAUSED	        paused
unpaid  	        -	            -	            unpaid
Onetime             NonRenewing     -               -
Canceled	        Cancelled,      CANCELLED, 	    canceled,
                    Transferred     EXPIRED         	
Failed	            -	            FAILED	        incomplete_expired
``` | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index b9006f9e82e..bf6f3fe637d 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -16,30 +16,38 @@ use error_stack::ResultExt;
 use hyperswitch_domain_models::{revenue_recovery, router_data_v2::RouterDataV2};
 use hyperswitch_domain_models::{
     router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+    router_data_v2::flow_common_types::SubscriptionCreateData,
     router_flow_types::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
         revenue_recovery::InvoiceRecordBack,
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
         CreateConnectorCustomer,
     },
     router_request_types::{
         revenue_recovery::InvoiceRecordBackRequest,
-        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
+        subscriptions::{
+            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+            SubscriptionCreateRequest,
+        },
         AccessTokenRequestData, ConnectorCustomerData, PaymentMethodTokenizationData,
         PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
         PaymentsSyncData, RefundsData, SetupMandateRequestData,
     },
     router_response_types::{
         revenue_recovery::InvoiceRecordBackResponse,
-        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        subscriptions::{
+            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+            SubscriptionCreateResponse,
+        },
         ConnectorInfo, PaymentsResponseData, RefundsResponseData,
     },
     types::{
         ConnectorCustomerRouterData, GetSubscriptionPlanPricesRouterData,
         GetSubscriptionPlansRouterData, InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData,
         PaymentsCaptureRouterData, PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+        SubscriptionCreateRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -94,10 +102,117 @@ impl api::Refund for Chargebee {}
 impl api::RefundExecute for Chargebee {}
 impl api::RefundSync for Chargebee {}
 impl api::PaymentToken for Chargebee {}
+impl api::subscriptions::Subscriptions for Chargebee {}
 
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl api::revenue_recovery::RevenueRecoveryRecordBack for Chargebee {}
 
+impl api::subscriptions::SubscriptionCreate for Chargebee {}
+
+impl ConnectorIntegration<SubscriptionCreate, SubscriptionCreateRequest, SubscriptionCreateResponse>
+    for Chargebee
+{
+    fn get_headers(
+        &self,
+        req: &SubscriptionCreateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_url(
+        &self,
+        req: &SubscriptionCreateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let metadata: chargebee::ChargebeeMetadata =
+            utils::to_connector_meta_from_secret(req.connector_meta_data.clone())?;
+        let url = self
+            .base_url(connectors)
+            .to_string()
+            .replace("{{merchant_endpoint_prefix}}", metadata.site.peek());
+        let customer_id = &req.request.customer_id.get_string_repr().to_string();
+        Ok(format!(
+            "{url}v2/customers/{customer_id}/subscription_for_items"
+        ))
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_request_body(
+        &self,
+        req: &SubscriptionCreateRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_router_data = chargebee::ChargebeeRouterData::from((MinorUnit::new(0), req));
+        let connector_req =
+            chargebee::ChargebeeSubscriptionCreateRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &SubscriptionCreateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::SubscriptionCreateType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::SubscriptionCreateType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::SubscriptionCreateType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &SubscriptionCreateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<SubscriptionCreateRouterData, errors::ConnectorError> {
+        let response: chargebee::ChargebeeSubscriptionCreateResponse = res
+            .response
+            .parse_struct("chargebee ChargebeeSubscriptionCreateResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl
+    ConnectorIntegrationV2<
+        SubscriptionCreate,
+        SubscriptionCreateData,
+        SubscriptionCreateRequest,
+        SubscriptionCreateResponse,
+    > for Chargebee
+{
+    // Not Implemented (R)
+}
+
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Chargebee
 {
@@ -689,7 +804,6 @@ fn get_chargebee_plans_query_params(
     Ok(param)
 }
 
-impl api::subscriptions::Subscriptions for Chargebee {}
 impl api::subscriptions::GetSubscriptionPlansFlow for Chargebee {}
 
 impl
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 7d76b869912..5f16d054890 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -5,7 +5,7 @@ use common_enums::enums;
 use common_utils::{
     errors::CustomResult,
     ext_traits::ByteSliceExt,
-    id_type::CustomerId,
+    id_type::{CustomerId, SubscriptionId},
     pii::{self, Email},
     types::MinorUnit,
 };
@@ -17,14 +17,20 @@ use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, RouterData},
     router_flow_types::{
         refunds::{Execute, RSync},
+        subscriptions::SubscriptionCreate,
         CreateConnectorCustomer, InvoiceRecordBack,
     },
     router_request_types::{
-        revenue_recovery::InvoiceRecordBackRequest, ConnectorCustomerData, ResponseId,
+        revenue_recovery::InvoiceRecordBackRequest,
+        subscriptions::{SubscriptionAutoCollection, SubscriptionCreateRequest},
+        ConnectorCustomerData, ResponseId,
     },
     router_response_types::{
         revenue_recovery::InvoiceRecordBackResponse,
-        subscriptions::{self, GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        subscriptions::{
+            self, GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+            SubscriptionCreateResponse, SubscriptionStatus,
+        },
         ConnectorCustomerResponseData, PaymentsResponseData, RefundsResponseData,
     },
     types::{InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData, RefundsRouterData},
@@ -36,9 +42,158 @@ use time::PrimitiveDateTime;
 
 use crate::{
     types::{RefundsResponseRouterData, ResponseRouterData},
-    utils::{self, PaymentsAuthorizeRequestData},
+    utils::{self, PaymentsAuthorizeRequestData, RouterData as OtherRouterData},
 };
 
+// SubscriptionCreate structures
+#[derive(Debug, Serialize)]
+pub struct ChargebeeSubscriptionCreateRequest {
+    #[serde(rename = "id")]
+    pub subscription_id: SubscriptionId,
+    #[serde(rename = "subscription_items[item_price_id][0]")]
+    pub item_price_id: String,
+    #[serde(rename = "subscription_items[quantity][0]")]
+    pub quantity: Option<u32>,
+    #[serde(rename = "billing_address[line1]")]
+    pub billing_address_line1: Option<Secret<String>>,
+    #[serde(rename = "billing_address[city]")]
+    pub billing_address_city: Option<String>,
+    #[serde(rename = "billing_address[state]")]
+    pub billing_address_state: Option<Secret<String>>,
+    #[serde(rename = "billing_address[zip]")]
+    pub billing_address_zip: Option<Secret<String>>,
+    #[serde(rename = "billing_address[country]")]
+    pub billing_address_country: Option<common_enums::CountryAlpha2>,
+    pub auto_collection: ChargebeeAutoCollection,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "snake_case")]
+pub enum ChargebeeAutoCollection {
+    On,
+    Off,
+}
+
+impl From<SubscriptionAutoCollection> for ChargebeeAutoCollection {
+    fn from(auto_collection: SubscriptionAutoCollection) -> Self {
+        match auto_collection {
+            SubscriptionAutoCollection::On => Self::On,
+            SubscriptionAutoCollection::Off => Self::Off,
+        }
+    }
+}
+
+impl TryFrom<&ChargebeeRouterData<&hyperswitch_domain_models::types::SubscriptionCreateRouterData>>
+    for ChargebeeSubscriptionCreateRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &ChargebeeRouterData<&hyperswitch_domain_models::types::SubscriptionCreateRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let req = &item.router_data.request;
+
+        let first_item =
+            req.subscription_items
+                .first()
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "subscription_items",
+                })?;
+
+        Ok(Self {
+            subscription_id: req.subscription_id.clone(),
+            item_price_id: first_item.item_price_id.clone(),
+            quantity: first_item.quantity,
+            billing_address_line1: item.router_data.get_optional_billing_line1(),
+            billing_address_city: item.router_data.get_optional_billing_city(),
+            billing_address_state: item.router_data.get_optional_billing_state(),
+            billing_address_zip: item.router_data.get_optional_billing_zip(),
+            billing_address_country: item.router_data.get_optional_billing_country(),
+            auto_collection: req.auto_collection.clone().into(),
+        })
+    }
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct ChargebeeSubscriptionCreateResponse {
+    pub subscription: ChargebeeSubscriptionDetails,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct ChargebeeSubscriptionDetails {
+    pub id: SubscriptionId,
+    pub status: ChargebeeSubscriptionStatus,
+    pub customer_id: CustomerId,
+    pub currency_code: enums::Currency,
+    pub total_dues: Option<MinorUnit>,
+    #[serde(default, with = "common_utils::custom_serde::timestamp::option")]
+    pub next_billing_at: Option<PrimitiveDateTime>,
+    #[serde(default, with = "common_utils::custom_serde::timestamp::option")]
+    pub created_at: Option<PrimitiveDateTime>,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "snake_case")]
+pub enum ChargebeeSubscriptionStatus {
+    Future,
+    #[serde(rename = "in_trial")]
+    InTrial,
+    Active,
+    #[serde(rename = "non_renewing")]
+    NonRenewing,
+    Paused,
+    Cancelled,
+    Transferred,
+}
+
+impl From<ChargebeeSubscriptionStatus> for SubscriptionStatus {
+    fn from(status: ChargebeeSubscriptionStatus) -> Self {
+        match status {
+            ChargebeeSubscriptionStatus::Future => Self::Pending,
+            ChargebeeSubscriptionStatus::InTrial => Self::Trial,
+            ChargebeeSubscriptionStatus::Active => Self::Active,
+            ChargebeeSubscriptionStatus::NonRenewing => Self::Onetime,
+            ChargebeeSubscriptionStatus::Paused => Self::Paused,
+            ChargebeeSubscriptionStatus::Cancelled => Self::Cancelled,
+            ChargebeeSubscriptionStatus::Transferred => Self::Cancelled,
+        }
+    }
+}
+
+impl
+    TryFrom<
+        ResponseRouterData<
+            SubscriptionCreate,
+            ChargebeeSubscriptionCreateResponse,
+            SubscriptionCreateRequest,
+            SubscriptionCreateResponse,
+        >,
+    > for hyperswitch_domain_models::types::SubscriptionCreateRouterData
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            SubscriptionCreate,
+            ChargebeeSubscriptionCreateResponse,
+            SubscriptionCreateRequest,
+            SubscriptionCreateResponse,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let subscription = &item.response.subscription;
+        Ok(Self {
+            response: Ok(SubscriptionCreateResponse {
+                subscription_id: subscription.id.clone(),
+                status: subscription.status.clone().into(),
+                customer_id: subscription.customer_id.clone(),
+                currency_code: subscription.currency_code,
+                total_amount: subscription.total_dues.unwrap_or(MinorUnit::new(0)),
+                next_billing_at: subscription.next_billing_at,
+                created_at: subscription.created_at,
+            }),
+            ..item.data
+        })
+    }
+}
+
 //TODO: Fill the struct with respective fields
 pub struct ChargebeeRouterData<T> {
     pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index abadb7cb199..5bac349e886 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -10,17 +10,22 @@ use error_stack::ResultExt;
 use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, ErrorResponse},
     router_data_v2::{
-        flow_common_types::{GetSubscriptionPlanPricesData, GetSubscriptionPlansData},
+        flow_common_types::{
+            GetSubscriptionPlanPricesData, GetSubscriptionPlansData, SubscriptionCreateData,
+        },
         UasFlowData,
     },
     router_flow_types::{
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
     },
     router_request_types::{
-        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
+        subscriptions::{
+            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+            SubscriptionCreateRequest,
+        },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -28,7 +33,7 @@ use hyperswitch_domain_models::{
         },
     },
     router_response_types::subscriptions::{
-        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse, SubscriptionCreateResponse,
     },
 };
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
@@ -168,6 +173,16 @@ impl
     > for Recurly
 {
 }
+impl api::subscriptions_v2::SubscriptionsCreateV2 for Recurly {}
+impl
+    ConnectorIntegrationV2<
+        SubscriptionCreate,
+        SubscriptionCreateData,
+        SubscriptionCreateRequest,
+        SubscriptionCreateResponse,
+    > for Recurly
+{
+}
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl api::revenue_recovery_v2::RevenueRecoveryRecordBackV2 for Recurly {}
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 96fbfb6b311..f109ea3fb2f 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -44,10 +44,14 @@ use hyperswitch_domain_models::{
         AccessTokenAuthentication, Authenticate, AuthenticationConfirmation,
         ExternalVaultCreateFlow, ExternalVaultDeleteFlow, ExternalVaultInsertFlow,
         ExternalVaultProxy, ExternalVaultRetrieveFlow, PostAuthenticate, PreAuthenticate,
+        SubscriptionCreate as SubscriptionCreateFlow,
     },
     router_request_types::{
         authentication,
-        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
+        subscriptions::{
+            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+            SubscriptionCreateRequest,
+        },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -66,7 +70,10 @@ use hyperswitch_domain_models::{
         VerifyWebhookSourceRequestData,
     },
     router_response_types::{
-        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        subscriptions::{
+            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+            SubscriptionCreateResponse,
+        },
         AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,
         DisputeSyncResponse, FetchDisputesResponse, GiftCardBalanceCheckResponseData,
         MandateRevokeResponseData, PaymentsResponseData, RetrieveFileResponse,
@@ -130,7 +137,10 @@ use hyperswitch_interfaces::{
             PaymentsPreAuthenticate, PaymentsPreProcessing, TaxCalculation,
         },
         revenue_recovery::RevenueRecovery,
-        subscriptions::{GetSubscriptionPlanPricesFlow, GetSubscriptionPlansFlow, Subscriptions},
+        subscriptions::{
+            GetSubscriptionPlanPricesFlow, GetSubscriptionPlansFlow, SubscriptionCreate,
+            Subscriptions,
+        },
         vault::{
             ExternalVault, ExternalVaultCreate, ExternalVaultDelete, ExternalVaultInsert,
             ExternalVaultRetrieve,
@@ -6941,6 +6951,7 @@ macro_rules! default_imp_for_subscriptions {
     ($($path:ident::$connector:ident),*) => {
         $(  impl Subscriptions for $path::$connector {}
             impl GetSubscriptionPlansFlow for $path::$connector {}
+            impl SubscriptionCreate for $path::$connector {}
             impl
             ConnectorIntegration<
             GetSubscriptionPlans,
@@ -6956,6 +6967,12 @@ macro_rules! default_imp_for_subscriptions {
             GetSubscriptionPlanPricesResponse
             > for $path::$connector
             {}
+            impl
+            ConnectorIntegration<
+            SubscriptionCreateFlow,
+            SubscriptionCreateRequest,
+            SubscriptionCreateResponse,
+            > for $path::$connector {}
         )*
     };
 }
@@ -9253,3 +9270,16 @@ impl<const T: u8>
     > for connectors::DummyConnector<T>
 {
 }
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> SubscriptionCreate for connectors::DummyConnector<T> {}
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+    ConnectorIntegration<
+        SubscriptionCreateFlow,
+        SubscriptionCreateRequest,
+        SubscriptionCreateResponse,
+    > for connectors::DummyConnector<T>
+{
+}
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 759e2f9943b..0d89445b6a3 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -150,6 +150,9 @@ pub struct FilesFlowData {
 #[derive(Debug, Clone)]
 pub struct InvoiceRecordBackData;
 
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateData;
+
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlansData;
 
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types.rs b/crates/hyperswitch_domain_models/src/router_flow_types.rs
index dc5418ac8cf..18cf7a53fa6 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types.rs
@@ -20,6 +20,7 @@ pub use payments::*;
 pub use payouts::*;
 pub use refunds::*;
 pub use revenue_recovery::*;
+pub use subscriptions::*;
 pub use unified_authentication_service::*;
 pub use vault::*;
 pub use webhooks::*;
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
index 4f277c07678..28c78e94393 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
@@ -1,4 +1,6 @@
 #[derive(Debug, Clone)]
+pub struct SubscriptionCreate;
+#[derive(Debug, Clone)]
 pub struct GetSubscriptionPlans;
 
 #[derive(Debug, Clone)]
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
index bc9049d10f9..832140e1690 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
@@ -1,3 +1,28 @@
+use api_models::payments::Address;
+use common_utils::id_type;
+
+use crate::connector_endpoints;
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionItem {
+    pub item_price_id: String,
+    pub quantity: Option<u32>,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateRequest {
+    pub customer_id: id_type::CustomerId,
+    pub subscription_id: id_type::SubscriptionId,
+    pub subscription_items: Vec<SubscriptionItem>,
+    pub billing_address: Address,
+    pub auto_collection: SubscriptionAutoCollection,
+    pub connector_params: connector_endpoints::ConnectorParams,
+}
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum SubscriptionAutoCollection {
+    On,
+    Off,
+}
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlansRequest {
     pub limit: Option<u32>,
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
index 0b06a6aa269..c61f9fd7ff4 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
@@ -1,4 +1,29 @@
 use common_enums::Currency;
+use common_utils::{id_type, types::MinorUnit};
+use time::PrimitiveDateTime;
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateResponse {
+    pub subscription_id: id_type::SubscriptionId,
+    pub status: SubscriptionStatus,
+    pub customer_id: id_type::CustomerId,
+    pub currency_code: Currency,
+    pub total_amount: MinorUnit,
+    pub next_billing_at: Option<PrimitiveDateTime>,
+    pub created_at: Option<PrimitiveDateTime>,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum SubscriptionStatus {
+    Pending,
+    Trial,
+    Active,
+    Paused,
+    Unpaid,
+    Onetime,
+    Cancelled,
+    Failed,
+}
 
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlansResponse {
@@ -21,7 +46,7 @@ pub struct GetSubscriptionPlanPricesResponse {
 pub struct SubscriptionPlanPrices {
     pub price_id: String,
     pub plan_id: Option<String>,
-    pub amount: common_utils::types::MinorUnit,
+    pub amount: MinorUnit,
     pub currency: Currency,
     pub interval: PeriodUnit,
     pub interval_count: i64,
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index cc57f7f82f0..06fbeb267d3 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -6,7 +6,7 @@ use crate::{
     router_flow_types::{
         mandate_revoke::MandateRevoke,
         revenue_recovery::InvoiceRecordBack,
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
         AccessTokenAuth, AccessTokenAuthentication, Authenticate, AuthenticationConfirmation,
         Authorize, AuthorizeSessionToken, BillingConnectorInvoiceSync,
         BillingConnectorPaymentsSync, CalculateTax, Capture, CompleteAuthorize,
@@ -20,7 +20,10 @@ use crate::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
             InvoiceRecordBackRequest,
         },
-        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
+        subscriptions::{
+            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+            SubscriptionCreateRequest,
+        },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -42,7 +45,10 @@ use crate::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
             InvoiceRecordBackResponse,
         },
-        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        subscriptions::{
+            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+            SubscriptionCreateResponse,
+        },
         GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
         RefundsResponseData, TaxCalculationResponseData, VaultResponseData,
         VerifyWebhookSourceResponseData,
@@ -195,3 +201,6 @@ pub type ExternalVaultProxyPaymentsRouterDataV2 = RouterDataV2<
     ExternalVaultProxyPaymentsData,
     PaymentsResponseData,
 >;
+
+pub type SubscriptionCreateRouterData =
+    RouterData<SubscriptionCreate, SubscriptionCreateRequest, SubscriptionCreateResponse>;
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions.rs b/crates/hyperswitch_interfaces/src/api/subscriptions.rs
index 7e710c63d13..1d15a7f2b64 100644
--- a/crates/hyperswitch_interfaces/src/api/subscriptions.rs
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions.rs
@@ -1,12 +1,13 @@
 //! Subscriptions Interface for V1
 #[cfg(feature = "v1")]
 use hyperswitch_domain_models::{
+    router_flow_types::subscriptions::SubscriptionCreate as SubscriptionCreateFlow,
     router_flow_types::subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
     router_request_types::subscriptions::{
-        GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+        GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest, SubscriptionCreateRequest,
     },
     router_response_types::subscriptions::{
-        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse, SubscriptionCreateResponse,
     },
 };
 
@@ -37,12 +38,20 @@ pub trait GetSubscriptionPlanPricesFlow:
 {
 }
 
+#[cfg(feature = "v1")]
+/// trait SubscriptionCreate
+pub trait SubscriptionCreate:
+    ConnectorIntegration<SubscriptionCreateFlow, SubscriptionCreateRequest, SubscriptionCreateResponse>
+{
+}
+
 /// trait Subscriptions
 #[cfg(feature = "v1")]
 pub trait Subscriptions:
     ConnectorCommon
     + GetSubscriptionPlansFlow
     + GetSubscriptionPlanPricesFlow
+    + SubscriptionCreate
     + PaymentsConnectorCustomer
 {
 }
@@ -62,3 +71,7 @@ pub trait GetSubscriptionPlanPricesFlow {}
 #[cfg(not(feature = "v1"))]
 /// trait CreateCustomer (disabled when not V1)
 pub trait ConnectorCustomer {}
+
+/// trait SubscriptionCreate
+#[cfg(not(feature = "v1"))]
+pub trait SubscriptionCreate {}
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
index 609ab2dbc3f..f14d8439e2c 100644
--- a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
@@ -1,12 +1,16 @@
 //! SubscriptionsV2
 use hyperswitch_domain_models::{
-    router_data_v2::flow_common_types::{GetSubscriptionPlanPricesData, GetSubscriptionPlansData},
-    router_flow_types::subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+    router_data_v2::flow_common_types::{
+        GetSubscriptionPlanPricesData, GetSubscriptionPlansData, SubscriptionCreateData,
+    },
+    router_flow_types::subscriptions::{
+        GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate,
+    },
     router_request_types::subscriptions::{
-        GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+        GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest, SubscriptionCreateRequest,
     },
     router_response_types::subscriptions::{
-        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse, SubscriptionCreateResponse,
     },
 };
 
@@ -15,7 +19,7 @@ use crate::connector_integration_v2::ConnectorIntegrationV2;
 
 /// trait SubscriptionsV2
 pub trait SubscriptionsV2:
-    GetSubscriptionPlansV2 + ConnectorCustomerV2 + GetSubscriptionPlanPricesV2
+    GetSubscriptionPlansV2 + SubscriptionsCreateV2 + ConnectorCustomerV2 + GetSubscriptionPlanPricesV2
 {
 }
 
@@ -40,3 +44,14 @@ pub trait GetSubscriptionPlanPricesV2:
 >
 {
 }
+
+/// trait SubscriptionsCreateV2
+pub trait SubscriptionsCreateV2:
+    ConnectorIntegrationV2<
+    SubscriptionCreate,
+    SubscriptionCreateData,
+    SubscriptionCreateRequest,
+    SubscriptionCreateResponse,
+>
+{
+}
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index d119cf332e1..a9d4a1bcd62 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -13,8 +13,8 @@ use hyperswitch_domain_models::{
             BillingConnectorPaymentsSyncFlowData, DisputesFlowData, ExternalAuthenticationFlowData,
             ExternalVaultProxyFlowData, FilesFlowData, GetSubscriptionPlanPricesData,
             GetSubscriptionPlansData, GiftCardBalanceCheckFlowData, InvoiceRecordBackData,
-            MandateRevokeFlowData, PaymentFlowData, RefundFlowData, UasFlowData,
-            VaultConnectorFlowData, WebhookSourceVerifyData,
+            MandateRevokeFlowData, PaymentFlowData, RefundFlowData, SubscriptionCreateData,
+            UasFlowData, VaultConnectorFlowData, WebhookSourceVerifyData,
         },
         RouterDataV2,
     },
@@ -878,6 +878,7 @@ macro_rules! default_router_data_conversion {
 }
 default_router_data_conversion!(GetSubscriptionPlansData);
 default_router_data_conversion!(GetSubscriptionPlanPricesData);
+default_router_data_conversion!(SubscriptionCreateData);
 
 impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowData {
     fn from_old_router_data(
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index dbb9ddf8869..d9975a8c058 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -16,7 +16,7 @@ use hyperswitch_domain_models::{
         },
         refunds::{Execute, RSync},
         revenue_recovery::{BillingConnectorPaymentsSync, InvoiceRecordBack},
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
@@ -32,7 +32,10 @@ use hyperswitch_domain_models::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
             InvoiceRecordBackRequest,
         },
-        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
+        subscriptions::{
+            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
+            SubscriptionCreateRequest,
+        },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -57,7 +60,10 @@ use hyperswitch_domain_models::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
             InvoiceRecordBackResponse,
         },
-        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        subscriptions::{
+            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
+            SubscriptionCreateResponse,
+        },
         AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
         GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
         RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
@@ -303,6 +309,13 @@ pub type InvoiceRecordBackType = dyn ConnectorIntegration<
     InvoiceRecordBackResponse,
 >;
 
+/// Type alias for `ConnectorIntegration<SubscriptionCreate, SubscriptionCreateRequest, SubscriptionCreateResponse>`
+pub type SubscriptionCreateType = dyn ConnectorIntegration<
+    SubscriptionCreate,
+    SubscriptionCreateRequest,
+    SubscriptionCreateResponse,
+>;
+
 /// Type alias for `ConnectorIntegration<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
 pub type BillingConnectorPaymentsSyncType = dyn ConnectorIntegration<
     BillingConnectorPaymentsSync,
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 4e8970d9309..0fd012e9f7a 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -211,6 +211,9 @@ where
     Ok(())
 }
 
+pub type BoxedSubscriptionConnectorIntegrationInterface<T, Req, Res> =
+    BoxedConnectorIntegrationInterface<T, common_types::SubscriptionCreateData, Req, Res>;
+
 /// Handle the flow by interacting with connector module
 /// `connector_request` is applicable only in case if the `CallConnectorAction` is `Trigger`
 /// In other cases, It will be created if required, even if it is not passed
 | 
	2025-09-08T10:23:30Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Added Chargebee subscription creation request/response structures.
- Implemented conversion traits for Chargebee subscription data.
- Enhanced Recurly connector to support subscription creation flows.
- Introduced new router flow types and request/response types for subscriptions.
- Updated default implementations to include subscription-related traits and integrations.
- Added new traits for subscription management in the hyperswitch interfaces.
- Implemented conversion logic for subscription data between old and new router data formats.
- Updated API service to handle subscription connector integration.
Common Status for Chargebee, Recurly and Stripe Billing
```
Common Status	    Chargebee	    Recurly	        Stripe Billing
Pending	            Future	        -	            incomplete, 
Trial	            InTrial	        -	            trialing
Active	            Active	        ACTIVE	        active
Paused	            Paused	        PAUSED	        paused
unpaid  	        -	            -	            unpaid
Onetime             NonRenewing     -               -
Cancelled	        Cancelled,      CANCELLED, 	    canceled,
                    Transferred     EXPIRED         	
Failed	            -	            FAILED	        incomplete_expired
```
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
closes [9056](https://github.com/juspay/hyperswitch/issues/9056)
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Since the API handler is being implemented in a separate PR, this connector integration code cannot be called directly and was tested only by successful compilation of code
<img width="996" height="805" alt="image" src="https://github.com/user-attachments/assets/2849b14f-c922-4f63-8ba0-68f5b3e21d29" />
<img width="981" height="623" alt="image" src="https://github.com/user-attachments/assets/b5f2524b-8e46-4c9a-be91-3730d9335865" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e2f1a456a17645b9ccac771d3608794c4956277d | 
	
Since the API handler is being implemented in a separate PR, this connector integration code cannot be called directly and was tested only by successful compilation of code
<img width="996" height="805" alt="image" src="https://github.com/user-attachments/assets/2849b14f-c922-4f63-8ba0-68f5b3e21d29" />
<img width="981" height="623" alt="image" src="https://github.com/user-attachments/assets/b5f2524b-8e46-4c9a-be91-3730d9335865" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9062 | 
	Bug: [FEATURE] Implement comprehensive event logging for UCS (Unified Connector Service) operations
Currently, UCS operations lack proper event logging and observability, making it difficult to debug issues, monitor performance, and track payment flows through the unified connector service. | 
	diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index 1c689943d73..b9d9b9aa27e 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -20,7 +20,7 @@ use crate::{
         unified_connector_service::{
             build_unified_connector_service_auth_metadata,
             handle_unified_connector_service_response_for_payment_authorize,
-            handle_unified_connector_service_response_for_payment_repeat,
+            handle_unified_connector_service_response_for_payment_repeat, ucs_logging_wrapper,
         },
     },
     logger,
@@ -523,20 +523,20 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
         merchant_context: &domain::MerchantContext,
     ) -> RouterResult<()> {
         if self.request.mandate_id.is_some() {
-            call_unified_connector_service_repeat_payment(
+            Box::pin(call_unified_connector_service_repeat_payment(
                 self,
                 state,
                 merchant_connector_account,
                 merchant_context,
-            )
+            ))
             .await
         } else {
-            call_unified_connector_service_authorize(
+            Box::pin(call_unified_connector_service_authorize(
                 self,
                 state,
                 merchant_connector_account,
                 merchant_context,
-            )
+            ))
             .await
         }
     }
@@ -854,33 +854,46 @@ async fn call_unified_connector_service_authorize(
             .change_context(ApiErrorResponse::InternalServerError)
             .attach_printable("Failed to construct request metadata")?;
 
-    let response = client
-        .payment_authorize(
-            payment_authorize_request,
-            connector_auth_metadata,
-            None,
-            state.get_grpc_headers(),
-        )
-        .await
-        .change_context(ApiErrorResponse::InternalServerError)
-        .attach_printable("Failed to authorize payment")?;
-
-    let payment_authorize_response = response.into_inner();
-
-    let (status, router_data_response, status_code) =
-        handle_unified_connector_service_response_for_payment_authorize(
-            payment_authorize_response.clone(),
-        )
-        .change_context(ApiErrorResponse::InternalServerError)
-        .attach_printable("Failed to deserialize UCS response")?;
-
-    router_data.status = status;
-    router_data.response = router_data_response;
-    router_data.raw_connector_response = payment_authorize_response
-        .raw_connector_response
-        .map(Secret::new);
-    router_data.connector_http_status_code = Some(status_code);
+    let updated_router_data = Box::pin(ucs_logging_wrapper(
+        router_data.clone(),
+        state,
+        payment_authorize_request,
+        |mut router_data, payment_authorize_request| async move {
+            let response = client
+                .payment_authorize(
+                    payment_authorize_request,
+                    connector_auth_metadata,
+                    None,
+                    state.get_grpc_headers(),
+                )
+                .await
+                .change_context(ApiErrorResponse::InternalServerError)
+                .attach_printable("Failed to authorize payment")?;
+
+            let payment_authorize_response = response.into_inner();
+
+            let (status, router_data_response, status_code) =
+                handle_unified_connector_service_response_for_payment_authorize(
+                    payment_authorize_response.clone(),
+                )
+                .change_context(ApiErrorResponse::InternalServerError)
+                .attach_printable("Failed to deserialize UCS response")?;
+
+            router_data.status = status;
+            router_data.response = router_data_response;
+            router_data.raw_connector_response = payment_authorize_response
+                .raw_connector_response
+                .clone()
+                .map(Secret::new);
+            router_data.connector_http_status_code = Some(status_code);
+
+            Ok((router_data, payment_authorize_response))
+        },
+    ))
+    .await?;
 
+    // Copy back the updated data
+    *router_data = updated_router_data;
     Ok(())
 }
 
@@ -903,40 +916,53 @@ async fn call_unified_connector_service_repeat_payment(
         .attach_printable("Failed to fetch Unified Connector Service client")?;
 
     let payment_repeat_request =
-        payments_grpc::PaymentServiceRepeatEverythingRequest::foreign_try_from(router_data)
+        payments_grpc::PaymentServiceRepeatEverythingRequest::foreign_try_from(&*router_data)
             .change_context(ApiErrorResponse::InternalServerError)
-            .attach_printable("Failed to construct Payment Authorize Request")?;
+            .attach_printable("Failed to construct Payment Repeat Request")?;
 
     let connector_auth_metadata =
         build_unified_connector_service_auth_metadata(merchant_connector_account, merchant_context)
             .change_context(ApiErrorResponse::InternalServerError)
             .attach_printable("Failed to construct request metadata")?;
 
-    let response = client
-        .payment_repeat(
-            payment_repeat_request,
-            connector_auth_metadata,
-            state.get_grpc_headers(),
-        )
-        .await
-        .change_context(ApiErrorResponse::InternalServerError)
-        .attach_printable("Failed to authorize payment")?;
-
-    let payment_repeat_response = response.into_inner();
-
-    let (status, router_data_response, status_code) =
-        handle_unified_connector_service_response_for_payment_repeat(
-            payment_repeat_response.clone(),
-        )
-        .change_context(ApiErrorResponse::InternalServerError)
-        .attach_printable("Failed to deserialize UCS response")?;
-
-    router_data.status = status;
-    router_data.response = router_data_response;
-    router_data.raw_connector_response = payment_repeat_response
-        .raw_connector_response
-        .map(Secret::new);
-    router_data.connector_http_status_code = Some(status_code);
+    let updated_router_data = Box::pin(ucs_logging_wrapper(
+        router_data.clone(),
+        state,
+        payment_repeat_request,
+        |mut router_data, payment_repeat_request| async move {
+            let response = client
+                .payment_repeat(
+                    payment_repeat_request,
+                    connector_auth_metadata.clone(),
+                    state.get_grpc_headers(),
+                )
+                .await
+                .change_context(ApiErrorResponse::InternalServerError)
+                .attach_printable("Failed to repeat payment")?;
+
+            let payment_repeat_response = response.into_inner();
+
+            let (status, router_data_response, status_code) =
+                handle_unified_connector_service_response_for_payment_repeat(
+                    payment_repeat_response.clone(),
+                )
+                .change_context(ApiErrorResponse::InternalServerError)
+                .attach_printable("Failed to deserialize UCS response")?;
+
+            router_data.status = status;
+            router_data.response = router_data_response;
+            router_data.raw_connector_response = payment_repeat_response
+                .raw_connector_response
+                .clone()
+                .map(Secret::new);
+            router_data.connector_http_status_code = Some(status_code);
+
+            Ok((router_data, payment_repeat_response))
+        },
+    ))
+    .await?;
 
+    // Copy back the updated data
+    *router_data = updated_router_data;
     Ok(())
 }
diff --git a/crates/router/src/core/payments/flows/external_proxy_flow.rs b/crates/router/src/core/payments/flows/external_proxy_flow.rs
index ac491685b5d..b184aa60d5e 100644
--- a/crates/router/src/core/payments/flows/external_proxy_flow.rs
+++ b/crates/router/src/core/payments/flows/external_proxy_flow.rs
@@ -15,7 +15,7 @@ use crate::{
         payments::{
             self, access_token, customers, helpers, tokenization, transformers, PaymentData,
         },
-        unified_connector_service,
+        unified_connector_service::{self, ucs_logging_wrapper},
     },
     logger,
     routes::{metrics, SessionState},
@@ -394,33 +394,45 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>
             .change_context(ApiErrorResponse::InternalServerError)
             .attach_printable("Failed to construct external vault proxy metadata")?;
 
-        let response = client
-            .payment_authorize(
-                payment_authorize_request,
-                connector_auth_metadata,
-                Some(external_vault_proxy_metadata),
-                state.get_grpc_headers(),
-            )
-            .await
-            .change_context(ApiErrorResponse::InternalServerError)
-            .attach_printable("Failed to authorize payment")?;
-
-        let payment_authorize_response = response.into_inner();
+        let updated_router_data = Box::pin(ucs_logging_wrapper(
+            self.clone(),
+            state,
+            payment_authorize_request.clone(),
+            |mut router_data, payment_authorize_request| async move {
+                let response = client
+                    .payment_authorize(
+                        payment_authorize_request,
+                        connector_auth_metadata,
+                        Some(external_vault_proxy_metadata),
+                        state.get_grpc_headers(),
+                    )
+                    .await
+                    .change_context(ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to authorize payment")?;
 
-        let (status, router_data_response, status_code) =
-            unified_connector_service::handle_unified_connector_service_response_for_payment_authorize(
-                payment_authorize_response.clone(),
-            )
-            .change_context(ApiErrorResponse::InternalServerError)
-            .attach_printable("Failed to deserialize UCS response")?;
+                let payment_authorize_response = response.into_inner();
 
-        self.status = status;
-        self.response = router_data_response;
-        self.raw_connector_response = payment_authorize_response
-            .raw_connector_response
-            .map(masking::Secret::new);
-        self.connector_http_status_code = Some(status_code);
+                let (status, router_data_response, status_code) =
+                    unified_connector_service::handle_unified_connector_service_response_for_payment_authorize(
+                        payment_authorize_response.clone(),
+                    )
+                    .change_context(ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to deserialize UCS response")?;
+
+                router_data.status = status;
+                router_data.response = router_data_response;
+                router_data.raw_connector_response = payment_authorize_response
+                    .raw_connector_response
+                    .clone()
+                    .map(masking::Secret::new);
+                router_data.connector_http_status_code = Some(status_code);
+
+                Ok((router_data, payment_authorize_response))
+            }
+        )).await?;
 
+        // Copy back the updated data
+        *self = updated_router_data;
         Ok(())
     }
 }
diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs
index 93a2c1ecd48..802bd3d5bcf 100644
--- a/crates/router/src/core/payments/flows/psync_flow.rs
+++ b/crates/router/src/core/payments/flows/psync_flow.rs
@@ -13,7 +13,7 @@ use crate::{
         payments::{self, access_token, helpers, transformers, PaymentData},
         unified_connector_service::{
             build_unified_connector_service_auth_metadata,
-            handle_unified_connector_service_response_for_payment_get,
+            handle_unified_connector_service_response_for_payment_get, ucs_logging_wrapper,
         },
     },
     routes::SessionState,
@@ -233,7 +233,7 @@ impl Feature<api::PSync, types::PaymentsSyncData>
             .ok_or(ApiErrorResponse::InternalServerError)
             .attach_printable("Failed to fetch Unified Connector Service client")?;
 
-        let payment_get_request = payments_grpc::PaymentServiceGetRequest::foreign_try_from(self)
+        let payment_get_request = payments_grpc::PaymentServiceGetRequest::foreign_try_from(&*self)
             .change_context(ApiErrorResponse::InternalServerError)
             .attach_printable("Failed to construct Payment Get Request")?;
 
@@ -244,28 +244,45 @@ impl Feature<api::PSync, types::PaymentsSyncData>
         .change_context(ApiErrorResponse::InternalServerError)
         .attach_printable("Failed to construct request metadata")?;
 
-        let response = client
-            .payment_get(
-                payment_get_request,
-                connector_auth_metadata,
-                state.get_grpc_headers(),
-            )
-            .await
-            .change_context(ApiErrorResponse::InternalServerError)
-            .attach_printable("Failed to get payment")?;
+        let updated_router_data = Box::pin(ucs_logging_wrapper(
+            self.clone(),
+            state,
+            payment_get_request,
+            |mut router_data, payment_get_request| async move {
+                let response = client
+                    .payment_get(
+                        payment_get_request,
+                        connector_auth_metadata,
+                        state.get_grpc_headers(),
+                    )
+                    .await
+                    .change_context(ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to get payment")?;
+
+                let payment_get_response = response.into_inner();
 
-        let payment_get_response = response.into_inner();
+                let (status, router_data_response, status_code) =
+                    handle_unified_connector_service_response_for_payment_get(
+                        payment_get_response.clone(),
+                    )
+                    .change_context(ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to deserialize UCS response")?;
 
-        let (status, router_data_response, status_code) =
-            handle_unified_connector_service_response_for_payment_get(payment_get_response.clone())
-                .change_context(ApiErrorResponse::InternalServerError)
-                .attach_printable("Failed to deserialize UCS response")?;
+                router_data.status = status;
+                router_data.response = router_data_response;
+                router_data.raw_connector_response = payment_get_response
+                    .raw_connector_response
+                    .clone()
+                    .map(Secret::new);
+                router_data.connector_http_status_code = Some(status_code);
 
-        self.status = status;
-        self.response = router_data_response;
-        self.raw_connector_response = payment_get_response.raw_connector_response.map(Secret::new);
-        self.connector_http_status_code = Some(status_code);
+                Ok((router_data, payment_get_response))
+            },
+        ))
+        .await?;
 
+        // Copy back the updated data
+        *self = updated_router_data;
         Ok(())
     }
 }
diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
index 035937808c4..6cd1cd1dedc 100644
--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -14,7 +14,7 @@ use crate::{
         },
         unified_connector_service::{
             build_unified_connector_service_auth_metadata,
-            handle_unified_connector_service_response_for_payment_register,
+            handle_unified_connector_service_response_for_payment_register, ucs_logging_wrapper,
         },
     },
     routes::SessionState,
@@ -272,7 +272,7 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
             .attach_printable("Failed to fetch Unified Connector Service client")?;
 
         let payment_register_request =
-            payments_grpc::PaymentServiceRegisterRequest::foreign_try_from(self)
+            payments_grpc::PaymentServiceRegisterRequest::foreign_try_from(&*self)
                 .change_context(ApiErrorResponse::InternalServerError)
                 .attach_printable("Failed to construct Payment Setup Mandate Request")?;
 
@@ -283,33 +283,41 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
         .change_context(ApiErrorResponse::InternalServerError)
         .attach_printable("Failed to construct request metadata")?;
 
-        let response = client
-            .payment_setup_mandate(
-                payment_register_request,
-                connector_auth_metadata,
-                state.get_grpc_headers(),
-            )
-            .await
-            .change_context(ApiErrorResponse::InternalServerError)
-            .attach_printable("Failed to Setup Mandate payment")?;
-
-        let payment_register_response = response.into_inner();
-
-        let (status, router_data_response, status_code) =
-            handle_unified_connector_service_response_for_payment_register(
-                payment_register_response.clone(),
-            )
-            .change_context(ApiErrorResponse::InternalServerError)
-            .attach_printable("Failed to deserialize UCS response")?;
-
-        self.status = status;
-        self.response = router_data_response;
-        self.connector_http_status_code = Some(status_code);
-        // UCS does not return raw connector response for setup mandate right now
-        // self.raw_connector_response = payment_register_response
-        //     .raw_connector_response
-        //     .map(Secret::new);
+        let updated_router_data = Box::pin(ucs_logging_wrapper(
+            self.clone(),
+            state,
+            payment_register_request,
+            |mut router_data, payment_register_request| async move {
+                let response = client
+                    .payment_setup_mandate(
+                        payment_register_request,
+                        connector_auth_metadata,
+                        state.get_grpc_headers(),
+                    )
+                    .await
+                    .change_context(ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to Setup Mandate payment")?;
+
+                let payment_register_response = response.into_inner();
+
+                let (status, router_data_response, status_code) =
+                    handle_unified_connector_service_response_for_payment_register(
+                        payment_register_response.clone(),
+                    )
+                    .change_context(ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to deserialize UCS response")?;
+
+                router_data.status = status;
+                router_data.response = router_data_response;
+                router_data.connector_http_status_code = Some(status_code);
+
+                Ok((router_data, payment_register_response))
+            },
+        ))
+        .await?;
 
+        // Copy back the updated data
+        *self = updated_router_data;
         Ok(())
     }
 }
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 9722f36ae41..e473482b57b 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1,4 +1,4 @@
-use std::str::FromStr;
+use std::{str::FromStr, time::Instant};
 
 use api_models::admin;
 #[cfg(feature = "v2")]
@@ -23,7 +23,7 @@ use hyperswitch_domain_models::{
     router_response_types::PaymentsResponseData,
 };
 use masking::{ExposeInterface, PeekInterface, Secret};
-use router_env::logger;
+use router_env::{instrument, logger, tracing};
 use unified_connector_service_cards::CardNumber;
 use unified_connector_service_client::payments::{
     self as payments_grpc, payment_method::PaymentMethod, CardDetails, CardPaymentMethodType,
@@ -44,6 +44,7 @@ use crate::{
         },
         utils::get_flow_name,
     },
+    events::connector_api_logs::ConnectorEvent,
     routes::SessionState,
     types::transformers::ForeignTryFrom,
     utils,
@@ -804,3 +805,120 @@ pub fn extract_webhook_content_from_ucs_response(
 ) -> Option<&unified_connector_service_client::payments::WebhookResponseContent> {
     transform_data.webhook_content.as_ref()
 }
+
+/// UCS Event Logging Wrapper Function
+/// This function wraps UCS calls with comprehensive event logging.
+/// It logs the actual gRPC request/response data, timing, and error information.
+#[instrument(skip_all, fields(connector_name, flow_type, payment_id))]
+pub async fn ucs_logging_wrapper<T, F, Fut, Req, Resp, GrpcReq, GrpcResp>(
+    router_data: RouterData<T, Req, Resp>,
+    state: &SessionState,
+    grpc_request: GrpcReq,
+    handler: F,
+) -> RouterResult<RouterData<T, Req, Resp>>
+where
+    T: std::fmt::Debug + Clone + Send + 'static,
+    Req: std::fmt::Debug + Clone + Send + Sync + 'static,
+    Resp: std::fmt::Debug + Clone + Send + Sync + 'static,
+    GrpcReq: serde::Serialize,
+    GrpcResp: serde::Serialize,
+    F: FnOnce(RouterData<T, Req, Resp>, GrpcReq) -> Fut + Send,
+    Fut: std::future::Future<Output = RouterResult<(RouterData<T, Req, Resp>, GrpcResp)>> + Send,
+{
+    tracing::Span::current().record("connector_name", &router_data.connector);
+    tracing::Span::current().record("flow_type", std::any::type_name::<T>());
+    tracing::Span::current().record("payment_id", &router_data.payment_id);
+
+    // Capture request data for logging
+    let connector_name = router_data.connector.clone();
+    let payment_id = router_data.payment_id.clone();
+    let merchant_id = router_data.merchant_id.clone();
+    let refund_id = router_data.refund_id.clone();
+    let dispute_id = router_data.dispute_id.clone();
+
+    // Log the actual gRPC request with masking
+    let grpc_request_body = masking::masked_serialize(&grpc_request)
+        .unwrap_or_else(|_| serde_json::json!({"error": "failed_to_serialize_grpc_request"}));
+
+    // Update connector call count metrics for UCS operations
+    crate::routes::metrics::CONNECTOR_CALL_COUNT.add(
+        1,
+        router_env::metric_attributes!(
+            ("connector", connector_name.clone()),
+            (
+                "flow",
+                std::any::type_name::<T>()
+                    .split("::")
+                    .last()
+                    .unwrap_or_default()
+            ),
+        ),
+    );
+
+    // Execute UCS function and measure timing
+    let start_time = Instant::now();
+    let result = handler(router_data, grpc_request).await;
+    let external_latency = start_time.elapsed().as_millis();
+
+    // Create and emit connector event after UCS call
+    let (status_code, response_body, router_result) = match result {
+        Ok((updated_router_data, grpc_response)) => {
+            let status = updated_router_data
+                .connector_http_status_code
+                .unwrap_or(200);
+
+            // Log the actual gRPC response
+            let grpc_response_body = serde_json::to_value(&grpc_response).unwrap_or_else(
+                |_| serde_json::json!({"error": "failed_to_serialize_grpc_response"}),
+            );
+
+            (status, Some(grpc_response_body), Ok(updated_router_data))
+        }
+        Err(error) => {
+            // Update error metrics for UCS calls
+            crate::routes::metrics::CONNECTOR_ERROR_RESPONSE_COUNT.add(
+                1,
+                router_env::metric_attributes!(("connector", connector_name.clone(),)),
+            );
+
+            let error_body = serde_json::json!({
+                "error": error.to_string(),
+                "error_type": "ucs_call_failed"
+            });
+            (500, Some(error_body), Err(error))
+        }
+    };
+
+    let mut connector_event = ConnectorEvent::new(
+        state.tenant.tenant_id.clone(),
+        connector_name,
+        std::any::type_name::<T>(),
+        grpc_request_body,
+        "grpc://unified-connector-service".to_string(),
+        common_utils::request::Method::Post,
+        payment_id,
+        merchant_id,
+        state.request_id.as_ref(),
+        external_latency,
+        refund_id,
+        dispute_id,
+        status_code,
+    );
+
+    // Set response body based on status code
+    if let Some(body) = response_body {
+        match status_code {
+            400..=599 => {
+                connector_event.set_error_response_body(&body);
+            }
+            _ => {
+                connector_event.set_response_body(&body);
+            }
+        }
+    }
+
+    // Emit event
+    state.event_handler.log_event(&connector_event);
+
+    router_result
+}
 | 
	2025-08-25T13:37:59Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added comprehensive event logging for UCS operations to improve debugging and monitoring. The changes wrap UCS calls with structured logging that captures request/response data, timing, and errors across all payment flows.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Enable UCS
```
curl --location 'http://localhost:8080/configs/' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--data '
{
    "key": "ucs_enabled",
    "value": "true"
}'
```
Enable UCS authorize
```curl --location 'http://localhost:8080/configs/' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_ya18hWOxWbhNjQWEacOVLAFiqOuhSsU3k53o5iyEK6IcxQohWPAMpCWGURyRSRYc' \
--data '{
      "key": "ucs_rollout_config_merchant_1756126931_razorpay_upi_Authorize",
      "value": "1.0"
  }'
```
Payments - Create
```curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Qaanra9EEOfvCZtfveDCXQbYgnzJF7vgwIqBiERdn510eGS9M49jmIZweYS5zC7y' \
--data-raw '{
  "amount": 100,
  "currency": "INR",
  "confirm": true,
  "capture_method": "automatic",
  "capture_on": "2022-09-10T10:11:12Z",
  "customer_id": "IatapayCustomer",
  "email": "[guest@example.com](mailto:guest@example.com)",
  "name": "John Doe",
  "phone": "999999999",
  "phone_country_code": "+1",
  "description": "Its my first payment request",
  "authentication_type": "no_three_ds",
  "return_url": "https://google.com/",
  "payment_method": "upi",
  "payment_method_type": "upi_collect",
  "payment_method_data": {
    "upi": {
      "upi_collect": {
      "vpa_id": "success@razorpay"
      }
    },
    "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "IN",
                "first_name": "Swangi",
                "last_name": "Kumari"
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "[swangi.kumari@juspay.in](mailto:swangi.kumari@juspay.in)"
        }
  },
  "billing": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "IN",
      "first_name": "joseph",
      "last_name": "Doe"
    },
    "phone": {
      "number": "8056594427",
      "country_code": "+91"
    }
  },
  "shipping": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name": "joseph",
      "last_name": "Doe"
    },
    "phone": {
      "number": "8056594427",
      "country_code": "+91"
    }
  },
  "statement_descriptor_name": "joseph",
  "statement_descriptor_suffix": "JS",
  "metadata": {
    "udf1": "value1",
    "new_customer": "true",
    "login_date": "2019-09-10T10:11:12Z"
  },
  "all_keys_required": true
}'
```
Logs (Success)
<img width="1253" height="411" alt="Screenshot 2025-08-28 at 2 46 00 PM" src="https://github.com/user-attachments/assets/4fff5e2e-233a-4e42-a3f9-e13c66594808" />
Logs(Failure)
<img width="1207" height="503" alt="Screenshot 2025-08-25 at 6 37 32 PM" src="https://github.com/user-attachments/assets/6b6f8596-a879-41d4-98ea-2e945376cbe2" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible | 
	c02d8b9ba9e204fa163b61c419811eaa65fdbcb4 | 
	
Enable UCS
```
curl --location 'http://localhost:8080/configs/' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--data '
{
    "key": "ucs_enabled",
    "value": "true"
}'
```
Enable UCS authorize
```curl --location 'http://localhost:8080/configs/' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_ya18hWOxWbhNjQWEacOVLAFiqOuhSsU3k53o5iyEK6IcxQohWPAMpCWGURyRSRYc' \
--data '{
      "key": "ucs_rollout_config_merchant_1756126931_razorpay_upi_Authorize",
      "value": "1.0"
  }'
```
Payments - Create
```curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Qaanra9EEOfvCZtfveDCXQbYgnzJF7vgwIqBiERdn510eGS9M49jmIZweYS5zC7y' \
--data-raw '{
  "amount": 100,
  "currency": "INR",
  "confirm": true,
  "capture_method": "automatic",
  "capture_on": "2022-09-10T10:11:12Z",
  "customer_id": "IatapayCustomer",
  "email": "[guest@example.com](mailto:guest@example.com)",
  "name": "John Doe",
  "phone": "999999999",
  "phone_country_code": "+1",
  "description": "Its my first payment request",
  "authentication_type": "no_three_ds",
  "return_url": "https://google.com/",
  "payment_method": "upi",
  "payment_method_type": "upi_collect",
  "payment_method_data": {
    "upi": {
      "upi_collect": {
      "vpa_id": "success@razorpay"
      }
    },
    "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "IN",
                "first_name": "Swangi",
                "last_name": "Kumari"
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "[swangi.kumari@juspay.in](mailto:swangi.kumari@juspay.in)"
        }
  },
  "billing": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "IN",
      "first_name": "joseph",
      "last_name": "Doe"
    },
    "phone": {
      "number": "8056594427",
      "country_code": "+91"
    }
  },
  "shipping": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name": "joseph",
      "last_name": "Doe"
    },
    "phone": {
      "number": "8056594427",
      "country_code": "+91"
    }
  },
  "statement_descriptor_name": "joseph",
  "statement_descriptor_suffix": "JS",
  "metadata": {
    "udf1": "value1",
    "new_customer": "true",
    "login_date": "2019-09-10T10:11:12Z"
  },
  "all_keys_required": true
}'
```
Logs (Success)
<img width="1253" height="411" alt="Screenshot 2025-08-28 at 2 46 00 PM" src="https://github.com/user-attachments/assets/4fff5e2e-233a-4e42-a3f9-e13c66594808" />
Logs(Failure)
<img width="1207" height="503" alt="Screenshot 2025-08-25 at 6 37 32 PM" src="https://github.com/user-attachments/assets/6b6f8596-a879-41d4-98ea-2e945376cbe2" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9055 | 
	Bug: Get Estimate for a plan price
**Request to Subscription Povider to get estimate**
curl --location '/api/v2/estimates/create_subscription_for_items' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic =' \
--data-urlencode 'billing_address%5Bline1%5D=PO Box 9999' \
--data-urlencode 'billing_address%5Bcity%5D=Walnut' \
--data-urlencode 'billing_address%5Bzip%5D=91789' \
--data-urlencode 'billing_address%5Bcountry%5D=US' \
--data-urlencode 'subscription_items%5Bitem_price_id%5D%5B0%5D=cbdemo_enterprise-suite-monthly'
**Response from Subscription Provider**
```
{
    "estimate": {
        "created_at": 1756113388,
        "object": "estimate",
        "subscription_estimate": {
            "status": "active",
            "next_billing_at": 1758791788,
            "object": "subscription_estimate",
            "currency_code": "INR"
        },
        "invoice_estimate": {
            "recurring": true,
            "date": 1756113388,
            "price_type": "tax_exclusive",
            "sub_total": 14100,
            "total": 14100,
            "credits_applied": 0,
            "amount_paid": 0,
            "amount_due": 14100,
            "object": "invoice_estimate",
            "customer_id": "16BaasUusKoPc107J",
            "line_items": [
                {
                    "id": "li_16BaasUusKoQ8107O",
                    "date_from": 1756113388,
                    "date_to": 1758791788,
                    "unit_amount": 14100,
                    "quantity": 1,
                    "amount": 14100,
                    "pricing_model": "flat_fee",
                    "is_taxed": false,
                    "tax_amount": 0,
                    "object": "line_item",
                    "customer_id": "16BaasUusKoPc107J",
                    "description": "Enterprise Suite Monthly",
                    "entity_type": "plan_item_price",
                    "entity_id": "cbdemo_enterprise-suite-monthly",
                    "discount_amount": 0,
                    "item_level_discount_amount": 0
                }
            ],
            "taxes": [],
            "line_item_taxes": [],
            "line_item_credits": [],
            "currency_code": "INR",
            "round_off_amount": 0,
            "line_item_discounts": []
        }
    }
}
``` | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index bf6f3fe637d..b761dc9ebbf 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -22,14 +22,17 @@ use hyperswitch_domain_models::{
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
         revenue_recovery::InvoiceRecordBack,
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
+        subscriptions::{
+            GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
+            SubscriptionCreate,
+        },
         CreateConnectorCustomer,
     },
     router_request_types::{
         revenue_recovery::InvoiceRecordBackRequest,
         subscriptions::{
-            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
-            SubscriptionCreateRequest,
+            GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+            GetSubscriptionPlansRequest, SubscriptionCreateRequest,
         },
         AccessTokenRequestData, ConnectorCustomerData, PaymentMethodTokenizationData,
         PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
@@ -38,15 +41,16 @@ use hyperswitch_domain_models::{
     router_response_types::{
         revenue_recovery::InvoiceRecordBackResponse,
         subscriptions::{
-            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
-            SubscriptionCreateResponse,
+            GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse,
         },
         ConnectorInfo, PaymentsResponseData, RefundsResponseData,
     },
     types::{
-        ConnectorCustomerRouterData, GetSubscriptionPlanPricesRouterData,
-        GetSubscriptionPlansRouterData, InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData,
-        PaymentsCaptureRouterData, PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+        ConnectorCustomerRouterData, GetSubscriptionEstimateRouterData,
+        GetSubscriptionPlanPricesRouterData, GetSubscriptionPlansRouterData,
+        InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
         SubscriptionCreateRouterData,
     },
 };
@@ -1139,6 +1143,94 @@ impl
     // TODO: implement functions when support enabled
 }
 
+impl api::subscriptions::GetSubscriptionEstimateFlow for Chargebee {}
+
+impl
+    ConnectorIntegration<
+        GetSubscriptionEstimate,
+        GetSubscriptionEstimateRequest,
+        GetSubscriptionEstimateResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        req: &GetSubscriptionEstimateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+    fn get_url(
+        &self,
+        req: &GetSubscriptionEstimateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let metadata: chargebee::ChargebeeMetadata =
+            utils::to_connector_meta_from_secret(req.connector_meta_data.clone())?;
+        let url = self
+            .base_url(connectors)
+            .to_string()
+            .replace("{{merchant_endpoint_prefix}}", metadata.site.peek());
+        Ok(format!("{url}v2/estimates/create_subscription_for_items"))
+    }
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+    fn get_request_body(
+        &self,
+        req: &GetSubscriptionEstimateRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_req = chargebee::ChargebeeSubscriptionEstimateRequest::try_from(req)?;
+        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+    }
+    fn build_request(
+        &self,
+        req: &GetSubscriptionEstimateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::GetSubscriptionEstimateType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::GetSubscriptionEstimateType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::GetSubscriptionEstimateType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+    fn handle_response(
+        &self,
+        data: &GetSubscriptionEstimateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<GetSubscriptionEstimateRouterData, errors::ConnectorError> {
+        let response: chargebee::SubscriptionEstimateResponse = res
+            .response
+            .parse_struct("chargebee SubscriptionEstimateResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
 #[async_trait::async_trait]
 impl webhooks::IncomingWebhook for Chargebee {
     fn get_webhook_source_verification_signature(
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 5f16d054890..572cb082a45 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -28,12 +28,16 @@ use hyperswitch_domain_models::{
     router_response_types::{
         revenue_recovery::InvoiceRecordBackResponse,
         subscriptions::{
-            self, GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
-            SubscriptionCreateResponse, SubscriptionStatus,
+            self, GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse, SubscriptionLineItem,
+            SubscriptionStatus,
         },
         ConnectorCustomerResponseData, PaymentsResponseData, RefundsResponseData,
     },
-    types::{InvoiceRecordBackRouterData, PaymentsAuthorizeRouterData, RefundsRouterData},
+    types::{
+        GetSubscriptionEstimateRouterData, InvoiceRecordBackRouterData,
+        PaymentsAuthorizeRouterData, RefundsRouterData,
+    },
 };
 use hyperswitch_interfaces::errors;
 use masking::{ExposeInterface, Secret};
@@ -959,6 +963,50 @@ pub struct ChargebeeItem {
     pub description: Option<String>,
 }
 
+impl<F, T>
+    TryFrom<ResponseRouterData<F, SubscriptionEstimateResponse, T, GetSubscriptionEstimateResponse>>
+    for RouterData<F, T, GetSubscriptionEstimateResponse>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            SubscriptionEstimateResponse,
+            T,
+            GetSubscriptionEstimateResponse,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let estimate = item.response.estimate;
+        Ok(Self {
+            response: Ok(GetSubscriptionEstimateResponse {
+                sub_total: estimate.invoice_estimate.sub_total,
+                total: estimate.invoice_estimate.total,
+                amount_paid: Some(estimate.invoice_estimate.amount_paid),
+                amount_due: Some(estimate.invoice_estimate.amount_due),
+                currency: estimate.subscription_estimate.currency_code,
+                next_billing_at: estimate.subscription_estimate.next_billing_at,
+                credits_applied: Some(estimate.invoice_estimate.credits_applied),
+                line_items: estimate
+                    .invoice_estimate
+                    .line_items
+                    .into_iter()
+                    .map(|line_item| SubscriptionLineItem {
+                        item_id: line_item.entity_id,
+                        item_type: line_item.entity_type,
+                        description: line_item.description,
+                        amount: line_item.amount,
+                        currency: estimate.invoice_estimate.currency_code,
+                        unit_amount: Some(line_item.unit_amount),
+                        quantity: line_item.quantity,
+                        pricing_model: Some(line_item.pricing_model),
+                    })
+                    .collect(),
+            }),
+            ..item.data
+        })
+    }
+}
+
 impl<F, T>
     TryFrom<ResponseRouterData<F, ChargebeeListPlansResponse, T, GetSubscriptionPlansResponse>>
     for RouterData<F, T, GetSubscriptionPlansResponse>
@@ -1075,6 +1123,18 @@ impl
     }
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeeSubscriptionEstimateRequest {
+    pub price_id: String,
+}
+
+impl TryFrom<&GetSubscriptionEstimateRouterData> for ChargebeeSubscriptionEstimateRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: &GetSubscriptionEstimateRouterData) -> Result<Self, Self::Error> {
+        let price_id = item.request.price_id.to_owned();
+        Ok(Self { price_id })
+    }
+}
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct ChargebeeGetPlanPricesResponse {
     pub list: Vec<ChargebeeGetPlanPriceList>,
@@ -1169,3 +1229,69 @@ impl<F, T>
         })
     }
 }
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct SubscriptionEstimateResponse {
+    pub estimate: ChargebeeEstimate,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeeEstimate {
+    pub created_at: i64,
+    /// type of the object will be `estimate`
+    pub object: String,
+    pub subscription_estimate: SubscriptionEstimate,
+    pub invoice_estimate: InvoiceEstimate,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct SubscriptionEstimate {
+    pub status: String,
+    #[serde(default, with = "common_utils::custom_serde::timestamp::option")]
+    pub next_billing_at: Option<PrimitiveDateTime>,
+    /// type of the object will be `subscription_estimate`
+    pub object: String,
+    pub currency_code: enums::Currency,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct InvoiceEstimate {
+    pub recurring: bool,
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub date: PrimitiveDateTime,
+    pub price_type: String,
+    pub sub_total: MinorUnit,
+    pub total: MinorUnit,
+    pub credits_applied: MinorUnit,
+    pub amount_paid: MinorUnit,
+    pub amount_due: MinorUnit,
+    /// type of the object will be `invoice_estimate`
+    pub object: String,
+    pub customer_id: String,
+    pub line_items: Vec<LineItem>,
+    pub currency_code: enums::Currency,
+    pub round_off_amount: MinorUnit,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct LineItem {
+    pub id: String,
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub date_from: PrimitiveDateTime,
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub date_to: PrimitiveDateTime,
+    pub unit_amount: MinorUnit,
+    pub quantity: i64,
+    pub amount: MinorUnit,
+    pub pricing_model: String,
+    pub is_taxed: bool,
+    pub tax_amount: MinorUnit,
+    /// type of the object will be `line_item`
+    pub object: String,
+    pub customer_id: String,
+    pub description: String,
+    pub entity_type: String,
+    pub entity_id: String,
+    pub discount_amount: MinorUnit,
+    pub item_level_discount_amount: MinorUnit,
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index 5bac349e886..738a7026c8d 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -11,20 +11,24 @@ use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, ErrorResponse},
     router_data_v2::{
         flow_common_types::{
-            GetSubscriptionPlanPricesData, GetSubscriptionPlansData, SubscriptionCreateData,
+            GetSubscriptionEstimateData, GetSubscriptionPlanPricesData, GetSubscriptionPlansData,
+            SubscriptionCreateData,
         },
         UasFlowData,
     },
     router_flow_types::{
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
+        subscriptions::{
+            GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
+            SubscriptionCreate,
+        },
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
     },
     router_request_types::{
         subscriptions::{
-            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
-            SubscriptionCreateRequest,
+            GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+            GetSubscriptionPlansRequest, SubscriptionCreateRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -33,7 +37,8 @@ use hyperswitch_domain_models::{
         },
     },
     router_response_types::subscriptions::{
-        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+        GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+        GetSubscriptionPlansResponse, SubscriptionCreateResponse,
     },
 };
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
@@ -183,6 +188,18 @@ impl
     > for Recurly
 {
 }
+
+impl api::subscriptions_v2::GetSubscriptionEstimateV2 for Recurly {}
+impl
+    ConnectorIntegrationV2<
+        GetSubscriptionEstimate,
+        GetSubscriptionEstimateData,
+        GetSubscriptionEstimateRequest,
+        GetSubscriptionEstimateResponse,
+    > for Recurly
+{
+}
+
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl api::revenue_recovery_v2::RevenueRecoveryRecordBackV2 for Recurly {}
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 057aca866f4..2ed56495797 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -39,7 +39,7 @@ use hyperswitch_domain_models::{
             PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, Reject,
             SdkSessionUpdate, UpdateMetadata,
         },
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+        subscriptions::{GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans},
         webhooks::VerifyWebhookSource,
         AccessTokenAuthentication, Authenticate, AuthenticationConfirmation,
         ExternalVaultCreateFlow, ExternalVaultDeleteFlow, ExternalVaultInsertFlow,
@@ -49,8 +49,8 @@ use hyperswitch_domain_models::{
     router_request_types::{
         authentication,
         subscriptions::{
-            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
-            SubscriptionCreateRequest,
+            GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+            GetSubscriptionPlansRequest, SubscriptionCreateRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -71,8 +71,8 @@ use hyperswitch_domain_models::{
     },
     router_response_types::{
         subscriptions::{
-            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
-            SubscriptionCreateResponse,
+            GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse,
         },
         AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,
         DisputeSyncResponse, FetchDisputesResponse, GiftCardBalanceCheckResponseData,
@@ -138,8 +138,8 @@ use hyperswitch_interfaces::{
         },
         revenue_recovery::RevenueRecovery,
         subscriptions::{
-            GetSubscriptionPlanPricesFlow, GetSubscriptionPlansFlow, SubscriptionCreate,
-            Subscriptions,
+            GetSubscriptionEstimateFlow, GetSubscriptionPlanPricesFlow, GetSubscriptionPlansFlow,
+            SubscriptionCreate, Subscriptions,
         },
         vault::{
             ExternalVault, ExternalVaultCreate, ExternalVaultDelete, ExternalVaultInsert,
@@ -7069,6 +7069,14 @@ macro_rules! default_imp_for_subscriptions {
             SubscriptionCreateRequest,
             SubscriptionCreateResponse,
             > for $path::$connector {}
+            impl GetSubscriptionEstimateFlow for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            GetSubscriptionEstimate,
+            GetSubscriptionEstimateRequest,
+            GetSubscriptionEstimateResponse
+            > for $path::$connector
+            {}
         )*
     };
 }
@@ -9403,3 +9411,15 @@ impl<const T: u8>
     > for connectors::DummyConnector<T>
 {
 }
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> GetSubscriptionEstimateFlow for connectors::DummyConnector<T> {}
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+    ConnectorIntegration<
+        GetSubscriptionEstimate,
+        GetSubscriptionEstimateRequest,
+        GetSubscriptionEstimateResponse,
+    > for connectors::DummyConnector<T>
+{
+}
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 0d89445b6a3..40be24722a5 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -159,6 +159,9 @@ pub struct GetSubscriptionPlansData;
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlanPricesData;
 
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionEstimateData;
+
 #[derive(Debug, Clone)]
 pub struct UasFlowData {
     pub authenticate_by: String,
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
index 28c78e94393..ac4e8388956 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
@@ -5,3 +5,6 @@ pub struct GetSubscriptionPlans;
 
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlanPrices;
+
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionEstimate;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
index 832140e1690..8599116e8f4 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
@@ -33,3 +33,8 @@ pub struct GetSubscriptionPlansRequest {
 pub struct GetSubscriptionPlanPricesRequest {
     pub plan_price_id: String,
 }
+
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionEstimateRequest {
+    pub price_id: String,
+}
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
index c61f9fd7ff4..f480765effa 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
@@ -61,3 +61,27 @@ pub enum PeriodUnit {
     Month,
     Year,
 }
+
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionEstimateResponse {
+    pub sub_total: MinorUnit,
+    pub total: MinorUnit,
+    pub credits_applied: Option<MinorUnit>,
+    pub amount_paid: Option<MinorUnit>,
+    pub amount_due: Option<MinorUnit>,
+    pub currency: Currency,
+    pub next_billing_at: Option<PrimitiveDateTime>,
+    pub line_items: Vec<SubscriptionLineItem>,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionLineItem {
+    pub item_id: String,
+    pub item_type: String,
+    pub description: String,
+    pub amount: MinorUnit,
+    pub currency: Currency,
+    pub unit_amount: Option<MinorUnit>,
+    pub quantity: i64,
+    pub pricing_model: Option<String>,
+}
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index 06fbeb267d3..b170fcf6d98 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -6,7 +6,10 @@ use crate::{
     router_flow_types::{
         mandate_revoke::MandateRevoke,
         revenue_recovery::InvoiceRecordBack,
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
+        subscriptions::{
+            GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
+            SubscriptionCreate,
+        },
         AccessTokenAuth, AccessTokenAuthentication, Authenticate, AuthenticationConfirmation,
         Authorize, AuthorizeSessionToken, BillingConnectorInvoiceSync,
         BillingConnectorPaymentsSync, CalculateTax, Capture, CompleteAuthorize,
@@ -21,8 +24,8 @@ use crate::{
             InvoiceRecordBackRequest,
         },
         subscriptions::{
-            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
-            SubscriptionCreateRequest,
+            GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+            GetSubscriptionPlansRequest, SubscriptionCreateRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -46,8 +49,8 @@ use crate::{
             InvoiceRecordBackResponse,
         },
         subscriptions::{
-            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
-            SubscriptionCreateResponse,
+            GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse,
         },
         GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
         RefundsResponseData, TaxCalculationResponseData, VaultResponseData,
@@ -144,6 +147,12 @@ pub type InvoiceRecordBackRouterData =
 pub type GetSubscriptionPlansRouterData =
     RouterData<GetSubscriptionPlans, GetSubscriptionPlansRequest, GetSubscriptionPlansResponse>;
 
+pub type GetSubscriptionEstimateRouterData = RouterData<
+    GetSubscriptionEstimate,
+    GetSubscriptionEstimateRequest,
+    GetSubscriptionEstimateResponse,
+>;
+
 pub type UasAuthenticationRouterData =
     RouterData<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>;
 
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions.rs b/crates/hyperswitch_interfaces/src/api/subscriptions.rs
index 1d15a7f2b64..bea4c4773ea 100644
--- a/crates/hyperswitch_interfaces/src/api/subscriptions.rs
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions.rs
@@ -2,12 +2,16 @@
 #[cfg(feature = "v1")]
 use hyperswitch_domain_models::{
     router_flow_types::subscriptions::SubscriptionCreate as SubscriptionCreateFlow,
-    router_flow_types::subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+    router_flow_types::subscriptions::{
+        GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
+    },
     router_request_types::subscriptions::{
-        GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest, SubscriptionCreateRequest,
+        GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+        GetSubscriptionPlansRequest, SubscriptionCreateRequest,
     },
     router_response_types::subscriptions::{
-        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+        GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+        GetSubscriptionPlansResponse, SubscriptionCreateResponse,
     },
 };
 
@@ -45,6 +49,16 @@ pub trait SubscriptionCreate:
 {
 }
 
+#[cfg(feature = "v1")]
+/// trait GetSubscriptionEstimate for V1
+pub trait GetSubscriptionEstimateFlow:
+    ConnectorIntegration<
+    GetSubscriptionEstimate,
+    GetSubscriptionEstimateRequest,
+    GetSubscriptionEstimateResponse,
+>
+{
+}
 /// trait Subscriptions
 #[cfg(feature = "v1")]
 pub trait Subscriptions:
@@ -53,6 +67,7 @@ pub trait Subscriptions:
     + GetSubscriptionPlanPricesFlow
     + SubscriptionCreate
     + PaymentsConnectorCustomer
+    + GetSubscriptionEstimateFlow
 {
 }
 
@@ -75,3 +90,7 @@ pub trait ConnectorCustomer {}
 /// trait SubscriptionCreate
 #[cfg(not(feature = "v1"))]
 pub trait SubscriptionCreate {}
+
+/// trait GetSubscriptionEstimateFlow (disabled when not V1)
+#[cfg(not(feature = "v1"))]
+pub trait GetSubscriptionEstimateFlow {}
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
index f14d8439e2c..09f25918c56 100644
--- a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
@@ -1,16 +1,20 @@
 //! SubscriptionsV2
 use hyperswitch_domain_models::{
     router_data_v2::flow_common_types::{
-        GetSubscriptionPlanPricesData, GetSubscriptionPlansData, SubscriptionCreateData,
+        GetSubscriptionEstimateData, GetSubscriptionPlanPricesData, GetSubscriptionPlansData,
+        SubscriptionCreateData,
     },
     router_flow_types::subscriptions::{
-        GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate,
+        GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
+        SubscriptionCreate,
     },
     router_request_types::subscriptions::{
-        GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest, SubscriptionCreateRequest,
+        GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+        GetSubscriptionPlansRequest, SubscriptionCreateRequest,
     },
     router_response_types::subscriptions::{
-        GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse, SubscriptionCreateResponse,
+        GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+        GetSubscriptionPlansResponse, SubscriptionCreateResponse,
     },
 };
 
@@ -19,7 +23,11 @@ use crate::connector_integration_v2::ConnectorIntegrationV2;
 
 /// trait SubscriptionsV2
 pub trait SubscriptionsV2:
-    GetSubscriptionPlansV2 + SubscriptionsCreateV2 + ConnectorCustomerV2 + GetSubscriptionPlanPricesV2
+    GetSubscriptionPlansV2
+    + SubscriptionsCreateV2
+    + ConnectorCustomerV2
+    + GetSubscriptionPlanPricesV2
+    + GetSubscriptionEstimateV2
 {
 }
 
@@ -55,3 +63,14 @@ pub trait SubscriptionsCreateV2:
 >
 {
 }
+
+/// trait GetSubscriptionEstimate for V2
+pub trait GetSubscriptionEstimateV2:
+    ConnectorIntegrationV2<
+    GetSubscriptionEstimate,
+    GetSubscriptionEstimateData,
+    GetSubscriptionEstimateRequest,
+    GetSubscriptionEstimateResponse,
+>
+{
+}
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index d9975a8c058..5003fdba1c7 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -16,7 +16,10 @@ use hyperswitch_domain_models::{
         },
         refunds::{Execute, RSync},
         revenue_recovery::{BillingConnectorPaymentsSync, InvoiceRecordBack},
-        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans, SubscriptionCreate},
+        subscriptions::{
+            GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
+            SubscriptionCreate,
+        },
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
@@ -33,8 +36,8 @@ use hyperswitch_domain_models::{
             InvoiceRecordBackRequest,
         },
         subscriptions::{
-            GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest,
-            SubscriptionCreateRequest,
+            GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
+            GetSubscriptionPlansRequest, SubscriptionCreateRequest,
         },
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -61,8 +64,8 @@ use hyperswitch_domain_models::{
             InvoiceRecordBackResponse,
         },
         subscriptions::{
-            GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse,
-            SubscriptionCreateResponse,
+            GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
+            GetSubscriptionPlansResponse, SubscriptionCreateResponse,
         },
         AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
         GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
@@ -361,6 +364,13 @@ pub type GetSubscriptionPlansType = dyn ConnectorIntegration<
     GetSubscriptionPlansResponse,
 >;
 
+/// Type alias for `ConnectorIntegration<GetSubscriptionEstimate, GetSubscriptionEstimateRequest, GetSubscriptionEstimateResponse>`
+pub type GetSubscriptionEstimateType = dyn ConnectorIntegration<
+    GetSubscriptionEstimate,
+    GetSubscriptionEstimateRequest,
+    GetSubscriptionEstimateResponse,
+>;
+
 /// Type alias for `ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>`
 pub type ExternalVaultInsertType =
     dyn ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>;
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 0fd012e9f7a..c12afb78293 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -110,6 +110,8 @@ pub type BoxedGetSubscriptionPlansInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<T, common_types::GetSubscriptionPlansData, Req, Res>;
 pub type BoxedGetSubscriptionPlanPricesInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<T, common_types::GetSubscriptionPlanPricesData, Req, Res>;
+pub type BoxedGetSubscriptionEstimateInterface<T, Req, Res> =
+    BoxedConnectorIntegrationInterface<T, common_types::GetSubscriptionEstimateData, Req, Res>;
 pub type BoxedBillingConnectorInvoiceSyncIntegrationInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<
         T,
 | 
	2025-09-10T07:59:34Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [X] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pull request introduces support for fetching subscription estimates from Chargebee, alongside the existing subscription plans functionality. It adds new data structures, request/response types, and integration logic to handle the "Get Subscription Estimate" flow end-to-end. The changes span the domain models, interface types, and the Chargebee connector implementation.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9055
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Compilation and PR checks are enough for now, as this is a new feature. Testing can be done after the external endpoint is added.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	3bd78ac5c1ff120d6afd46e02df498a16ece6f5f | 
	
Compilation and PR checks are enough for now, as this is a new feature. Testing can be done after the external endpoint is added.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9054 | 
	Bug: Get Plan prices
**Request to Subscription Povider to get plans prices**
api/v2/item_prices?item_id[is]=cbdemo_enterprise-suite'
**Response from Subscription Provider**
```
{
    "list": [
        {
            "item_price": {
                "id": "cbdemo_enterprise-suite-INR-Daily",
                "name": "Enterprise Suite INR Daily",
                "item_family_id": "cbdemo_omnisupport-solutions",
                "item_id": "cbdemo_enterprise-suite",
                "status": "active",
                "external_name": "Enterprise Suite",
                "pricing_model": "flat_fee",
                "price": 10000,
                "period": 1,
                "currency_code": "INR",
                "period_unit": "day",
                "free_quantity": 0,
                "channel": "web",
                "resource_version": 1755510951486,
                "updated_at": 1755510951,
                "created_at": 1755510951,
                "is_taxable": true,
                "item_type": "plan",
                "show_description_in_invoices": false,
                "show_description_in_quotes": false,
                "deleted": false,
                "object": "item_price"
            }
        },
        {
            "item_price": {
                "id": "cbdemo_enterprise-suite-monthly",
                "name": "Enterprise Suite Monthly",
                "item_family_id": "cbdemo_omnisupport-solutions",
                "item_id": "cbdemo_enterprise-suite",
                "description": "Enterprise Suite billed monthly",
                "status": "active",
                "external_name": "Enterprise Suite Monthly",
                "pricing_model": "flat_fee",
                "price": 14100,
                "period": 1,
                "currency_code": "INR",
                "period_unit": "month",
                "free_quantity": 0,
                "channel": "web",
                "resource_version": 1754897341938,
                "updated_at": 1754897341,
                "created_at": 1754897341,
                "is_taxable": true,
                "item_type": "plan",
                "show_description_in_invoices": false,
                "show_description_in_quotes": false,
                "deleted": false,
                "object": "item_price"
            }
        },
        {
            "item_price": {
                "id": "cbdemo_enterprise-suite-annual",
                "name": "Enterprise Suite Annual",
                "item_family_id": "cbdemo_omnisupport-solutions",
                "item_id": "cbdemo_enterprise-suite",
                "description": "Enterprise Suite billed annually",
                "status": "active",
                "external_name": "Enterprise Suite Annual",
                "pricing_model": "flat_fee",
                "price": 169000,
                "period": 1,
                "currency_code": "INR",
                "period_unit": "year",
                "free_quantity": 0,
                "channel": "web",
                "resource_version": 1754897341789,
                "updated_at": 1754897341,
                "created_at": 1754897341,
                "is_taxable": true,
                "item_type": "plan",
                "show_description_in_invoices": false,
                "show_description_in_quotes": false,
                "deleted": false,
                "object": "item_price"
            }
        }
    ]
}
``` | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index 1a021ef4961..b7ea2d591f5 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -25,21 +25,22 @@ use hyperswitch_domain_models::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
-        subscriptions::GetSubscriptionPlans,
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
     },
     router_request_types::{
-        subscriptions::GetSubscriptionPlansRequest, AccessTokenRequestData,
-        PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,
-        SetupMandateRequestData,
+        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
+        AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+        RefundsData, SetupMandateRequestData,
     },
     router_response_types::{
-        subscriptions::GetSubscriptionPlansResponse, ConnectorInfo, PaymentsResponseData,
-        RefundsResponseData,
+        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        ConnectorInfo, PaymentsResponseData, RefundsResponseData,
     },
     types::{
-        GetSubscriptionPlansRouterData, PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,
-        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+        GetSubscriptionPlanPricesRouterData, GetSubscriptionPlansRouterData,
+        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+        RefundSyncRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -57,8 +58,12 @@ use masking::{Mask, PeekInterface, Secret};
 use transformers as chargebee;
 
 use crate::{
-    connectors::chargebee::transformers::ChargebeeListPlansResponse, constants::headers,
-    types::ResponseRouterData, utils,
+    connectors::chargebee::transformers::{
+        ChargebeeGetPlanPricesResponse, ChargebeeListPlansResponse,
+    },
+    constants::headers,
+    types::ResponseRouterData,
+    utils,
 };
 
 #[derive(Clone)]
@@ -673,11 +678,7 @@ impl
 }
 
 fn get_chargebee_plans_query_params(
-    _req: &RouterData<
-        GetSubscriptionPlans,
-        GetSubscriptionPlansRequest,
-        GetSubscriptionPlansResponse,
-    >,
+    _req: &GetSubscriptionPlansRouterData,
 ) -> CustomResult<String, errors::ConnectorError> {
     let limit = 10; // hardcoded limit param
     let item_type = "plan"; // hardcoded filter param
@@ -766,6 +767,90 @@ impl
     }
 }
 
+fn get_chargebee_plan_prices_query_params(
+    req: &GetSubscriptionPlanPricesRouterData,
+) -> CustomResult<String, errors::ConnectorError> {
+    let item_id = req.request.item_id.to_string();
+    let params = format!("?item_id[is]={item_id}");
+    Ok(params)
+}
+impl
+    ConnectorIntegration<
+        GetSubscriptionPlanPrices,
+        GetSubscriptionPlanPricesRequest,
+        GetSubscriptionPlanPricesResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        req: &GetSubscriptionPlanPricesRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_url(
+        &self,
+        req: &GetSubscriptionPlanPricesRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let query_params = get_chargebee_plan_prices_query_params(req)?;
+        let metadata: chargebee::ChargebeeMetadata =
+            utils::to_connector_meta_from_secret(req.connector_meta_data.clone())?;
+        let url = self
+            .base_url(connectors)
+            .to_string()
+            .replace("{{merchant_endpoint_prefix}}", metadata.site.peek());
+        Ok(format!("{url}v2/item_prices{query_params}"))
+    }
+    // check if get_content_type is required
+    fn build_request(
+        &self,
+        req: &GetSubscriptionPlanPricesRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Get)
+                .url(&types::GetSubscriptionPlanPricesType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::GetSubscriptionPlanPricesType::get_headers(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &GetSubscriptionPlanPricesRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<GetSubscriptionPlanPricesRouterData, errors::ConnectorError> {
+        let response: ChargebeeGetPlanPricesResponse = res
+            .response
+            .parse_struct("chargebee ChargebeeGetPlanPricesResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
 #[async_trait::async_trait]
 impl webhooks::IncomingWebhook for Chargebee {
     fn get_webhook_source_verification_signature(
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 8f4a3f2756b..adeb7ce21dd 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -16,7 +16,8 @@ use hyperswitch_domain_models::{
     router_request_types::{revenue_recovery::RevenueRecoveryRecordBackRequest, ResponseId},
     router_response_types::{
         revenue_recovery::RevenueRecoveryRecordBackResponse,
-        subscriptions::GetSubscriptionPlansResponse, PaymentsResponseData, RefundsResponseData,
+        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
+        PaymentsResponseData, RefundsResponseData,
     },
     types::{PaymentsAuthorizeRouterData, RefundsRouterData, RevenueRecoveryRecordBackRouterData},
 };
@@ -789,7 +790,7 @@ pub struct ChargebeeItem {
     pub id: String,
     pub name: String,
     #[serde(rename = "type")]
-    pub plan_type: String, // to check if new enum is required for this
+    pub plan_type: String,
     pub is_giftable: bool,
     pub enabled_for_checkout: bool,
     pub enabled_in_portal: bool,
@@ -812,7 +813,7 @@ impl<F, T>
             .into_iter()
             .map(|wrapper| {
                 hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionPlans {
-                    subscription_provider_plan_id: wrapper.item.id,
+                    plan_id: wrapper.item.id,
                     name: wrapper.item.name,
                     description: wrapper.item.description,
                 }
@@ -824,3 +825,100 @@ impl<F, T>
         })
     }
 }
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeeGetPlanPricesResponse {
+    pub list: Vec<ChargebeePlanPriceWrapper>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeePlanPriceWrapper {
+    pub item_price: ChargebeePlanPrice,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeePlanPrice {
+    pub id: String,
+    pub name: String,
+    pub currency_code: String,
+    pub free_quantity: i64,
+    #[serde(default, with = "common_utils::custom_serde::timestamp::option")]
+    pub created_at: Option<PrimitiveDateTime>,
+    pub deleted: bool,
+    pub item_id: Option<String>,
+    pub period: i64,
+    pub period_unit: ChargebeePeriodUnit,
+    pub trial_period: Option<i64>,
+    pub trial_period_unit: ChargebeeTrialPeriodUnit,
+    pub price: MinorUnit,
+    pub pricing_model: ChargebeePricingModel,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ChargebeePricingModel {
+    FlatFee,
+    PerUnit,
+    Tiered,
+    Volume,
+    Stairstep,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ChargebeePeriodUnit {
+    Day,
+    Week,
+    Month,
+    Year,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ChargebeeTrialPeriodUnit {
+    Day,
+    Month,
+}
+
+impl<F, T>
+    TryFrom<
+        ResponseRouterData<F, ChargebeeGetPlanPricesResponse, T, GetSubscriptionPlanPricesResponse>,
+    > for RouterData<F, T, GetSubscriptionPlanPricesResponse>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            F,
+            ChargebeeGetPlanPricesResponse,
+            T,
+            GetSubscriptionPlanPricesResponse,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let plan_prices = item
+            .response
+            .list
+            .into_iter()
+            .map(|wrapper| {
+                hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionPlanPrices {
+                    price_id: wrapper.item_price.id,
+                    plan_id: wrapper.item_price.item_id,
+                    amount: wrapper.item_price.price,
+                    currency: <common_enums::Currency as std::str::FromStr>::from_str(&wrapper.item_price.currency_code).unwrap_or(common_enums::Currency::USD), // defaulting to USD if parsing fails
+                    interval: match wrapper.item_price.period_unit {
+                        ChargebeePeriodUnit::Day => hyperswitch_domain_models::router_response_types::subscriptions::PeriodUnit::Day,
+                        ChargebeePeriodUnit::Week => hyperswitch_domain_models::router_response_types::subscriptions::PeriodUnit::Week,
+                        ChargebeePeriodUnit::Month => hyperswitch_domain_models::router_response_types::subscriptions::PeriodUnit::Month,
+                        ChargebeePeriodUnit::Year => hyperswitch_domain_models::router_response_types::subscriptions::PeriodUnit::Year,
+                    },
+                    interval_count: wrapper.item_price.period,
+                    trial_period: wrapper.item_price.trial_period,
+                    trial_period_unit: match wrapper.item_price.trial_period_unit {
+                        ChargebeeTrialPeriodUnit::Day => Some(hyperswitch_domain_models::router_response_types::subscriptions::PeriodUnit::Day),
+                        ChargebeeTrialPeriodUnit::Month => Some(hyperswitch_domain_models::router_response_types::subscriptions::PeriodUnit::Month),
+                    },
+                }
+            })
+            .collect();
+        Ok(Self {
+            response: Ok(GetSubscriptionPlanPricesResponse { list: plan_prices }),
+            ..item.data
+        })
+    }
+}
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
index a71b81e7d3e..4f277c07678 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
@@ -1,2 +1,5 @@
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlans;
+
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionPlanPrices;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
index f6441e737a3..3a93433a693 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
@@ -1,2 +1,7 @@
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlansRequest;
+
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionPlanPricesRequest {
+    pub item_id: String,
+}
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
index fd6fd7965b1..967907a947a 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
@@ -1,3 +1,5 @@
+use common_enums::Currency;
+
 #[derive(Debug, Clone)]
 pub struct GetSubscriptionPlansResponse {
     pub list: Vec<SubscriptionPlans>,
@@ -5,7 +7,32 @@ pub struct GetSubscriptionPlansResponse {
 
 #[derive(Debug, Clone)]
 pub struct SubscriptionPlans {
-    pub subscription_provider_plan_id: String,
+    pub plan_id: String,
     pub name: String,
     pub description: Option<String>,
 }
+
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionPlanPricesResponse {
+    pub list: Vec<SubscriptionPlanPrices>,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionPlanPrices {
+    pub price_id: String,
+    pub plan_id: Option<String>,
+    pub amount: common_utils::types::MinorUnit,
+    pub currency: Currency,
+    pub interval: PeriodUnit,
+    pub interval_count: i64,
+    pub trial_period: Option<i64>,
+    pub trial_period_unit: Option<PeriodUnit>,
+}
+
+#[derive(Debug, Clone)]
+pub enum PeriodUnit {
+    Day,
+    Week,
+    Month,
+    Year,
+}
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index 65958b60b0c..9d5094118db 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -4,11 +4,13 @@ use crate::{
     router_data::{AccessToken, AccessTokenAuthenticationResponse, RouterData},
     router_data_v2::{self, RouterDataV2},
     router_flow_types::{
-        mandate_revoke::MandateRevoke, revenue_recovery::RecoveryRecordBack,
-        subscriptions::GetSubscriptionPlans, AccessTokenAuth, AccessTokenAuthentication,
-        Authenticate, AuthenticationConfirmation, Authorize, AuthorizeSessionToken,
-        BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, CalculateTax, Capture,
-        CompleteAuthorize, CreateConnectorCustomer, CreateOrder, Execute, ExternalVaultProxy,
+        mandate_revoke::MandateRevoke,
+        revenue_recovery::RecoveryRecordBack,
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
+        AccessTokenAuth, AccessTokenAuthentication, Authenticate, AuthenticationConfirmation,
+        Authorize, AuthorizeSessionToken, BillingConnectorInvoiceSync,
+        BillingConnectorPaymentsSync, CalculateTax, Capture, CompleteAuthorize,
+        CreateConnectorCustomer, CreateOrder, Execute, ExternalVaultProxy,
         IncrementalAuthorization, PSync, PaymentMethodToken, PostAuthenticate, PostCaptureVoid,
         PostSessionTokens, PreAuthenticate, PreProcessing, RSync, SdkSessionUpdate, Session,
         SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,
@@ -18,7 +20,7 @@ use crate::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
             RevenueRecoveryRecordBackRequest,
         },
-        subscriptions::GetSubscriptionPlansRequest,
+        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -39,7 +41,7 @@ use crate::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
             RevenueRecoveryRecordBackResponse,
         },
-        subscriptions::GetSubscriptionPlansResponse,
+        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
         MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData,
         TaxCalculationResponseData, VaultResponseData, VerifyWebhookSourceResponseData,
     },
@@ -126,6 +128,12 @@ pub type RevenueRecoveryRecordBackRouterData = RouterData<
 pub type GetSubscriptionPlansRouterData =
     RouterData<GetSubscriptionPlans, GetSubscriptionPlansRequest, GetSubscriptionPlansResponse>;
 
+pub type GetSubscriptionPlanPricesRouterData = RouterData<
+    GetSubscriptionPlanPrices,
+    GetSubscriptionPlanPricesRequest,
+    GetSubscriptionPlanPricesResponse,
+>;
+
 pub type UasAuthenticationRouterData =
     RouterData<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>;
 
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index 0da67f321dd..a97f31c8578 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -16,7 +16,7 @@ use hyperswitch_domain_models::{
         },
         refunds::{Execute, RSync},
         revenue_recovery::{BillingConnectorPaymentsSync, RecoveryRecordBack},
-        subscriptions::GetSubscriptionPlans,
+        subscriptions::{GetSubscriptionPlanPrices, GetSubscriptionPlans},
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
@@ -32,7 +32,7 @@ use hyperswitch_domain_models::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
             RevenueRecoveryRecordBackRequest,
         },
-        subscriptions::GetSubscriptionPlansRequest,
+        subscriptions::{GetSubscriptionPlanPricesRequest, GetSubscriptionPlansRequest},
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -55,7 +55,7 @@ use hyperswitch_domain_models::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
             RevenueRecoveryRecordBackResponse,
         },
-        subscriptions::GetSubscriptionPlansResponse,
+        subscriptions::{GetSubscriptionPlanPricesResponse, GetSubscriptionPlansResponse},
         AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
         MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData, RetrieveFileResponse,
         SubmitEvidenceResponse, TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
@@ -319,6 +319,13 @@ pub type GetSubscriptionPlansType = dyn ConnectorIntegration<
     GetSubscriptionPlansResponse,
 >;
 
+/// Type alias for `ConnectorIntegration<GetSubscriptionPlanPrices, GetSubscriptionPlanPricesRequest, GetSubscriptionPlanPricesResponse>`
+pub type GetSubscriptionPlanPricesType = dyn ConnectorIntegration<
+    GetSubscriptionPlanPrices,
+    GetSubscriptionPlanPricesRequest,
+    GetSubscriptionPlanPricesResponse,
+>;
+
 /// Type alias for `ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>`
 pub type ExternalVaultInsertType =
     dyn ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>;
 | 
	2025-09-01T12:30:05Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR adds support for the get plan prices endpoint for Chargebee
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9054 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	4d5ce22678a4258491943b9bbeda5585ed528102 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9048 | 
	Bug: Error for successive config activation
 | 
	diff --git a/crates/api_models/src/open_router.rs b/crates/api_models/src/open_router.rs
index c2e6bc76c06..94d31a73787 100644
--- a/crates/api_models/src/open_router.rs
+++ b/crates/api_models/src/open_router.rs
@@ -251,7 +251,7 @@ pub struct DecisionEngineConfigSetupRequest {
 #[derive(Debug, Serialize, Deserialize, Clone)]
 pub struct GetDecisionEngineConfigRequest {
     pub merchant_id: String,
-    pub config: DecisionEngineDynamicAlgorithmType,
+    pub algorithm: DecisionEngineDynamicAlgorithmType,
 }
 
 #[derive(Debug, Serialize, Deserialize, Clone)]
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 6094c9826a1..0078bfcea0b 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -28,7 +28,9 @@ use external_services::grpc_client::dynamic_routing::{
     success_rate_client::SuccessBasedDynamicRouting,
 };
 #[cfg(all(feature = "v1", feature = "dynamic_routing"))]
-use helpers::update_decision_engine_dynamic_routing_setup;
+use helpers::{
+    enable_decision_engine_dynamic_routing_setup, update_decision_engine_dynamic_routing_setup,
+};
 use hyperswitch_domain_models::{mandates, payment_address};
 use payment_methods::helpers::StorageErrorExt;
 use rustc_hash::FxHashSet;
@@ -694,7 +696,15 @@ pub async fn link_routing_config(
                 #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                 {
                     if state.conf.open_router.dynamic_routing_enabled {
-                        update_decision_engine_dynamic_routing_setup(
+                        let existing_config = helpers::get_decision_engine_active_dynamic_routing_algorithm(
+                        &state,
+                        business_profile.get_id(),
+                        api_models::open_router::DecisionEngineDynamicAlgorithmType::SuccessRate,
+                    )
+                    .await;
+
+                        if let Ok(Some(_config)) = existing_config {
+                            update_decision_engine_dynamic_routing_setup(
                             &state,
                             business_profile.get_id(),
                             routing_algorithm.algorithm_data.clone(),
@@ -706,6 +716,27 @@ pub async fn link_routing_config(
                         .attach_printable(
                             "Failed to update the success rate routing config in Decision Engine",
                         )?;
+                        } else {
+                            let data: routing_types::SuccessBasedRoutingConfig =
+                            routing_algorithm.algorithm_data
+                                .clone()
+                                .parse_value("SuccessBasedRoutingConfig")
+                                .change_context(errors::ApiErrorResponse::InternalServerError)
+                                .attach_printable(
+                                    "unable to deserialize SuccessBasedRoutingConfig from routing algorithm data",
+                                )?;
+
+                            enable_decision_engine_dynamic_routing_setup(
+                            &state,
+                            business_profile.get_id(),
+                            routing_types::DynamicRoutingType::SuccessRateBasedRouting,
+                            &mut dynamic_routing_ref,
+                            Some(routing_types::DynamicRoutingPayload::SuccessBasedRoutingPayload(data)),
+                        )
+                        .await
+                        .change_context(errors::ApiErrorResponse::InternalServerError)
+                        .attach_printable("Unable to setup decision engine dynamic routing")?;
+                        }
                     }
                 }
             } else if routing_algorithm.name == helpers::ELIMINATION_BASED_DYNAMIC_ROUTING_ALGORITHM
@@ -725,18 +756,51 @@ pub async fn link_routing_config(
                 #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                 {
                     if state.conf.open_router.dynamic_routing_enabled {
-                        update_decision_engine_dynamic_routing_setup(
+                        let existing_config = helpers::get_decision_engine_active_dynamic_routing_algorithm(
                             &state,
                             business_profile.get_id(),
-                            routing_algorithm.algorithm_data.clone(),
-                            routing_types::DynamicRoutingType::EliminationRouting,
-                            &mut dynamic_routing_ref,
+                            api_models::open_router::DecisionEngineDynamicAlgorithmType::Elimination,
                         )
-                        .await
-                        .change_context(errors::ApiErrorResponse::InternalServerError)
-                        .attach_printable(
-                            "Failed to update the elimination routing config in Decision Engine",
-                        )?;
+                        .await;
+
+                        if let Ok(Some(_config)) = existing_config {
+                            update_decision_engine_dynamic_routing_setup(
+                                &state,
+                                business_profile.get_id(),
+                                routing_algorithm.algorithm_data.clone(),
+                                routing_types::DynamicRoutingType::EliminationRouting,
+                                &mut dynamic_routing_ref,
+                            )
+                            .await
+                            .change_context(errors::ApiErrorResponse::InternalServerError)
+                            .attach_printable(
+                                "Failed to update the elimination routing config in Decision Engine",
+                            )?;
+                        } else {
+                            let data: routing_types::EliminationRoutingConfig =
+                                routing_algorithm.algorithm_data
+                                    .clone()
+                                    .parse_value("EliminationRoutingConfig")
+                                    .change_context(errors::ApiErrorResponse::InternalServerError)
+                                    .attach_printable(
+                                        "unable to deserialize EliminationRoutingConfig from routing algorithm data",
+                                    )?;
+
+                            enable_decision_engine_dynamic_routing_setup(
+                                &state,
+                                business_profile.get_id(),
+                                routing_types::DynamicRoutingType::EliminationRouting,
+                                &mut dynamic_routing_ref,
+                                Some(
+                                    routing_types::DynamicRoutingPayload::EliminationRoutingPayload(
+                                        data,
+                                    ),
+                                ),
+                            )
+                            .await
+                            .change_context(errors::ApiErrorResponse::InternalServerError)
+                            .attach_printable("Unable to setup decision engine dynamic routing")?;
+                        }
                     }
                 }
             } else if routing_algorithm.name == helpers::CONTRACT_BASED_DYNAMIC_ROUTING_ALGORITHM {
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 290feb9e306..0b1395ed4ba 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -2307,19 +2307,6 @@ pub async fn create_specific_dynamic_routing_setup(
         }
     };
 
-    if state.conf.open_router.dynamic_routing_enabled {
-        enable_decision_engine_dynamic_routing_setup(
-            state,
-            business_profile.get_id(),
-            dynamic_routing_type,
-            &mut dynamic_routing_algo_ref,
-            Some(payload),
-        )
-        .await
-        .change_context(errors::ApiErrorResponse::InternalServerError)
-        .attach_printable("Unable to setup decision engine dynamic routing")?;
-    }
-
     let record = db
         .insert_routing_algorithm(algo)
         .await
@@ -2599,7 +2586,7 @@ pub async fn get_decision_engine_active_dynamic_routing_algorithm(
     );
     let request = open_router::GetDecisionEngineConfigRequest {
         merchant_id: profile_id.get_string_repr().to_owned(),
-        config: dynamic_routing_type,
+        algorithm: dynamic_routing_type,
     };
     let response: Option<open_router::DecisionEngineConfigSetupRequest> =
         routing_utils::ConfigApiClient::send_decision_engine_request(
 | 
	2025-08-22T11:56:58Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Taged Issue
https://github.com/juspay/hyperswitch-cloud/issues/10731
### Summary
This PR refactors **Decision Engine dynamic routing setup** handling inside `link_routing_config` and `create_specific_dynamic_routing_setup` to improve reliability when updating dynamic routing configs.
### Key Changes
1. **Added `enable_decision_engine_dynamic_routing_setup` import**
   * Alongside `update_decision_engine_dynamic_routing_setup` in `helpers.rs`.
2. **Enhanced error handling for SuccessRate & Elimination routing configs**
   * Now, we first attempt to update the DE config via `update_decision_engine_dynamic_routing_setup`.
   * If the update fails, we gracefully fallback to **enabling** the config using `enable_decision_engine_dynamic_routing_setup` with parsed payloads:
     * `SuccessBasedRoutingConfig`
     * `EliminationRoutingConfig`
3. **Improved error messages & traceability**
   * Distinct error messages for update vs. enable flow.
   * Clearer attachable printables for debugging.
4. **Removed redundant `enable_decision_engine_dynamic_routing_setup` call** in
   `create_specific_dynamic_routing_setup` to avoid duplicate execution, since setup is now properly handled within `link_routing_config`.
### Why this change?
* Previously, DE config updates could silently fail without retry/fallback.
* This introduces a safer mechanism:
  * Try **update** → fallback to **enable** with correct payload.
* Ensures merchant routing configs remain in sync with Decision Engine even if updates fail.
### Impact
* More reliable DE config synchronization.
* Clearer error logs.
* Slight increase in control-flow complexity inside `link_routing_config`, but safer handling overall.
**Screenshots
<img width="1282" height="897" alt="Screenshot 2025-08-25 at 3 18 05 PM" src="https://github.com/user-attachments/assets/1c96fefe-edd7-40a3-ba0d-84ea48f56bcb" />
<img width="1282" height="777" alt="Screenshot 2025-08-25 at 3 18 47 PM" src="https://github.com/user-attachments/assets/270cb13f-6dd4-41cb-88dc-317004d60a79" />
<img width="1288" height="816" alt="Screenshot 2025-08-25 at 3 19 12 PM" src="https://github.com/user-attachments/assets/781ac691-50dc-466d-a272-d5350fa2fbd1" />
<img width="1299" height="849" alt="Screenshot 2025-08-25 at 3 19 37 PM" src="https://github.com/user-attachments/assets/862be21c-c330-49a7-8bad-34dc91904fec" />
**Curls and Responses
create
```
curl --location 'http://localhost:8080/account/merchant_1756108708/business_profile/pro_hawNVdPoyuXr2njSINGY/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \
--header 'Content-Type: application/json' \
--header 'api-key:*****' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 200,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
response
```
{
    "id": "routing_tVG4bP14dqo4TP7UVPV9",
    "profile_id": "pro_hawNVdPoyuXr2njSINGY",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756115463,
    "modified_at": 1756115463,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
activate
```
curl --location 'http://localhost:8080/routing/routing_tVG4bP14dqo4TP7UVPV9/activate' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_oxFyweqWmRlpg3ZXpKnr5nRQp4JJbrB4uDs85G3mWdCN9F0ZOAtSIvAnfNPhqV1q' \
--data '{}'
```
response
```
{
    "id": "routing_tVG4bP14dqo4TP7UVPV9",
    "profile_id": "pro_hawNVdPoyuXr2njSINGY",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756115463,
    "modified_at": 1756115463,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
create(new)
```
curl --location 'http://localhost:8080/account/merchant_1756108708/business_profile/pro_hawNVdPoyuXr2njSINGY/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 200,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
response
```
{
    "id": "routing_Jhz8tJy37C12jH19m90F",
    "profile_id": "pro_hawNVdPoyuXr2njSINGY",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756115557,
    "modified_at": 1756115557,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
activate(new)
```
curl --location 'http://localhost:8080/routing/routing_Jhz8tJy37C12jH19m90F/activate' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_oxFyweqWmRlpg3ZXpKnr5nRQp4JJbrB4uDs85G3mWdCN9F0ZOAtSIvAnfNPhqV1q' \
--data '{}'
```
response
```
{
    "id": "routing_Jhz8tJy37C12jH19m90F",
    "profile_id": "pro_hawNVdPoyuXr2njSINGY",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756115557,
    "modified_at": 1756115557,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
activate(old)
```
curl --location 'http://localhost:8080/routing/routing_tVG4bP14dqo4TP7UVPV9/activate' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_oxFyweqWmRlpg3ZXpKnr5nRQp4JJbrB4uDs85G3mWdCN9F0ZOAtSIvAnfNPhqV1q' \
--data '{}'
```
response
```
{
    "id": "routing_tVG4bP14dqo4TP7UVPV9",
    "profile_id": "pro_hawNVdPoyuXr2njSINGY",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756115463,
    "modified_at": 1756115463,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
``` | 
	cb34ec51e0f2b4ba071602f5fe974429de542b80 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9034 | 
	Bug: [BUG] CUSTOMERREQUEST refund reason not supported in Adyen
### Bug Description
CUSTOMERREQUEST refund reason not supported in Adyen
### Expected Behavior
CUSTOMERREQUEST refund reason should be supported in Adyen.
### Actual Behavior
CUSTOMERREQUEST refund reason not supported in Adyen
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 63c1b0d8a32..f30732173a7 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -1415,7 +1415,7 @@ impl FromStr for AdyenRefundRequestReason {
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         match s.to_uppercase().as_str() {
             "FRAUD" => Ok(Self::FRAUD),
-            "CUSTOMER REQUEST" => Ok(Self::CUSTOMERREQUEST),
+            "CUSTOMER REQUEST" | "CUSTOMERREQUEST" => Ok(Self::CUSTOMERREQUEST),
             "RETURN" => Ok(Self::RETURN),
             "DUPLICATE" => Ok(Self::DUPLICATE),
             "OTHER" => Ok(Self::OTHER),
 | 
	2025-08-22T11:28:33Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/9034)
## Description
<!-- Describe your changes in detail -->
Added Support for CUSTOMERREQUEST Refund Reason in Adyen
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test:
Refunds:
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_KYKqKi3f1IgAl2wzfLwajdyMApB5XvTmX7SjYWpAcuLRnYxXToxXjDDuMoKPJ5h2' \
--data '{
    "payment_id": "pay_rcvdW42PBSd2ik1tYEpA",
    "amount": 1000,
    "reason": "CustomerRequest",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    } 
}'
```
Response:
```
{
    "refund_id": "ref_3UOUCY4WziTz0iWhRGjT",
    "payment_id": "pay_rcvdW42PBSd2ik1tYEpA",
    "amount": 1000,
    "currency": "USD",
    "status": "pending",
    "reason": "CUSTOMER REQUEST",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-06T04:02:37.782Z",
    "updated_at": "2025-08-06T04:02:39.280Z",
    "connector": "adyen",
    "profile_id": "pro_H4NAjXx3vY9NI4nQbXom",
    "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c90625a4ea163e03895276a04ec3a23d4117413d | 
	
Postman Test:
Refunds:
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_KYKqKi3f1IgAl2wzfLwajdyMApB5XvTmX7SjYWpAcuLRnYxXToxXjDDuMoKPJ5h2' \
--data '{
    "payment_id": "pay_rcvdW42PBSd2ik1tYEpA",
    "amount": 1000,
    "reason": "CustomerRequest",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    } 
}'
```
Response:
```
{
    "refund_id": "ref_3UOUCY4WziTz0iWhRGjT",
    "payment_id": "pay_rcvdW42PBSd2ik1tYEpA",
    "amount": 1000,
    "currency": "USD",
    "status": "pending",
    "reason": "CUSTOMER REQUEST",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-06T04:02:37.782Z",
    "updated_at": "2025-08-06T04:02:39.280Z",
    "connector": "adyen",
    "profile_id": "pro_H4NAjXx3vY9NI4nQbXom",
    "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9053 | 
	Bug: Get Plans
**Request to Subscription Povider to get plans**
/api/v2/items?limit=5&type[is]=plan&item_family_id[is]=cbdemo_omnisupport-solutions'
**Response from Subscription Provider**
```
{
    "list": [
        {
            "item": {
                "id": "cbdemo_enterprise-suite",
                "name": "Enterprise Suite",
                "external_name": "Enterprise Suite",
                "description": "High-end customer support suite with enterprise-grade solutions.",
                "status": "active",
                "resource_version": 1754897340100,
                "updated_at": 1754897340,
                "item_family_id": "cbdemo_omnisupport-solutions",
                "type": "plan",
                "is_shippable": false,
                "is_giftable": false,
                "enabled_for_checkout": true,
                "enabled_in_portal": true,
                "item_applicability": "all",
                "metered": false,
                "channel": "web",
                "bundle_items": [],
                "deleted": false,
                "object": "item"
            }
        },
        {
            "item": {
                "id": "cbdemo_business-suite",
                "name": "Business Suite",
                "external_name": "Business Suite",
                "description": "Advanced customer support plan with premium features.",
                "status": "active",
                "resource_version": 1754897339947,
                "updated_at": 1754897339,
                "item_family_id": "cbdemo_omnisupport-solutions",
                "type": "plan",
                "is_shippable": false,
                "is_giftable": false,
                "enabled_for_checkout": true,
                "enabled_in_portal": true,
                "item_applicability": "all",
                "metered": false,
                "channel": "web",
                "bundle_items": [],
                "deleted": false,
                "object": "item"
            }
        },
        {
            "item": {
                "id": "cbdemo_professional-suite",
                "name": "Professional Suite",
                "external_name": "Professional Suite",
                "description": "Comprehensive customer support plan with extended capabilities.",
                "status": "active",
                "resource_version": 1754897339843,
                "updated_at": 1754897339,
                "item_family_id": "cbdemo_omnisupport-solutions",
                "type": "plan",
                "is_shippable": false,
                "is_giftable": false,
                "enabled_for_checkout": true,
                "enabled_in_portal": true,
                "item_applicability": "all",
                "metered": false,
                "channel": "web",
                "bundle_items": [],
                "deleted": false,
                "object": "item"
            }
        },
        {
            "item": {
                "id": "cbdemo_essential-support",
                "name": "Essential Support",
                "external_name": "Essential Support",
                "description": "Basic customer support plan with core features.",
                "status": "active",
                "resource_version": 1754897339723,
                "updated_at": 1754897339,
                "item_family_id": "cbdemo_omnisupport-solutions",
                "type": "plan",
                "is_shippable": false,
                "is_giftable": false,
                "enabled_for_checkout": true,
                "enabled_in_portal": true,
                "item_applicability": "all",
                "metered": false,
                "channel": "web",
                "bundle_items": [],
                "deleted": false,
                "object": "item"
            }
        }
    ]
}
```
 | 
	diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index 3b343459e9e..c991f3c048b 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -42,6 +42,7 @@ pub mod recon;
 pub mod refunds;
 pub mod relay;
 pub mod routing;
+pub mod subscription;
 pub mod surcharge_decision_configs;
 pub mod three_ds_decision_rule;
 #[cfg(feature = "tokenization_v2")]
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 4789ec15dfb..e8a9cb29d9f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -897,6 +897,13 @@ impl AmountDetailsUpdate {
         self.tax_on_surcharge
     }
 }
+
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct BillingConnectorDetails {
+    pub processor_mca: id_type::MerchantConnectorAccountId,
+    pub subscription_id: String,
+    pub invoice_id: String,
+}
 #[cfg(feature = "v1")]
 #[derive(
     Default,
@@ -1255,6 +1262,8 @@ pub struct PaymentsRequest {
 
     /// Allow partial authorization for this payment
     pub enable_partial_authorization: Option<bool>,
+
+    pub billing_processor_details: Option<BillingConnectorDetails>,
 }
 
 #[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -7234,7 +7243,12 @@ pub struct ApplepaySessionRequest {
     pub initiative: String,
     pub initiative_context: String,
 }
-
+// #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+// pub struct BillingConnectorDetails {
+//     pub connector: String,
+//     pub subscription_id: String,
+//     pub invoice_id: String,
+// }
 /// Some connectors like Apple Pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.
 #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
 pub struct ConnectorMetadata {
diff --git a/crates/api_models/src/process_tracker.rs b/crates/api_models/src/process_tracker.rs
index 9854933734f..97ff63c65a7 100644
--- a/crates/api_models/src/process_tracker.rs
+++ b/crates/api_models/src/process_tracker.rs
@@ -1,2 +1,3 @@
 #[cfg(feature = "v2")]
 pub mod revenue_recovery;
+pub mod subscription;
diff --git a/crates/api_models/src/process_tracker/subscription.rs b/crates/api_models/src/process_tracker/subscription.rs
new file mode 100644
index 00000000000..0393be4e052
--- /dev/null
+++ b/crates/api_models/src/process_tracker/subscription.rs
@@ -0,0 +1,16 @@
+use common_utils::id_type;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct SubscriptionWorkflowTrackingData {
+    pub merchant_id: id_type::MerchantId,
+    pub profile_id: id_type::ProfileId,
+    pub payment_method_id: String,
+    pub subscription_id: Option<String>,
+    pub invoice_id: String,
+    pub amount: common_utils::types::MinorUnit,
+    pub currency: common_enums::Currency,
+    pub customer_id: Option<id_type::CustomerId>,
+    pub connector_name: String,
+    pub billing_connector_mca_id: id_type::MerchantConnectorAccountId,
+}
diff --git a/crates/api_models/src/subscription.rs b/crates/api_models/src/subscription.rs
new file mode 100644
index 00000000000..ce6cc9ff7b8
--- /dev/null
+++ b/crates/api_models/src/subscription.rs
@@ -0,0 +1,108 @@
+use common_utils::{events::ApiEventMetric, pii};
+
+use crate::{
+    customers::{CustomerRequest, CustomerResponse},
+    payments::CustomerDetailsResponse,
+};
+
+pub const SUBSCRIPTION_ID_PREFIX: &str = "sub";
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct CreateSubscriptionRequest {
+    pub subscription_id: Option<String>,
+    pub plan_id: Option<String>,
+    pub coupon_code: Option<String>,
+    pub mca_id: Option<String>,
+    pub confirm: bool,
+    pub customer_id: Option<common_utils::id_type::CustomerId>,
+    pub customer: Option<CustomerRequest>,
+}
+
+impl CreateSubscriptionRequest {
+    pub fn get_customer_id(&self) -> Option<&common_utils::id_type::CustomerId> {
+        self.customer_id
+            .as_ref()
+            .or_else(|| self.customer.as_ref()?.customer_id.as_ref())
+    }
+}
+
+#[derive(Debug, Clone, serde::Serialize)]
+pub struct CreateSubscriptionResponse {
+    pub subscription: Subscription,
+    pub client_secret: Option<String>,
+    pub merchant_id: String,
+    pub mca_id: Option<String>,
+    pub coupon_code: Option<String>,
+    pub customer: Option<CustomerDetailsResponse>,
+    pub invoice: Option<Invoice>,
+}
+
+#[derive(Debug, Clone, serde::Serialize)]
+pub struct Subscription {
+    pub id: String,
+    pub status: SubscriptionStatus,
+    pub plan_id: Option<String>,
+}
+
+#[derive(Debug, Clone, serde::Serialize, strum::EnumString, strum::Display)]
+pub enum SubscriptionStatus {
+    Created,
+    Active,
+    InActive,
+}
+
+#[derive(Debug, Clone, serde::Serialize)]
+pub struct Invoice {
+    pub id: String,
+    pub total: u64,
+}
+
+impl Subscription {
+    pub fn new(id: impl Into<String>, status: SubscriptionStatus, plan_id: Option<String>) -> Self {
+        Self {
+            id: id.into(),
+            status,
+            plan_id,
+        }
+    }
+}
+
+impl Invoice {
+    pub fn new(id: impl Into<String>, total: u64) -> Self {
+        Self {
+            id: id.into(),
+            total,
+        }
+    }
+}
+impl CreateSubscriptionResponse {
+    #[allow(clippy::too_many_arguments)]
+    pub fn new(
+        subscription: Subscription,
+        merchant_id: impl Into<String>,
+        mca_id: Option<String>,
+    ) -> Self {
+        Self {
+            subscription,
+            client_secret: None,
+            merchant_id: merchant_id.into(),
+            mca_id,
+            coupon_code: None,
+            customer: None,
+            invoice: None,
+        }
+    }
+}
+
+pub fn map_customer_resp_to_details(r: &CustomerResponse) -> CustomerDetailsResponse {
+    CustomerDetailsResponse {
+        id: Some(r.customer_id.clone()),
+        name: r.name.as_ref().map(|n| n.clone().into_inner()),
+        email: r.email.as_ref().map(|e| pii::Email::from(e.clone())),
+        phone: r.phone.as_ref().map(|p| p.clone().into_inner()),
+        phone_country_code: r.phone_country_code.clone(),
+    }
+}
+
+impl ApiEventMetric for CreateSubscriptionResponse {}
+impl ApiEventMetric for CreateSubscriptionRequest {}
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index bb58a0dc440..6b42778f564 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -66,6 +66,8 @@ pub enum IncomingWebhookEvent {
     RecoveryPaymentPending,
     #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
     RecoveryInvoiceCancel,
+    #[cfg(feature = "v1")]
+    InvoiceGenerated,
 }
 
 impl IncomingWebhookEvent {
@@ -297,6 +299,8 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
             | IncomingWebhookEvent::RecoveryPaymentFailure
             | IncomingWebhookEvent::RecoveryPaymentPending
             | IncomingWebhookEvent::RecoveryPaymentSuccess => Self::Recovery,
+            #[cfg(feature = "v1")]
+            IncomingWebhookEvent::InvoiceGenerated => Self::Subscription,
         }
     }
 }
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 67c5efb00a6..124af626717 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -7777,6 +7777,7 @@ pub enum Resource {
     RunRecon,
     ReconConfig,
     RevenueRecovery,
+    Subscription,
     InternalConnector,
     Theme,
 }
@@ -8733,6 +8734,7 @@ pub enum ProcessTrackerRunner {
     PassiveRecoveryWorkflow,
     ProcessDisputeWorkflow,
     DisputeListWorkflow,
+    SubscriptionsWorkflow,
 }
 
 #[derive(Debug)]
diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs
index 246807a041a..caf979b2c5f 100644
--- a/crates/diesel_models/src/lib.rs
+++ b/crates/diesel_models/src/lib.rs
@@ -44,6 +44,7 @@ pub mod relay;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 pub mod types;
 pub mod unified_translations;
 
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index a152d4085df..791f5b5debe 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -178,6 +178,7 @@ pub struct PaymentIntent {
     pub duty_amount: Option<MinorUnit>,
     pub order_date: Option<PrimitiveDateTime>,
     pub enable_partial_authorization: Option<bool>,
+    pub billing_processor_details: Option<serde_json::Value>,
 }
 
 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]
@@ -467,6 +468,7 @@ pub struct PaymentIntentNew {
     pub shipping_amount_tax: Option<MinorUnit>,
     pub duty_amount: Option<MinorUnit>,
     pub enable_partial_authorization: Option<bool>,
+    pub billing_processor_details: Option<serde_json::Value>,
 }
 
 #[cfg(feature = "v2")]
diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs
index 7c8831b3811..17eae2427e7 100644
--- a/crates/diesel_models/src/query.rs
+++ b/crates/diesel_models/src/query.rs
@@ -39,6 +39,7 @@ pub mod relay;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 #[cfg(feature = "tokenization_v2")]
 pub mod tokenization;
 pub mod unified_translations;
diff --git a/crates/diesel_models/src/query/subscription.rs b/crates/diesel_models/src/query/subscription.rs
new file mode 100644
index 00000000000..a8289a58d44
--- /dev/null
+++ b/crates/diesel_models/src/query/subscription.rs
@@ -0,0 +1,94 @@
+use async_bb8_diesel::AsyncRunQueryDsl;
+use diesel::{
+    associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods, QueryDsl,
+};
+use error_stack::report;
+use error_stack::ResultExt;
+
+use super::generics;
+use crate::{
+    errors,
+    schema::subscription::dsl,
+    subscription::{Subscription, SubscriptionNew, SubscriptionUpdate},
+    PgPooledConn, StorageResult,
+};
+
+impl SubscriptionNew {
+    pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Subscription> {
+        generics::generic_insert(conn, self).await
+    }
+}
+
+impl Subscription {
+    pub async fn find_by_merchant_id_subscription_id(
+        conn: &PgPooledConn,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> StorageResult<Self> {
+        generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
+            conn,
+            dsl::merchant_id
+                .eq(merchant_id.to_owned())
+                .and(dsl::subscription_id.eq(subscription_id.to_owned())),
+        )
+        .await
+    }
+
+    pub async fn find_payment_method_ids_by_billing_connector_subscription_id(
+        conn: &PgPooledConn,
+        subscription_id: &str,
+    ) -> StorageResult<Vec<String>> {
+        let query = <Self as HasTable>::table()
+            .select(dsl::payment_method_id)
+            .filter(dsl::subscription_id.eq(subscription_id.to_owned()))
+            .filter(dsl::payment_method_id.is_not_null())
+            .order(dsl::created_at.desc())
+            .into_boxed();
+
+        router_env::logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
+
+        generics::db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
+            query.load_async::<Option<String>>(conn),
+            generics::db_metrics::DatabaseOperation::Filter,
+        )
+        .await
+        .change_context(errors::DatabaseError::Others)
+        .attach_printable("Failed to find payment method IDs by billing connector subscription ID")
+        .map(|results| results.into_iter().filter_map(|x| x).collect())
+    }
+
+    pub async fn update_subscription_entry(
+        conn: &PgPooledConn,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        subscription_update: SubscriptionUpdate,
+    ) -> StorageResult<Self> {
+        generics::generic_update_with_results::<
+            <Self as HasTable>::Table,
+            SubscriptionUpdate,
+            _,
+            _,
+        >(
+            conn,
+            dsl::subscription_id
+                .eq(subscription_id.to_owned())
+                .and(dsl::merchant_id.eq(merchant_id.to_owned())),
+            subscription_update,
+        )
+        .await?
+        .first()
+        .cloned()
+        .ok_or_else(|| {
+            report!(errors::DatabaseError::NotFound)
+                .attach_printable("Error while updating subscription entry")
+        })
+    }
+
+    // pub async fn find_subscription_by_id(conn: &PgPooledConn, id: String) -> StorageResult<Self> {
+    //     generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
+    //         conn,
+    //         dsl::id.eq(id.to_owned()),
+    //     )
+    //     .await
+    // }
+}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 08675d904de..7881facea27 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1086,6 +1086,7 @@ diesel::table! {
         duty_amount -> Nullable<Int8>,
         order_date -> Nullable<Timestamp>,
         enable_partial_authorization -> Nullable<Bool>,
+        billing_processor_details -> Nullable<Jsonb>,
     }
 }
 
@@ -1465,6 +1466,34 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    subscription (id) {
+        id -> Int4,
+        #[max_length = 128]
+        subscription_id -> Varchar,
+        #[max_length = 128]
+        status -> Varchar,
+        #[max_length = 128]
+        billing_processor -> Nullable<Varchar>,
+        #[max_length = 128]
+        payment_method_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        mca_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        client_secret -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Varchar,
+        #[max_length = 64]
+        customer_id -> Varchar,
+        metadata -> Nullable<Jsonb>,
+        created_at -> Timestamp,
+        modified_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1650,6 +1679,7 @@ diesel::allow_tables_to_appear_in_same_query!(
     reverse_lookup,
     roles,
     routing_algorithm,
+    subscription,
     themes,
     unified_translations,
     user_authentication_methods,
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index ea3980d942a..8c0cf89b070 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1400,6 +1400,32 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    subscription (id) {
+        id -> Int4,
+        #[max_length = 128]
+        subscription_id -> Varchar,
+        #[max_length = 128]
+        billing_processor -> Nullable<Varchar>,
+        #[max_length = 128]
+        payment_method_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        mca_id -> Nullable<Varchar>,
+        #[max_length = 128]
+        client_secret -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Varchar,
+        #[max_length = 64]
+        customer_id -> Varchar,
+        metadata -> Nullable<Jsonb>,
+        created_at -> Timestamp,
+        modified_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1605,6 +1631,7 @@ diesel::allow_tables_to_appear_in_same_query!(
     reverse_lookup,
     roles,
     routing_algorithm,
+    subscription,
     themes,
     tokenization,
     unified_translations,
diff --git a/crates/diesel_models/src/subscription.rs b/crates/diesel_models/src/subscription.rs
new file mode 100644
index 00000000000..0a0be40be8d
--- /dev/null
+++ b/crates/diesel_models/src/subscription.rs
@@ -0,0 +1,99 @@
+use common_utils::{generate_id_with_default_len, pii::SecretSerdeValue};
+use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
+use serde::{Deserialize, Serialize};
+
+use crate::schema::subscription;
+
+#[derive(Clone, Debug, Eq, Insertable, PartialEq, Serialize, Deserialize)]
+#[diesel(table_name = subscription)]
+pub struct SubscriptionNew {
+    subscription_id: String,
+    status: String,
+    billing_processor: Option<String>,
+    payment_method_id: Option<String>,
+    mca_id: Option<String>,
+    client_secret: Option<String>,
+    merchant_id: common_utils::id_type::MerchantId,
+    customer_id: common_utils::id_type::CustomerId,
+    metadata: Option<SecretSerdeValue>,
+    created_at: time::PrimitiveDateTime,
+    modified_at: time::PrimitiveDateTime,
+}
+
+#[derive(
+    Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize,
+)]
+#[diesel(table_name = subscription, primary_key(id), check_for_backend(diesel::pg::Pg))]
+pub struct Subscription {
+    #[serde(skip_serializing, skip_deserializing)]
+    pub id: i32,
+    pub subscription_id: String,
+    pub status: String,
+    pub billing_processor: Option<String>,
+    pub payment_method_id: Option<String>,
+    pub mca_id: Option<String>,
+    pub client_secret: Option<String>,
+    pub merchant_id: common_utils::id_type::MerchantId,
+    pub customer_id: common_utils::id_type::CustomerId,
+    pub metadata: Option<serde_json::Value>,
+    pub created_at: time::PrimitiveDateTime,
+    pub modified_at: time::PrimitiveDateTime,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, AsChangeset, router_derive::DebugAsDisplay, Deserialize)]
+#[diesel(table_name = subscription)]
+pub struct SubscriptionUpdate {
+    pub payment_method_id: Option<String>,
+    pub status: Option<String>,
+    pub modified_at: time::PrimitiveDateTime,
+}
+
+impl SubscriptionNew {
+    #[allow(clippy::too_many_arguments)]
+    pub fn new(
+        subscription_id: String,
+        status: String,
+        billing_processor: Option<String>,
+        payment_method_id: Option<String>,
+        mca_id: Option<String>,
+        client_secret: Option<String>,
+        merchant_id: common_utils::id_type::MerchantId,
+        customer_id: common_utils::id_type::CustomerId,
+        metadata: Option<SecretSerdeValue>,
+    ) -> Self {
+        let now = common_utils::date_time::now();
+        Self {
+            subscription_id,
+            status,
+            billing_processor,
+            payment_method_id,
+            mca_id,
+            client_secret,
+            merchant_id,
+            customer_id,
+            metadata,
+            created_at: now,
+            modified_at: now,
+        }
+    }
+
+    pub fn generate_and_set_client_secret(&mut self) -> Option<String> {
+        let client_secret = Some(generate_id_with_default_len(&format!(
+            "{}_secret",
+            self.subscription_id
+        )));
+
+        self.client_secret = self.client_secret.clone();
+        client_secret
+    }
+}
+
+impl SubscriptionUpdate {
+    pub fn new(payment_method_id: Option<String>, status: Option<String>) -> Self {
+        Self {
+            payment_method_id,
+            status,
+            modified_at: common_utils::date_time::now(),
+        }
+    }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index 19ec99fc1d0..35d8044fcd0 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -9,32 +9,43 @@ use common_utils::{
     request::{Method, Request, RequestBuilder, RequestContent},
     types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
 };
-#[cfg(feature = "v1")]
-use error_stack::report;
+
 use error_stack::ResultExt;
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::{
-    revenue_recovery, router_flow_types::revenue_recovery::RecoveryRecordBack,
+    router_flow_types::revenue_recovery::RecoveryRecordBack,
     router_request_types::revenue_recovery::RevenueRecoveryRecordBackRequest,
     router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
     types::RevenueRecoveryRecordBackRouterData,
 };
+#[cfg(feature = "v2")]
+use hyperswitch_domain_models::{
+    router_data_v2::{flow_common_types::RevenueRecoveryRecordBackData, RouterDataV2},
+};
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+use hyperswitch_domain_models::revenue_recovery;
+
 use hyperswitch_domain_models::{
     router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
     router_flow_types::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
+        subscriptions::GetSubscriptionPlans,
     },
     router_request_types::{
-        AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
-        PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, SetupMandateRequestData,
+        subscriptions::GetSubscriptionPlansRequest, AccessTokenRequestData,
+        PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,
+        PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,
+        SetupMandateRequestData,
+    },
+    router_response_types::{
+        subscriptions::GetSubscriptionPlansResponse, ConnectorInfo, PaymentsResponseData,
+        RefundsResponseData,
     },
-    router_response_types::{ConnectorInfo, PaymentsResponseData, RefundsResponseData},
     types::{
-        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
-        RefundSyncRouterData, RefundsRouterData,
+        GetSubscriptionPlansRouterData, PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -48,10 +59,15 @@ use hyperswitch_interfaces::{
     types::{self, Response},
     webhooks,
 };
+#[cfg(feature = "v2")]
+use hyperswitch_interfaces::connector_integration_v2::ConnectorIntegrationV2;
 use masking::{Mask, PeekInterface, Secret};
 use transformers as chargebee;
 
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{
+    connectors::chargebee::transformers::ChargebeeListPlansResponse, constants::headers,
+    types::ResponseRouterData, utils,
+};
 
 #[derive(Clone)]
 pub struct Chargebee {
@@ -80,6 +96,396 @@ impl api::RefundSync for Chargebee {}
 impl api::PaymentToken for Chargebee {}
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl api::revenue_recovery::RevenueRecoveryRecordBack for Chargebee {}
+// #[cfg(feature = "v1")]
+// impl api::subscriptions::Subscriptions for Chargebee {}
+#[cfg(feature = "v1")]
+impl api::subscriptions::SubscriptionRecordBack for Chargebee {}
+
+// impl api::revenue_recovery::SubscriptionsRecordBack for Chargebee {}
+
+#[cfg(feature = "v1")]
+impl
+    ConnectorIntegration<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+        hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+    fn get_url(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        // let metadata: chargebee::ChargebeeMetadata =
+        //     utils::to_connector_meta_from_secret(req.connector_meta_data.clone())?;
+        let url = self
+            .base_url(connectors)
+            .to_string()
+            .replace("$", "hyperswitch-juspay-test"); // have to fix this
+        let invoice_id = req
+            .request
+            .merchant_reference_id
+            .to_string();
+        Ok(format!("{url}v2/invoices/{invoice_id}/record_payment"))
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_request_body(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let amount = utils::convert_amount(
+            self.amount_converter,
+            req.request.amount,
+            req.request.currency,
+        )?;
+        let connector_router_data = chargebee::ChargebeeRouterData::from((amount, req));
+        let connector_req =
+            chargebee::ChargebeeRecordPaymentRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::SubscriptionRecordBackType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::SubscriptionRecordBackType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::SubscriptionRecordBackType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<hyperswitch_domain_models::types::SubscriptionRecordBackRouterData, errors::ConnectorError> {
+        let response: chargebee::ChargebeeRecordbackResponse = res
+            .response
+            .parse_struct("chargebee ChargebeeRecordbackResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }          
+}
+#[cfg(all(feature = "v2", feature = "v1"))]
+impl
+    ConnectorIntegrationV2<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+        hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+        hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+        >,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn get_url(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+        >,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        todo!()
+    }
+
+    fn get_request_body(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+        >,
+    ) -> CustomResult<Option<RequestContent>, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn build_request_v2(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+        >,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn handle_response_v2(
+        &self,
+        _data: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+        >,
+        _event_builder: Option<&mut ConnectorEvent>,
+        _res: types::Response,
+    ) -> CustomResult<
+        RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::RevenueRecoveryRecordBackData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+        >,
+        errors::ConnectorError,
+    > {
+        todo!()
+    }
+
+    fn get_error_response_v2(
+        &self,
+        _res: types::Response,
+        _event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        todo!()
+    }
+}
+
+
+#[cfg(feature = "v1")]
+impl api::subscriptions::SubscriptionCreate for Chargebee {}
+
+#[cfg(feature = "v1")]
+impl
+    ConnectorIntegration<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+        hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionCreateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_url(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionCreateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let url = self
+            .base_url(connectors)
+            .to_string()
+            .replace("$", "hyperswitch-juspay-test"); // have to fix this
+        let customer_id = &req.request.customer_id;
+        Ok(format!("{url}v2/customers/{customer_id}/subscription_for_items"))
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_request_body(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionCreateRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_router_data = chargebee::ChargebeeRouterData::from((MinorUnit::new(0), req));
+        let connector_req =
+            chargebee::ChargebeeSubscriptionCreateRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &hyperswitch_domain_models::types::SubscriptionCreateRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::SubscriptionCreateType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::SubscriptionCreateType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::SubscriptionCreateType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &hyperswitch_domain_models::types::SubscriptionCreateRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<hyperswitch_domain_models::types::SubscriptionCreateRouterData, errors::ConnectorError> {
+        let response: chargebee::ChargebeeSubscriptionCreateResponse = res
+            .response
+            .parse_struct("chargebee ChargebeeSubscriptionCreateResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+#[cfg(all(feature = "v2", feature = "v1"))]
+impl
+    ConnectorIntegrationV2<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+        hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+        hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+        >,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn get_url(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+        >,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        todo!()
+    }
+
+    fn get_request_body(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+        >,
+    ) -> CustomResult<Option<RequestContent>, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn build_request_v2(
+        &self,
+        _req: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+        >,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        todo!()
+    }
+
+    fn handle_response_v2(
+        &self,
+        _data: &RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+        >,
+        _event_builder: Option<&mut ConnectorEvent>,
+        _res: types::Response,
+    ) -> CustomResult<
+        RouterDataV2<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            hyperswitch_domain_models::router_data_v2::flow_common_types::SubscriptionCreateData,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::revenue_recovery::SubscriptionCreateResponse,
+        >,
+        errors::ConnectorError,
+    > {
+        todo!()
+    }
+
+    fn get_error_response_v2(
+        &self,
+        _res: types::Response,
+        _event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        todo!()
+    }
+}
 
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Chargebee
@@ -664,6 +1070,100 @@ impl
     }
 }
 
+fn get_chargebee_plans_query_params(
+    _req: &RouterData<
+        GetSubscriptionPlans,
+        GetSubscriptionPlansRequest,
+        GetSubscriptionPlansResponse,
+    >,
+) -> CustomResult<String, errors::ConnectorError> {
+    let limit = 10; // hardcoded limit param
+    let item_type = "plan"; // hardcoded filter param
+    let param = format!("?limit={}&type[is]={}", limit, item_type);
+    Ok(param)
+}
+
+impl
+    ConnectorIntegration<
+        GetSubscriptionPlans,
+        GetSubscriptionPlansRequest,
+        GetSubscriptionPlansResponse,
+    > for Chargebee
+{
+    fn get_headers(
+        &self,
+        req: &GetSubscriptionPlansRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_url(
+        &self,
+        req: &GetSubscriptionPlansRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        let query_params = get_chargebee_plans_query_params(req)?;
+        let metadata: chargebee::ChargebeeMetadata =
+            utils::to_connector_meta_from_secret(req.connector_meta_data.clone())?;
+        let url = self
+            .base_url(connectors)
+            .to_string()
+            .replace("{{merchant_endpoint_prefix}}", metadata.site.peek());
+        Ok(format!("{url}v2/items{query_params}"))
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn build_request(
+        &self,
+        req: &GetSubscriptionPlansRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Get)
+                .url(&types::GetSubscriptionPlansType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::GetSubscriptionPlansType::get_headers(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &GetSubscriptionPlansRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<GetSubscriptionPlansRouterData, errors::ConnectorError> {
+        let response: ChargebeeListPlansResponse = res
+            .response
+            .parse_struct("chargebee ChargebeeListPlansResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
 #[async_trait::async_trait]
 impl webhooks::IncomingWebhook for Chargebee {
     fn get_webhook_source_verification_signature(
@@ -717,7 +1217,6 @@ impl webhooks::IncomingWebhook for Chargebee {
         Ok(signature_auth == secret_auth)
     }
 
-    #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
     fn get_webhook_object_reference_id(
         &self,
         request: &webhooks::IncomingWebhookRequestDetails<'_>,
@@ -725,18 +1224,28 @@ impl webhooks::IncomingWebhook for Chargebee {
         let webhook =
             chargebee::ChargebeeInvoiceBody::get_invoice_webhook_data_from_body(request.body)
                 .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
-        Ok(api_models::webhooks::ObjectReferenceId::InvoiceId(
-            api_models::webhooks::InvoiceIdType::ConnectorInvoiceId(webhook.content.invoice.id),
-        ))
-    }
-    #[cfg(any(feature = "v1", not(all(feature = "revenue_recovery", feature = "v2"))))]
-    fn get_webhook_object_reference_id(
-        &self,
-        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
-    ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
-        Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+        
+        #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
+        {
+            Ok(api_models::webhooks::ObjectReferenceId::InvoiceId(
+                api_models::webhooks::InvoiceIdType::ConnectorInvoiceId(webhook.content.invoice.id),
+            ))
+        }
+        
+        #[cfg(any(feature = "v1", not(all(feature = "revenue_recovery", feature = "v2"))))]
+        {
+            // For v1 or non-revenue recovery, use subscription ID as object reference
+            // This allows the webhook to be processed without errors
+            let subscription_id = webhook.content.invoice.subscription_id
+                .unwrap_or_else(|| webhook.content.invoice.id.clone());
+            Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+                api_models::payments::PaymentIdType::PaymentIntentId(
+                    common_utils::id_type::PaymentId::wrap(subscription_id)
+                        .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?
+                )
+            ))
+        }
     }
-    #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
     fn get_webhook_event_type(
         &self,
         request: &webhooks::IncomingWebhookRequestDetails<'_>,
@@ -747,13 +1256,6 @@ impl webhooks::IncomingWebhook for Chargebee {
         let event = api_models::webhooks::IncomingWebhookEvent::from(webhook.event_type);
         Ok(event)
     }
-    #[cfg(any(feature = "v1", not(all(feature = "revenue_recovery", feature = "v2"))))]
-    fn get_webhook_event_type(
-        &self,
-        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
-    ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
-        Err(report!(errors::ConnectorError::WebhooksNotImplemented))
-    }
 
     fn get_webhook_resource_object(
         &self,
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index 95f105c67b9..a7a13ea1c1e 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -1,6 +1,3 @@
-#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
-use std::str::FromStr;
-
 use common_enums::enums;
 use common_utils::{errors::CustomResult, ext_traits::ByteSliceExt, pii, types::MinorUnit};
 use error_stack::ResultExt;
@@ -13,16 +10,19 @@ use hyperswitch_domain_models::{
         refunds::{Execute, RSync},
         RecoveryRecordBack,
     },
+    router_request_types::subscriptions::SubscriptionsRecordBackRequest,
     router_request_types::{revenue_recovery::RevenueRecoveryRecordBackRequest, ResponseId},
     router_response_types::{
-        revenue_recovery::RevenueRecoveryRecordBackResponse, PaymentsResponseData,
-        RefundsResponseData,
+        revenue_recovery::RevenueRecoveryRecordBackResponse,
+        subscriptions::GetSubscriptionPlansResponse, PaymentsResponseData, RefundsResponseData,
     },
     types::{PaymentsAuthorizeRouterData, RefundsRouterData, RevenueRecoveryRecordBackRouterData},
 };
 use hyperswitch_interfaces::errors;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
+#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
+use std::str::FromStr;
 use time::PrimitiveDateTime;
 
 use crate::{
@@ -169,6 +169,143 @@ impl<F, T> TryFrom<ResponseRouterData<F, ChargebeePaymentsResponse, T, PaymentsR
     }
 }
 
+// SubscriptionCreate structures
+#[derive(Debug, Serialize)]
+pub struct ChargebeeSubscriptionCreateRequest {
+    #[serde(rename = "subscription_items[item_price_id][0]")]
+    pub item_price_id: String,
+    #[serde(rename = "id")]
+    pub subscription_id: String,
+    #[serde(rename = "subscription_items[quantity][0]")]
+    pub quantity: Option<u32>,
+    #[serde(rename = "billing_address[line1]")]
+    pub billing_address_line1: Option<String>,
+    #[serde(rename = "billing_address[city]")]
+    pub billing_address_city: Option<String>,
+    #[serde(rename = "billing_address[state]")]
+    pub billing_address_state: Option<String>,
+    #[serde(rename = "billing_address[zip]")]
+    pub billing_address_zip: Option<String>,
+    #[serde(rename = "billing_address[country]")]
+    pub billing_address_country: Option<String>,
+    #[serde(rename = "auto_collection")]
+    pub auto_collection: String,
+}
+
+#[cfg(feature = "v1")]
+impl TryFrom<&ChargebeeRouterData<&hyperswitch_domain_models::types::SubscriptionCreateRouterData>>
+    for ChargebeeSubscriptionCreateRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &ChargebeeRouterData<&hyperswitch_domain_models::types::SubscriptionCreateRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let req = &item.router_data.request;
+
+        // Get the first subscription item (assuming at least one exists)
+        let first_item =
+            req.subscription_items
+                .first()
+                .ok_or(errors::ConnectorError::MissingRequiredField {
+                    field_name: "subscription_items",
+                })?;
+
+        Ok(Self {
+            item_price_id: first_item.item_price_id.clone(),
+            subscription_id: req.subscription_id.clone(),
+            quantity: first_item.quantity,
+            billing_address_line1: req
+                .billing_address
+                .address
+                .as_ref()
+                .and_then(|addr| addr.line1.as_ref().map(|line1| line1.clone().expose())),
+            billing_address_city: req
+                .billing_address
+                .address
+                .as_ref()
+                .and_then(|addr| addr.city.clone()),
+            billing_address_state: req
+                .billing_address
+                .address
+                .as_ref()
+                .and_then(|addr| addr.state.as_ref().map(|state| state.clone().expose())),
+            billing_address_zip: req
+                .billing_address
+                .address
+                .as_ref()
+                .and_then(|addr| addr.zip.as_ref().map(|zip| zip.clone().expose())),
+            billing_address_country: req
+                .billing_address
+                .address
+                .as_ref()
+                .and_then(|addr| addr.country.map(|country| country.to_string())),
+            auto_collection: req.auto_collection.clone(),
+        })
+    }
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct ChargebeeSubscriptionCreateResponse {
+    pub subscription: ChargebeeSubscriptionDetails,
+    pub invoice: ChargebeeInvoiceDetails,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct ChargebeeInvoiceDetails {
+    pub id: String,
+    pub subscription_id: String,
+    pub status: String,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct ChargebeeSubscriptionDetails {
+    pub id: String,
+    pub status: String,
+    pub customer_id: String,
+    pub currency_code: enums::Currency,
+    pub total_dues: Option<MinorUnit>,
+    #[serde(default, with = "common_utils::custom_serde::timestamp::option")]
+    pub next_billing_at: Option<PrimitiveDateTime>,
+    #[serde(default, with = "common_utils::custom_serde::timestamp::option")]
+    pub created_at: Option<PrimitiveDateTime>,
+}
+
+#[cfg(feature = "v1")]
+impl TryFrom<
+    ResponseRouterData<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+        ChargebeeSubscriptionCreateResponse,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+        hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+    >,
+> for hyperswitch_domain_models::types::SubscriptionCreateRouterData
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+            ChargebeeSubscriptionCreateResponse,
+            hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+            hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let subscription = &item.response.subscription;
+        let invoice = &item.response.invoice;
+        Ok(Self {
+            response: Ok(hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse {
+                subscription_id: subscription.id.clone(),
+                invoice_id: invoice.id.clone(),
+                status: subscription.status.clone(),
+                customer_id: subscription.customer_id.clone(),
+                currency_code: subscription.currency_code,
+                total_amount: subscription.total_dues.unwrap_or(MinorUnit::new(0)),
+                next_billing_at: subscription.next_billing_at,
+                created_at: subscription.created_at,
+            }),
+            ..item.data
+        })
+    }
+}
 //TODO: Fill the struct with respective fields
 // REFUND :
 // Type definition for RefundRequest
@@ -291,6 +428,7 @@ pub enum ChargebeeEventType {
     PaymentSucceeded,
     PaymentFailed,
     InvoiceDeleted,
+    InvoiceGenerated,
 }
 
 #[derive(Serialize, Deserialize, Debug)]
@@ -301,6 +439,11 @@ pub struct ChargebeeInvoiceData {
     pub currency_code: enums::Currency,
     pub billing_address: Option<ChargebeeInvoiceBillingAddress>,
     pub linked_payments: Option<Vec<ChargebeeInvoicePayments>>,
+    // New fields for invoice_generated webhook
+    pub status: Option<String>,
+    pub customer_id: Option<common_utils::id_type::CustomerId>,
+    pub subscription_id: Option<String>,
+    pub first_invoice: Option<bool>,
 }
 
 #[derive(Serialize, Deserialize, Debug)]
@@ -415,6 +558,36 @@ impl ChargebeeInvoiceBody {
     }
 }
 
+// Structure to extract MIT payment data from invoice_generated webhook
+#[derive(Debug, Clone)]
+pub struct ChargebeeMitPaymentData {
+    pub invoice_id: String,
+    pub amount_due: MinorUnit,
+    pub currency_code: enums::Currency,
+    pub status: String,
+    pub customer_id: Option<common_utils::id_type::CustomerId>,
+    pub subscription_id: Option<String>,
+    pub first_invoice: bool,
+}
+
+impl TryFrom<ChargebeeInvoiceBody> for ChargebeeMitPaymentData {
+    type Error = error_stack::Report<errors::ConnectorError>;
+
+    fn try_from(webhook_body: ChargebeeInvoiceBody) -> Result<Self, Self::Error> {
+        let invoice = webhook_body.content.invoice;
+
+        Ok(Self {
+            invoice_id: invoice.id,
+            amount_due: invoice.total,
+            currency_code: invoice.currency_code,
+            status: invoice.status.unwrap_or_else(|| "payment_due".to_string()),
+            customer_id: invoice.customer_id,
+            subscription_id: invoice.subscription_id,
+            first_invoice: invoice.first_invoice.unwrap_or(false),
+        })
+    }
+}
+
 pub struct ChargebeeMandateDetails {
     pub customer_id: String,
     pub mandate_id: String,
@@ -575,6 +748,18 @@ impl From<ChargebeeEventType> for api_models::webhooks::IncomingWebhookEvent {
             ChargebeeEventType::PaymentSucceeded => Self::RecoveryPaymentSuccess,
             ChargebeeEventType::PaymentFailed => Self::RecoveryPaymentFailure,
             ChargebeeEventType::InvoiceDeleted => Self::RecoveryInvoiceCancel,
+            ChargebeeEventType::InvoiceGenerated => todo!(),
+        }
+    }
+}
+#[cfg(feature = "v1")]
+impl From<ChargebeeEventType> for api_models::webhooks::IncomingWebhookEvent {
+    fn from(event: ChargebeeEventType) -> Self {
+        match event {
+            ChargebeeEventType::PaymentSucceeded => Self::PaymentIntentSuccess,
+            ChargebeeEventType::PaymentFailed => Self::PaymentIntentFailure,
+            ChargebeeEventType::InvoiceDeleted => Self::EventNotSupported,
+            ChargebeeEventType::InvoiceGenerated => Self::InvoiceGenerated,
         }
     }
 }
@@ -734,6 +919,71 @@ impl TryFrom<enums::AttemptStatus> for ChargebeeRecordStatus {
         }
     }
 }
+#[cfg(feature = "v1")]
+impl
+    TryFrom<
+        &ChargebeeRouterData<&hyperswitch_domain_models::types::SubscriptionRecordBackRouterData>,
+    > for ChargebeeRecordPaymentRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &ChargebeeRouterData<
+            &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let req = &item.router_data.request;
+        Ok(Self {
+            amount: req.amount,
+            payment_method: ChargebeeRecordPaymentMethod::Other,
+            connector_payment_id: req
+                .connector_transaction_id
+                .as_ref()
+                .map(|connector_payment_id| connector_payment_id.get_id().to_string()),
+            status: ChargebeeRecordStatus::try_from(req.attempt_status)?,
+        })
+    }
+}
+
+#[cfg(feature = "v1")]
+impl TryFrom<enums::AttemptStatus> for ChargebeeRecordStatus {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(status: enums::AttemptStatus) -> Result<Self, Self::Error> {
+        match status {
+            enums::AttemptStatus::Charged
+            | enums::AttemptStatus::PartialCharged
+            | enums::AttemptStatus::PartialChargedAndChargeable => Ok(Self::Success),
+            enums::AttemptStatus::Failure
+            | enums::AttemptStatus::CaptureFailed
+            | enums::AttemptStatus::RouterDeclined => Ok(Self::Failure),
+            enums::AttemptStatus::AuthenticationFailed
+            | enums::AttemptStatus::Started
+            | enums::AttemptStatus::AuthenticationPending
+            | enums::AttemptStatus::AuthenticationSuccessful
+            | enums::AttemptStatus::Authorized
+            | enums::AttemptStatus::PartiallyAuthorized
+            | enums::AttemptStatus::AuthorizationFailed
+            | enums::AttemptStatus::Authorizing
+            | enums::AttemptStatus::CodInitiated
+            | enums::AttemptStatus::Voided
+            | enums::AttemptStatus::VoidedPostCharge
+            | enums::AttemptStatus::VoidInitiated
+            | enums::AttemptStatus::CaptureInitiated
+            | enums::AttemptStatus::VoidFailed
+            | enums::AttemptStatus::AutoRefunded
+            | enums::AttemptStatus::Unresolved
+            | enums::AttemptStatus::Pending
+            | enums::AttemptStatus::PaymentMethodAwaited
+            | enums::AttemptStatus::ConfirmationAwaited
+            | enums::AttemptStatus::DeviceDataCollectionPending
+            | enums::AttemptStatus::IntegrityFailure
+            | enums::AttemptStatus::Expired => Err(errors::ConnectorError::NotSupported {
+                message: "Record back flow is only supported for terminal status".to_string(),
+                connector: "chargebee",
+            }
+            .into()),
+        }
+    }
+}
 
 #[derive(Debug, Deserialize, Serialize, Clone)]
 pub struct ChargebeeRecordbackResponse {
@@ -773,3 +1023,79 @@ impl
         })
     }
 }
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeeListPlansResponse {
+    pub list: Vec<ChargebeeItemWrapper>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeeItemWrapper {
+    pub item: ChargebeeItem,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChargebeeItem {
+    pub id: String,
+    pub name: String,
+    #[serde(rename = "type")]
+    pub plan_type: String, // to check if new enum is required for this
+    pub is_giftable: bool,
+    pub enabled_for_checkout: bool,
+    pub enabled_in_portal: bool,
+    pub metered: bool,
+    pub deleted: bool,
+    pub description: Option<String>,
+}
+
+impl<F, T>
+    TryFrom<ResponseRouterData<F, ChargebeeListPlansResponse, T, GetSubscriptionPlansResponse>>
+    for RouterData<F, T, GetSubscriptionPlansResponse>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<F, ChargebeeListPlansResponse, T, GetSubscriptionPlansResponse>,
+    ) -> Result<Self, Self::Error> {
+        let plans = item
+            .response
+            .list
+            .into_iter()
+            .map(|wrapper| {
+                hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionPlans {
+                    subscription_provider_plan_id: wrapper.item.id,
+                    name: wrapper.item.name,
+                    description: wrapper.item.description,
+                }
+            })
+            .collect();
+        Ok(Self {
+            response: Ok(GetSubscriptionPlansResponse { list: plans }),
+#[cfg(feature = "v1")]
+impl
+    TryFrom<
+        ResponseRouterData<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            ChargebeeRecordbackResponse,
+            SubscriptionsRecordBackRequest,
+            RevenueRecoveryRecordBackResponse,
+        >,
+    > for hyperswitch_domain_models::types::SubscriptionRecordBackRouterData
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+            ChargebeeRecordbackResponse,
+            SubscriptionsRecordBackRequest,
+            RevenueRecoveryRecordBackResponse,
+        >,
+    ) -> Result<Self, Self::Error> {
+        let merchant_reference_id = item.response.invoice.id;
+        Ok(Self {
+            response: Ok(RevenueRecoveryRecordBackResponse {
+                merchant_reference_id,
+            }),
+            ..item.data
+        })
+    }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index 35b736b844e..baa438b2da6 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -10,8 +10,11 @@ use error_stack::ResultExt;
 use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, ErrorResponse},
     router_data_v2::UasFlowData,
-    router_flow_types::unified_authentication_service::{
-        Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
+    router_flow_types::{
+        unified_authentication_service::{
+            Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
+        },
+        SubscriptionRecordBack,
     },
     router_request_types::unified_authentication_service::{
         UasAuthenticationRequestData, UasAuthenticationResponseData, UasConfirmationRequestData,
@@ -20,12 +23,17 @@ use hyperswitch_domain_models::{
 };
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::{
-    router_data_v2::flow_common_types as recovery_flow_common_types,
     router_flow_types::revenue_recovery as recovery_router_flows,
     router_request_types::revenue_recovery as recovery_request_types,
-    router_response_types::revenue_recovery as recovery_response_types,
     types as recovery_router_data_types,
 };
+use hyperswitch_domain_models::{
+    router_flow_types::subscriptions::SubscriptionCreate,
+    router_data_v2::flow_common_types as recovery_flow_common_types,
+    router_request_types::subscriptions as subscriptions_request_types,
+    router_response_types::subscriptions as subscriptions_response_types,
+    router_response_types::revenue_recovery as recovery_response_types,
+};
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_interfaces::types;
 use hyperswitch_interfaces::{
@@ -131,6 +139,27 @@ impl
 }
 
 impl api::revenue_recovery_v2::RevenueRecoveryV2 for Recurly {}
+impl api::subscriptions_v2::SubscriptionsV2 for Recurly {}
+impl api::subscriptions_v2::SubscriptionsRecordBackV2 for Recurly {}
+impl api::subscriptions_v2::SubscriptionsCreateV2 for Recurly {}
+impl
+    ConnectorIntegrationV2<
+        SubscriptionRecordBack,
+        recovery_flow_common_types::RevenueRecoveryRecordBackData,
+        subscriptions_request_types::SubscriptionsRecordBackRequest,
+        recovery_response_types::RevenueRecoveryRecordBackResponse,
+    > for Recurly
+{
+}
+impl 
+    ConnectorIntegrationV2<
+        SubscriptionCreate,
+        recovery_flow_common_types::SubscriptionCreateData,
+        subscriptions_request_types::SubscriptionCreateRequest,
+        subscriptions_response_types::SubscriptionCreateResponse,
+    > for Recurly
+{
+}
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 impl api::revenue_recovery_v2::RevenueRecoveryRecordBackV2 for Recurly {}
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 8b87e0c098a..f2fa0652afb 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -10,6 +10,13 @@ use common_utils::errors::CustomResult;
 use hyperswitch_domain_models::router_flow_types::{
     BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, RecoveryRecordBack,
 };
+
+use hyperswitch_domain_models::router_flow_types::{
+    SubscriptionRecordBack as SubscriptionRecordBackFlow,
+    SubscriptionCreate as SubscriptionCreateFlow,
+};
+use hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest;
+use hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse;
 #[cfg(feature = "dummy_connector")]
 use hyperswitch_domain_models::router_request_types::authentication::{
     ConnectorAuthenticationRequestData, ConnectorPostAuthenticationRequestData, PreAuthNRequestData,
@@ -19,11 +26,14 @@ use hyperswitch_domain_models::router_request_types::revenue_recovery::{
     BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
     RevenueRecoveryRecordBackRequest,
 };
+
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 use hyperswitch_domain_models::router_response_types::revenue_recovery::{
-    BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
-    RevenueRecoveryRecordBackResponse,
+    BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
 };
+#[cfg(feature = "v1")]
+use hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse;
+
 use hyperswitch_domain_models::{
     router_data::AccessTokenAuthenticationResponse,
     router_flow_types::{
@@ -45,6 +55,7 @@ use hyperswitch_domain_models::{
         ExternalVaultProxy, ExternalVaultRetrieveFlow, PostAuthenticate, PreAuthenticate,
     },
     router_request_types::{
+        subscriptions::SubscriptionsRecordBackRequest,
         authentication,
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
@@ -124,6 +135,7 @@ use hyperswitch_interfaces::{
             PaymentsPreProcessing, TaxCalculation,
         },
         revenue_recovery::RevenueRecovery,
+        subscriptions::{Subscriptions,SubscriptionRecordBack,SubscriptionCreate},
         vault::{
             ExternalVault, ExternalVaultCreate, ExternalVaultDelete, ExternalVaultInsert,
             ExternalVaultRetrieve,
@@ -6333,6 +6345,141 @@ macro_rules! default_imp_for_revenue_recovery {
     };
 }
 
+macro_rules! default_imp_for_subscriptions {
+    ($($path:ident::$connector:ident),*) => {
+        $(  impl Subscriptions for $path::$connector {}
+        )*
+    };
+}
+
+default_imp_for_subscriptions!(
+    connectors::Vgs,
+    connectors::Aci,
+    connectors::Adyen,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bluesnap,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Braintree,
+    connectors::Boku,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Chargebee,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Cybersource,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Hipay,
+    connectors::Helcim,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Netcetera,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Paystack,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Phonepe,
+    connectors::Paypal,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Paybox,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Silverflow,
+    connectors::Signifyd,
+    connectors::Stax,
+    connectors::Stripe,
+    connectors::Square,
+    connectors::Stripebilling,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Volt,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
+
 default_imp_for_revenue_recovery!(
     connectors::Vgs,
     connectors::Aci,
@@ -6894,6 +7041,148 @@ default_imp_for_billing_connector_invoice_sync!(
     connectors::Zsl
 );
 
+#[cfg(feature = "v1")]
+macro_rules! default_imp_for_subscription_record_back {
+    ($($path:ident::$connector:ident),*) => {
+        $( impl SubscriptionRecordBack for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            SubscriptionRecordBackFlow,
+            SubscriptionsRecordBackRequest,
+            RevenueRecoveryRecordBackResponse
+            > for $path::$connector
+            {}
+        )*
+    };
+}
+
+#[cfg(feature = "v1")]
+default_imp_for_subscription_record_back!(
+    connectors::Vgs,
+    connectors::Aci,
+    connectors::Adyen,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bluesnap,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Braintree,
+    connectors::Boku,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Cybersource,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Helcim,
+    connectors::Hipay,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Netcetera,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Paystack,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Phonepe,
+    connectors::Paypal,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Paybox,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Silverflow,
+    connectors::Signifyd,
+    connectors::Stripe,
+    connectors::Stripebilling,
+    connectors::Stax,
+    connectors::Square,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Volt,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
 macro_rules! default_imp_for_external_vault {
     ($($path:ident::$connector:ident),*) => {
         $(
@@ -7888,6 +8177,148 @@ default_imp_for_external_vault_proxy_payments_create!(
     connectors::Zsl,
     connectors::CtpMastercard
 );
+#[cfg(feature = "v1")]
+macro_rules! default_imp_for_subscription_create {
+    ($($path:ident::$connector:ident),*) => {
+        $( impl SubscriptionCreate for $path::$connector {}
+            impl
+            ConnectorIntegration<
+            SubscriptionCreateFlow,
+            SubscriptionCreateRequest,
+            SubscriptionCreateResponse,
+            > for $path::$connector
+            {}
+        )*
+    };
+}
+
+#[cfg(feature = "v1")]
+default_imp_for_subscription_create!(
+    connectors::Vgs,
+    connectors::Aci,
+    connectors::Adyen,
+    connectors::Adyenplatform,
+    connectors::Affirm,
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Archipel,
+    connectors::Authipay,
+    connectors::Authorizedotnet,
+    connectors::Bambora,
+    connectors::Bamboraapac,
+    connectors::Bankofamerica,
+    connectors::Barclaycard,
+    connectors::Billwerk,
+    connectors::Bluesnap,
+    connectors::Bitpay,
+    connectors::Blackhawknetwork,
+    connectors::Bluecode,
+    connectors::Braintree,
+    connectors::Boku,
+    connectors::Breadpay,
+    connectors::Cashtocode,
+    connectors::Celero,
+    connectors::Checkbook,
+    connectors::Checkout,
+    connectors::Coinbase,
+    connectors::Coingate,
+    connectors::Cryptopay,
+    connectors::CtpMastercard,
+    connectors::Custombilling,
+    connectors::Cybersource,
+    connectors::Datatrans,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Dwolla,
+    connectors::Ebanx,
+    connectors::Elavon,
+    connectors::Facilitapay,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Flexiti,
+    connectors::Forte,
+    connectors::Getnet,
+    connectors::Globalpay,
+    connectors::Globepay,
+    connectors::Gocardless,
+    connectors::Gpayments,
+    connectors::Helcim,
+    connectors::Hipay,
+    connectors::HyperswitchVault,
+    connectors::Hyperwallet,
+    connectors::Iatapay,
+    connectors::Inespay,
+    connectors::Itaubank,
+    connectors::Jpmorgan,
+    connectors::Juspaythreedsserver,
+    connectors::Katapult,
+    connectors::Klarna,
+    connectors::Netcetera,
+    connectors::Nmi,
+    connectors::Nomupay,
+    connectors::Noon,
+    connectors::Nordea,
+    connectors::Novalnet,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nuvei,
+    connectors::Opayo,
+    connectors::Opennode,
+    connectors::Payeezy,
+    connectors::Payload,
+    connectors::Paystack,
+    connectors::Paytm,
+    connectors::Payu,
+    connectors::Phonepe,
+    connectors::Paypal,
+    connectors::Powertranz,
+    connectors::Prophetpay,
+    connectors::Mifinity,
+    connectors::Mollie,
+    connectors::Moneris,
+    connectors::Mpgs,
+    connectors::Multisafepay,
+    connectors::Paybox,
+    connectors::Payme,
+    connectors::Payone,
+    connectors::Placetopay,
+    connectors::Plaid,
+    connectors::Rapyd,
+    connectors::Razorpay,
+    connectors::Recurly,
+    connectors::Redsys,
+    connectors::Riskified,
+    connectors::Santander,
+    connectors::Shift4,
+    connectors::Sift,
+    connectors::Silverflow,
+    connectors::Signifyd,
+    connectors::Stripe,
+    connectors::Stripebilling,
+    connectors::Stax,
+    connectors::Square,
+    connectors::Taxjar,
+    connectors::Threedsecureio,
+    connectors::Thunes,
+    connectors::Tokenio,
+    connectors::Trustpay,
+    connectors::Trustpayments,
+    connectors::Tsys,
+    connectors::UnifiedAuthenticationService,
+    connectors::Wise,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Worldpayvantiv,
+    connectors::Worldpayxml,
+    connectors::Wellsfargo,
+    connectors::Wellsfargopayout,
+    connectors::Volt,
+    connectors::Xendit,
+    connectors::Zen,
+    connectors::Zsl
+);
 
 #[cfg(feature = "dummy_connector")]
 impl<const T: u8> PaymentsCompleteAuthorize for connectors::DummyConnector<T> {}
@@ -8333,6 +8764,36 @@ impl<const T: u8>
 #[cfg(feature = "dummy_connector")]
 impl<const T: u8> RevenueRecovery for connectors::DummyConnector<T> {}
 
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> SubscriptionRecordBack for connectors::DummyConnector<T> {}
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+    ConnectorIntegration<
+        SubscriptionRecordBackFlow,
+        SubscriptionsRecordBackRequest,
+        RevenueRecoveryRecordBackResponse,
+    > for connectors::DummyConnector<T>
+{
+}
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> SubscriptionCreate for connectors::DummyConnector<T> {}
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+    ConnectorIntegration<
+        SubscriptionCreateFlow,
+        SubscriptionCreateRequest,
+        SubscriptionCreateResponse,
+    > for connectors::DummyConnector<T>
+{
+}
+
+
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8> Subscriptions for connectors::DummyConnector<T> {}
+
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
 #[cfg(feature = "dummy_connector")]
 impl<const T: u8> api::revenue_recovery::BillingConnectorPaymentsSyncIntegration
diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs
index 0fa3d5b4e07..f94ee594fd1 100644
--- a/crates/hyperswitch_domain_models/src/payment_methods.rs
+++ b/crates/hyperswitch_domain_models/src/payment_methods.rs
@@ -863,6 +863,12 @@ pub trait PaymentMethodInterface {
         merchant_id: &id_type::MerchantId,
         payment_method_id: &str,
     ) -> CustomResult<PaymentMethod, Self::Error>;
+
+    #[cfg(feature = "v1")]
+    async fn find_payment_method_ids_by_billing_connector_subscription_id(
+        &self,
+        subscription_id: &str,
+    ) -> CustomResult<Vec<String>, Self::Error>;
 }
 
 #[cfg(feature = "v2")]
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 58a859acbca..b69119f46f6 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -123,6 +123,7 @@ pub struct PaymentIntent {
     pub shipping_amount_tax: Option<MinorUnit>,
     pub duty_amount: Option<MinorUnit>,
     pub enable_partial_authorization: Option<bool>,
+    pub billing_processor_details: Option<api_models::payments::BillingConnectorDetails>,
 }
 
 impl PaymentIntent {
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 8dbdd1761bf..f9969604119 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -2105,6 +2105,9 @@ impl behaviour::Conversion for PaymentIntent {
             shipping_amount_tax: self.shipping_amount_tax,
             duty_amount: self.duty_amount,
             enable_partial_authorization: self.enable_partial_authorization,
+            billing_processor_details: self
+                .billing_processor_details
+                .and_then(|details| serde_json::to_value(details).ok()),
         })
     }
 
@@ -2213,6 +2216,9 @@ impl behaviour::Conversion for PaymentIntent {
                 duty_amount: storage_model.duty_amount,
                 order_date: storage_model.order_date,
                 enable_partial_authorization: storage_model.enable_partial_authorization,
+                billing_processor_details: storage_model
+                    .billing_processor_details
+                    .and_then(|details| serde_json::from_value(details).ok()),
             })
         }
         .await
@@ -2293,6 +2299,9 @@ impl behaviour::Conversion for PaymentIntent {
             shipping_amount_tax: self.shipping_amount_tax,
             duty_amount: self.duty_amount,
             enable_partial_authorization: self.enable_partial_authorization,
+            billing_processor_details: self
+                .billing_processor_details
+                .and_then(|details| serde_json::to_value(details).ok()),
         })
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 686912c6dca..0e0bb848eb1 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -150,6 +150,9 @@ pub struct FilesFlowData {
 #[derive(Debug, Clone)]
 pub struct RevenueRecoveryRecordBackData;
 
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateData;
+
 #[derive(Debug, Clone)]
 pub struct UasFlowData {
     pub authenticate_by: String,
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types.rs b/crates/hyperswitch_domain_models/src/router_flow_types.rs
index 887babd5fca..5778148c8e5 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types.rs
@@ -8,6 +8,8 @@ pub mod payments;
 pub mod payouts;
 pub mod refunds;
 pub mod revenue_recovery;
+// #[cfg(feature = "v1")]
+pub mod subscriptions;
 pub mod unified_authentication_service;
 pub mod vault;
 pub mod webhooks;
@@ -20,6 +22,8 @@ pub use payments::*;
 pub use payouts::*;
 pub use refunds::*;
 pub use revenue_recovery::*;
+// #[cfg(feature = "v1")]
+pub use subscriptions::*;
 pub use unified_authentication_service::*;
 pub use vault::*;
 pub use webhooks::*;
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
new file mode 100644
index 00000000000..2c147a3d4ae
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
@@ -0,0 +1,9 @@
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionPlans;
+//! Subscriptions flow types for V1
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionRecordBack;
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreate;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index a9a842dcfd5..fe61b589b0e 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -1,7 +1,9 @@
 pub mod authentication;
 pub mod fraud_check;
 pub mod revenue_recovery;
+pub mod subscriptions;
 pub mod unified_authentication_service;
+pub mod subscriptions;
 use api_models::payments::{AdditionalPaymentData, RequestSurchargeDetails};
 use common_types::payments as common_payments_types;
 use common_utils::{consts, errors, ext_traits::OptionExt, id_type, pii, types::MinorUnit};
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
new file mode 100644
index 00000000000..d84782b52f1
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/router_request_types/subscriptions.rs
@@ -0,0 +1,33 @@
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionPlansRequest;
+use api_models::payments::Address;
+use common_enums::enums;
+
+use crate::connector_endpoints;
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionsRecordBackRequest {
+    pub merchant_reference_id: String,
+    pub amount: common_utils::types::MinorUnit,
+    pub currency: enums::Currency,
+    pub payment_method_type: Option<common_enums::PaymentMethodType>,
+    pub attempt_status: common_enums::AttemptStatus,
+    pub connector_transaction_id: Option<common_utils::types::ConnectorTransactionId>,
+    pub connector_params: connector_endpoints::ConnectorParams,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionItem {
+    pub item_price_id: String,
+    pub quantity: Option<u32>,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateRequest {
+    pub customer_id: String,
+    pub subscription_id: String,
+    pub subscription_items: Vec<SubscriptionItem>,
+    pub billing_address: Address,
+    pub auto_collection: String,
+    pub connector_params: connector_endpoints::ConnectorParams,
+}
diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs
index 17c268fb60c..cc766a00ba8 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types.rs
@@ -1,6 +1,7 @@
 pub mod disputes;
 pub mod fraud_check;
 pub mod revenue_recovery;
+pub mod subscriptions;
 use std::collections::HashMap;
 
 use common_utils::{pii, request::Method, types::MinorUnit};
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
new file mode 100644
index 00000000000..a6bfcfe68fe
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/router_response_types/subscriptions.rs
@@ -0,0 +1,25 @@
+#[derive(Debug, Clone)]
+pub struct GetSubscriptionPlansResponse {
+    pub list: Vec<SubscriptionPlans>,
+}
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionPlans {
+    pub subscription_provider_plan_id: String,
+    pub name: String,
+    pub description: Option<String>,
+use common_enums::enums;
+use common_utils::types::MinorUnit;
+use time::PrimitiveDateTime;
+
+#[derive(Debug, Clone)]
+pub struct SubscriptionCreateResponse {
+    pub subscription_id: String,
+    pub invoice_id: String,
+    pub status: String,
+    pub customer_id: String,
+    pub currency_code: enums::Currency,
+    pub total_amount: MinorUnit,
+    pub next_billing_at: Option<PrimitiveDateTime>,
+    pub created_at: Option<PrimitiveDateTime>,
+}
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index bcca0ba12a9..43d200d68ee 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -4,19 +4,22 @@ use crate::{
     router_data::{AccessToken, AccessTokenAuthenticationResponse, RouterData},
     router_data_v2::{self, RouterDataV2},
     router_flow_types::{
-        mandate_revoke::MandateRevoke, revenue_recovery::RecoveryRecordBack, AccessTokenAuth,
-        AccessTokenAuthentication, Authenticate, AuthenticationConfirmation, Authorize,
-        AuthorizeSessionToken, BillingConnectorInvoiceSync, BillingConnectorPaymentsSync,
-        CalculateTax, Capture, CompleteAuthorize, CreateConnectorCustomer, CreateOrder, Execute,
-        ExternalVaultProxy, IncrementalAuthorization, PSync, PaymentMethodToken, PostAuthenticate,
-        PostCaptureVoid, PostSessionTokens, PreAuthenticate, PreProcessing, RSync,
-        SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,
+        mandate_revoke::MandateRevoke, revenue_recovery::RecoveryRecordBack,
+        subscriptions::GetSubscriptionPlans, AccessTokenAuth, AccessTokenAuthentication,
+        Authenticate, AuthenticationConfirmation, Authorize, AuthorizeSessionToken,
+        BillingConnectorInvoiceSync, BillingConnectorPaymentsSync, CalculateTax, Capture,
+        CompleteAuthorize, CreateConnectorCustomer, CreateOrder, Execute, ExternalVaultProxy,
+        IncrementalAuthorization, PSync, PaymentMethodToken, PostAuthenticate, PostCaptureVoid,
+        PostSessionTokens, PreAuthenticate, PreProcessing, RSync, SdkSessionUpdate, Session,
+        SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,
     },
     router_request_types::{
         revenue_recovery::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
             RevenueRecoveryRecordBackRequest,
         },
+        subscriptions::GetSubscriptionPlansRequest,
+        subscriptions::{SubscriptionsRecordBackRequest, SubscriptionCreateRequest},
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -37,6 +40,8 @@ use crate::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
             RevenueRecoveryRecordBackResponse,
         },
+        subscriptions::GetSubscriptionPlansResponse,
+        subscriptions::SubscriptionCreateResponse,
         MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData,
         TaxCalculationResponseData, VaultResponseData, VerifyWebhookSourceResponseData,
     },
@@ -44,6 +49,9 @@ use crate::{
 #[cfg(feature = "payouts")]
 pub use crate::{router_request_types::PayoutsData, router_response_types::PayoutsResponseData};
 
+#[cfg(feature = "v1")]
+use crate::router_flow_types::subscriptions::{SubscriptionRecordBack, SubscriptionCreate};
+
 pub type PaymentsAuthorizeRouterData =
     RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData>;
 pub type ExternalVaultProxyPaymentsRouterData =
@@ -120,6 +128,9 @@ pub type RevenueRecoveryRecordBackRouterData = RouterData<
     RevenueRecoveryRecordBackResponse,
 >;
 
+pub type GetSubscriptionPlansRouterData =
+    RouterData<GetSubscriptionPlans, GetSubscriptionPlansRequest, GetSubscriptionPlansResponse>;
+
 pub type UasAuthenticationRouterData =
     RouterData<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>;
 
@@ -171,3 +182,17 @@ pub type ExternalVaultProxyPaymentsRouterDataV2 = RouterDataV2<
     ExternalVaultProxyPaymentsData,
     PaymentsResponseData,
 >;
+
+#[cfg(feature = "v1")]
+pub type SubscriptionRecordBackRouterData = RouterData<
+    SubscriptionRecordBack,
+    SubscriptionsRecordBackRequest,
+    RevenueRecoveryRecordBackResponse,
+>;
+
+#[cfg(feature = "v1")]
+pub type SubscriptionCreateRouterData = RouterData<
+    SubscriptionCreate,
+    SubscriptionCreateRequest,
+    SubscriptionCreateResponse,
+>;
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index c4d427a8f9a..013473ed7f7 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -22,6 +22,8 @@ pub mod refunds;
 pub mod refunds_v2;
 pub mod revenue_recovery;
 pub mod revenue_recovery_v2;
+pub mod subscriptions_v2;
+pub mod subscriptions;
 pub mod vault;
 pub mod vault_v2;
 
@@ -104,6 +106,7 @@ pub trait Connector:
     + UnifiedAuthenticationService
     + revenue_recovery::RevenueRecovery
     + ExternalVault
+    + subscriptions::Subscriptions
 {
 }
 
@@ -126,7 +129,8 @@ impl<
             + TaxCalculation
             + UnifiedAuthenticationService
             + revenue_recovery::RevenueRecovery
-            + ExternalVault,
+            + ExternalVault
+            + subscriptions::Subscriptions,
     > Connector for T
 {
 }
diff --git a/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs b/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
index 053d3cdde35..2041dbd73df 100644
--- a/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
+++ b/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
@@ -13,9 +13,8 @@ use hyperswitch_domain_models::{
         RevenueRecoveryRecordBackResponse,
     },
 };
-
 #[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-use super::ConnectorCommon;
+ use crate::api::ConnectorCommon;
 use super::ConnectorIntegration;
 
 /// trait RevenueRecovery
@@ -28,6 +27,7 @@ pub trait RevenueRecovery:
 {
 }
 
+
 /// trait BillingConnectorPaymentsSyncIntegration
 pub trait BillingConnectorPaymentsSyncIntegration:
     ConnectorIntegration<
@@ -48,6 +48,8 @@ pub trait RevenueRecoveryRecordBack:
 {
 }
 
+
+
 /// trait BillingConnectorInvoiceSyncIntegration
 pub trait BillingConnectorInvoiceSyncIntegration:
     ConnectorIntegration<
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions.rs b/crates/hyperswitch_interfaces/src/api/subscriptions.rs
new file mode 100644
index 00000000000..ce9c3e7ab0a
--- /dev/null
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions.rs
@@ -0,0 +1,57 @@
+//! Subscriptions Interface for V1
+
+use hyperswitch_domain_models::{
+    router_flow_types::subscriptions::{
+        SubscriptionRecordBack as SubscriptionRecordBackFlow,
+        SubscriptionCreate as SubscriptionCreateFlow,
+    },
+    router_request_types::subscriptions::{SubscriptionsRecordBackRequest, SubscriptionCreateRequest},
+    router_response_types::{
+        revenue_recovery::RevenueRecoveryRecordBackResponse,
+        subscriptions::SubscriptionCreateResponse,
+    },
+};
+
+use super::{ConnectorCommon, ConnectorIntegration};
+
+#[cfg(feature = "v1")]
+/// trait SubscriptionRecordBack for V1
+pub trait SubscriptionRecordBack:
+    ConnectorIntegration<
+        SubscriptionRecordBackFlow,
+        SubscriptionsRecordBackRequest,
+        RevenueRecoveryRecordBackResponse,
+    >
+{
+}
+
+#[cfg(feature = "v1")]
+/// trait SubscriptionCreate for V1
+pub trait SubscriptionCreate:
+    ConnectorIntegration<
+        SubscriptionCreateFlow,
+        SubscriptionCreateRequest,
+        SubscriptionCreateResponse,
+    >
+{
+}
+
+/// trait Subscriptions 
+#[cfg(feature = "v1")]
+pub trait Subscriptions:
+    ConnectorCommon
+    + SubscriptionRecordBack
+    + SubscriptionCreate
+{
+}
+
+#[cfg(not(feature = "v1"))]
+/// trait SubscriptionRecordBack (disabled when not V1)
+pub trait SubscriptionRecordBack {}
+
+/// trait Subscriptions (disabled when not V1)
+#[cfg(not(feature = "v1"))]
+pub trait Subscriptions {}
+
+#[cfg(not(feature = "v1"))]
+pub trait SubscriptionCreate {}
diff --git a/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
new file mode 100644
index 00000000000..fdad445be07
--- /dev/null
+++ b/crates/hyperswitch_interfaces/src/api/subscriptions_v2.rs
@@ -0,0 +1,43 @@
+//! SubscriptionsV2
+use hyperswitch_domain_models::{
+    router_data_v2::flow_common_types::{
+        RevenueRecoveryRecordBackData, SubscriptionCreateData,
+    },
+    router_flow_types::{
+        SubscriptionCreate, SubscriptionRecordBack,
+    },
+    router_request_types::subscriptions::{
+        SubscriptionCreateRequest, SubscriptionsRecordBackRequest,
+    },
+    router_response_types::{
+        revenue_recovery::RevenueRecoveryRecordBackResponse,
+        subscriptions::SubscriptionCreateResponse,
+    },
+};
+
+use crate::connector_integration_v2::ConnectorIntegrationV2;
+
+/// trait SubscriptionsV2
+pub trait SubscriptionsV2: SubscriptionsRecordBackV2 + SubscriptionsCreateV2 {}
+
+/// trait SubscriptionsRecordBackV2
+pub trait SubscriptionsRecordBackV2:
+    ConnectorIntegrationV2<
+    SubscriptionRecordBack,
+    RevenueRecoveryRecordBackData,
+    SubscriptionsRecordBackRequest,
+    RevenueRecoveryRecordBackResponse,
+>
+{
+}
+
+/// trait SubscriptionsCreateV2
+pub trait SubscriptionsCreateV2:
+    ConnectorIntegrationV2<
+    SubscriptionCreate,
+    SubscriptionCreateData,
+    SubscriptionCreateRequest,
+    SubscriptionCreateResponse,
+>
+{
+}
diff --git a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
index aa4bc72f610..73df8a76611 100644
--- a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
+++ b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
@@ -35,6 +35,7 @@ pub trait ConnectorV2:
     + api::UnifiedAuthenticationServiceV2
     + api::revenue_recovery_v2::RevenueRecoveryV2
     + api::ExternalVaultV2
+    + api::subscriptions_v2::SubscriptionsV2
 {
 }
 impl<
@@ -55,7 +56,8 @@ impl<
             + api::authentication_v2::ExternalAuthenticationV2
             + api::UnifiedAuthenticationServiceV2
             + api::revenue_recovery_v2::RevenueRecoveryV2
-            + api::ExternalVaultV2,
+            + api::ExternalVaultV2
+            + api::subscriptions_v2::SubscriptionsV2,
     > ConnectorV2 for T
 {
 }
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 23fb9e76bcd..b9fe040f97c 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -12,7 +12,7 @@ use hyperswitch_domain_models::{
             AccessTokenFlowData, AuthenticationTokenFlowData, BillingConnectorInvoiceSyncFlowData,
             BillingConnectorPaymentsSyncFlowData, DisputesFlowData, ExternalAuthenticationFlowData,
             ExternalVaultProxyFlowData, FilesFlowData, MandateRevokeFlowData, PaymentFlowData,
-            RefundFlowData, RevenueRecoveryRecordBackData, UasFlowData, VaultConnectorFlowData,
+            RefundFlowData, RevenueRecoveryRecordBackData, SubscriptionCreateData, UasFlowData, VaultConnectorFlowData,
             WebhookSourceVerifyData,
         },
         RouterDataV2,
@@ -798,6 +798,46 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
     }
 }
 
+impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
+    for SubscriptionCreateData
+{
+    fn from_old_router_data(
+        old_router_data: &RouterData<T, Req, Resp>,
+    ) -> CustomResult<RouterDataV2<T, Self, Req, Resp>, ConnectorError>
+    where
+        Self: Sized,
+    {
+        let resource_common_data = Self {};
+        Ok(RouterDataV2 {
+            flow: std::marker::PhantomData,
+            tenant_id: old_router_data.tenant_id.clone(),
+            resource_common_data,
+            connector_auth_type: old_router_data.connector_auth_type.clone(),
+            request: old_router_data.request.clone(),
+            response: old_router_data.response.clone(),
+        })
+    }
+
+    fn to_old_router_data(
+        new_router_data: RouterDataV2<T, Self, Req, Resp>,
+    ) -> CustomResult<RouterData<T, Req, Resp>, ConnectorError>
+    where
+        Self: Sized,
+    {
+        let router_data = get_default_router_data(
+            new_router_data.tenant_id.clone(),
+            "subscription_create",
+            new_router_data.request,
+            new_router_data.response,
+        );
+        Ok(RouterData {
+            connector_auth_type: new_router_data.connector_auth_type.clone(),
+            ..router_data
+        })
+    }
+}
+
+
 impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowData {
     fn from_old_router_data(
         old_router_data: &RouterData<T, Req, Resp>,
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index eed89fe00ba..b74eb51d297 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -16,6 +16,7 @@ use hyperswitch_domain_models::{
         },
         refunds::{Execute, RSync},
         revenue_recovery::{BillingConnectorPaymentsSync, RecoveryRecordBack},
+        subscriptions::GetSubscriptionPlans,
         unified_authentication_service::{
             Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
         },
@@ -31,6 +32,8 @@ use hyperswitch_domain_models::{
             BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
             RevenueRecoveryRecordBackRequest,
         },
+        subscriptions::GetSubscriptionPlansRequest,
+        subscriptions::{SubscriptionsRecordBackRequest, SubscriptionCreateRequest},
         unified_authentication_service::{
             UasAuthenticationRequestData, UasAuthenticationResponseData,
             UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -53,6 +56,7 @@ use hyperswitch_domain_models::{
             BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
             RevenueRecoveryRecordBackResponse,
         },
+        subscriptions::GetSubscriptionPlansResponse,
         AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
         MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData, RetrieveFileResponse,
         SubmitEvidenceResponse, TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
@@ -271,6 +275,22 @@ pub type RevenueRecoveryRecordBackType = dyn ConnectorIntegration<
     RevenueRecoveryRecordBackResponse,
 >;
 
+#[cfg(feature = "v1")]
+/// Type alias for `ConnectorIntegration<SubscriptionRecordBack, SubscriptionsRecordBackRequest, RevenueRecoveryRecordBackResponse>`
+pub type SubscriptionRecordBackType = dyn ConnectorIntegration<
+    hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+    SubscriptionsRecordBackRequest,
+    RevenueRecoveryRecordBackResponse,
+>;
+
+#[cfg(feature = "v1")]
+/// Type alias for `ConnectorIntegration<SubscriptionCreate, SubscriptionCreateRequest, SubscriptionCreateResponse>`
+pub type SubscriptionCreateType = dyn ConnectorIntegration<
+    hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+    SubscriptionCreateRequest,
+    hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+>;
+
 /// Type alias for `ConnectorIntegration<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
 pub type BillingConnectorPaymentsSyncType = dyn ConnectorIntegration<
     BillingConnectorPaymentsSync,
@@ -309,6 +329,29 @@ pub type BillingConnectorInvoiceSyncTypeV2 = dyn ConnectorIntegrationV2<
     BillingConnectorInvoiceSyncResponse,
 >;
 
+/// Type alias for `ConnectorIntegration<GetSubscriptionPlans, GetSubscriptionPlansRequest, GetSubscriptionPlansResponse>`
+pub type GetSubscriptionPlansType = dyn ConnectorIntegration<
+    GetSubscriptionPlans,
+    GetSubscriptionPlansRequest,
+    GetSubscriptionPlansResponse,
+#[cfg(feature = "v1")]
+/// Type alias for `ConnectorIntegrationV2<SubscriptionRecordBack, SubscriptionCreateData, SubscriptionsRecordBackRequest, RevenueRecoveryRecordBackResponse>`
+pub type SubscriptionRecordBackTypeV2 = dyn ConnectorIntegrationV2<
+    hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+    flow_common_types::SubscriptionCreateData,
+    SubscriptionsRecordBackRequest,
+    RevenueRecoveryRecordBackResponse,
+>;
+
+#[cfg(feature = "v1")]
+/// Type alias for `ConnectorIntegrationV2<SubscriptionCreate, SubscriptionCreateData, SubscriptionCreateRequest, SubscriptionCreateResponse>`
+pub type SubscriptionCreateTypeV2 = dyn ConnectorIntegrationV2<
+    hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+    flow_common_types::SubscriptionCreateData,
+    SubscriptionCreateRequest,
+    hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+>;
+
 /// Type alias for `ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>`
 pub type ExternalVaultInsertType =
     dyn ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>;
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index 492c07e5ab9..b5948c79b5a 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -330,6 +330,9 @@ impl ProcessTrackerWorkflows<routes::SessionState> for WorkflowRunner {
                 storage::ProcessTrackerRunner::PassiveRecoveryWorkflow => {
                     Ok(Box::new(workflows::revenue_recovery::ExecutePcrWorkflow))
                 }
+                storage::ProcessTrackerRunner::SubscriptionsWorkflow => Ok(Box::new(
+                    workflows::subscription::ExecuteSubscriptionWorkflow,
+                )),
             }
         };
 
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index 0fe3e57f872..fbfa0e6c56c 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -49,6 +49,8 @@ pub mod refunds_v2;
 #[cfg(feature = "v1")]
 pub mod debit_routing;
 pub mod routing;
+#[cfg(feature = "v1")]
+pub mod subscription;
 pub mod surcharge_decision_config;
 pub mod three_ds_decision_rule;
 #[cfg(feature = "olap")]
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index d4bf2c455d0..f21026c64b2 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -98,7 +98,7 @@ use crate::{
     },
 };
 #[cfg(feature = "v2")]
-use crate::{core::admin as core_admin, headers, types::ConnectorAuthType};
+use crate::{core::admin as core_admin, headers};
 #[cfg(feature = "v1")]
 use crate::{
     core::payment_methods::cards::create_encrypted_data, types::storage::CustomerUpdate::Update,
@@ -3899,6 +3899,7 @@ mod tests {
             shipping_amount_tax: None,
             duty_amount: None,
             enable_partial_authorization: None,
+            billing_processor_details: None,
         };
         let req_cs = Some("1".to_string());
         assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());
@@ -3983,6 +3984,7 @@ mod tests {
             shipping_amount_tax: None,
             duty_amount: None,
             enable_partial_authorization: None,
+            billing_processor_details: None,
         };
         let req_cs = Some("1".to_string());
         assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())
@@ -4065,6 +4067,7 @@ mod tests {
             shipping_amount_tax: None,
             duty_amount: None,
             enable_partial_authorization: None,
+            billing_processor_details: None,
         };
         let req_cs = Some("1".to_string());
         assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())
@@ -7675,3 +7678,233 @@ pub async fn get_merchant_connector_account_v2(
         .attach_printable("merchant_connector_id is not provided"),
     }
 }
+#[cfg(feature = "v1")]
+pub fn create_subscription_router_data<F, Req, Res>(
+    state: &SessionState,
+    merchant_id: id_type::MerchantId,
+    customer_id: Option<id_type::CustomerId>,
+    connector_name: String,
+    auth_type: hyperswitch_domain_models::router_data::ConnectorAuthType,
+    request: Req,
+    payment_id: Option<id_type::PaymentId>,
+) -> CustomResult<RouterData<F, Req, Res>, errors::ApiErrorResponse>
+where
+    F: Clone,
+{
+    // Placeholder for future implementation
+
+    Ok(RouterData {
+        flow: std::marker::PhantomData,
+        merchant_id,
+        customer_id,
+        connector_customer: None,
+        connector: connector_name,
+        payment_id: payment_id
+            .map(|id| id.get_string_repr().to_owned())
+            .unwrap_or("DefaultPaymentId".to_string()),
+        tenant_id: state.tenant.tenant_id.clone(),
+        attempt_id: "Subscriptions attempt".to_owned(),
+        status: common_enums::AttemptStatus::default(),
+        payment_method: common_enums::PaymentMethod::default(),
+        connector_auth_type: auth_type,
+        description: None,
+        address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
+        auth_type: common_enums::AuthenticationType::default(),
+        connector_meta_data: None,
+        connector_wallets_details: None,
+        amount_captured: None,
+        minor_amount_captured: None,
+        access_token: None,
+        session_token: None,
+        reference_id: None,
+        payment_method_token: None,
+        recurring_mandate_payment_data: None,
+        preprocessing_id: None,
+        payment_method_balance: None,
+        connector_api_version: None,
+        request,
+        response: Err(ErrorResponse::default()),
+        connector_request_reference_id: "Notjing".to_owned(),
+        #[cfg(feature = "payouts")]
+        payout_method_data: None,
+        #[cfg(feature = "payouts")]
+        quote_id: None,
+        test_mode: None,
+        connector_http_status_code: None,
+        external_latency: None,
+        apple_pay_flow: None,
+        frm_metadata: None,
+        dispute_id: None,
+        refund_id: None,
+        payment_method_status: None,
+        connector_response: None,
+        integrity_check: Ok(()),
+        additional_merchant_data: None,
+        header_payload: None,
+        connector_mandate_request_reference_id: None,
+        authentication_id: None,
+        psd2_sca_exemption_type: None,
+        raw_connector_response: None,
+        is_payment_id_from_merchant: None,
+        l2_l3_data: None,
+        minor_amount_capturable: None,
+    })
+}
+#[cfg(feature = "v1")]
+pub async fn perform_billing_processor_record_back<F, D>(
+    state: &SessionState,
+    payment_data: &mut D,
+    key_store: &domain::MerchantKeyStore,
+) -> CustomResult<(), errors::ApiErrorResponse>
+where
+    F: Clone,
+    D: payments::OperationSessionGetters<F> + payments::OperationSessionSetters<F> + Send,
+{
+    logger::info!("perform_billing_processor_record_back");
+    let billing_processor_detail = payment_data
+        .get_payment_intent()
+        .billing_processor_details
+        .clone();
+    let attempt_status = payment_data.get_payment_attempt().status;
+    logger::info!("attempt_status is {:?}", attempt_status);
+
+    if billing_processor_detail.is_none() || !attempt_status.is_success() {
+        return Ok(());
+    }
+
+    let billing_processor_detail =
+        billing_processor_detail.ok_or(errors::ApiErrorResponse::GenericNotFoundError {
+            message: "billing_processor_detail not found in payment".to_string(),
+        })?;
+
+    let merchant_id = &payment_data.get_payment_intent().merchant_id;
+    let customer_id = payment_data
+        .get_payment_intent()
+        .customer_id
+        .clone()
+        .ok_or(errors::ApiErrorResponse::MissingRequiredField {
+            field_name: "customer_id",
+        })?;
+
+    let db = &*state.store;
+
+    // Fetch Subscriptions record from DB
+    db.find_by_merchant_id_subscription_id(
+        merchant_id,
+        billing_processor_detail.subscription_id.clone(),
+    )
+    .await
+    .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+        message: format!(
+            "subscription not found for id: {}",
+            &billing_processor_detail.subscription_id
+        ),
+    })?;
+
+    // Fetch billing processor mca
+    let mca_id = billing_processor_detail.processor_mca.to_owned();
+    let billing_processor_mca = db
+        .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
+            &state.into(),
+            &payment_data.get_payment_intent().merchant_id,
+            &mca_id,
+            key_store,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+            id: mca_id.get_string_repr().to_string(),
+        })?;
+
+    // Record back to billing processor
+
+    let auth_type = MerchantConnectorAccountType::DbVal(Box::new(billing_processor_mca.clone()))
+        .get_connector_account_details()
+        .parse_value("ConnectorAuthType")
+        .change_context(errors::ApiErrorResponse::InternalServerError)?;
+
+    let connector = &billing_processor_mca.connector_name;
+
+    let connector_data = api::ConnectorData::get_connector_by_name(
+        &state.conf.connectors,
+        &billing_processor_mca.connector_name,
+        api::GetToken::Connector,
+        Some(billing_processor_mca.get_id()),
+    )
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("invalid connector name received in billing merchant connector account")?;
+
+    let connector_enum = common_enums::connector_enums::Connector::from_str(connector.as_str())
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Cannot find connector from the connector_name")?;
+
+    let connector_params =
+        hyperswitch_domain_models::connector_endpoints::Connectors::get_connector_params(
+            &state.conf.connectors,
+            connector_enum,
+        )
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable(format!(
+            "cannot find connector params for this connector {connector} in this flow",
+        ))?;
+
+    let connector_integration: services::BoxedRevenueRecoveryRecordBackInterface<
+                        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+                        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+                        hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+                    > = connector_data.connector.get_connector_integration();
+
+    // let connector_integration_for_create_subscription: services::BoxedSubscriptionConnectorIntegrationInterface<
+    //                     hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+    //                     hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+    //                     hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+    //                 > = connector_data.connector.get_connector_integration();
+
+    let request = hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest {
+        merchant_reference_id: billing_processor_detail.invoice_id.clone(),
+        amount: payment_data.get_payment_attempt().get_total_amount(),
+        currency: payment_data
+            .get_payment_intent()
+            .currency
+            .unwrap_or(common_enums::Currency::USD),
+        payment_method_type: payment_data.get_payment_attempt().payment_method_type,
+
+        attempt_status: payment_data.get_payment_attempt().status,
+        connector_transaction_id: payment_data
+            .get_payment_attempt()
+            .connector_transaction_id
+            .clone()
+            .map(|id| common_utils::types::ConnectorTransactionId::TxnId(id)),
+        connector_params,
+    };
+
+    let router_data = create_subscription_router_data::<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionsRecordBackRequest,
+        hyperswitch_domain_models::router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
+    >(
+        state,
+        merchant_id.clone(),
+        Some(customer_id),
+        connector.clone(),
+        auth_type,
+        request,
+        Some(payment_data
+            .get_payment_intent()
+            .payment_id
+            .to_owned())
+    )?;
+
+    services::execute_connector_processing_step(
+        state,
+        connector_integration,
+        &router_data,
+        common_enums::CallConnectorAction::Trigger,
+        None,
+        None,
+    )
+    .await
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed while handling response of record back to billing connector")?;
+
+    Ok(())
+}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 79bfbebf499..09f09a98837 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1630,6 +1630,7 @@ impl PaymentCreate {
             tax_status: request.tax_status,
             shipping_amount_tax: request.shipping_amount_tax,
             enable_partial_authorization: request.enable_partial_authorization,
+            billing_processor_details: request.billing_processor_details.clone(),
         })
     }
 
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index a4ef1bdac82..51dceb30674 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -277,6 +277,46 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
             } else {
                 None
             };
+
+            if let Some(ref pm_id) = payment_method_id {
+                let billing_processor_detail = payment_data
+                    .payment_intent
+                    .billing_processor_details
+                    .clone();
+
+                if let Some(details) = billing_processor_detail {
+                    let merchant_id = &payment_data.payment_intent.merchant_id;
+                    // Update subscription record with the payment method id
+
+                    let subscription_record = state
+                        .store
+                        .find_by_merchant_id_subscription_id(
+                            merchant_id,
+                            details.subscription_id.clone(),
+                        )
+                        .await
+                        .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+                            message: format!(
+                                "subscription not found for id: {}",
+                                &details.subscription_id
+                            ),
+                        })?;
+
+                    let udpate = storage::SubscriptionUpdate::new(Some(pm_id.clone()), None);
+
+                    state
+                        .store
+                        .update_subscription_entry(
+                            &subscription_record.merchant_id,
+                            subscription_record.subscription_id.clone(),
+                            udpate,
+                        )
+                        .await
+                        .change_context(errors::ApiErrorResponse::InternalServerError)
+                        .attach_printable("Failed to update subscription with payment method")?;
+                }
+            }
+
             payment_data.payment_attempt.payment_method_id = payment_method_id;
             payment_data.payment_attempt.connector_mandate_detail = connector_mandate_reference_id
                 .clone()
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 8f104451be5..f3d10887de3 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -756,7 +756,7 @@ pub(super) async fn get_or_create_customer_details(
 }
 
 #[cfg(feature = "v1")]
-pub(super) async fn get_or_create_customer_details(
+pub async fn get_or_create_customer_details(
     state: &SessionState,
     customer_details: &CustomerDetails,
     merchant_context: &domain::MerchantContext,
diff --git a/crates/router/src/core/subscription.rs b/crates/router/src/core/subscription.rs
new file mode 100644
index 00000000000..f2ae8dd9c7f
--- /dev/null
+++ b/crates/router/src/core/subscription.rs
@@ -0,0 +1,371 @@
+pub mod utils;
+use super::errors::{self, RouterResponse};
+use crate::{
+    core::{payments as payments_core, payouts::helpers},
+    routes::SessionState,
+    services::{api as service_api, logger},
+    types::api as api_types,
+};
+use api_models::enums as api_enums;
+use api_models::subscription::{
+    self as subscription_types, CreateSubscriptionResponse, Subscription, SubscriptionStatus,
+    SUBSCRIPTION_ID_PREFIX,
+};
+use common_types::payments::CustomerAcceptance;
+use common_utils::ext_traits::ValueExt;
+use common_utils::{events::ApiEventMetric, generate_id_with_default_len, id_type};
+use diesel_models::subscription::{SubscriptionNew, SubscriptionUpdate};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{api::ApplicationResponse, merchant_context::MerchantContext};
+use payment_methods::helpers::StorageErrorExt;
+use std::{num::NonZeroI64, str::FromStr};
+use utils::{get_customer_details_from_request, get_or_create_customer};
+
+pub async fn create_subscription(
+    state: SessionState,
+    merchant_context: MerchantContext,
+    request: subscription_types::CreateSubscriptionRequest,
+) -> RouterResponse<subscription_types::CreateSubscriptionResponse> {
+    let store = state.store.clone();
+    let db = store.as_ref();
+    let id = request.subscription_id.clone().unwrap_or(generate_id_with_default_len(SUBSCRIPTION_ID_PREFIX));
+    let subscription_details = Subscription::new(&id, SubscriptionStatus::Created, None);
+    let mut response = subscription_types::CreateSubscriptionResponse::new(
+        subscription_details,
+        merchant_context
+            .get_merchant_account()
+            .get_id()
+            .get_string_repr(),
+        request.mca_id.clone(),
+    );
+
+    let customer = get_customer_details_from_request(request.clone());
+    let customer_id = if customer.customer_id.is_some()
+        || customer.name.is_some()
+        || customer.email.is_some()
+        || customer.phone.is_some()
+        || customer.phone_country_code.is_some()
+    {
+        let customer = get_or_create_customer(state, request.customer, merchant_context.clone())
+            .await
+            .map_err(|e| e.change_context(errors::ApiErrorResponse::CustomerNotFound))
+            .attach_printable("subscriptions: unable to process customer")?;
+
+        let customer_table_response = match &customer {
+            ApplicationResponse::Json(inner) => {
+                Some(subscription_types::map_customer_resp_to_details(inner))
+            }
+            _ => None,
+        };
+        response.customer = customer_table_response;
+        response
+            .customer
+            .as_ref()
+            .and_then(|customer| customer.id.clone())
+    } else {
+        request.customer_id.clone()
+    }
+    .ok_or(errors::ApiErrorResponse::CustomerNotFound)
+    .attach_printable("subscriptions: unable to create a customer")?;
+
+    // If provided we can strore plan_id, coupon_code etc as metadata
+    let mut subscription = SubscriptionNew::new(
+        id,
+        SubscriptionStatus::Created.to_string(),
+        None,
+        None,
+        request.mca_id,
+        None,
+        merchant_context.get_merchant_account().get_id().clone(),
+        customer_id,
+        None,
+    );
+    response.client_secret = subscription.generate_and_set_client_secret();
+    db.insert_subscription_entry(subscription)
+        .await
+        .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)
+        .attach_printable("subscriptions: unable to insert subscription entry to database")?;
+
+    Ok(ApplicationResponse::Json(response))
+}
+
+pub async fn confirm_subscription(
+    state: SessionState,
+    merchant_context: MerchantContext,
+    authentication_profile_id: Option<common_utils::id_type::ProfileId>,
+    request: ConfirmSubscriptionRequest,
+    subscription_id: String,
+) -> RouterResponse<ConfirmSubscriptionResponse> {
+    let db = state.store.as_ref();
+    // Fetch subscription from DB
+    let mercahnt_account = merchant_context.get_merchant_account();
+    let key_store = merchant_context.get_merchant_key_store();
+    let subscription = state
+        .store
+        .find_by_merchant_id_subscription_id(mercahnt_account.get_id(), subscription_id.clone())
+        .await
+        .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+            message: format!("subscription not found for id: {}", subscription_id),
+        })?;
+
+    logger::debug!("fetched_subscription: {:?}", subscription);
+
+    let mca_id = subscription
+        .mca_id
+        .as_ref()
+        .map(|id| id_type::MerchantConnectorAccountId::wrap(id.clone()))
+        .transpose()
+        .change_context(errors::ApiErrorResponse::InternalServerError)?
+        .ok_or(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+            id: "No mca_id associated with this subscription".to_string(),
+        })?;
+
+    let billing_processor_mca = db
+        .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
+            &(&state).into(),
+            &mercahnt_account.get_id(),
+            &mca_id,
+            key_store,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+            id: mca_id.get_string_repr().to_string(),
+        })?;
+
+    let connector_name = billing_processor_mca.connector_name.clone();
+
+    let connector_data = api_types::ConnectorData::get_connector_by_name(
+        &state.conf.connectors,
+        &connector_name,
+        api_types::GetToken::Connector,
+        Some(billing_processor_mca.get_id()),
+    )
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("invalid connector name received in billing merchant connector account")?;
+
+    let connector_enum =
+        common_enums::connector_enums::Connector::from_str(connector_name.as_str())
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("Cannot find connector from the connector_name")?;
+
+    let connector_params =
+        hyperswitch_domain_models::connector_endpoints::Connectors::get_connector_params(
+            &state.conf.connectors,
+            connector_enum,
+        )
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable(format!(
+            "cannot find connector params for this connector {connector_name} in this flow",
+        ))?;
+
+    let connector_integration: service_api::BoxedSubscriptionConnectorIntegrationInterface<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+        hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+    > = connector_data.connector.get_connector_integration();
+
+    // Create Subscription at billing processor
+    let subscription_item =
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionItem {
+            item_price_id: request.item_price_id.ok_or(
+                errors::ApiErrorResponse::InvalidRequestData {
+                    message: "item_price_id is required".to_string(),
+                },
+            )?,
+            quantity: Some(1),
+        };
+
+    let conn_request =
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest {
+            customer_id: subscription.customer_id.get_string_repr().to_string(),
+            subscription_id: subscription.subscription_id.clone(),
+            subscription_items: vec![subscription_item],
+            billing_address: request.billing_address.clone().ok_or(
+                errors::ApiErrorResponse::InvalidRequestData {
+                    message: "Billing address is required".to_string(),
+                },
+            )?,
+            auto_collection: "off".to_string(),
+            connector_params,
+        };
+
+    logger::debug!("conn_request_customer: {:?}", conn_request.customer_id);
+
+    let auth_type = payments_core::helpers::MerchantConnectorAccountType::DbVal(Box::new(
+        billing_processor_mca.clone(),
+    ))
+    .get_connector_account_details()
+    .parse_value("ConnectorAuthType")
+    .change_context(errors::ApiErrorResponse::InternalServerError)?;
+
+    let router_data = payments_core::helpers::create_subscription_router_data::<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+        hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+    >(
+        &state,
+        subscription.merchant_id.to_owned(),
+        Some(subscription.customer_id.to_owned()),
+        connector_name,
+        auth_type,
+        conn_request,
+        None,
+    )?;
+
+    let response = service_api::execute_connector_processing_step::<
+        hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate,
+        _,
+        hyperswitch_domain_models::router_request_types::subscriptions::SubscriptionCreateRequest,
+        hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse,
+    >(
+        &state,
+        connector_integration,
+        &router_data,
+        common_enums::CallConnectorAction::Trigger,
+        None,
+        None,
+    )
+    .await
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed while handling response of subscription_create")?;
+
+    let connector_resp = response.response.map_err(|err| {
+        crate::logger::error!(?err);
+        errors::ApiErrorResponse::InternalServerError
+    })?;
+
+    crate::logger::debug!("connector_resp: {:?}", connector_resp);
+
+    // Form Payments Request with billing processor details
+    let billing_connector_details = api_models::payments::BillingConnectorDetails {
+        processor_mca: mca_id.to_owned(),
+        subscription_id: connector_resp.subscription_id.clone(),
+        invoice_id: connector_resp.invoice_id.clone(),
+    };
+
+    let mut payment_request = api_types::PaymentsRequest {
+        amount: Some(api_types::Amount::Value(
+            NonZeroI64::new(request.amount).unwrap(), // fix this
+        )),
+        currency: Some(request.currency),
+        customer_id: Some(subscription.customer_id.to_owned()),
+        merchant_id: Some(subscription.merchant_id.to_owned()),
+        billing_processor_details: Some(billing_connector_details),
+        confirm: Some(true),
+        setup_future_usage: request.payment_data.setup_future_usage,
+        payment_method: Some(request.payment_data.payment_method),
+        payment_method_type: request.payment_data.payment_method_type,
+        payment_method_data: Some(request.payment_data.payment_method_data),
+        customer_acceptance: request.payment_data.customer_acceptance,
+        ..Default::default()
+    };
+
+    if let Err(err) = crate::routes::payments::get_or_generate_payment_id(&mut payment_request) {
+        return Err(err.into());
+    }
+
+    // Call Payments Core
+    let payment_response = payments_core::payments_core::<
+        api_types::Authorize,
+        api_types::PaymentsResponse,
+        _,
+        _,
+        _,
+        payments_core::PaymentData<api_types::Authorize>,
+    >(
+        state.clone(),
+        state.get_req_state(),
+        merchant_context,
+        authentication_profile_id,
+        payments_core::PaymentCreate,
+        payment_request,
+        service_api::AuthFlow::Merchant,
+        payments_core::CallConnectorAction::Trigger,
+        None,
+        hyperswitch_domain_models::payments::HeaderPayload::with_source(
+            common_enums::PaymentSource::Webhook,
+        ),
+    )
+    .await;
+
+    // fix this error handling
+    let payment_res = match payment_response {
+        Ok(service_api::ApplicationResponse::JsonWithHeaders((pi, _))) => Ok(pi),
+        Ok(_) => Err(errors::ApiErrorResponse::InternalServerError),
+        Err(error) => {
+            crate::logger::error!(?error);
+            Err(errors::ApiErrorResponse::InternalServerError)
+        }
+    }?;
+    // Semd back response
+    let update = SubscriptionUpdate::new(None, Some(SubscriptionStatus::Active.to_string()));
+    db.update_subscription_entry(
+        &subscription.merchant_id,
+        subscription.subscription_id.clone(),
+        update,
+    )
+    .await
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("subscriptions: unable to update subscription entry to database")?;
+
+    let response = ConfirmSubscriptionResponse {
+        subscription: Subscription::new(
+            subscription.subscription_id.clone(),
+            SubscriptionStatus::Active,
+            None,
+        ), // ?!?
+        customer_id: Some(subscription.customer_id.to_owned()),
+        invoice: None,
+        payment: payment_res,
+    };
+
+    Ok(service_api::ApplicationResponse::Json(response))
+}
+
+#[derive(Debug, Clone, serde::Serialize)]
+pub struct Invoice {
+    pub id: String,
+    pub total: u64,
+}
+
+impl Invoice {
+    pub fn new(id: impl Into<String>, total: u64) -> Self {
+        Self {
+            id: id.into(),
+            total,
+        }
+    }
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct PaymentData {
+    pub payment_method: api_enums::PaymentMethod,
+    pub payment_method_type: Option<api_enums::PaymentMethodType>,
+    pub payment_method_data: api_models::payments::PaymentMethodDataRequest,
+    pub setup_future_usage: Option<api_enums::FutureUsage>,
+    pub customer_acceptance: Option<CustomerAcceptance>,
+}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct ConfirmSubscriptionRequest {
+    // pub client_secret: Option<String>,
+    pub amount: i64,
+    pub currency: api_enums::Currency,
+    pub plan_id: Option<String>,
+    pub item_price_id: Option<String>,
+    pub coupon_code: Option<String>,
+    pub customer: Option<api_models::payments::CustomerDetails>,
+    pub billing_address: Option<api_models::payments::Address>,
+    pub payment_data: PaymentData,
+}
+
+impl ApiEventMetric for ConfirmSubscriptionRequest {}
+
+#[derive(Debug, Clone, serde::Serialize)]
+pub struct ConfirmSubscriptionResponse {
+    pub subscription: Subscription,
+    pub payment: api_models::payments::PaymentsResponse,
+    pub customer_id: Option<common_utils::id_type::CustomerId>,
+    pub invoice: Option<Invoice>,
+}
+
+impl ApiEventMetric for ConfirmSubscriptionResponse {}
diff --git a/crates/router/src/core/subscription/utils.rs b/crates/router/src/core/subscription/utils.rs
new file mode 100644
index 00000000000..b97f49b58fc
--- /dev/null
+++ b/crates/router/src/core/subscription/utils.rs
@@ -0,0 +1,73 @@
+use api_models::{customers::CustomerRequest, subscription::CreateSubscriptionRequest};
+use common_utils::id_type::GenerateId;
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+    api::ApplicationResponse, merchant_context::MerchantContext,
+    router_request_types::CustomerDetails,
+};
+
+use crate::{
+    core::customers::create_customer,
+    db::{errors, StorageInterface},
+    routes::SessionState,
+    types::{api::CustomerResponse, transformers::ForeignInto},
+};
+
+pub async fn get_or_create_customer(
+    state: SessionState,
+    customer_request: Option<CustomerRequest>,
+    merchant_context: MerchantContext,
+) -> errors::CustomerResponse<CustomerResponse> {
+    let db: &dyn StorageInterface = &*state.store;
+
+    // Create customer_id if not passed in request
+    let customer_id = customer_request
+        .as_ref()
+        .and_then(|c| c.customer_id.clone())
+        .unwrap_or_else(common_utils::id_type::CustomerId::generate);
+
+    let merchant_id = merchant_context.get_merchant_account().get_id();
+    let key_manager_state = &(&state).into();
+
+    match db
+        .find_customer_optional_by_customer_id_merchant_id(
+            key_manager_state,
+            &customer_id,
+            merchant_id,
+            merchant_context.get_merchant_key_store(),
+            merchant_context.get_merchant_account().storage_scheme,
+        )
+        .await
+        .change_context(errors::CustomersErrorResponse::InternalServerError)
+        .attach_printable("subscription: unable to perform db read query")?
+    {
+        // Customer found
+        Some(customer) => {
+            let api_customer: CustomerResponse =
+                (customer, None::<api_models::payments::AddressDetails>).foreign_into();
+            Ok(ApplicationResponse::Json(api_customer))
+        }
+
+        // Customer not found
+        None => Ok(create_customer(
+            state,
+            merchant_context,
+            customer_request.ok_or(errors::CustomersErrorResponse::CustomerNotFound)?,
+            None,
+        )
+        .await?),
+    }
+}
+
+pub fn get_customer_details_from_request(request: CreateSubscriptionRequest) -> CustomerDetails {
+    let customer_id = request.get_customer_id().map(ToOwned::to_owned);
+    let customer = request.customer.as_ref();
+    CustomerDetails {
+        customer_id,
+        name: customer.and_then(|cus| cus.name.clone()),
+        email: customer.and_then(|cus| cus.email.clone()),
+        phone: customer.and_then(|cus| cus.phone.clone()),
+        phone_country_code: customer.and_then(|cus| cus.phone_country_code.clone()),
+        tax_registration_id: customer.and_then(|cus| cus.tax_registration_id.clone()),
+    }
+}
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 4d38ce2ed02..0b935aaa390 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -4,6 +4,7 @@ use actix_web::FromRequest;
 #[cfg(feature = "payouts")]
 use api_models::payouts as payout_models;
 use api_models::webhooks::{self, WebhookResponseTracker};
+pub use common_enums::enums::ProcessTrackerRunner;
 use common_utils::{
     errors::ReportSwitchExt,
     events::ApiEventsType,
@@ -252,7 +253,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
                 .decode_webhook_body(
                     &request_details,
                     merchant_context.get_merchant_account().get_id(),
-                    merchant_connector_account
+                    merchant_connector_account.clone()
                         .and_then(|mca| mca.connector_webhook_details.clone()),
                     &connector_name,
                 )
@@ -317,6 +318,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
                 &webhook_processing_result.transform_data,
                 &final_request_details,
                 is_relay_webhook,
+                merchant_connector_account.unwrap().merchant_connector_id,
             )
             .await;
 
@@ -499,6 +501,7 @@ async fn process_webhook_business_logic(
     webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
     request_details: &IncomingWebhookRequestDetails<'_>,
     is_relay_webhook: bool,
+    billing_connector_mca_id: common_utils::id_type::MerchantConnectorAccountId,
 ) -> errors::RouterResult<WebhookResponseTracker> {
     let object_ref_id = connector
         .get_webhook_object_reference_id(request_details)
@@ -789,8 +792,21 @@ async fn process_webhook_business_logic(
             .await
             .attach_printable("Incoming webhook flow for payouts failed"),
 
-            _ => Err(errors::ApiErrorResponse::InternalServerError)
-                .attach_printable("Unsupported Flow Type received in incoming webhooks"),
+            api::WebhookFlow::Subscription => Box::pin(subscription_incoming_webhook_flow(
+                state.clone(),
+                req_state,
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+                &connector,
+                &request_details,
+                event_type,
+                billing_connector_mca_id,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for subscription failed"),
+
         }
     };
 
@@ -2505,3 +2521,132 @@ fn insert_mandate_details(
     )?;
     Ok(connector_mandate_details)
 }
+
+#[allow(clippy::too_many_arguments)]
+#[instrument(skip_all)]
+async fn subscription_incoming_webhook_flow(
+    state: SessionState,
+    _req_state: ReqState,
+    merchant_context: domain::MerchantContext,
+    business_profile: domain::Profile,
+    webhook_details: api::IncomingWebhookDetails,
+    source_verified: bool,
+    connector: &ConnectorEnum,
+    _request_details: &IncomingWebhookRequestDetails<'_>,
+    event_type: webhooks::IncomingWebhookEvent,
+    billing_connector_mca_id: common_utils::id_type::MerchantConnectorAccountId,
+) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
+    // Only process invoice_generated events for MIT payments
+    if event_type != webhooks::IncomingWebhookEvent::InvoiceGenerated {
+        return Ok(WebhookResponseTracker::NoEffect);
+    }
+
+    if !source_verified {
+        logger::error!("Webhook source verification failed for subscription webhook flow");
+        return Err(report!(
+            errors::ApiErrorResponse::WebhookAuthenticationFailed
+        ));
+    }
+
+    // Parse the webhook body to extract MIT payment data
+    let mit_payment_data = match connector.id() {
+        "chargebee" => {
+            use hyperswitch_connectors::connectors::chargebee::transformers::{
+                ChargebeeInvoiceBody, ChargebeeMitPaymentData,
+            };
+
+            let webhook_body = ChargebeeInvoiceBody::get_invoice_webhook_data_from_body(
+                &webhook_details.resource_object,
+            )
+            .change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
+            .attach_printable("Failed to parse Chargebee invoice webhook body")?;
+
+            ChargebeeMitPaymentData::try_from(webhook_body)
+                .change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable("Failed to extract MIT payment data from Chargebee webhook")?
+        }
+        _ => {
+            return Err(errors::ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable("Subscription webhook flow not supported for this connector");
+        }
+    };
+
+    logger::info!(
+        invoice_id = %mit_payment_data.invoice_id,
+        amount_due = %mit_payment_data.amount_due.get_amount_as_i64(),
+        currency = %mit_payment_data.currency_code,
+        status = %mit_payment_data.status,
+        subscription_id = ?mit_payment_data.subscription_id,
+        first_invoice = %mit_payment_data.first_invoice,
+        "Received invoice_generated webhook for MIT payment"
+    );
+
+    if mit_payment_data.first_invoice {
+        return Ok(WebhookResponseTracker::NoEffect)
+    }
+
+    // For now, we need a payment_method_id to create the subscription workflow
+    // TODO: Implement proper payment method retrieval from subscription/customer data
+
+    let payment_method_id = state
+        .store
+        .find_payment_method_ids_by_billing_connector_subscription_id(
+            mit_payment_data
+                .subscription_id
+                .as_ref()
+                .ok_or(errors::ApiErrorResponse::InternalServerError)
+                .attach_printable("Missing subscription_id in MIT payment data")?,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed to find payment method IDs by subscription ID")?
+        .first()
+        .ok_or(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("No payment method found for subscription ID")?
+        .clone();
+
+
+    logger::info!("Payment method ID found: {}", payment_method_id);
+
+    // Create tracking data for subscription MIT payment
+    let tracking_data =
+        api_models::process_tracker::subscription::SubscriptionWorkflowTrackingData {
+            merchant_id: merchant_context.get_merchant_account().get_id().clone(),
+            profile_id: business_profile.get_id().clone(),
+            payment_method_id,
+            subscription_id: mit_payment_data.subscription_id,
+            invoice_id: mit_payment_data.invoice_id.clone(),
+            amount: mit_payment_data.amount_due,
+            currency: mit_payment_data.currency_code,
+            customer_id: mit_payment_data.customer_id,
+            connector_name: connector.id().to_string(),
+            billing_connector_mca_id: billing_connector_mca_id.clone(),
+        };
+
+    // Create process tracker entry for subscription MIT payment
+    let process_tracker_entry = diesel_models::ProcessTrackerNew {
+        id: generate_id(consts::ID_LENGTH, "proc"),
+        name: Some("SUBSCRIPTION_MIT_PAYMENT".to_string()),
+        tag: vec!["SUBSCRIPTION".to_string()],
+        runner: Some(ProcessTrackerRunner::SubscriptionsWorkflow.to_string()),
+        retry_count: 0,
+        schedule_time: Some(common_utils::date_time::now()),
+        rule: String::new(),
+        tracking_data: serde_json::to_value(&tracking_data)
+            .change_context(errors::ApiErrorResponse::InternalServerError)?,
+        business_status: "Pending".to_string(),
+        status: diesel_models::enums::ProcessTrackerStatus::New,
+        event: vec![],
+        created_at: common_utils::date_time::now(),
+        updated_at: common_utils::date_time::now(),
+        version: common_types::consts::API_VERSION,
+    };
+
+    state
+        .store
+        .insert_process(process_tracker_entry)
+        .await
+        .change_context(errors::ApiErrorResponse::InternalServerError)?;
+
+    Ok(WebhookResponseTracker::NoEffect)
+}
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index 59c31d4b2b8..f675e316aef 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -34,6 +34,7 @@ pub mod relay;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 pub mod unified_translations;
 pub mod user;
 pub mod user_authentication_method;
@@ -143,6 +144,7 @@ pub trait StorageInterface:
     + payment_method_session::PaymentMethodsSessionInterface
     + tokenization::TokenizationInterface
     + callback_mapper::CallbackMapperInterface
+    + subscription::SubscriptionInterface
     + 'static
 {
     fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface>;
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 9eaef17b9c5..0bb7f9c2da8 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -2340,6 +2340,16 @@ impl PaymentMethodInterface for KafkaStore {
             .find_payment_method_by_fingerprint_id(state, key_store, fingerprint_id)
             .await
     }
+
+    #[cfg(feature = "v1")]
+    async fn find_payment_method_ids_by_billing_connector_subscription_id(
+        &self,
+        subscription_id: &str,
+    ) -> CustomResult<Vec<String>, errors::StorageError> {
+        self.diesel_store
+            .find_payment_method_ids_by_billing_connector_subscription_id(subscription_id)
+            .await
+    }
 }
 
 #[cfg(not(feature = "payouts"))]
diff --git a/crates/router/src/db/subscription.rs b/crates/router/src/db/subscription.rs
new file mode 100644
index 00000000000..368e254a445
--- /dev/null
+++ b/crates/router/src/db/subscription.rs
@@ -0,0 +1,170 @@
+use error_stack::report;
+use router_env::{instrument, tracing};
+use storage_impl::MockDb;
+
+use super::Store;
+use crate::{
+    connection,
+    core::errors::{self, CustomResult},
+    db::kafka_store::KafkaStore,
+    types::storage,
+};
+
+#[async_trait::async_trait]
+pub trait SubscriptionInterface {
+    async fn insert_subscription_entry(
+        &self,
+        subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError>;
+
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError>;
+
+    async fn update_subscription_entry(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError>;
+
+    // async fn find_subscription_by_id(
+    //     &self,
+    //     id: String,
+    // ) -> CustomResult<storage::Subscription, errors::StorageError>;
+}
+
+#[async_trait::async_trait]
+impl SubscriptionInterface for Store {
+    #[instrument(skip_all)]
+    async fn insert_subscription_entry(
+        &self,
+        subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        subscription_new
+            .insert(&conn)
+            .await
+            .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    #[instrument(skip_all)]
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        storage::Subscription::find_by_merchant_id_subscription_id(
+            &conn,
+            merchant_id,
+            subscription_id,
+        )
+        .await
+        .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    #[instrument(skip_all)]
+    async fn update_subscription_entry(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        storage::Subscription::update_subscription_entry(&conn, merchant_id, subscription_id, data)
+            .await
+            .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    // #[instrument(skip_all)]
+    // async fn find_subscription_by_id(
+    //     &self,
+    //     id: String,
+    // ) -> CustomResult<storage::Subscription, errors::StorageError> {
+    //     let conn = connection::pg_connection_write(self).await?;
+    //     storage::Subscription::find_subscription_by_id(&conn, id)
+    //         .await
+    //         .map_err(|error| report!(errors::StorageError::from(error)))
+    // }
+}
+
+#[async_trait::async_trait]
+impl SubscriptionInterface for MockDb {
+    #[instrument(skip_all)]
+    async fn insert_subscription_entry(
+        &self,
+        _subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        Err(errors::StorageError::MockDbError)?
+    }
+
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        _merchant_id: &common_utils::id_type::MerchantId,
+        _subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        Err(errors::StorageError::MockDbError)?
+    }
+
+    async fn update_subscription_entry(
+        &self,
+        _merchant_id: &common_utils::id_type::MerchantId,
+        _subscription_id: String,
+        _data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        Err(errors::StorageError::MockDbError)?
+    }
+
+    // async fn find_subscription_by_id(
+    //     &self,
+    //     _id: String,
+    // ) -> CustomResult<storage::Subscription, errors::StorageError> {
+    //     Err(errors::StorageError::MockDbError)?
+    // }
+}
+
+#[async_trait::async_trait]
+impl SubscriptionInterface for KafkaStore {
+    #[instrument(skip_all)]
+    async fn insert_subscription_entry(
+        &self,
+        subscription_new: storage::subscription::SubscriptionNew,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        self.diesel_store
+            .insert_subscription_entry(subscription_new)
+            .await
+    }
+
+    #[instrument(skip_all)]
+    async fn find_by_merchant_id_subscription_id(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        self.diesel_store
+            .find_by_merchant_id_subscription_id(merchant_id, subscription_id)
+            .await
+    }
+
+    #[instrument(skip_all)]
+    async fn update_subscription_entry(
+        &self,
+        merchant_id: &common_utils::id_type::MerchantId,
+        subscription_id: String,
+        data: storage::SubscriptionUpdate,
+    ) -> CustomResult<storage::Subscription, errors::StorageError> {
+        self.diesel_store
+            .update_subscription_entry(merchant_id, subscription_id, data)
+            .await
+    }
+
+    // async fn find_subscription_by_id(
+    //     &self,
+    //     id: String,
+    // ) -> CustomResult<storage::Subscription, errors::StorageError> {
+    //     self.diesel_store.find_subscription_by_id(id).await
+    // }
+}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 00df2908f44..43cd29e2f72 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -209,6 +209,7 @@ pub fn mk_app(
                 .service(routes::Files::server(state.clone()))
                 .service(routes::Disputes::server(state.clone()))
                 .service(routes::Blocklist::server(state.clone()))
+                .service(routes::Subscription::server(state.clone()))
                 .service(routes::Gsm::server(state.clone()))
                 .service(routes::ApplePayCertificatesMigration::server(state.clone()))
                 .service(routes::PaymentLink::server(state.clone()))
diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs
index b8fde79e2a1..f2af4631917 100644
--- a/crates/router/src/routes.rs
+++ b/crates/router/src/routes.rs
@@ -50,6 +50,8 @@ pub mod recon;
 pub mod refunds;
 #[cfg(feature = "olap")]
 pub mod routing;
+#[cfg(feature = "v1")]
+pub mod subscription;
 pub mod three_ds_decision_rule;
 pub mod tokenization;
 #[cfg(feature = "olap")]
@@ -96,7 +98,7 @@ pub use self::app::{
     User, UserDeprecated, Webhooks,
 };
 #[cfg(feature = "olap")]
-pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents};
+pub use self::app::{Blocklist, Organization, Routing, Subscription, Verify, WebhookEvents};
 #[cfg(feature = "payouts")]
 pub use self::app::{PayoutLink, Payouts};
 #[cfg(all(feature = "stripe", feature = "v1"))]
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 690a4337351..0fab52a40cf 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -65,7 +65,9 @@ use super::{
     profiles, relay, user, user_role,
 };
 #[cfg(feature = "v1")]
-use super::{apple_pay_certificates_migration, blocklist, payment_link, webhook_events};
+use super::{
+    apple_pay_certificates_migration, blocklist, payment_link, subscription, webhook_events,
+};
 #[cfg(any(feature = "olap", feature = "oltp"))]
 use super::{configs::*, customers, payments};
 #[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v1"))]
@@ -1155,6 +1157,29 @@ impl Routing {
     }
 }
 
+#[cfg(feature = "olap")]
+pub struct Subscription;
+
+#[cfg(all(feature = "olap", feature = "v1"))]
+impl Subscription {
+    pub fn server(state: AppState) -> Scope {
+        web::scope("/subscription")
+            .app_data(web::Data::new(state.clone()))
+            .service(web::resource("/create").route(
+                web::post().to(|state, req, payload| {
+                    subscription::create_subscription(state, req, payload)
+                }),
+            ))
+            .service(
+                web::resource("/{subscription_id}/confirm").route(web::post().to(
+                    |state, req, id, payload| {
+                        subscription::confirm_subscription(state, req, id, payload)
+                    },
+                )),
+            )
+    }
+}
+
 pub struct Customers;
 
 #[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))]
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 27b66e5bb54..fb8c6c8a935 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -26,6 +26,7 @@ pub enum ApiIdentifier {
     ApiKeys,
     PaymentLink,
     Routing,
+    Subscription,
     Blocklist,
     Forex,
     RustLockerMigration,
@@ -88,6 +89,8 @@ impl From<Flow> for ApiIdentifier {
             | Flow::DecisionEngineDecideGatewayCall
             | Flow::DecisionEngineGatewayFeedbackCall => Self::Routing,
 
+            Flow::CreateSubscription => Self::Subscription,
+
             Flow::RetrieveForexFlow => Self::Forex,
 
             Flow::AddToBlocklist => Self::Blocklist,
diff --git a/crates/router/src/routes/subscription.rs b/crates/router/src/routes/subscription.rs
new file mode 100644
index 00000000000..b2edfb4ed85
--- /dev/null
+++ b/crates/router/src/routes/subscription.rs
@@ -0,0 +1,94 @@
+//! Analysis for usage of Subscription in Payment flows
+//!
+//! Functions that are used to perform the api level configuration and retrieval
+//! of various types under Subscriptions.
+
+use actix_web::{web, HttpRequest, Responder};
+use api_models::subscription as subscription_types;
+use router_env::{
+    tracing::{self, instrument},
+    Flow,
+};
+
+use crate::{
+    core::{api_locking, subscription},
+    routes::AppState,
+    services::{api as oss_api, authentication as auth, authorization::permissions::Permission},
+    types::domain,
+};
+
+#[cfg(all(feature = "olap", feature = "v1"))]
+#[instrument(skip_all)]
+pub async fn create_subscription(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    json_payload: web::Json<subscription_types::CreateSubscriptionRequest>,
+) -> impl Responder {
+    let flow = Flow::CreateSubscription;
+    Box::pin(oss_api::server_wrap(
+        flow,
+        state,
+        &req,
+        json_payload.into_inner(),
+        |state, auth: auth::AuthenticationData, payload, _| {
+            let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                domain::Context(auth.merchant_account, auth.key_store),
+            ));
+            subscription::create_subscription(state, merchant_context, payload.clone())
+        },
+        auth::auth_type(
+            &auth::HeaderAuth(auth::ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            }),
+            &auth::JWTAuth {
+                permission: Permission::ProfileSubscriptionWrite,
+            },
+            req.headers(),
+        ),
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
+
+#[cfg(all(feature = "olap", feature = "v1"))]
+#[instrument(skip_all)]
+pub async fn confirm_subscription(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    subscription_id: web::Path<String>,
+    json_payload: web::Json<subscription::ConfirmSubscriptionRequest>,
+) -> impl Responder {
+    let flow = Flow::RoutingCreateConfig;
+    let subscription_id = subscription_id.into_inner();
+    Box::pin(oss_api::server_wrap(
+        flow,
+        state,
+        &req,
+        json_payload.into_inner(),
+        |state, auth: auth::AuthenticationData, payload, _| {
+            let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
+                domain::Context(auth.merchant_account, auth.key_store),
+            ));
+            subscription::confirm_subscription(
+                state,
+                merchant_context,
+                auth.profile_id,
+                payload.clone(),
+                subscription_id.clone(),
+            )
+        },
+        auth::auth_type(
+            &auth::HeaderAuth(auth::ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            }),
+            &auth::JWTAuth {
+                permission: Permission::ProfileRoutingWrite,
+            },
+            req.headers(),
+        ),
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index fa8e840fdea..ec0e4e43b0c 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -127,6 +127,8 @@ pub type BoxedBillingConnectorPaymentsSyncIntegrationInterface<T, Req, Res> =
 pub type BoxedVaultConnectorIntegrationInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<T, common_types::VaultConnectorFlowData, Req, Res>;
 
+pub type BoxedSubscriptionConnectorIntegrationInterface<T, Req, Res> =
+    BoxedConnectorIntegrationInterface<T, common_types::SubscriptionCreateData, Req, Res>;
 /// Handle UCS webhook response processing
 fn handle_ucs_response<T, Req, Resp>(
     router_data: types::RouterData<T, Req, Resp>,
diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rs
index 3860d343b68..6fb4b09cd5d 100644
--- a/crates/router/src/services/authorization/permissions.rs
+++ b/crates/router/src/services/authorization/permissions.rs
@@ -43,6 +43,10 @@ generate_permissions! {
             scopes: [Read, Write],
             entities: [Profile, Merchant]
         },
+        Subscription: {
+            scopes: [Read, Write],
+            entities: [Profile, Merchant]
+        },
         ThreeDsDecisionManager: {
             scopes: [Read, Write],
             entities: [Merchant, Profile]
@@ -123,6 +127,7 @@ pub fn get_resource_name(resource: Resource, entity_type: EntityType) -> Option<
             Some("Payment Processors, Payout Processors, Fraud & Risk Managers")
         }
         (Resource::Routing, _) => Some("Routing"),
+        (Resource::Subscription, _) => Some("Subscription"),
         (Resource::RevenueRecovery, _) => Some("Revenue Recovery"),
         (Resource::ThreeDsDecisionManager, _) => Some("3DS Decision Manager"),
         (Resource::SurchargeDecisionManager, _) => Some("Surcharge Decision Manager"),
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 70a0a344150..5d4c4a8bb29 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -41,6 +41,7 @@ pub mod revenue_recovery_redis_operation;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
+pub mod subscription;
 pub mod unified_translations;
 pub mod user;
 pub mod user_authentication_method;
@@ -77,5 +78,5 @@ pub use self::{
     generic_link::*, gsm::*, locker_mock_up::*, mandate::*, merchant_account::*,
     merchant_connector_account::*, merchant_key_store::*, payment_link::*, payment_method::*,
     process_tracker::*, refund::*, reverse_lookup::*, role::*, routing_algorithm::*,
-    unified_translations::*, user::*, user_authentication_method::*, user_role::*,
+    subscription::*, unified_translations::*, user::*, user_authentication_method::*, user_role::*,
 };
diff --git a/crates/router/src/types/storage/subscription.rs b/crates/router/src/types/storage/subscription.rs
new file mode 100644
index 00000000000..973c2283494
--- /dev/null
+++ b/crates/router/src/types/storage/subscription.rs
@@ -0,0 +1 @@
+pub use diesel_models::subscription::{Subscription, SubscriptionNew, SubscriptionUpdate};
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index 5c8d79e0f04..9ffa01045ef 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -297,6 +297,7 @@ pub async fn generate_sample_data(
             tax_status: None,
             shipping_amount_tax: None,
             enable_partial_authorization: None,
+            billing_processor_details: None,
         };
         let (connector_transaction_id, processor_transaction_data) =
             ConnectorTransactionId::form_id_and_data(attempt_id.clone());
diff --git a/crates/router/src/workflows.rs b/crates/router/src/workflows.rs
index 2c2410f7449..283b72d086d 100644
--- a/crates/router/src/workflows.rs
+++ b/crates/router/src/workflows.rs
@@ -15,3 +15,5 @@ pub mod revenue_recovery;
 pub mod process_dispute;
 
 pub mod dispute_list;
+
+pub mod subscription;
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index 52a72a2d020..f16554d7896 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -1,12 +1,19 @@
+#[cfg(feature = "v1")]
+use crate::core::payments::helpers::{
+    perform_billing_processor_record_back,
+};
 use common_utils::ext_traits::{OptionExt, StringExt, ValueExt};
 use diesel_models::process_tracker::business_status;
 use error_stack::ResultExt;
+
+
 use router_env::logger;
 use scheduler::{
     consumer::{self, types::process_data, workflows::ProcessTrackerWorkflow},
     errors as sch_errors, utils as scheduler_utils,
 };
 
+
 use crate::{
     consts,
     core::{
@@ -112,7 +119,10 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
                     .store
                     .as_scheduler()
                     .finish_process_with_business_status(process, business_status::COMPLETED_BY_PT)
-                    .await?
+                    .await?;
+
+                // call to subsription connector
+                perform_billing_processor_record_back(state, &mut payment_data, &key_store).await?;
             }
             _ => {
                 let connector = payment_data
diff --git a/crates/router/src/workflows/subscription.rs b/crates/router/src/workflows/subscription.rs
new file mode 100644
index 00000000000..fcb7c784e38
--- /dev/null
+++ b/crates/router/src/workflows/subscription.rs
@@ -0,0 +1,206 @@
+use api_models::payments::BillingConnectorDetails;
+use async_trait::async_trait;
+use common_utils::ext_traits::ValueExt;
+use diesel_models::process_tracker::business_status;
+use error_stack::ResultExt;
+use router_env::logger;
+use scheduler::{consumer::workflows::ProcessTrackerWorkflow, errors};
+
+#[cfg(feature = "v1")]
+use crate::routes::payments::get_or_generate_payment_id;
+use crate::{
+    core::{errors::RecoveryError::ProcessTrackerFailure, payments},
+    routes::SessionState,
+    services,
+    types::{api as api_types, domain, storage},
+};
+pub struct ExecuteSubscriptionWorkflow;
+
+#[async_trait]
+impl ProcessTrackerWorkflow<SessionState> for ExecuteSubscriptionWorkflow {
+    #[cfg(feature = "v1")]
+    async fn execute_workflow<'a>(
+        &'a self,
+        state: &'a SessionState,
+        process: storage::ProcessTracker,
+    ) -> Result<(), errors::ProcessTrackerError> {
+        let tracking_data = process
+            .tracking_data
+            .clone()
+            .parse_value::<api_models::process_tracker::subscription::SubscriptionWorkflowTrackingData>(
+                "SubscriptionWorkflowTrackingData",
+            )?;
+
+        match process.name.as_deref() {
+            Some("SUBSCRIPTION_MIT_PAYMENT") => {
+                Box::pin(perform_subscription_mit_payment(
+                    state,
+                    &process,
+                    &tracking_data,
+                ))
+                .await
+            }
+            _ => Err(errors::ProcessTrackerError::JobNotFound),
+        }
+    }
+    #[cfg(feature = "v2")]
+    async fn execute_workflow<'a>(
+        &'a self,
+        state: &'a SessionState,
+        process: storage::ProcessTracker,
+    ) -> Result<(), errors::ProcessTrackerError> {
+        todo!()
+    }
+}
+#[cfg(feature = "v1")]
+async fn perform_subscription_mit_payment(
+    state: &SessionState,
+    process: &storage::ProcessTracker,
+    tracking_data: &api_models::process_tracker::subscription::SubscriptionWorkflowTrackingData,
+) -> Result<(), errors::ProcessTrackerError> {
+    // Extract merchant context
+    let key_manager_state = &state.into();
+    let key_store = state
+        .store
+        .get_merchant_key_store_by_merchant_id(
+            key_manager_state,
+            &tracking_data.merchant_id,
+            &state.store.get_master_key().to_vec().into(),
+        )
+        .await?;
+
+    let merchant_account = state
+        .store
+        .find_merchant_account_by_merchant_id(
+            key_manager_state,
+            &tracking_data.merchant_id,
+            &key_store,
+        )
+        .await?;
+
+    let profile = state
+        .store
+        .find_business_profile_by_profile_id(
+            key_manager_state,
+            &key_store,
+            &tracking_data.profile_id,
+        )
+        .await?;
+
+    let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(domain::Context(
+        merchant_account,
+        key_store,
+    )));
+
+    let profile_id = profile.get_id().clone();
+
+    let billing_connector_details = BillingConnectorDetails {
+        processor_mca: tracking_data.billing_connector_mca_id.clone(),
+        subscription_id: tracking_data.subscription_id.clone().ok_or_else(|| {
+            errors::ProcessTrackerError::SerializationFailed
+        })?,
+        invoice_id: tracking_data.invoice_id.clone(),
+    };
+
+    logger::debug!(
+        "Executing subscription MIT payment for process: {:?}, tracking_data: {:?}",
+        process.id,
+        tracking_data
+    );
+
+
+    // Create MIT payment request with the determined payment_method_id
+    let mut payment_request = api_types::PaymentsRequest {
+        amount: Some(api_types::Amount::from(tracking_data.amount)),
+        currency: Some(tracking_data.currency),
+        customer_id: tracking_data.customer_id.clone(),
+        recurring_details: Some(api_models::mandates::RecurringDetails::PaymentMethodId(
+            tracking_data.payment_method_id.clone(),
+        )),
+        merchant_id: Some(tracking_data.merchant_id.clone()),
+        billing_processor_details: Some(billing_connector_details),
+        confirm: Some(true),
+        off_session: Some(true),
+        ..Default::default()
+    };
+
+    logger::debug!(
+        "payment_request for subscription MIT payment: {:?}, process_id: {:?}, tracking_data: {:?}",
+        payment_request,
+        process.id,
+        payment_request
+    );
+
+    if let Err(err) = get_or_generate_payment_id(&mut payment_request) {
+        return Err(err.into());
+    }
+
+    // Execute MIT payment
+    let payment_response = payments::payments_core::<
+        api_types::Authorize,
+        api_types::PaymentsResponse,
+        _,
+        _,
+        _,
+        payments::PaymentData<api_types::Authorize>,
+    >(
+        state.clone(),
+        state.get_req_state(),
+        merchant_context,
+        Some(profile_id),
+        payments::PaymentCreate,
+        payment_request,
+        services::api::AuthFlow::Merchant,
+        payments::CallConnectorAction::Trigger,
+        None,
+        hyperswitch_domain_models::payments::HeaderPayload::with_source(
+            common_enums::PaymentSource::Webhook,
+        ),
+    )
+    .await;
+
+    let payment_res = match payment_response {
+        Ok(services::ApplicationResponse::JsonWithHeaders((pi, _))) => Ok(pi),
+        Ok(_) => Err(errors::ProcessTrackerError::FlowExecutionError {
+            flow: "SUBSCRIPTION_MIT_PAYMENT",
+        }),
+        Err(error) => {
+            logger::error!(?error);
+            Err(errors::ProcessTrackerError::FlowExecutionError {
+                flow: "SUBSCRIPTION_MIT_PAYMENT",
+            })
+        }
+    }?;
+
+    if payment_res.status == common_enums::IntentStatus::Succeeded {
+        // Update the process tracker with the payment response
+        let updated_process = storage::ProcessTracker {
+            id: process.id.clone(),
+            status: common_enums::ProcessTrackerStatus::Finish,
+            ..process.clone()
+        };
+
+        state
+            .store
+            .as_scheduler()
+            .finish_process_with_business_status(
+                updated_process.clone(),
+                business_status::EXECUTE_WORKFLOW_COMPLETE,
+            )
+            .await
+            .change_context(ProcessTrackerFailure)
+            .attach_printable("Failed to update the process tracker")?;
+    } else {
+        // Handle payment failure - log the payment status and return appropriate error
+        logger::error!(
+            "Payment failed for subscription MIT payment. Payment ID: {:?}, Status: {:?}",
+            payment_res.payment_id,
+            payment_res.status
+        );
+        return Err(errors::ProcessTrackerError::FlowExecutionError {
+            flow: "SUBSCRIPTION_MIT_PAYMENT",
+        });
+    }
+
+    Ok(())
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index b758d98f498..56cdd049b2f 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -261,6 +261,8 @@ pub enum Flow {
     RoutingUpdateDefaultConfig,
     /// Routing delete config
     RoutingDeleteConfig,
+    /// Subscription create flow,
+    CreateSubscription,
     /// Create dynamic routing
     CreateDynamicRoutingConfig,
     /// Toggle dynamic routing
diff --git a/crates/storage_impl/src/mock_db.rs b/crates/storage_impl/src/mock_db.rs
index 884d9747943..260bb33a5e2 100644
--- a/crates/storage_impl/src/mock_db.rs
+++ b/crates/storage_impl/src/mock_db.rs
@@ -65,6 +65,7 @@ pub struct MockDb {
     pub user_authentication_methods:
         Arc<Mutex<Vec<store::user_authentication_method::UserAuthenticationMethod>>>,
     pub themes: Arc<Mutex<Vec<store::user::theme::Theme>>>,
+    pub subscriptions: Arc<Mutex<Vec<store::subscription::Subscription>>>,
 }
 
 impl MockDb {
@@ -113,6 +114,7 @@ impl MockDb {
             user_key_store: Default::default(),
             user_authentication_methods: Default::default(),
             themes: Default::default(),
+            subscriptions: Default::default(),
         })
     }
 
diff --git a/crates/storage_impl/src/payment_method.rs b/crates/storage_impl/src/payment_method.rs
index 760f09e8eb0..d1707cb8296 100644
--- a/crates/storage_impl/src/payment_method.rs
+++ b/crates/storage_impl/src/payment_method.rs
@@ -370,6 +370,16 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
             .await
     }
 
+    #[cfg(feature = "v1")]
+    async fn find_payment_method_ids_by_billing_connector_subscription_id(
+        &self,
+        subscription_id: &str,
+    ) -> CustomResult<Vec<String>, errors::StorageError> {
+        self.router_store
+            .find_payment_method_ids_by_billing_connector_subscription_id(subscription_id)
+            .await
+    }
+
     // Soft delete, Check if KV stuff is needed here
     #[cfg(feature = "v2")]
     async fn delete_payment_method(
@@ -666,6 +676,23 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
         .await
     }
 
+    #[cfg(feature = "v1")]
+    async fn find_payment_method_ids_by_billing_connector_subscription_id(
+        &self,
+        subscription_id: &str,
+    ) -> CustomResult<Vec<String>, errors::StorageError> {
+        let conn = pg_connection_read(self).await?;
+        diesel_models::subscription::Subscription::find_payment_method_ids_by_billing_connector_subscription_id(
+            &conn,
+            subscription_id,
+        )
+        .await
+        .map_err(|error| {
+            let new_err = diesel_error_to_data_error(*error.current_context());
+            error.change_context(new_err)
+        })
+    }
+
     #[cfg(feature = "v2")]
     async fn delete_payment_method(
         &self,
@@ -923,6 +950,24 @@ impl PaymentMethodInterface for MockDb {
         }
     }
 
+    #[cfg(feature = "v1")]
+    async fn find_payment_method_ids_by_billing_connector_subscription_id(
+        &self,
+        subscription_id: &str,
+    ) -> CustomResult<Vec<String>, errors::StorageError> {
+        // let subscriptions = self.subscriptions.lock().await;
+        // let payment_method_ids: Vec<String> = subscriptions
+        //     .iter()
+        //     .filter(|sub| {
+        //         sub.subscription_id
+        //             .as_ref()
+        //             .map_or(false, |id| id == subscription_id)
+        //     })
+        //     .filter_map(|sub| sub.payment_method_id.clone())
+        //     .collect();
+        Ok(vec![])
+    }
+
     async fn update_payment_method(
         &self,
         state: &KeyManagerState,
diff --git a/migrations/2025-08-21-110802_add_subcription_table/down.sql b/migrations/2025-08-21-110802_add_subcription_table/down.sql
new file mode 100644
index 00000000000..0979103e48c
--- /dev/null
+++ b/migrations/2025-08-21-110802_add_subcription_table/down.sql
@@ -0,0 +1 @@
+DROP table subscription;
diff --git a/migrations/2025-08-21-110802_add_subcription_table/up.sql b/migrations/2025-08-21-110802_add_subcription_table/up.sql
new file mode 100644
index 00000000000..94614bf9448
--- /dev/null
+++ b/migrations/2025-08-21-110802_add_subcription_table/up.sql
@@ -0,0 +1,16 @@
+CREATE TABLE subscription (
+  id SERIAL PRIMARY KEY,
+  subscription_id VARCHAR(128) NOT NULL,
+  status VARCHAR(128) NOT NULL,
+  billing_processor VARCHAR(128),
+  payment_method_id VARCHAR(128),
+  mca_id VARCHAR(128),
+  client_secret VARCHAR(128),
+  merchant_id VARCHAR(64) NOT NULL,
+  customer_id VARCHAR(64) NOT NULL,
+  metadata JSONB,
+  created_at TIMESTAMP NOT NULL,
+  modified_at TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX merchant_subscription_unique_index ON subscription (merchant_id, subscription_id);
diff --git a/migrations/2025-08-26-085230_add_billing_processor_in_connector_type/down.sql b/migrations/2025-08-26-085230_add_billing_processor_in_connector_type/down.sql
new file mode 100644
index 00000000000..d0b08278125
--- /dev/null
+++ b/migrations/2025-08-26-085230_add_billing_processor_in_connector_type/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+SELECT(1);
\ No newline at end of file
diff --git a/migrations/2025-08-26-085230_add_billing_processor_in_connector_type/up.sql b/migrations/2025-08-26-085230_add_billing_processor_in_connector_type/up.sql
new file mode 100644
index 00000000000..0201e3753f1
--- /dev/null
+++ b/migrations/2025-08-26-085230_add_billing_processor_in_connector_type/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TYPE "ConnectorType"
+ADD VALUE 'billing_processor';
\ No newline at end of file
diff --git a/migrations/2025-08-26-085518_add_billing_processor_details_in_payment_intent/down.sql b/migrations/2025-08-26-085518_add_billing_processor_details_in_payment_intent/down.sql
new file mode 100644
index 00000000000..0c5528d1072
--- /dev/null
+++ b/migrations/2025-08-26-085518_add_billing_processor_details_in_payment_intent/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent DROP COLUMN IF EXISTS billing_processor_details jsonb;
\ No newline at end of file
diff --git a/migrations/2025-08-26-085518_add_billing_processor_details_in_payment_intent/up.sql b/migrations/2025-08-26-085518_add_billing_processor_details_in_payment_intent/up.sql
new file mode 100644
index 00000000000..6efa6e47164
--- /dev/null
+++ b/migrations/2025-08-26-085518_add_billing_processor_details_in_payment_intent/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS billing_processor_details jsonb;
\ No newline at end of file
 | 
	2025-08-30T12:04:48Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR includes connector integration for the get subscription plans API for Chargebee
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9053 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
PR can be tested once the API handlers for this endpoint are implemented
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	144f38527e4bf5278947705f9fbbb707bf822109 | 
	
PR can be tested once the API handlers for this endpoint are implemented
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9027 | 
	Bug: [BUG] There is a bug when the webhook response comes from ucs
### Bug Description
There is a bug when the webhook response comes from ucs,
the code was not able to deserialize the response
### Expected Behavior
webhook response form ucs should be handle using ucs logic
### Actual Behavior
a webhook failed
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index a01ca3eeeea..bb58a0dc440 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -68,6 +68,67 @@ pub enum IncomingWebhookEvent {
     RecoveryInvoiceCancel,
 }
 
+impl IncomingWebhookEvent {
+    /// Convert UCS event type integer to IncomingWebhookEvent
+    /// Maps from proto WebhookEventType enum values to IncomingWebhookEvent variants
+    pub fn from_ucs_event_type(event_type: i32) -> Self {
+        match event_type {
+            0 => Self::EventNotSupported,
+            // Payment intent events
+            1 => Self::PaymentIntentFailure,
+            2 => Self::PaymentIntentSuccess,
+            3 => Self::PaymentIntentProcessing,
+            4 => Self::PaymentIntentPartiallyFunded,
+            5 => Self::PaymentIntentCancelled,
+            6 => Self::PaymentIntentCancelFailure,
+            7 => Self::PaymentIntentAuthorizationSuccess,
+            8 => Self::PaymentIntentAuthorizationFailure,
+            9 => Self::PaymentIntentCaptureSuccess,
+            10 => Self::PaymentIntentCaptureFailure,
+            11 => Self::PaymentIntentExpired,
+            12 => Self::PaymentActionRequired,
+            // Source events
+            13 => Self::SourceChargeable,
+            14 => Self::SourceTransactionCreated,
+            // Refund events
+            15 => Self::RefundFailure,
+            16 => Self::RefundSuccess,
+            // Dispute events
+            17 => Self::DisputeOpened,
+            18 => Self::DisputeExpired,
+            19 => Self::DisputeAccepted,
+            20 => Self::DisputeCancelled,
+            21 => Self::DisputeChallenged,
+            22 => Self::DisputeWon,
+            23 => Self::DisputeLost,
+            // Mandate events
+            24 => Self::MandateActive,
+            25 => Self::MandateRevoked,
+            // Miscellaneous events
+            26 => Self::EndpointVerification,
+            27 => Self::ExternalAuthenticationARes,
+            28 => Self::FrmApproved,
+            29 => Self::FrmRejected,
+            // Payout events
+            #[cfg(feature = "payouts")]
+            30 => Self::PayoutSuccess,
+            #[cfg(feature = "payouts")]
+            31 => Self::PayoutFailure,
+            #[cfg(feature = "payouts")]
+            32 => Self::PayoutProcessing,
+            #[cfg(feature = "payouts")]
+            33 => Self::PayoutCancelled,
+            #[cfg(feature = "payouts")]
+            34 => Self::PayoutCreated,
+            #[cfg(feature = "payouts")]
+            35 => Self::PayoutExpired,
+            #[cfg(feature = "payouts")]
+            36 => Self::PayoutReversed,
+            _ => Self::EventNotSupported,
+        }
+    }
+}
+
 pub enum WebhookFlow {
     Payment,
     #[cfg(feature = "payouts")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 07916214269..806e84ebb9c 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -573,6 +573,7 @@ pub enum CallConnectorAction {
         error_message: Option<String>,
     },
     HandleResponse(Vec<u8>),
+    UCSHandleResponse(Vec<u8>),
 }
 
 /// The three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the payment amount. This field is mandatory for creating a payment.
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 5008b3a68b7..da8d9321f22 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4263,7 +4263,13 @@ where
         services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,
 {
     record_time_taken_with(|| async {
-        if should_call_unified_connector_service(
+        if !matches!(
+            call_connector_action,
+            CallConnectorAction::UCSHandleResponse(_)
+        ) && !matches!(
+            call_connector_action,
+            CallConnectorAction::HandleResponse(_),
+        ) && should_call_unified_connector_service(
             state,
             merchant_context,
             &router_data,
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index 40422e82542..dec4281e7a9 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -1220,6 +1220,7 @@ impl ForeignTryFrom<&hyperswitch_interfaces::webhooks::IncomingWebhookRequestDet
 }
 
 /// Webhook transform data structure containing UCS response information
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
 pub struct WebhookTransformData {
     pub event_type: api_models::webhooks::IncomingWebhookEvent,
     pub source_verified: bool,
@@ -1231,16 +1232,8 @@ pub struct WebhookTransformData {
 pub fn transform_ucs_webhook_response(
     response: PaymentServiceTransformResponse,
 ) -> Result<WebhookTransformData, error_stack::Report<errors::ApiErrorResponse>> {
-    let event_type = match response.event_type {
-        0 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess,
-        1 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentFailure,
-        2 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentProcessing,
-        3 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentCancelled,
-        4 => api_models::webhooks::IncomingWebhookEvent::RefundSuccess,
-        5 => api_models::webhooks::IncomingWebhookEvent::RefundFailure,
-        6 => api_models::webhooks::IncomingWebhookEvent::MandateRevoked,
-        _ => api_models::webhooks::IncomingWebhookEvent::EventNotSupported,
-    };
+    let event_type =
+        api_models::webhooks::IncomingWebhookEvent::from_ucs_event_type(response.event_type);
 
     Ok(WebhookTransformData {
         event_type,
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 29a6c6c8e26..4d38ce2ed02 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -695,6 +695,7 @@ async fn process_webhook_business_logic(
                 connector,
                 request_details,
                 event_type,
+                webhook_transform_data,
             ))
             .await
             .attach_printable("Incoming webhook flow for payments failed"),
@@ -931,9 +932,22 @@ async fn payments_incoming_webhook_flow(
     connector: &ConnectorEnum,
     request_details: &IncomingWebhookRequestDetails<'_>,
     event_type: webhooks::IncomingWebhookEvent,
+    webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
 ) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
     let consume_or_trigger_flow = if source_verified {
-        payments::CallConnectorAction::HandleResponse(webhook_details.resource_object)
+        // Determine the appropriate action based on UCS availability
+        let resource_object = webhook_details.resource_object;
+
+        match webhook_transform_data.as_ref() {
+            Some(transform_data) => {
+                // Serialize the transform data to pass to UCS handler
+                let transform_data_bytes = serde_json::to_vec(transform_data.as_ref())
+                    .change_context(errors::ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to serialize UCS webhook transform data")?;
+                payments::CallConnectorAction::UCSHandleResponse(transform_data_bytes)
+            }
+            None => payments::CallConnectorAction::HandleResponse(resource_object),
+        }
     } else {
         payments::CallConnectorAction::Trigger
     };
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 41a12f35576..fa8e840fdea 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -61,7 +61,7 @@ use crate::{
     core::{
         api_locking,
         errors::{self, CustomResult},
-        payments,
+        payments, unified_connector_service,
     },
     events::{
         api_logs::{ApiEvent, ApiEventMetric, ApiEventsType},
@@ -127,6 +127,62 @@ pub type BoxedBillingConnectorPaymentsSyncIntegrationInterface<T, Req, Res> =
 pub type BoxedVaultConnectorIntegrationInterface<T, Req, Res> =
     BoxedConnectorIntegrationInterface<T, common_types::VaultConnectorFlowData, Req, Res>;
 
+/// Handle UCS webhook response processing
+fn handle_ucs_response<T, Req, Resp>(
+    router_data: types::RouterData<T, Req, Resp>,
+    transform_data_bytes: Vec<u8>,
+) -> CustomResult<types::RouterData<T, Req, Resp>, errors::ConnectorError>
+where
+    T: Clone + Debug + 'static,
+    Req: Debug + Clone + 'static,
+    Resp: Debug + Clone + 'static,
+{
+    let webhook_transform_data: unified_connector_service::WebhookTransformData =
+        serde_json::from_slice(&transform_data_bytes)
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)
+            .attach_printable("Failed to deserialize UCS webhook transform data")?;
+
+    let webhook_content = webhook_transform_data
+        .webhook_content
+        .ok_or(errors::ConnectorError::ResponseDeserializationFailed)
+        .attach_printable("UCS webhook transform data missing webhook_content")?;
+
+    let payment_get_response = match webhook_content.content {
+        Some(unified_connector_service_client::payments::webhook_response_content::Content::PaymentsResponse(payments_response)) => {
+            Ok(payments_response)
+        },
+        Some(unified_connector_service_client::payments::webhook_response_content::Content::RefundsResponse(_)) => {
+            Err(errors::ConnectorError::ProcessingStepFailed(Some("UCS webhook contains refund response but payment processing was expected".to_string().into())).into())
+        },
+        Some(unified_connector_service_client::payments::webhook_response_content::Content::DisputesResponse(_)) => {
+            Err(errors::ConnectorError::ProcessingStepFailed(Some("UCS webhook contains dispute response but payment processing was expected".to_string().into())).into())
+        },
+        None => {
+            Err(errors::ConnectorError::ResponseDeserializationFailed)
+                .attach_printable("UCS webhook content missing payments_response")
+        }
+    }?;
+
+    let (status, router_data_response, status_code) =
+        unified_connector_service::handle_unified_connector_service_response_for_payment_get(
+            payment_get_response.clone(),
+        )
+        .change_context(errors::ConnectorError::ProcessingStepFailed(None))
+        .attach_printable("Failed to process UCS webhook response using PSync handler")?;
+
+    let mut updated_router_data = router_data;
+    updated_router_data.status = status;
+
+    let _ = router_data_response.map_err(|error_response| {
+        updated_router_data.response = Err(error_response);
+    });
+    updated_router_data.raw_connector_response =
+        payment_get_response.raw_connector_response.map(Secret::new);
+    updated_router_data.connector_http_status_code = Some(status_code);
+
+    Ok(updated_router_data)
+}
+
 fn store_raw_connector_response_if_required<T, Req, Resp>(
     return_raw_connector_response: Option<bool>,
     router_data: &mut types::RouterData<T, Req, Resp>,
@@ -186,6 +242,9 @@ where
             };
             connector_integration.handle_response(req, None, response)
         }
+        payments::CallConnectorAction::UCSHandleResponse(transform_data_bytes) => {
+            handle_ucs_response(router_data, transform_data_bytes)
+        }
         payments::CallConnectorAction::Avoid => Ok(router_data),
         payments::CallConnectorAction::StatusUpdate {
             status,
 | 
	2025-08-22T05:20:49Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
while handling the response of UCS for webhooks Hyperswitch used to use the existing connector code (Psync's Handle Respnse) which gave error for UCS response so fixed this issue.
Closes #9027 
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
testing of the webhook can be done by the step in this merged PR:https://github.com/juspay/hyperswitch/pull/8814
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a589e2246447b7096fd335d444a24b2450c3e7c2 | 
	
testing of the webhook can be done by the step in this merged PR:https://github.com/juspay/hyperswitch/pull/8814
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9028 | 
	Bug: [FEATURE] CELERO CIT_MIT (ALPHACONNECTOR)
### Feature Description
IMPLEMENT CIT & MIT for celero
### Possible Implementation
- DOCS : https://sandbox.gotnpgateway.com/docs/api/transactions#cit-mit
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs
index 2003ba59ae0..4e4c3f113cf 100644
--- a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs
@@ -1,5 +1,5 @@
 use common_enums::{enums, Currency};
-use common_utils::{pii::Email, types::MinorUnit};
+use common_utils::{id_type::CustomerId, pii::Email, types::MinorUnit};
 use hyperswitch_domain_models::{
     address::Address as DomainAddress,
     payment_method_data::PaymentMethodData,
@@ -12,20 +12,24 @@ use hyperswitch_domain_models::{
         refunds::{Execute, RSync},
     },
     router_request_types::{PaymentsCaptureData, ResponseId},
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
+    router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData},
     types::{
         PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
         RefundSyncRouterData, RefundsRouterData,
     },
 };
-use hyperswitch_interfaces::{consts, errors};
+use hyperswitch_interfaces::{
+    consts,
+    errors::{self},
+};
 use masking::{PeekInterface, Secret};
 use serde::{Deserialize, Serialize};
 
 use crate::{
     types::{RefundsResponseRouterData, ResponseRouterData},
     utils::{
-        AddressDetailsData, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData as _,
+        get_unimplemented_payment_method_error_message, AddressDetailsData,
+        PaymentsAuthorizeRequestData, RefundsRequestData, RouterData as _,
     },
 };
 
@@ -87,6 +91,17 @@ pub struct CeleroPaymentsRequest {
     shipping_address: Option<CeleroAddress>,
     #[serde(skip_serializing_if = "Option::is_none")]
     create_vault_record: Option<bool>,
+    // CIT/MIT fields
+    #[serde(skip_serializing_if = "Option::is_none")]
+    card_on_file_indicator: Option<CardOnFileIndicator>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    initiated_by: Option<InitiatedBy>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    initial_transaction_id: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    stored_credential_indicator: Option<StoredCredentialIndicator>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    billing_method: Option<BillingMethod>,
 }
 
 #[derive(Debug, Serialize, PartialEq)]
@@ -135,8 +150,14 @@ impl TryFrom<&DomainAddress> for CeleroAddress {
 #[serde(rename_all = "lowercase")]
 pub enum CeleroPaymentMethod {
     Card(CeleroCard),
+    Customer(CeleroCustomer),
 }
 
+#[derive(Debug, Serialize, PartialEq)]
+pub struct CeleroCustomer {
+    id: Option<CustomerId>,
+    payment_method_id: Option<String>,
+}
 #[derive(Debug, Serialize, PartialEq, Clone, Copy)]
 #[serde(rename_all = "lowercase")]
 pub enum CeleroEntryType {
@@ -233,27 +254,102 @@ impl TryFrom<&CeleroRouterData<&PaymentsAuthorizeRouterData>> for CeleroPayments
             .get_optional_shipping()
             .and_then(|address| address.try_into().ok());
 
-        // Check if 3DS is requested
-        let is_three_ds = item.router_data.is_three_ds();
+        // Determine CIT/MIT fields based on mandate data
+        let (mandate_fields, payment_method) = determine_cit_mit_fields(item.router_data)?;
 
         let request = Self {
             idempotency_key: item.router_data.connector_request_reference_id.clone(),
             transaction_type,
             amount: item.amount,
             currency: item.router_data.request.currency,
-            payment_method: CeleroPaymentMethod::try_from((
-                &item.router_data.request.payment_method_data,
-                is_three_ds,
-            ))?,
+            payment_method,
             billing_address,
             shipping_address,
             create_vault_record: Some(false),
+            card_on_file_indicator: mandate_fields.card_on_file_indicator,
+            initiated_by: mandate_fields.initiated_by,
+            initial_transaction_id: mandate_fields.initial_transaction_id,
+            stored_credential_indicator: mandate_fields.stored_credential_indicator,
+            billing_method: mandate_fields.billing_method,
         };
 
         Ok(request)
     }
 }
 
+// Define a struct to hold CIT/MIT fields to avoid complex tuple return type
+#[derive(Debug, Default)]
+pub struct CeleroMandateFields {
+    pub card_on_file_indicator: Option<CardOnFileIndicator>,
+    pub initiated_by: Option<InitiatedBy>,
+    pub initial_transaction_id: Option<String>,
+    pub stored_credential_indicator: Option<StoredCredentialIndicator>,
+    pub billing_method: Option<BillingMethod>,
+}
+
+// Helper function to determine CIT/MIT fields based on mandate data
+fn determine_cit_mit_fields(
+    router_data: &PaymentsAuthorizeRouterData,
+) -> Result<(CeleroMandateFields, CeleroPaymentMethod), error_stack::Report<errors::ConnectorError>>
+{
+    // Default null values
+    let mut mandate_fields = CeleroMandateFields::default();
+
+    // First check if there's a mandate_id in the request
+    match router_data
+        .request
+        .mandate_id
+        .clone()
+        .and_then(|mandate_ids| mandate_ids.mandate_reference_id)
+    {
+        // If there's a connector mandate ID, this is a MIT (Merchant Initiated Transaction)
+        Some(api_models::payments::MandateReferenceId::ConnectorMandateId(
+            connector_mandate_id,
+        )) => {
+            mandate_fields.card_on_file_indicator = Some(CardOnFileIndicator::RecurringPayment);
+            mandate_fields.initiated_by = Some(InitiatedBy::Merchant); // This is a MIT
+            mandate_fields.stored_credential_indicator = Some(StoredCredentialIndicator::Used);
+            mandate_fields.billing_method = Some(BillingMethod::Recurring);
+            mandate_fields.initial_transaction_id =
+                connector_mandate_id.get_connector_mandate_request_reference_id();
+            Ok((
+                mandate_fields,
+                CeleroPaymentMethod::Customer(CeleroCustomer {
+                    id: Some(router_data.get_customer_id()?),
+                    payment_method_id: connector_mandate_id.get_payment_method_id(),
+                }),
+            ))
+        }
+        // For other mandate types that might not be supported
+        Some(api_models::payments::MandateReferenceId::NetworkMandateId(_))
+        | Some(api_models::payments::MandateReferenceId::NetworkTokenWithNTI(_)) => {
+            // These might need different handling or return an error
+            Err(errors::ConnectorError::NotImplemented(
+                get_unimplemented_payment_method_error_message("Celero"),
+            )
+            .into())
+        }
+        // If no mandate ID is present, check if it's a mandate payment
+        None => {
+            if router_data.request.is_mandate_payment() {
+                // This is a customer-initiated transaction for a recurring payment
+                mandate_fields.initiated_by = Some(InitiatedBy::Customer);
+                mandate_fields.card_on_file_indicator = Some(CardOnFileIndicator::RecurringPayment);
+                mandate_fields.billing_method = Some(BillingMethod::Recurring);
+                mandate_fields.stored_credential_indicator = Some(StoredCredentialIndicator::Used);
+            }
+            let is_three_ds = router_data.is_three_ds();
+            Ok((
+                mandate_fields,
+                CeleroPaymentMethod::try_from((
+                    &router_data.request.payment_method_data,
+                    is_three_ds,
+                ))?,
+            ))
+        }
+    }
+}
+
 // Auth Struct for CeleroCommerce API key authentication
 pub struct CeleroAuthType {
     pub(super) api_key: Secret<String>,
@@ -326,6 +422,38 @@ pub enum TransactionType {
     Sale,
     Authorize,
 }
+
+// CIT/MIT related enums
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub enum CardOnFileIndicator {
+    #[serde(rename = "C")]
+    GeneralPurposeStorage,
+    #[serde(rename = "R")]
+    RecurringPayment,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum InitiatedBy {
+    Customer,
+    Merchant,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum StoredCredentialIndicator {
+    Used,
+    Stored,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum BillingMethod {
+    Straight,
+    #[serde(rename = "initial_recurring")]
+    InitialRecurring,
+    Recurring,
+}
 #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
 #[serde_with::skip_serializing_none]
 pub struct CeleroTransactionResponseData {
@@ -337,6 +465,26 @@ pub struct CeleroTransactionResponseData {
     pub response: CeleroPaymentMethodResponse,
     pub billing_address: Option<CeleroAddressResponse>,
     pub shipping_address: Option<CeleroAddressResponse>,
+    // Additional fields from the sample response
+    pub status: Option<String>,
+    pub response_code: Option<i32>,
+    pub customer_id: Option<String>,
+    pub payment_method_id: Option<String>,
+}
+
+impl CeleroTransactionResponseData {
+    pub fn get_mandate_reference(&self) -> Box<Option<MandateReference>> {
+        if self.payment_method_id.is_some() {
+            Box::new(Some(MandateReference {
+                connector_mandate_id: None,
+                payment_method_id: self.payment_method_id.clone(),
+                mandate_metadata: None,
+                connector_mandate_request_reference_id: Some(self.id.clone()),
+            }))
+        } else {
+            Box::new(None)
+        }
+    }
 }
 
 #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@@ -411,9 +559,11 @@ impl<F, T> TryFrom<ResponseRouterData<F, CeleroPaymentsResponse, T, PaymentsResp
                             Ok(Self {
                                 status: final_status,
                                 response: Ok(PaymentsResponseData::TransactionResponse {
-                                    resource_id: ResponseId::ConnectorTransactionId(data.id),
+                                    resource_id: ResponseId::ConnectorTransactionId(
+                                        data.id.clone(),
+                                    ),
                                     redirection_data: Box::new(None),
-                                    mandate_reference: Box::new(None),
+                                    mandate_reference: data.get_mandate_reference(),
                                     connector_metadata: None,
                                     network_txn_id: None,
                                     connector_response_reference_id: response.auth_code.clone(),
@@ -427,6 +577,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, CeleroPaymentsResponse, T, PaymentsResp
                     }
                 } else {
                     // No transaction data in successful response
+                    // We don't have a transaction ID in this case
                     Ok(Self {
                         status: common_enums::AttemptStatus::Failure,
                         response: Err(hyperswitch_domain_models::router_data::ErrorResponse {
@@ -450,6 +601,10 @@ impl<F, T> TryFrom<ResponseRouterData<F, CeleroPaymentsResponse, T, PaymentsResp
                 let error_details =
                     CeleroErrorDetails::from_top_level_error(item.response.msg.clone());
 
+                // Extract transaction ID from the top-level data if available
+                let connector_transaction_id =
+                    item.response.data.as_ref().map(|data| data.id.clone());
+
                 Ok(Self {
                     status: common_enums::AttemptStatus::Failure,
                     response: Err(hyperswitch_domain_models::router_data::ErrorResponse {
@@ -460,7 +615,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, CeleroPaymentsResponse, T, PaymentsResp
                         reason: error_details.decline_reason,
                         status_code: item.http_code,
                         attempt_status: None,
-                        connector_transaction_id: None,
+                        connector_transaction_id,
                         network_decline_code: None,
                         network_advice_code: None,
                         network_error_message: None,
 | 
	2025-08-22T07:29:35Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
CIT-MIT implementation for CELERO (alpha connector)
DOCS
- https://sandbox.gotnpgateway.com/docs/api/transactions#cit-mit
Caviats
- Connector expecting initial_transaction_id which is nothing but prev txn id
- Connector not returning `payment_method_id` or `mandate_id`
### Note this is an alpha connector and we depend on alpha cypress test which 
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8446ffbf5992a97d79d129cade997effc60fcd85 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9047 | 
	Bug: Payment Intent and MCA changes for split payments
- Add split_txns_enabled field in PaymentIntent
- Add split_enabled field to MCA payment_method
- Code changes to modify split_enabled for a payment method when creating or updating an MCA (similar to recurring_enabled)
- PML changes to filter payment methods based on split_enabled in MCA and split_txns_enabled in Intent | 
	diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 2e70e1a6c95..e7d70225884 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2342,6 +2342,10 @@ pub struct ProfileCreate {
     /// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
     #[schema(value_type = Option<MerchantCountryCode>, example = "840")]
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+
+    /// Enable split payments, i.e., split the amount between multiple payment methods
+    #[schema(value_type = Option<SplitTxnsEnabled>, default = "skip")]
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 #[cfg(feature = "v1")]
@@ -2688,6 +2692,10 @@ pub struct ProfileResponse {
     /// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
     #[schema(value_type = Option<MerchantCountryCode>, example = "840")]
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+
+    /// Enable split payments, i.e., split the amount between multiple payment methods
+    #[schema(value_type = SplitTxnsEnabled, default = "skip")]
+    pub split_txns_enabled: common_enums::SplitTxnsEnabled,
 }
 
 #[cfg(feature = "v1")]
@@ -3006,6 +3014,10 @@ pub struct ProfileUpdate {
     #[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
     pub revenue_recovery_retry_algorithm_type:
         Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
+
+    /// Enable split payments, i.e., split the amount between multiple payment methods
+    #[schema(value_type = Option<SplitTxnsEnabled>, default = "skip")]
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 5660819cea8..c56456e4ce8 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -643,6 +643,10 @@ pub struct PaymentsIntentResponse {
     #[schema(value_type = RequestIncrementalAuthorization)]
     pub request_incremental_authorization: common_enums::RequestIncrementalAuthorization,
 
+    /// Enable split payments, i.e., split the amount between multiple payment methods
+    #[schema(value_type = SplitTxnsEnabled, default = "skip")]
+    pub split_txns_enabled: common_enums::SplitTxnsEnabled,
+
     ///Will be used to expire client secret after certain amount of time to be supplied in seconds
     #[serde(with = "common_utils::custom_serde::iso8601")]
     pub expires_on: PrimitiveDateTime,
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 07916214269..cbe1e3f0aab 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2859,6 +2859,29 @@ pub enum RequestIncrementalAuthorization {
     Default,
 }
 
+#[derive(
+    Clone,
+    Debug,
+    Copy,
+    Default,
+    Eq,
+    Hash,
+    PartialEq,
+    serde::Deserialize,
+    serde::Serialize,
+    strum::Display,
+    strum::EnumString,
+    ToSchema,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum SplitTxnsEnabled {
+    Enable,
+    #[default]
+    Skip,
+}
+
 #[derive(Clone, Copy, Eq, Hash, PartialEq, Debug, Serialize, Deserialize, strum::Display, ToSchema,)]
 #[rustfmt::skip]
 pub enum CountryAlpha3 {
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 8a76b648d0d..a51887a94d6 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -412,6 +412,7 @@ pub struct Profile {
     pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
     pub is_external_vault_enabled: Option<bool>,
     pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 impl Profile {
@@ -487,6 +488,7 @@ pub struct ProfileNew {
     pub is_iframe_redirection_enabled: Option<bool>,
     pub is_external_vault_enabled: Option<bool>,
     pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 #[cfg(feature = "v2")]
@@ -546,6 +548,7 @@ pub struct ProfileUpdateInternal {
     pub is_iframe_redirection_enabled: Option<bool>,
     pub is_external_vault_enabled: Option<bool>,
     pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 #[cfg(feature = "v2")]
@@ -602,6 +605,7 @@ impl ProfileUpdateInternal {
             external_vault_connector_details,
             merchant_category_code,
             merchant_country_code,
+            split_txns_enabled,
         } = self;
         Profile {
             id: source.id,
@@ -698,6 +702,7 @@ impl ProfileUpdateInternal {
             merchant_category_code: merchant_category_code.or(source.merchant_category_code),
             merchant_country_code: merchant_country_code.or(source.merchant_country_code),
             dispute_polling_interval: None,
+            split_txns_enabled: split_txns_enabled.or(source.split_txns_enabled),
         }
     }
 }
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index acc8d4b21f8..a152d4085df 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -95,6 +95,7 @@ pub struct PaymentIntent {
     pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
     pub payment_link_config: Option<PaymentLinkConfigRequestForPayments>,
     pub id: common_utils::id_type::GlobalPaymentId,
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 #[cfg(feature = "v1")]
@@ -355,6 +356,7 @@ pub struct PaymentIntentNew {
     pub tax_details: Option<TaxDetails>,
     pub skip_external_tax_calculation: Option<bool>,
     pub enable_partial_authorization: Option<bool>,
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
     pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,
     pub billing_address: Option<Encryption>,
     pub shipping_address: Option<Encryption>,
@@ -800,6 +802,7 @@ impl PaymentIntentUpdateInternal {
             duty_amount: source.duty_amount,
             order_date: source.order_date,
             enable_partial_authorization: None,
+            split_txns_enabled: source.split_txns_enabled,
         }
     }
 }
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 4711143d32c..ea3980d942a 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -263,6 +263,8 @@ diesel::table! {
         revenue_recovery_retry_algorithm_data -> Nullable<Jsonb>,
         is_external_vault_enabled -> Nullable<Bool>,
         external_vault_connector_details -> Nullable<Jsonb>,
+        #[max_length = 16]
+        split_txns_enabled -> Nullable<Varchar>,
     }
 }
 
@@ -1039,6 +1041,8 @@ diesel::table! {
         payment_link_config -> Nullable<Jsonb>,
         #[max_length = 64]
         id -> Varchar,
+        #[max_length = 16]
+        split_txns_enabled -> Nullable<Varchar>,
     }
 }
 
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 44089872660..581754d6017 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -1074,6 +1074,7 @@ pub struct Profile {
     pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
     pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+    pub split_txns_enabled: common_enums::SplitTxnsEnabled,
 }
 
 #[cfg(feature = "v2")]
@@ -1131,6 +1132,7 @@ pub struct ProfileSetter {
     pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
     pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+    pub split_txns_enabled: common_enums::SplitTxnsEnabled,
 }
 
 #[cfg(feature = "v2")]
@@ -1193,6 +1195,7 @@ impl From<ProfileSetter> for Profile {
             external_vault_connector_details: value.external_vault_connector_details,
             merchant_category_code: value.merchant_category_code,
             merchant_country_code: value.merchant_country_code,
+            split_txns_enabled: value.split_txns_enabled,
         }
     }
 }
@@ -1380,6 +1383,7 @@ pub struct ProfileGeneralUpdate {
     pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
     pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
+    pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
 }
 
 #[cfg(feature = "v2")]
@@ -1461,6 +1465,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                     merchant_category_code,
                     merchant_country_code,
                     revenue_recovery_retry_algorithm_type,
+                    split_txns_enabled,
                 } = *update;
                 Self {
                     profile_name,
@@ -1514,6 +1519,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                     external_vault_connector_details,
                     merchant_category_code,
                     merchant_country_code,
+                    split_txns_enabled,
                 }
             }
             ProfileUpdate::RoutingAlgorithmUpdate {
@@ -1570,6 +1576,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::ExtendedCardInfoUpdate {
                 is_extended_card_info_enabled,
@@ -1624,6 +1631,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::ConnectorAgnosticMitUpdate {
                 is_connector_agnostic_mit_enabled,
@@ -1678,6 +1686,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::DefaultRoutingFallbackUpdate {
                 default_fallback_routing,
@@ -1732,6 +1741,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::NetworkTokenizationUpdate {
                 is_network_tokenization_enabled,
@@ -1786,6 +1796,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::CollectCvvDuringPaymentUpdate {
                 should_collect_cvv_during_payment,
@@ -1840,6 +1851,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::DecisionManagerRecordUpdate {
                 three_ds_decision_manager_config,
@@ -1894,6 +1906,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::CardTestingSecretKeyUpdate {
                 card_testing_secret_key,
@@ -1948,6 +1961,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
             ProfileUpdate::RevenueRecoveryAlgorithmUpdate {
                 revenue_recovery_retry_algorithm_type,
@@ -2003,6 +2017,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                 external_vault_connector_details: None,
                 merchant_category_code: None,
                 merchant_country_code: None,
+                split_txns_enabled: None,
             },
         }
     }
@@ -2082,6 +2097,7 @@ impl super::behaviour::Conversion for Profile {
             merchant_category_code: self.merchant_category_code,
             merchant_country_code: self.merchant_country_code,
             dispute_polling_interval: None,
+            split_txns_enabled: Some(self.split_txns_enabled),
         })
     }
 
@@ -2177,6 +2193,7 @@ impl super::behaviour::Conversion for Profile {
                 external_vault_connector_details: item.external_vault_connector_details,
                 merchant_category_code: item.merchant_category_code,
                 merchant_country_code: item.merchant_country_code,
+                split_txns_enabled: item.split_txns_enabled.unwrap_or_default(),
             })
         }
         .await
@@ -2247,6 +2264,7 @@ impl super::behaviour::Conversion for Profile {
             external_vault_connector_details: self.external_vault_connector_details,
             merchant_category_code: self.merchant_category_code,
             merchant_country_code: self.merchant_country_code,
+            split_txns_enabled: Some(self.split_txns_enabled),
         })
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 36eece964f9..134f4fe7a07 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -460,6 +460,8 @@ pub struct PaymentIntent {
     pub updated_by: String,
     /// Denotes whether merchant requested for incremental authorization to be enabled for this payment.
     pub request_incremental_authorization: storage_enums::RequestIncrementalAuthorization,
+    /// Denotes whether merchant requested for split payments to be enabled for this payment
+    pub split_txns_enabled: storage_enums::SplitTxnsEnabled,
     /// Denotes the number of authorizations that have been made for the payment.
     pub authorization_count: Option<i32>,
     /// Denotes the client secret expiry for the payment. This is the time at which the client secret will expire.
@@ -637,6 +639,7 @@ impl PaymentIntent {
             request_external_three_ds_authentication: request
                 .request_external_three_ds_authentication
                 .unwrap_or_default(),
+            split_txns_enabled: profile.split_txns_enabled,
             frm_metadata: request.frm_metadata,
             customer_details: None,
             merchant_reference_id: request.merchant_reference_id,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index c96209d2b4f..8dbdd1761bf 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -752,7 +752,6 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal
                     frm_metadata,
                     request_external_three_ds_authentication:
                         request_external_three_ds_authentication.map(|val| val.as_bool()),
-
                     updated_by,
                     force_3ds_challenge,
                     is_iframe_redirection_enabled,
@@ -1665,6 +1664,7 @@ impl behaviour::Conversion for PaymentIntent {
             frm_merchant_decision,
             updated_by,
             request_incremental_authorization,
+            split_txns_enabled,
             authorization_count,
             session_expiry,
             request_external_three_ds_authentication,
@@ -1734,6 +1734,7 @@ impl behaviour::Conversion for PaymentIntent {
             updated_by,
 
             request_incremental_authorization: Some(request_incremental_authorization),
+            split_txns_enabled: Some(split_txns_enabled),
             authorization_count,
             session_expiry,
             request_external_three_ds_authentication: Some(
@@ -1887,6 +1888,7 @@ impl behaviour::Conversion for PaymentIntent {
                 request_incremental_authorization: storage_model
                     .request_incremental_authorization
                     .unwrap_or_default(),
+                split_txns_enabled: storage_model.split_txns_enabled.unwrap_or_default(),
                 authorization_count: storage_model.authorization_count,
                 session_expiry: storage_model.session_expiry,
                 request_external_three_ds_authentication: storage_model
@@ -1975,6 +1977,7 @@ impl behaviour::Conversion for PaymentIntent {
             updated_by: self.updated_by,
 
             request_incremental_authorization: Some(self.request_incremental_authorization),
+            split_txns_enabled: Some(self.split_txns_enabled),
             authorization_count: self.authorization_count,
             session_expiry: self.session_expiry,
             request_external_three_ds_authentication: Some(
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 1c52daa639a..59609e79057 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -644,6 +644,7 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::enums::MitExemptionRequest,
         api_models::enums::EnablePaymentLinkRequest,
         api_models::enums::RequestIncrementalAuthorization,
+        api_models::enums::SplitTxnsEnabled,
         api_models::enums::External3dsAuthenticationRequest,
         api_models::enums::TaxCalculationOverride,
         api_models::enums::SurchargeCalculationOverride,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 7d625a78396..c3f0cf91dcb 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3645,6 +3645,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
                 .map(ForeignInto::foreign_into),
             merchant_category_code: self.merchant_category_code,
             merchant_country_code: self.merchant_country_code,
+            split_txns_enabled: self.split_txns_enabled.unwrap_or_default(),
         }))
     }
 }
@@ -4133,6 +4134,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
                 merchant_category_code: self.merchant_category_code,
                 merchant_country_code: self.merchant_country_code,
                 revenue_recovery_retry_algorithm_type,
+                split_txns_enabled: self.split_txns_enabled,
             },
         )))
     }
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 8a3594c310c..9aed3766546 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2195,6 +2195,7 @@ where
                     .clone()
                     .map(ForeignFrom::foreign_from),
                 request_incremental_authorization: payment_intent.request_incremental_authorization,
+                split_txns_enabled: payment_intent.split_txns_enabled,
                 expires_on: payment_intent.session_expiry,
                 frm_metadata: payment_intent.frm_metadata.clone(),
                 request_external_three_ds_authentication: payment_intent
diff --git a/crates/router/src/services/kafka/payment_intent.rs b/crates/router/src/services/kafka/payment_intent.rs
index e5caffc4a54..85cf80cd8a7 100644
--- a/crates/router/src/services/kafka/payment_intent.rs
+++ b/crates/router/src/services/kafka/payment_intent.rs
@@ -143,6 +143,7 @@ pub struct KafkaPaymentIntent<'a> {
     pub updated_by: &'a String,
     pub surcharge_applicable: Option<bool>,
     pub request_incremental_authorization: RequestIncrementalAuthorization,
+    pub split_txns_enabled: common_enums::SplitTxnsEnabled,
     pub authorization_count: Option<i32>,
     #[serde(with = "time::serde::timestamp")]
     pub session_expiry: OffsetDateTime,
@@ -209,6 +210,7 @@ impl<'a> KafkaPaymentIntent<'a> {
             frm_merchant_decision,
             updated_by,
             request_incremental_authorization,
+            split_txns_enabled,
             authorization_count,
             session_expiry,
             request_external_three_ds_authentication,
@@ -265,6 +267,7 @@ impl<'a> KafkaPaymentIntent<'a> {
             updated_by,
             surcharge_applicable: None,
             request_incremental_authorization: *request_incremental_authorization,
+            split_txns_enabled: *split_txns_enabled,
             authorization_count: *authorization_count,
             session_expiry: session_expiry.assume_utc(),
             request_external_three_ds_authentication: *request_external_three_ds_authentication,
diff --git a/crates/router/src/services/kafka/payment_intent_event.rs b/crates/router/src/services/kafka/payment_intent_event.rs
index db6de3cce1e..edfb570901a 100644
--- a/crates/router/src/services/kafka/payment_intent_event.rs
+++ b/crates/router/src/services/kafka/payment_intent_event.rs
@@ -96,6 +96,7 @@ pub struct KafkaPaymentIntentEvent<'a> {
     pub updated_by: &'a String,
     pub surcharge_applicable: Option<bool>,
     pub request_incremental_authorization: RequestIncrementalAuthorization,
+    pub split_txns_enabled: common_enums::SplitTxnsEnabled,
     pub authorization_count: Option<i32>,
     #[serde(with = "time::serde::timestamp::nanoseconds")]
     pub session_expiry: OffsetDateTime,
@@ -221,6 +222,7 @@ impl<'a> KafkaPaymentIntentEvent<'a> {
             frm_merchant_decision,
             updated_by,
             request_incremental_authorization,
+            split_txns_enabled,
             authorization_count,
             session_expiry,
             request_external_three_ds_authentication,
@@ -277,6 +279,7 @@ impl<'a> KafkaPaymentIntentEvent<'a> {
             updated_by,
             surcharge_applicable: None,
             request_incremental_authorization: *request_incremental_authorization,
+            split_txns_enabled: *split_txns_enabled,
             authorization_count: *authorization_count,
             session_expiry: session_expiry.assume_utc(),
             request_external_three_ds_authentication: *request_external_three_ds_authentication,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index e0866e13eb8..8035959dd35 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -319,6 +319,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
                 .map(ForeignInto::foreign_into),
             merchant_category_code: item.merchant_category_code,
             merchant_country_code: item.merchant_country_code,
+            split_txns_enabled: item.split_txns_enabled,
         })
     }
 }
diff --git a/v2_compatible_migrations/2025-08-25-090221_add-split-txns-enabled-in-payment-intent/down.sql b/v2_compatible_migrations/2025-08-25-090221_add-split-txns-enabled-in-payment-intent/down.sql
new file mode 100644
index 00000000000..becd303be31
--- /dev/null
+++ b/v2_compatible_migrations/2025-08-25-090221_add-split-txns-enabled-in-payment-intent/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent DROP COLUMN IF EXISTS split_txns_enabled;
diff --git a/v2_compatible_migrations/2025-08-25-090221_add-split-txns-enabled-in-payment-intent/up.sql b/v2_compatible_migrations/2025-08-25-090221_add-split-txns-enabled-in-payment-intent/up.sql
new file mode 100644
index 00000000000..c765ec9e037
--- /dev/null
+++ b/v2_compatible_migrations/2025-08-25-090221_add-split-txns-enabled-in-payment-intent/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS split_txns_enabled VARCHAR(16);
\ No newline at end of file
diff --git a/v2_compatible_migrations/2025-08-29-040411_add-split-txns-enabled-in-business-profile/down.sql b/v2_compatible_migrations/2025-08-29-040411_add-split-txns-enabled-in-business-profile/down.sql
new file mode 100644
index 00000000000..a0fb7698515
--- /dev/null
+++ b/v2_compatible_migrations/2025-08-29-040411_add-split-txns-enabled-in-business-profile/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile DROP COLUMN IF EXISTS split_txns_enabled;
\ No newline at end of file
diff --git a/v2_compatible_migrations/2025-08-29-040411_add-split-txns-enabled-in-business-profile/up.sql b/v2_compatible_migrations/2025-08-29-040411_add-split-txns-enabled-in-business-profile/up.sql
new file mode 100644
index 00000000000..d5cc041c284
--- /dev/null
+++ b/v2_compatible_migrations/2025-08-29-040411_add-split-txns-enabled-in-business-profile/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS split_txns_enabled VARCHAR(16);
\ No newline at end of file
 | 
	2025-08-25T09:13:26Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Add split_txns_enabled field to business_profile DB, create+update API calls
- Add split_txns_enabled field in PaymentIntent
- PML changes to filter payment methods based on split_enabled in MCA and split_txns_enabled in Intent
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9047 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Business Profile Create Request (split_txns_enabled)
```
curl --location 'http://localhost:8080/v2/profiles' \
--header 'x-merchant-id: cloth_seller_v2_5WeDFMHDxeA6s3I9WReI' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
    "profile_name": "businesss",
    "return_url": "https://google.com/success",
...
    "split_txns_enabled": "enable"
    
}'
```
Response:
```json
{
    "merchant_id": "cloth_seller_v2_5WeDFMHDxeA6s3I9WReI",
    "id": "pro_ayVzG5Zr33W31ArJk7CK",
    "profile_name": "businesss",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "c94j5uGyFCAIU1N24p3mVl9DKLrSCN0xslChyzawzX1gwvSynCgpX6vS39JuA0J9",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "metadata": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "should_collect_cvv_during_payment": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_iframe_redirection_enabled": null,
    "is_external_vault_enabled": null,
    "external_vault_connector_details": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "split_txns_enabled": "enable"
}
```
2. Payment Intent Create Request
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_xjdI9HLJv4OJIab8VojIjDWbXN3i4a50fzUaxgaQjtP3vwL3WmQVwNbgNmA9M5DV' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_dPNtC5bK3lNxBYt7kyk4' \
--header 'Authorization: api-key=dev_xjdI9HLJv4OJIab8VojIjDWbXN3i4a50fzUaxgaQjtP3vwL3WmQVwNbgNmA9M5DV' \
--data-raw '{
	"amount_details": {
		"order_amount": 1000,
		"currency": "USD"
	},
	"capture_method": "automatic",
	"authentication_type": "three_ds",
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 1000
		}
	],
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		},
		"email": "user@gmail.com"
	},
	"shipping": {
		"address": {
			"first_name": "John",
			"last_name": "Dough",
			"city": "Karwar",
			"zip": "571201",
			"state": "California",
			"country": "US"
		},
		"email": "example@example.com",
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		}
	},
    "customer_id": "12345_cus_0198e54d6c3b7871bcfde4a50ee43b88"
}'
```
```json
{
    "id": "12345_pay_0198e54f328775408faf14fc2c47651a",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 1000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": "cs_0198e54f32b07003a723ffba50f47fea",
    "profile_id": "pro_dPNtC5bK3lNxBYt7kyk4",
    "merchant_reference_id": null,
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "user@gmail.com"
    },
    "shipping": {
        "address": {
            "city": "Karwar",
            "country": "US",
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": "571201",
            "state": "California",
            "first_name": "John",
            "last_name": "Dough",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "example@example.com"
    },
    "customer_id": "12345_cus_0198e54d6c3b7871bcfde4a50ee43b88",
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 1000,
            "tax_rate": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "product_img_link": null,
            "product_id": null,
            "category": null,
            "sub_category": null,
            "brand": null,
            "product_type": null,
            "product_tax_code": null,
            "description": null,
            "sku": null,
            "upc": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "total_amount": null,
            "unit_discount_amount": null
        }
    ],
    "allowed_payment_method_types": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "split_txns_enabled": "true",
    "expires_on": "2025-08-26T07:52:09.530Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	9f0cd51cabb281de82b00734b532fea3cf6205fe | 
	
1. Business Profile Create Request (split_txns_enabled)
```
curl --location 'http://localhost:8080/v2/profiles' \
--header 'x-merchant-id: cloth_seller_v2_5WeDFMHDxeA6s3I9WReI' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
    "profile_name": "businesss",
    "return_url": "https://google.com/success",
...
    "split_txns_enabled": "enable"
    
}'
```
Response:
```json
{
    "merchant_id": "cloth_seller_v2_5WeDFMHDxeA6s3I9WReI",
    "id": "pro_ayVzG5Zr33W31ArJk7CK",
    "profile_name": "businesss",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "c94j5uGyFCAIU1N24p3mVl9DKLrSCN0xslChyzawzX1gwvSynCgpX6vS39JuA0J9",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "metadata": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "should_collect_cvv_during_payment": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_iframe_redirection_enabled": null,
    "is_external_vault_enabled": null,
    "external_vault_connector_details": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "split_txns_enabled": "enable"
}
```
2. Payment Intent Create Request
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_xjdI9HLJv4OJIab8VojIjDWbXN3i4a50fzUaxgaQjtP3vwL3WmQVwNbgNmA9M5DV' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_dPNtC5bK3lNxBYt7kyk4' \
--header 'Authorization: api-key=dev_xjdI9HLJv4OJIab8VojIjDWbXN3i4a50fzUaxgaQjtP3vwL3WmQVwNbgNmA9M5DV' \
--data-raw '{
	"amount_details": {
		"order_amount": 1000,
		"currency": "USD"
	},
	"capture_method": "automatic",
	"authentication_type": "three_ds",
	"order_details": [
		{
			"product_name": "Apple iphone 15",
			"quantity": 1,
			"amount": 1000
		}
	],
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "joseph",
			"last_name": "Doe"
		},
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		},
		"email": "user@gmail.com"
	},
	"shipping": {
		"address": {
			"first_name": "John",
			"last_name": "Dough",
			"city": "Karwar",
			"zip": "571201",
			"state": "California",
			"country": "US"
		},
		"email": "example@example.com",
		"phone": {
			"number": "123456789",
			"country_code": "+1"
		}
	},
    "customer_id": "12345_cus_0198e54d6c3b7871bcfde4a50ee43b88"
}'
```
```json
{
    "id": "12345_pay_0198e54f328775408faf14fc2c47651a",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 1000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": "cs_0198e54f32b07003a723ffba50f47fea",
    "profile_id": "pro_dPNtC5bK3lNxBYt7kyk4",
    "merchant_reference_id": null,
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "user@gmail.com"
    },
    "shipping": {
        "address": {
            "city": "Karwar",
            "country": "US",
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": "571201",
            "state": "California",
            "first_name": "John",
            "last_name": "Dough",
            "origin_zip": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        },
        "email": "example@example.com"
    },
    "customer_id": "12345_cus_0198e54d6c3b7871bcfde4a50ee43b88",
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 1000,
            "tax_rate": null,
            "total_tax_amount": null,
            "requires_shipping": null,
            "product_img_link": null,
            "product_id": null,
            "category": null,
            "sub_category": null,
            "brand": null,
            "product_type": null,
            "product_tax_code": null,
            "description": null,
            "sku": null,
            "upc": null,
            "commodity_code": null,
            "unit_of_measure": null,
            "total_amount": null,
            "unit_discount_amount": null
        }
    ],
    "allowed_payment_method_types": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "split_txns_enabled": "true",
    "expires_on": "2025-08-26T07:52:09.530Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip"
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9023 | 
	Bug: Vault connector changes
Need to implement Vault Retrieve for VGS | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index ab7f0ebdef8..e9e51123925 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -309,7 +309,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index a8c1fcfd662..6f78f4ceeef 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -144,7 +144,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 1900a06ff79..25208f9081b 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -148,7 +148,7 @@ trustpay.base_url = "https://tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://gateway.transit-pass.com/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.live.verygoodvault.com/"
 volt.base_url = "https://api.volt.io/"
 wellsfargo.base_url = "https://api.cybersource.com/"
 wellsfargopayout.base_url = "https://api.wellsfargo.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 3c7070879e5..2eb25d54754 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -148,7 +148,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/development.toml b/config/development.toml
index 9380fa7e6e9..32f7a9441ba 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -355,7 +355,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
 trustpayments.base_url = "https://webservices.securetrading.net/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000/"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index dcf86bbcfa5..6c11cc9bef9 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -235,7 +235,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/crates/hyperswitch_connectors/src/connectors/vgs.rs b/crates/hyperswitch_connectors/src/connectors/vgs.rs
index 68751d6e44a..d7bdf4522eb 100644
--- a/crates/hyperswitch_connectors/src/connectors/vgs.rs
+++ b/crates/hyperswitch_connectors/src/connectors/vgs.rs
@@ -1,10 +1,10 @@
 pub mod transformers;
 
+use base64::Engine;
 use common_utils::{
     errors::CustomResult,
     ext_traits::BytesExt,
     request::{Method, Request, RequestBuilder, RequestContent},
-    types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
 };
 use error_stack::{report, ResultExt};
 use hyperswitch_domain_models::{
@@ -13,17 +13,15 @@ use hyperswitch_domain_models::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
+        ExternalVaultInsertFlow, ExternalVaultRetrieveFlow,
     },
     router_request_types::{
         AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
         PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, SetupMandateRequestData,
-    },
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
-    types::{
-        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
-        RefundSyncRouterData, RefundsRouterData,
+        RefundsData, SetupMandateRequestData, VaultRequestData,
     },
+    router_response_types::{PaymentsResponseData, RefundsResponseData, VaultResponseData},
+    types::VaultRouterData,
 };
 use hyperswitch_interfaces::{
     api::{
@@ -36,23 +34,13 @@ use hyperswitch_interfaces::{
     types::{self, Response},
     webhooks,
 };
-use masking::{ExposeInterface, Mask};
+use masking::Mask;
 use transformers as vgs;
 
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{constants::headers, types::ResponseRouterData};
 
 #[derive(Clone)]
-pub struct Vgs {
-    amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
-}
-
-impl Vgs {
-    pub fn new() -> &'static Self {
-        &Self {
-            amount_converter: &StringMinorUnitForConnector,
-        }
-    }
-}
+pub struct Vgs;
 
 impl api::Payment for Vgs {}
 impl api::PaymentSession for Vgs {}
@@ -66,6 +54,9 @@ impl api::Refund for Vgs {}
 impl api::RefundExecute for Vgs {}
 impl api::RefundSync for Vgs {}
 impl api::PaymentToken for Vgs {}
+impl api::ExternalVaultInsert for Vgs {}
+impl api::ExternalVault for Vgs {}
+impl api::ExternalVaultRetrieve for Vgs {}
 
 impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
     for Vgs
@@ -82,13 +73,21 @@ where
         req: &RouterData<Flow, Request, Response>,
         _connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        let mut header = vec![(
-            headers::CONTENT_TYPE.to_string(),
-            self.get_content_type().to_string().into(),
-        )];
-        let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
-        header.append(&mut api_key);
-        Ok(header)
+        let auth = vgs::VgsAuthType::try_from(&req.connector_auth_type)
+            .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+        let auth_value = auth
+            .username
+            .zip(auth.password)
+            .map(|(username, password)| {
+                format!(
+                    "Basic {}",
+                    common_utils::consts::BASE64_ENGINE.encode(format!("{username}:{password}"))
+                )
+            });
+        Ok(vec![(
+            headers::AUTHORIZATION.to_string(),
+            auth_value.into_masked(),
+        )])
     }
 }
 
@@ -111,14 +110,9 @@ impl ConnectorCommon for Vgs {
 
     fn get_auth_header(
         &self,
-        auth_type: &ConnectorAuthType,
+        _auth_type: &ConnectorAuthType,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        let auth = vgs::VgsAuthType::try_from(auth_type)
-            .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
-        Ok(vec![(
-            headers::AUTHORIZATION.to_string(),
-            auth.username.expose().into_masked(),
-        )])
+        Ok(vec![])
     }
 
     fn build_error_response(
@@ -134,11 +128,16 @@ impl ConnectorCommon for Vgs {
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
+        let error = response
+            .errors
+            .first()
+            .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+
         Ok(ErrorResponse {
             status_code: res.status_code,
-            code: response.code,
-            message: response.message,
-            reason: response.reason,
+            code: error.code.clone(),
+            message: error.code.clone(),
+            reason: error.detail.clone(),
             attempt_status: None,
             connector_transaction_id: None,
             network_decline_code: None,
@@ -149,212 +148,68 @@ impl ConnectorCommon for Vgs {
     }
 }
 
-impl ConnectorValidation for Vgs {
-    //TODO: implement functions when support enabled
-}
+impl ConnectorValidation for Vgs {}
 
-impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Vgs {
-    //TODO: implement sessions flow
-}
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Vgs {}
 
 impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Vgs {}
 
 impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Vgs {}
 
-impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Vgs {
-    fn get_headers(
-        &self,
-        req: &PaymentsAuthorizeRouterData,
-        connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        self.build_headers(req, connectors)
-    }
-
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Vgs {}
 
-    fn get_url(
-        &self,
-        _req: &PaymentsAuthorizeRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
-    fn get_request_body(
-        &self,
-        req: &PaymentsAuthorizeRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let amount = utils::convert_amount(
-            self.amount_converter,
-            req.request.minor_amount,
-            req.request.currency,
-        )?;
-
-        let connector_router_data = vgs::VgsRouterData::from((amount, req));
-        let connector_req = vgs::VgsPaymentsRequest::try_from(&connector_router_data)?;
-        Ok(RequestContent::Json(Box::new(connector_req)))
-    }
-
-    fn build_request(
-        &self,
-        req: &PaymentsAuthorizeRouterData,
-        connectors: &Connectors,
-    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Ok(Some(
-            RequestBuilder::new()
-                .method(Method::Post)
-                .url(&types::PaymentsAuthorizeType::get_url(
-                    self, req, connectors,
-                )?)
-                .attach_default_headers()
-                .headers(types::PaymentsAuthorizeType::get_headers(
-                    self, req, connectors,
-                )?)
-                .set_body(types::PaymentsAuthorizeType::get_request_body(
-                    self, req, connectors,
-                )?)
-                .build(),
-        ))
-    }
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Vgs {}
 
-    fn handle_response(
-        &self,
-        data: &PaymentsAuthorizeRouterData,
-        event_builder: Option<&mut ConnectorEvent>,
-        res: Response,
-    ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
-        let response: vgs::VgsPaymentsResponse = res
-            .response
-            .parse_struct("Vgs PaymentsAuthorizeResponse")
-            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-        event_builder.map(|i| i.set_response_body(&response));
-        router_env::logger::info!(connector_response=?response);
-        RouterData::try_from(ResponseRouterData {
-            response,
-            data: data.clone(),
-            http_code: res.status_code,
-        })
-    }
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Vgs {}
 
-    fn get_error_response(
-        &self,
-        res: Response,
-        event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
-        self.build_error_response(res, event_builder)
-    }
-}
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Vgs {}
 
-impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Vgs {
-    fn get_headers(
-        &self,
-        req: &PaymentsSyncRouterData,
-        connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        self.build_headers(req, connectors)
-    }
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Vgs {}
 
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Vgs {}
 
+impl ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData> for Vgs {
     fn get_url(
         &self,
-        _req: &PaymentsSyncRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
-    fn build_request(
-        &self,
-        req: &PaymentsSyncRouterData,
+        _req: &VaultRouterData<ExternalVaultInsertFlow>,
         connectors: &Connectors,
-    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        Ok(Some(
-            RequestBuilder::new()
-                .method(Method::Get)
-                .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
-                .attach_default_headers()
-                .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
-                .build(),
-        ))
-    }
-
-    fn handle_response(
-        &self,
-        data: &PaymentsSyncRouterData,
-        event_builder: Option<&mut ConnectorEvent>,
-        res: Response,
-    ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
-        let response: vgs::VgsPaymentsResponse = res
-            .response
-            .parse_struct("vgs PaymentsSyncResponse")
-            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-        event_builder.map(|i| i.set_response_body(&response));
-        router_env::logger::info!(connector_response=?response);
-        RouterData::try_from(ResponseRouterData {
-            response,
-            data: data.clone(),
-            http_code: res.status_code,
-        })
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!("{}aliases", self.base_url(connectors)))
     }
 
-    fn get_error_response(
-        &self,
-        res: Response,
-        event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
-        self.build_error_response(res, event_builder)
-    }
-}
-
-impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Vgs {
     fn get_headers(
         &self,
-        req: &PaymentsCaptureRouterData,
+        req: &VaultRouterData<ExternalVaultInsertFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
-
-    fn get_url(
-        &self,
-        _req: &PaymentsCaptureRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
     fn get_request_body(
         &self,
-        _req: &PaymentsCaptureRouterData,
+        req: &VaultRouterData<ExternalVaultInsertFlow>,
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+        let connector_req = vgs::VgsInsertRequest::try_from(req)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
     fn build_request(
         &self,
-        req: &PaymentsCaptureRouterData,
+        req: &VaultRouterData<ExternalVaultInsertFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Post)
-                .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+                .url(&types::ExternalVaultInsertType::get_url(
+                    self, req, connectors,
+                )?)
                 .attach_default_headers()
-                .headers(types::PaymentsCaptureType::get_headers(
+                .headers(types::ExternalVaultInsertType::get_headers(
                     self, req, connectors,
                 )?)
-                .set_body(types::PaymentsCaptureType::get_request_body(
+                .set_body(types::ExternalVaultInsertType::get_request_body(
                     self, req, connectors,
                 )?)
                 .build(),
@@ -363,13 +218,13 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
 
     fn handle_response(
         &self,
-        data: &PaymentsCaptureRouterData,
+        data: &VaultRouterData<ExternalVaultInsertFlow>,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
-        let response: vgs::VgsPaymentsResponse = res
+    ) -> CustomResult<VaultRouterData<ExternalVaultInsertFlow>, errors::ConnectorError> {
+        let response: vgs::VgsInsertResponse = res
             .response
-            .parse_struct("Vgs PaymentsCaptureResponse")
+            .parse_struct("VgsInsertResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
@@ -389,125 +244,46 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
     }
 }
 
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Vgs {}
-
-impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Vgs {
-    fn get_headers(
-        &self,
-        req: &RefundsRouterData<Execute>,
-        connectors: &Connectors,
-    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
-        self.build_headers(req, connectors)
-    }
-
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
-
+impl ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData> for Vgs {
     fn get_url(
         &self,
-        _req: &RefundsRouterData<Execute>,
-        _connectors: &Connectors,
+        req: &VaultRouterData<ExternalVaultRetrieveFlow>,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
-    }
-
-    fn get_request_body(
-        &self,
-        req: &RefundsRouterData<Execute>,
-        _connectors: &Connectors,
-    ) -> CustomResult<RequestContent, errors::ConnectorError> {
-        let refund_amount = utils::convert_amount(
-            self.amount_converter,
-            req.request.minor_refund_amount,
-            req.request.currency,
+        let alias = req.request.connector_vault_id.clone().ok_or(
+            errors::ConnectorError::MissingRequiredField {
+                field_name: "connector_vault_id",
+            },
         )?;
 
-        let connector_router_data = vgs::VgsRouterData::from((refund_amount, req));
-        let connector_req = vgs::VgsRefundRequest::try_from(&connector_router_data)?;
-        Ok(RequestContent::Json(Box::new(connector_req)))
-    }
-
-    fn build_request(
-        &self,
-        req: &RefundsRouterData<Execute>,
-        connectors: &Connectors,
-    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
-        let request = RequestBuilder::new()
-            .method(Method::Post)
-            .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
-            .attach_default_headers()
-            .headers(types::RefundExecuteType::get_headers(
-                self, req, connectors,
-            )?)
-            .set_body(types::RefundExecuteType::get_request_body(
-                self, req, connectors,
-            )?)
-            .build();
-        Ok(Some(request))
-    }
-
-    fn handle_response(
-        &self,
-        data: &RefundsRouterData<Execute>,
-        event_builder: Option<&mut ConnectorEvent>,
-        res: Response,
-    ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
-        let response: vgs::RefundResponse = res
-            .response
-            .parse_struct("vgs RefundResponse")
-            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-        event_builder.map(|i| i.set_response_body(&response));
-        router_env::logger::info!(connector_response=?response);
-        RouterData::try_from(ResponseRouterData {
-            response,
-            data: data.clone(),
-            http_code: res.status_code,
-        })
-    }
-
-    fn get_error_response(
-        &self,
-        res: Response,
-        event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
-        self.build_error_response(res, event_builder)
+        Ok(format!("{}aliases/{alias}", self.base_url(connectors)))
     }
-}
 
-impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Vgs {
     fn get_headers(
         &self,
-        req: &RefundSyncRouterData,
+        req: &VaultRouterData<ExternalVaultRetrieveFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
-    fn get_content_type(&self) -> &'static str {
-        self.common_get_content_type()
-    }
-
-    fn get_url(
-        &self,
-        _req: &RefundSyncRouterData,
-        _connectors: &Connectors,
-    ) -> CustomResult<String, errors::ConnectorError> {
-        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    fn get_http_method(&self) -> Method {
+        Method::Get
     }
 
     fn build_request(
         &self,
-        req: &RefundSyncRouterData,
+        req: &VaultRouterData<ExternalVaultRetrieveFlow>,
         connectors: &Connectors,
     ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Ok(Some(
             RequestBuilder::new()
                 .method(Method::Get)
-                .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+                .url(&types::ExternalVaultRetrieveType::get_url(
+                    self, req, connectors,
+                )?)
                 .attach_default_headers()
-                .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
-                .set_body(types::RefundSyncType::get_request_body(
+                .headers(types::ExternalVaultRetrieveType::get_headers(
                     self, req, connectors,
                 )?)
                 .build(),
@@ -516,14 +292,14 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Vgs {
 
     fn handle_response(
         &self,
-        data: &RefundSyncRouterData,
+        data: &VaultRouterData<ExternalVaultRetrieveFlow>,
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
-    ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
-        let response: vgs::RefundResponse = res
-            .response
-            .parse_struct("vgs RefundSyncResponse")
-            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+    ) -> CustomResult<VaultRouterData<ExternalVaultRetrieveFlow>, errors::ConnectorError> {
+        let response: vgs::VgsRetrieveResponse =
+            res.response
+                .parse_struct("VgsRetrieveResponse")
+                .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
         RouterData::try_from(ResponseRouterData {
diff --git a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
index f30a455ef4d..4915e2da400 100644
--- a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
@@ -1,23 +1,22 @@
-use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_utils::{
+    ext_traits::{Encode, StringExt},
+    types::StringMinorUnit,
+};
+use error_stack::ResultExt;
 use hyperswitch_domain_models::{
-    payment_method_data::PaymentMethodData,
     router_data::{ConnectorAuthType, RouterData},
-    router_flow_types::refunds::{Execute, RSync},
-    router_request_types::ResponseId,
-    router_response_types::{PaymentsResponseData, RefundsResponseData},
-    types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+    router_flow_types::{ExternalVaultInsertFlow, ExternalVaultRetrieveFlow},
+    router_request_types::VaultRequestData,
+    router_response_types::VaultResponseData,
+    types::VaultRouterData,
+    vault::PaymentMethodVaultingData,
 };
 use hyperswitch_interfaces::errors;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
 
-use crate::{
-    types::{RefundsResponseRouterData, ResponseRouterData},
-    utils::PaymentsAuthorizeRequestData,
-};
+use crate::types::ResponseRouterData;
 
-//TODO: Fill the struct with respective fields
 pub struct VgsRouterData<T> {
     pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
     pub router_data: T,
@@ -25,7 +24,6 @@ pub struct VgsRouterData<T> {
 
 impl<T> From<(StringMinorUnit, T)> for VgsRouterData<T> {
     fn from((amount, item): (StringMinorUnit, T)) -> Self {
-        //Todo :  use utils to convert the amount to the type of amount that a connector accepts
         Self {
             amount,
             router_data: item,
@@ -33,49 +31,48 @@ impl<T> From<(StringMinorUnit, T)> for VgsRouterData<T> {
     }
 }
 
-//TODO: Fill the struct with respective fields
+const VGS_FORMAT: &str = "UUID";
+const VGS_CLASSIFIER: &str = "data";
+
 #[derive(Default, Debug, Serialize, PartialEq)]
-pub struct VgsPaymentsRequest {
-    amount: StringMinorUnit,
-    card: VgsCard,
+pub struct VgsTokenRequestItem {
+    value: Secret<String>,
+    classifiers: Vec<String>,
+    format: String,
 }
 
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct VgsCard {
-    number: cards::CardNumber,
-    expiry_month: Secret<String>,
-    expiry_year: Secret<String>,
-    cvc: Secret<String>,
-    complete: bool,
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct VgsInsertRequest {
+    data: Vec<VgsTokenRequestItem>,
 }
 
-impl TryFrom<&VgsRouterData<&PaymentsAuthorizeRouterData>> for VgsPaymentsRequest {
+impl<F> TryFrom<&VaultRouterData<F>> for VgsInsertRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &VgsRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
-        match item.router_data.request.payment_method_data.clone() {
-            PaymentMethodData::Card(req_card) => {
-                let card = VgsCard {
-                    number: req_card.card_number,
-                    expiry_month: req_card.card_exp_month,
-                    expiry_year: req_card.card_exp_year,
-                    cvc: req_card.card_cvc,
-                    complete: item.router_data.request.is_auto_capture()?,
-                };
+    fn try_from(item: &VaultRouterData<F>) -> Result<Self, Self::Error> {
+        match item.request.payment_method_vaulting_data.clone() {
+            Some(PaymentMethodVaultingData::Card(req_card)) => {
+                let stringified_card = req_card
+                    .encode_to_string_of_json()
+                    .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
                 Ok(Self {
-                    amount: item.amount.clone(),
-                    card,
+                    data: vec![VgsTokenRequestItem {
+                        value: Secret::new(stringified_card),
+                        classifiers: vec![VGS_CLASSIFIER.to_string()],
+                        format: VGS_FORMAT.to_string(),
+                    }],
                 })
             }
-            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+            _ => Err(errors::ConnectorError::NotImplemented(
+                "Payment method apart from card".to_string(),
+            )
+            .into()),
         }
     }
 }
 
-//TODO: Fill the struct with respective fields
-// Auth Struct
 pub struct VgsAuthType {
     pub(super) username: Secret<String>,
-    #[allow(dead_code)]
     pub(super) password: Secret<String>,
 }
 
@@ -83,7 +80,7 @@ impl TryFrom<&ConnectorAuthType> for VgsAuthType {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
         match auth_type {
-            ConnectorAuthType::SignatureKey { api_key, key1, .. } => Ok(Self {
+            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
                 username: api_key.to_owned(),
                 password: key1.to_owned(),
             }),
@@ -91,139 +88,120 @@ impl TryFrom<&ConnectorAuthType> for VgsAuthType {
         }
     }
 }
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum VgsPaymentStatus {
-    Succeeded,
-    Failed,
-    #[default]
-    Processing,
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct VgsAliasItem {
+    alias: String,
+    format: String,
 }
 
-impl From<VgsPaymentStatus> for common_enums::AttemptStatus {
-    fn from(item: VgsPaymentStatus) -> Self {
-        match item {
-            VgsPaymentStatus::Succeeded => Self::Charged,
-            VgsPaymentStatus::Failed => Self::Failure,
-            VgsPaymentStatus::Processing => Self::Authorizing,
-        }
-    }
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct VgsTokenResponseItem {
+    value: Secret<String>,
+    classifiers: Vec<String>,
+    aliases: Vec<VgsAliasItem>,
+    created_at: Option<String>,
+    storage: String,
 }
 
-//TODO: Fill the struct with respective fields
 #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct VgsPaymentsResponse {
-    status: VgsPaymentStatus,
-    id: String,
+pub struct VgsInsertResponse {
+    data: Vec<VgsTokenResponseItem>,
 }
 
-impl<F, T> TryFrom<ResponseRouterData<F, VgsPaymentsResponse, T, PaymentsResponseData>>
-    for RouterData<F, T, PaymentsResponseData>
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct VgsRetrieveResponse {
+    data: Vec<VgsTokenResponseItem>,
+}
+
+impl
+    TryFrom<
+        ResponseRouterData<
+            ExternalVaultInsertFlow,
+            VgsInsertResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
+    > for RouterData<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: ResponseRouterData<F, VgsPaymentsResponse, T, PaymentsResponseData>,
+        item: ResponseRouterData<
+            ExternalVaultInsertFlow,
+            VgsInsertResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
     ) -> Result<Self, Self::Error> {
+        let vgs_alias = item
+            .response
+            .data
+            .first()
+            .and_then(|val| val.aliases.first())
+            .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+
         Ok(Self {
-            status: common_enums::AttemptStatus::from(item.response.status),
-            response: Ok(PaymentsResponseData::TransactionResponse {
-                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
-                redirection_data: Box::new(None),
-                mandate_reference: Box::new(None),
-                connector_metadata: None,
-                network_txn_id: None,
-                connector_response_reference_id: None,
-                incremental_authorization_allowed: None,
-                charges: None,
+            status: common_enums::AttemptStatus::Started,
+            response: Ok(VaultResponseData::ExternalVaultInsertResponse {
+                connector_vault_id: vgs_alias.alias.clone(),
+                fingerprint_id: vgs_alias.alias.clone(),
             }),
             ..item.data
         })
     }
 }
 
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
-pub struct VgsRefundRequest {
-    pub amount: StringMinorUnit,
-}
-
-impl<F> TryFrom<&VgsRouterData<&RefundsRouterData<F>>> for VgsRefundRequest {
-    type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &VgsRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
-        Ok(Self {
-            amount: item.amount.to_owned(),
-        })
-    }
-}
-
-// Type definition for Refund Response
-
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
-    Succeeded,
-    Failed,
-    #[default]
-    Processing,
-}
-
-impl From<RefundStatus> for enums::RefundStatus {
-    fn from(item: RefundStatus) -> Self {
-        match item {
-            RefundStatus::Succeeded => Self::Success,
-            RefundStatus::Failed => Self::Failure,
-            RefundStatus::Processing => Self::Pending,
-            //TODO: Review mapping
-        }
-    }
-}
-
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
-    id: String,
-    status: RefundStatus,
-}
-
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+impl
+    TryFrom<
+        ResponseRouterData<
+            ExternalVaultRetrieveFlow,
+            VgsRetrieveResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
+    > for RouterData<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData>
+{
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: RefundsResponseRouterData<Execute, RefundResponse>,
+        item: ResponseRouterData<
+            ExternalVaultRetrieveFlow,
+            VgsRetrieveResponse,
+            VaultRequestData,
+            VaultResponseData,
+        >,
     ) -> Result<Self, Self::Error> {
+        let token_response_item = item
+            .response
+            .data
+            .first()
+            .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
+
+        let card_detail: api_models::payment_methods::CardDetail = token_response_item
+            .value
+            .clone()
+            .expose()
+            .parse_struct("CardDetail")
+            .change_context(errors::ConnectorError::ParsingFailed)?;
+
         Ok(Self {
-            response: Ok(RefundsResponseData {
-                connector_refund_id: item.response.id.to_string(),
-                refund_status: enums::RefundStatus::from(item.response.status),
+            status: common_enums::AttemptStatus::Started,
+            response: Ok(VaultResponseData::ExternalVaultRetrieveResponse {
+                vault_data: PaymentMethodVaultingData::Card(card_detail),
             }),
             ..item.data
         })
     }
 }
 
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
-    type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(
-        item: RefundsResponseRouterData<RSync, RefundResponse>,
-    ) -> Result<Self, Self::Error> {
-        Ok(Self {
-            response: Ok(RefundsResponseData {
-                connector_refund_id: item.response.id.to_string(),
-                refund_status: enums::RefundStatus::from(item.response.status),
-            }),
-            ..item.data
-        })
-    }
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct VgsErrorItem {
+    pub status: u16,
+    pub code: String,
+    pub detail: Option<String>,
 }
 
-//TODO: Fill the struct with respective fields
 #[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
 pub struct VgsErrorResponse {
-    pub status_code: u16,
-    pub code: String,
-    pub message: String,
-    pub reason: Option<String>,
+    pub errors: Vec<VgsErrorItem>,
+    pub trace_id: String,
 }
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 7d746072f67..963e233c44c 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -6977,7 +6977,6 @@ default_imp_for_external_vault!(
     connectors::Worldpayxml,
     connectors::Wellsfargo,
     connectors::Wellsfargopayout,
-    connectors::Vgs,
     connectors::Volt,
     connectors::Xendit,
     connectors::Zen,
@@ -7120,7 +7119,6 @@ default_imp_for_external_vault_insert!(
     connectors::Worldpayxml,
     connectors::Wellsfargo,
     connectors::Wellsfargopayout,
-    connectors::Vgs,
     connectors::Volt,
     connectors::Xendit,
     connectors::Zen,
@@ -7263,7 +7261,6 @@ default_imp_for_external_vault_retrieve!(
     connectors::Worldpayxml,
     connectors::Wellsfargo,
     connectors::Wellsfargopayout,
-    connectors::Vgs,
     connectors::Volt,
     connectors::Xendit,
     connectors::Zen,
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 1ea747d8101..3a072e12cc7 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -1036,11 +1036,14 @@ pub async fn create_payment_method_card_core(
     .await;
 
     let (response, payment_method) = match vaulting_result {
-        Ok(pm_types::AddVaultResponse {
-            vault_id,
-            fingerprint_id,
-            ..
-        }) => {
+        Ok((
+            pm_types::AddVaultResponse {
+                vault_id,
+                fingerprint_id,
+                ..
+            },
+            external_vault_source,
+        )) => {
             let pm_update = create_pm_additional_data_update(
                 Some(&payment_method_data),
                 state,
@@ -1052,7 +1055,7 @@ pub async fn create_payment_method_card_core(
                 network_tokenization_resp,
                 Some(req.payment_method_type),
                 Some(req.payment_method_subtype),
-                None,
+                external_vault_source,
             )
             .await
             .attach_printable("unable to create payment method data")?;
@@ -2395,7 +2398,10 @@ pub async fn vault_payment_method(
     profile: &domain::Profile,
     existing_vault_id: Option<domain::VaultId>,
     customer_id: &id_type::GlobalCustomerId,
-) -> RouterResult<pm_types::AddVaultResponse> {
+) -> RouterResult<(
+    pm_types::AddVaultResponse,
+    Option<id_type::MerchantConnectorAccountId>,
+)> {
     let is_external_vault_enabled = profile.is_external_vault_enabled();
 
     match is_external_vault_enabled {
@@ -2427,17 +2433,17 @@ pub async fn vault_payment_method(
                 merchant_connector_account,
             )
             .await
+            .map(|value| (value, Some(external_vault_source)))
         }
-        false => {
-            vault_payment_method_internal(
-                state,
-                pmd,
-                merchant_context,
-                existing_vault_id,
-                customer_id,
-            )
-            .await
-        }
+        false => vault_payment_method_internal(
+            state,
+            pmd,
+            merchant_context,
+            existing_vault_id,
+            customer_id,
+        )
+        .await
+        .map(|value| (value, None)),
     }
 }
 
@@ -2812,20 +2818,20 @@ pub async fn update_payment_method_core(
         // cannot use async map because of problems related to lifetimes
         // to overcome this, we will have to use a move closure and add some clones
         Some(ref vault_request_data) => {
-            Some(
-                vault_payment_method(
-                    state,
-                    vault_request_data,
-                    merchant_context,
-                    profile,
-                    // using current vault_id for now,
-                    // will have to refactor this to generate new one on each vaulting later on
-                    current_vault_id,
-                    &payment_method.customer_id,
-                )
-                .await
-                .attach_printable("Failed to add payment method in vault")?,
+            let (vault_response, _) = vault_payment_method(
+                state,
+                vault_request_data,
+                merchant_context,
+                profile,
+                // using current vault_id for now,
+                // will have to refactor this to generate new one on each vaulting later on
+                current_vault_id,
+                &payment_method.customer_id,
             )
+            .await
+            .attach_printable("Failed to add payment method in vault")?;
+
+            Some(vault_response)
         }
         None => None,
     };
diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs
index c184c9db8dd..bd9a1fedeec 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -429,7 +429,7 @@ impl ConnectorData {
                 // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new(
                 //     connector::UnifiedAuthenticationService,
                 // ))),
-                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))),
+                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))),
                 enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))),
                 enums::Connector::Wellsfargo => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new())))
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index ac7754faa30..c771255dd71 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -349,7 +349,7 @@ impl FeatureMatrixConnectorData {
                 // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new(
                 //     connector::UnifiedAuthenticationService,
                 // ))),
-                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))),
+                enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))),
                 enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))),
                 enums::Connector::Wellsfargo => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new())))
diff --git a/crates/router/tests/connectors/vgs.rs b/crates/router/tests/connectors/vgs.rs
index fb9b6bb30be..70ce1045962 100644
--- a/crates/router/tests/connectors/vgs.rs
+++ b/crates/router/tests/connectors/vgs.rs
@@ -11,7 +11,7 @@ impl utils::Connector for VgsTest {
     fn get_data(&self) -> types::api::ConnectorData {
         use router::connector::Vgs;
         utils::construct_connector_data_old(
-            Box::new(Vgs::new()),
+            Box::new(&Vgs),
             types::Connector::Vgs,
             types::api::GetToken::Connector,
             None,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 9b81a63e182..50a992515a7 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -202,7 +202,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/"
 trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
 tsys.base_url = "https://stagegw.transnox.com/"
 unified_authentication_service.base_url = "http://localhost:8000"
-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com"
+vgs.base_url = "https://api.sandbox.verygoodvault.com/"
 volt.base_url = "https://api.sandbox.volt.io/"
 wellsfargo.base_url = "https://apitest.cybersource.com/"
 wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
 | 
	2025-04-30T09:54:19Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Added Connector changes for VGS
- Implemented `ExternalVaultInsertFlow` and `ExternalVaultRetrieveFlow` for VGS
- This allows Payment methods to be vaulted in VGS when `is_external_vault_enabled` is set to true in profile
- Updated VGS URL in TOML files
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #9023
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Confirm Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \
--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \
--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \
--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \
--data '{
    "payment_method_data": {
        "card": {
            "card_cvc": "123",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_number": "4242424242424242",
            "card_holder_name": "joseph Doe"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "card",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    },
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "2022-09-10T10:11:12Z",
        "online": {
            "ip_address": "123.32.25.123",
            "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
        }
    }
    
}'
```
Insert Request:
<img width="1598" height="26" alt="image" src="https://github.com/user-attachments/assets/2e2e81e1-360a-481f-a018-91d7da156d54" />
Insert Response:
<img width="2364" height="38" alt="image" src="https://github.com/user-attachments/assets/aad8f89e-144c-4a0e-a6e5-9ec2c6aa957a" />
Confirm Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \
--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \
--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \
--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \
--data '{
    "payment_method_data": {
        "card_token": {
            "card_cvc": "123"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "card",
    "payment_token": "token_UBCgOA3daIE4CP4pugXW"
}'
```
Retrieve Request:
<img width="2364" height="38" alt="image" src="https://github.com/user-attachments/assets/0eaa5d7f-19e1-4cfb-95a4-b6376f8e3c74" />
Retrieve Response:
<img width="2373" height="51" alt="image" src="https://github.com/user-attachments/assets/9b81e22d-931f-4132-a8e4-2a7bd6341c02" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c90625a4ea163e03895276a04ec3a23d4117413d | 
	
Confirm Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \
--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \
--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \
--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \
--data '{
    "payment_method_data": {
        "card": {
            "card_cvc": "123",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_number": "4242424242424242",
            "card_holder_name": "joseph Doe"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "card",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    },
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "2022-09-10T10:11:12Z",
        "online": {
            "ip_address": "123.32.25.123",
            "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
        }
    }
    
}'
```
Insert Request:
<img width="1598" height="26" alt="image" src="https://github.com/user-attachments/assets/2e2e81e1-360a-481f-a018-91d7da156d54" />
Insert Response:
<img width="2364" height="38" alt="image" src="https://github.com/user-attachments/assets/aad8f89e-144c-4a0e-a6e5-9ec2c6aa957a" />
Confirm Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \
--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \
--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \
--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \
--data '{
    "payment_method_data": {
        "card_token": {
            "card_cvc": "123"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "card",
    "payment_token": "token_UBCgOA3daIE4CP4pugXW"
}'
```
Retrieve Request:
<img width="2364" height="38" alt="image" src="https://github.com/user-attachments/assets/0eaa5d7f-19e1-4cfb-95a4-b6376f8e3c74" />
Retrieve Response:
<img width="2373" height="51" alt="image" src="https://github.com/user-attachments/assets/9b81e22d-931f-4132-a8e4-2a7bd6341c02" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9016 | 
	Bug: [FEATURE] Automatic connector_payment_id hashing in v2 if length > 128 in v2
### Feature Description
Automatically hash connector_payment_id longer than 128 chars and store the original in connector_payment_data.
### Possible Implementation
Implement hashing in PaymentAttemptUpdate conversion by using ConnectorTransactionId::form_id_and_data, setting connector_payment_id to the hash and preserving the original in connector_payment_data.
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 0a085991815..7a1494ea923 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -743,57 +743,51 @@ pub enum PaymentAttemptUpdate {
     //     error_message: Option<Option<String>>,
     //     updated_by: String,
     // },
-    // ResponseUpdate {
-    //     status: storage_enums::AttemptStatus,
-    //     connector: Option<String>,
-    //     connector_transaction_id: Option<String>,
-    //     authentication_type: Option<storage_enums::AuthenticationType>,
-    //     payment_method_id: Option<String>,
-    //     mandate_id: Option<String>,
-    //     connector_metadata: Option<serde_json::Value>,
-    //     payment_token: Option<String>,
-    //     error_code: Option<Option<String>>,
-    //     error_message: Option<Option<String>>,
-    //     error_reason: Option<Option<String>>,
-    //     connector_response_reference_id: Option<String>,
-    //     amount_capturable: Option<MinorUnit>,
-    //     updated_by: String,
-    //     authentication_data: Option<serde_json::Value>,
-    //     encoded_data: Option<String>,
-    //     unified_code: Option<Option<String>>,
-    //     unified_message: Option<Option<String>>,
-    //     payment_method_data: Option<serde_json::Value>,
-    //     charge_id: Option<String>,
-    // },
-    // UnresolvedResponseUpdate {
-    //     status: storage_enums::AttemptStatus,
-    //     connector: Option<String>,
-    //     connector_transaction_id: Option<String>,
-    //     payment_method_id: Option<String>,
-    //     error_code: Option<Option<String>>,
-    //     error_message: Option<Option<String>>,
-    //     error_reason: Option<Option<String>>,
-    //     connector_response_reference_id: Option<String>,
-    //     updated_by: String,
-    // },
+    ResponseUpdate {
+        status: storage_enums::AttemptStatus,
+        connector: Option<String>,
+        connector_payment_id: Option<String>,
+        authentication_type: Option<storage_enums::AuthenticationType>,
+        payment_method_id: Option<id_type::GlobalPaymentMethodId>,
+        connector_metadata: Option<pii::SecretSerdeValue>,
+        payment_token: Option<String>,
+        error_code: Option<Option<String>>,
+        error_message: Option<Option<String>>,
+        error_reason: Option<Option<String>>,
+        connector_response_reference_id: Option<String>,
+        amount_capturable: Option<MinorUnit>,
+        updated_by: String,
+        unified_code: Option<Option<String>>,
+        unified_message: Option<Option<String>>,
+    },
+    UnresolvedResponseUpdate {
+        status: storage_enums::AttemptStatus,
+        connector: Option<String>,
+        connector_payment_id: Option<String>,
+        payment_method_id: Option<id_type::GlobalPaymentMethodId>,
+        error_code: Option<Option<String>>,
+        error_message: Option<Option<String>>,
+        error_reason: Option<Option<String>>,
+        connector_response_reference_id: Option<String>,
+        updated_by: String,
+    },
     // StatusUpdate {
     //     status: storage_enums::AttemptStatus,
     //     updated_by: String,
     // },
-    // ErrorUpdate {
-    //     connector: Option<String>,
-    //     status: storage_enums::AttemptStatus,
-    //     error_code: Option<Option<String>>,
-    //     error_message: Option<Option<String>>,
-    //     error_reason: Option<Option<String>>,
-    //     amount_capturable: Option<MinorUnit>,
-    //     updated_by: String,
-    //     unified_code: Option<Option<String>>,
-    //     unified_message: Option<Option<String>>,
-    //     connector_transaction_id: Option<String>,
-    //     payment_method_data: Option<serde_json::Value>,
-    //     authentication_type: Option<storage_enums::AuthenticationType>,
-    // },
+    ErrorUpdate {
+        connector: Option<String>,
+        status: storage_enums::AttemptStatus,
+        error_code: Option<Option<String>>,
+        error_message: Option<Option<String>>,
+        error_reason: Option<Option<String>>,
+        amount_capturable: Option<MinorUnit>,
+        updated_by: String,
+        unified_code: Option<Option<String>>,
+        unified_message: Option<Option<String>>,
+        connector_payment_id: Option<String>,
+        authentication_type: Option<storage_enums::AuthenticationType>,
+    },
     // CaptureUpdate {
     //     amount_to_capture: Option<MinorUnit>,
     //     multiple_capture_count: Option<MinorUnit>,
@@ -804,23 +798,20 @@ pub enum PaymentAttemptUpdate {
     //     amount_capturable: MinorUnit,
     //     updated_by: String,
     // },
-    // PreprocessingUpdate {
-    //     status: storage_enums::AttemptStatus,
-    //     payment_method_id: Option<String>,
-    //     connector_metadata: Option<serde_json::Value>,
-    //     preprocessing_step_id: Option<String>,
-    //     connector_transaction_id: Option<String>,
-    //     connector_response_reference_id: Option<String>,
-    //     updated_by: String,
-    // },
-    // ConnectorResponse {
-    //     authentication_data: Option<serde_json::Value>,
-    //     encoded_data: Option<String>,
-    //     connector_transaction_id: Option<String>,
-    //     connector: Option<String>,
-    //     charge_id: Option<String>,
-    //     updated_by: String,
-    // },
+    PreprocessingUpdate {
+        status: storage_enums::AttemptStatus,
+        payment_method_id: Option<id_type::GlobalPaymentMethodId>,
+        connector_metadata: Option<pii::SecretSerdeValue>,
+        preprocessing_step_id: Option<String>,
+        connector_payment_id: Option<String>,
+        connector_response_reference_id: Option<String>,
+        updated_by: String,
+    },
+    ConnectorResponse {
+        connector_payment_id: Option<String>,
+        connector: Option<String>,
+        updated_by: String,
+    },
     // IncrementalAuthorizationAmountUpdate {
     //     amount: MinorUnit,
     //     amount_capturable: MinorUnit,
@@ -832,16 +823,16 @@ pub enum PaymentAttemptUpdate {
     //     authentication_id: Option<String>,
     //     updated_by: String,
     // },
-    // ManualUpdate {
-    //     status: Option<storage_enums::AttemptStatus>,
-    //     error_code: Option<String>,
-    //     error_message: Option<String>,
-    //     error_reason: Option<String>,
-    //     updated_by: String,
-    //     unified_code: Option<String>,
-    //     unified_message: Option<String>,
-    //     connector_transaction_id: Option<String>,
-    // },
+    ManualUpdate {
+        status: Option<storage_enums::AttemptStatus>,
+        error_code: Option<String>,
+        error_message: Option<String>,
+        error_reason: Option<String>,
+        updated_by: String,
+        unified_code: Option<String>,
+        unified_message: Option<String>,
+        connector_payment_id: Option<String>,
+    },
 }
 
 // TODO: uncomment fields as and when required
@@ -852,7 +843,8 @@ pub struct PaymentAttemptUpdateInternal {
     pub status: Option<storage_enums::AttemptStatus>,
     pub authentication_type: Option<storage_enums::AuthenticationType>,
     pub error_message: Option<String>,
-    pub connector_payment_id: Option<String>,
+    pub connector_payment_id: Option<ConnectorTransactionId>,
+    pub connector_payment_data: Option<String>,
     pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
     // cancellation_reason: Option<String>,
     pub modified_at: PrimitiveDateTime,
@@ -875,8 +867,8 @@ pub struct PaymentAttemptUpdateInternal {
     pub connector: Option<String>,
     pub redirection_data: Option<RedirectForm>,
     // encoded_data: Option<String>,
-    pub unified_code: Option<Option<String>>,
-    pub unified_message: Option<Option<String>>,
+    pub unified_code: Option<String>,
+    pub unified_message: Option<String>,
     // external_three_ds_authentication_attempted: Option<bool>,
     // authentication_connector: Option<String>,
     // authentication_id: Option<String>,
@@ -902,6 +894,7 @@ impl PaymentAttemptUpdateInternal {
             authentication_type,
             error_message,
             connector_payment_id,
+            connector_payment_data,
             modified_at,
             browser_info,
             error_code,
@@ -958,8 +951,8 @@ impl PaymentAttemptUpdateInternal {
             updated_by,
             merchant_connector_id: merchant_connector_id.or(source.merchant_connector_id),
             encoded_data: source.encoded_data,
-            unified_code: unified_code.flatten().or(source.unified_code),
-            unified_message: unified_message.flatten().or(source.unified_message),
+            unified_code: unified_code.or(source.unified_code),
+            unified_message: unified_message.or(source.unified_message),
             net_amount: source.net_amount,
             external_three_ds_authentication_attempted: source
                 .external_three_ds_authentication_attempted,
@@ -983,7 +976,7 @@ impl PaymentAttemptUpdateInternal {
             created_by: source.created_by,
             payment_method_type_v2: source.payment_method_type_v2,
             network_transaction_id: source.network_transaction_id,
-            connector_payment_id: source.connector_payment_id,
+            connector_payment_id: connector_payment_id.or(source.connector_payment_id),
             payment_method_subtype: source.payment_method_subtype,
             routing_result: source.routing_result,
             authentication_applied: source.authentication_applied,
@@ -991,7 +984,7 @@ impl PaymentAttemptUpdateInternal {
             tax_on_surcharge: source.tax_on_surcharge,
             payment_method_billing_address: source.payment_method_billing_address,
             redirection_data: redirection_data.or(source.redirection_data),
-            connector_payment_data: source.connector_payment_data,
+            connector_payment_data: connector_payment_data.or(source.connector_payment_data),
             connector_token_details: connector_token_details.or(source.connector_token_details),
             id: source.id,
             feature_metadata: feature_metadata.or(source.feature_metadata),
@@ -1336,8 +1329,278 @@ impl PaymentAttemptUpdate {
 
 #[cfg(feature = "v2")]
 impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
-    fn from(_payment_attempt_update: PaymentAttemptUpdate) -> Self {
-        todo!()
+    fn from(payment_attempt_update: PaymentAttemptUpdate) -> Self {
+        match payment_attempt_update {
+            PaymentAttemptUpdate::ResponseUpdate {
+                status,
+                connector,
+                connector_payment_id,
+                authentication_type,
+                payment_method_id,
+                connector_metadata,
+                payment_token,
+                error_code,
+                error_message,
+                error_reason,
+                connector_response_reference_id,
+                amount_capturable,
+                updated_by,
+                unified_code,
+                unified_message,
+            } => {
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    status: Some(status),
+                    connector,
+                    connector_payment_id,
+                    connector_payment_data,
+                    authentication_type,
+                    payment_method_id,
+                    connector_metadata,
+                    error_code: error_code.flatten(),
+                    error_message: error_message.flatten(),
+                    error_reason: error_reason.flatten(),
+                    connector_response_reference_id,
+                    amount_capturable,
+                    updated_by,
+                    unified_code: unified_code.flatten(),
+                    unified_message: unified_message.flatten(),
+                    modified_at: common_utils::date_time::now(),
+                    browser_info: None,
+                    amount_to_capture: None,
+                    merchant_connector_id: None,
+                    redirection_data: None,
+                    connector_token_details: None,
+                    feature_metadata: None,
+                    network_decline_code: None,
+                    network_advice_code: None,
+                    network_error_message: None,
+                    connector_request_reference_id: None,
+                }
+            }
+            PaymentAttemptUpdate::ErrorUpdate {
+                connector,
+                status,
+                error_code,
+                error_message,
+                error_reason,
+                amount_capturable,
+                updated_by,
+                unified_code,
+                unified_message,
+                connector_payment_id,
+                authentication_type,
+            } => {
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    connector,
+                    status: Some(status),
+                    error_code: error_code.flatten(),
+                    error_message: error_message.flatten(),
+                    error_reason: error_reason.flatten(),
+                    amount_capturable,
+                    updated_by,
+                    unified_code: unified_code.flatten(),
+                    unified_message: unified_message.flatten(),
+                    connector_payment_id,
+                    connector_payment_data,
+                    authentication_type,
+                    modified_at: common_utils::date_time::now(),
+                    payment_method_id: None,
+                    browser_info: None,
+                    connector_metadata: None,
+                    amount_to_capture: None,
+                    merchant_connector_id: None,
+                    redirection_data: None,
+                    connector_token_details: None,
+                    feature_metadata: None,
+                    network_decline_code: None,
+                    network_advice_code: None,
+                    network_error_message: None,
+                    connector_request_reference_id: None,
+                    connector_response_reference_id: None,
+                }
+            }
+            PaymentAttemptUpdate::UnresolvedResponseUpdate {
+                status,
+                connector,
+                connector_payment_id,
+                payment_method_id,
+                error_code,
+                error_message,
+                error_reason,
+                connector_response_reference_id,
+                updated_by,
+            } => {
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    status: Some(status),
+                    connector,
+                    connector_payment_id,
+                    connector_payment_data,
+                    payment_method_id,
+                    error_code: error_code.flatten(),
+                    error_message: error_message.flatten(),
+                    error_reason: error_reason.flatten(),
+                    connector_response_reference_id,
+                    updated_by,
+                    modified_at: common_utils::date_time::now(),
+                    authentication_type: None,
+                    browser_info: None,
+                    connector_metadata: None,
+                    amount_capturable: None,
+                    amount_to_capture: None,
+                    merchant_connector_id: None,
+                    redirection_data: None,
+                    unified_code: None,
+                    unified_message: None,
+                    connector_token_details: None,
+                    feature_metadata: None,
+                    network_decline_code: None,
+                    network_advice_code: None,
+                    network_error_message: None,
+                    connector_request_reference_id: None,
+                }
+            }
+            PaymentAttemptUpdate::PreprocessingUpdate {
+                status,
+                payment_method_id,
+                connector_metadata,
+                preprocessing_step_id,
+                connector_payment_id,
+                connector_response_reference_id,
+                updated_by,
+            } => {
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    status: Some(status),
+                    payment_method_id,
+                    connector_metadata,
+                    connector_payment_id,
+                    connector_payment_data,
+                    connector_response_reference_id,
+                    updated_by,
+                    modified_at: common_utils::date_time::now(),
+                    authentication_type: None,
+                    error_message: None,
+                    browser_info: None,
+                    error_code: None,
+                    error_reason: None,
+                    amount_capturable: None,
+                    amount_to_capture: None,
+                    merchant_connector_id: None,
+                    connector: None,
+                    redirection_data: None,
+                    unified_code: None,
+                    unified_message: None,
+                    connector_token_details: None,
+                    feature_metadata: None,
+                    network_decline_code: None,
+                    network_advice_code: None,
+                    network_error_message: None,
+                    connector_request_reference_id: None,
+                }
+            }
+            PaymentAttemptUpdate::ConnectorResponse {
+                connector_payment_id,
+                connector,
+                updated_by,
+            } => {
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    connector_payment_id,
+                    connector_payment_data,
+                    connector,
+                    updated_by,
+                    modified_at: common_utils::date_time::now(),
+                    status: None,
+                    authentication_type: None,
+                    error_message: None,
+                    payment_method_id: None,
+                    browser_info: None,
+                    error_code: None,
+                    connector_metadata: None,
+                    error_reason: None,
+                    amount_capturable: None,
+                    amount_to_capture: None,
+                    merchant_connector_id: None,
+                    redirection_data: None,
+                    unified_code: None,
+                    unified_message: None,
+                    connector_token_details: None,
+                    feature_metadata: None,
+                    network_decline_code: None,
+                    network_advice_code: None,
+                    network_error_message: None,
+                    connector_request_reference_id: None,
+                    connector_response_reference_id: None,
+                }
+            }
+            PaymentAttemptUpdate::ManualUpdate {
+                status,
+                error_code,
+                error_message,
+                error_reason,
+                updated_by,
+                unified_code,
+                unified_message,
+                connector_payment_id,
+            } => {
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    status,
+                    error_code,
+                    error_message,
+                    error_reason,
+                    updated_by,
+                    unified_code,
+                    unified_message,
+                    connector_payment_id,
+                    connector_payment_data,
+                    modified_at: common_utils::date_time::now(),
+                    authentication_type: None,
+                    payment_method_id: None,
+                    browser_info: None,
+                    connector_metadata: None,
+                    amount_capturable: None,
+                    amount_to_capture: None,
+                    merchant_connector_id: None,
+                    connector: None,
+                    redirection_data: None,
+                    connector_token_details: None,
+                    feature_metadata: None,
+                    network_decline_code: None,
+                    network_advice_code: None,
+                    network_error_message: None,
+                    connector_request_reference_id: None,
+                    connector_response_reference_id: None,
+                }
+            }
+        }
         // match payment_attempt_update {
         //     PaymentAttemptUpdate::Update {
         //         amount,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 4d1ae8bb920..ef33e561b4e 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -2805,6 +2805,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 unified_code: None,
                 unified_message: None,
                 connector_payment_id: None,
+                connector_payment_data: None,
                 connector: Some(connector),
                 redirection_data: None,
                 connector_metadata: None,
@@ -2825,33 +2826,42 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 connector_payment_id,
                 amount_capturable,
                 updated_by,
-            } => Self {
-                status: Some(status),
-                payment_method_id: None,
-                error_message: Some(error.message),
-                error_code: Some(error.code),
-                modified_at: common_utils::date_time::now(),
-                browser_info: None,
-                error_reason: error.reason,
-                updated_by,
-                merchant_connector_id: None,
-                unified_code: None,
-                unified_message: None,
-                connector_payment_id,
-                connector: None,
-                redirection_data: None,
-                connector_metadata: None,
-                amount_capturable,
-                amount_to_capture: None,
-                connector_token_details: None,
-                authentication_type: None,
-                feature_metadata: None,
-                network_advice_code: error.network_advice_code,
-                network_decline_code: error.network_decline_code,
-                network_error_message: error.network_error_message,
-                connector_request_reference_id: None,
-                connector_response_reference_id: None,
-            },
+            } => {
+                // Apply automatic hashing for long connector payment IDs
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
+
+                Self {
+                    status: Some(status),
+                    payment_method_id: None,
+                    error_message: Some(error.message),
+                    error_code: Some(error.code),
+                    modified_at: common_utils::date_time::now(),
+                    browser_info: None,
+                    error_reason: error.reason,
+                    updated_by,
+                    merchant_connector_id: None,
+                    unified_code: None,
+                    unified_message: None,
+                    connector_payment_id,
+                    connector_payment_data,
+                    connector: None,
+                    redirection_data: None,
+                    connector_metadata: None,
+                    amount_capturable,
+                    amount_to_capture: None,
+                    connector_token_details: None,
+                    authentication_type: None,
+                    feature_metadata: None,
+                    network_advice_code: error.network_advice_code,
+                    network_decline_code: error.network_decline_code,
+                    network_error_message: error.network_error_message,
+                    connector_request_reference_id: None,
+                    connector_response_reference_id: None,
+                }
+            }
             PaymentAttemptUpdate::ConfirmIntentResponse(confirm_intent_response_update) => {
                 let ConfirmIntentResponseUpdate {
                     status,
@@ -2863,6 +2873,12 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                     connector_token_details,
                     connector_response_reference_id,
                 } = *confirm_intent_response_update;
+
+                // Apply automatic hashing for long connector payment IDs
+                let (connector_payment_id, connector_payment_data) = connector_payment_id
+                    .map(ConnectorTransactionId::form_id_and_data)
+                    .map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
+                    .unwrap_or((None, None));
                 Self {
                     status: Some(status),
                     payment_method_id: None,
@@ -2877,6 +2893,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                     unified_code: None,
                     unified_message: None,
                     connector_payment_id,
+                    connector_payment_data,
                     connector: None,
                     redirection_data: redirection_data
                         .map(diesel_models::payment_attempt::RedirectForm::from),
@@ -2910,6 +2927,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 unified_code: None,
                 unified_message: None,
                 connector_payment_id: None,
+                connector_payment_data: None,
                 connector: None,
                 redirection_data: None,
                 connector_metadata: None,
@@ -2942,6 +2960,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 unified_code: None,
                 unified_message: None,
                 connector_payment_id: None,
+                connector_payment_data: None,
                 connector: None,
                 redirection_data: None,
                 connector_metadata: None,
@@ -2970,6 +2989,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 unified_code: None,
                 unified_message: None,
                 connector_payment_id: None,
+                connector_payment_data: None,
                 connector: None,
                 redirection_data: None,
                 status: None,
@@ -3004,6 +3024,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
                 unified_code: None,
                 unified_message: None,
                 connector_payment_id: None,
+                connector_payment_data: None,
                 connector: Some(connector),
                 redirection_data: None,
                 connector_metadata: None,
 | 
	2025-08-21T13:30:48Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Implement hashing in PaymentAttemptUpdate conversion by using ConnectorTransactionId::form_id_and_data, setting connector_payment_id to the hash and preserving the original in connector_payment_data.For worldpay connector_payment_id should be less then 128 so after this original payment_id will be stored in connector_payment_data and hased id will be stored in connector_payment_id that is less than 128.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
If connector transaction id is more than 128 then payment intents are failing.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198ccb7376f74a38cad615be26fa5a8/confirm-intent' \
--header 'x-profile-id: pro_ODIfdcDxqoiMbqheIsJk' \
--header 'x-client-secret: cs_0198ccb737837d90b70939489421999b' \
--header 'Authorization: api-key=dev_uf0UlpOafwdX9RSG1PcLVpW7X2QBwM9h3XQ0dYplnSaUxz19t18ylXpa7KcLMZK5' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_1c90c0f7679f4edd8544c8dfe39fc46d' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "26",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
     "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    }
}'
```
Response:
```
{
    "id": "12345_pay_0198ccb7376f74a38cad615be26fa5a8",
    "status": "succeeded",
    "amount": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 100
    },
    "customer_id": null,
    "connector": "worldpay",
    "created": "2025-08-21T13:00:16.122Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT9TAfq0WMxFYyAoD6mMf6Crhf7XoNg6BSaRfnbGX:1Ranv7RKyexxN4UZGNvq4ZuRjjszRbCOMdf1GwWUwp05qAqWWPHGXgnjILdaJfxgAakBurvk:7t7Hx793s0jicYqEU4sbE4TxIcxVuGWepjm49witK5xZ3XDNLML2TKoEMEhI+bQbMnX8zOFyl9tDujZnveoWvbcKsU0kCH69a7ZfVd6u38N8OTvVGU+L0IvQTMgnGh5Fkg:0WwlgnJokKmtPBi4oU3Cnnm+nW8BSObf1OW7W1blA9xV3jt84HBWb3g==",
    "connector_reference_id": "6632a554-bf74-46cb-be9c-c03c0f6e597d",
    "merchant_connector_id": "mca_fRb8a8ohINpIeEdELcwq",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": null,
    "raw_connector_response": null,
    "feature_metadata": null
}
```
<img width="1325" height="1039" alt="image" src="https://github.com/user-attachments/assets/a4d6841d-2819-4605-b2ac-f848ecaa468a" />
<img width="1721" height="205" alt="image" src="https://github.com/user-attachments/assets/850533c8-a55f-49fb-b1a4-acc3b88d692c" />
closes #9016 
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f5db00352b90e99e78b631fa8b9cde5800093a9d | 
	
Request:
```
curl --location 'http://localhost:8080/v2/payments/12345_pay_0198ccb7376f74a38cad615be26fa5a8/confirm-intent' \
--header 'x-profile-id: pro_ODIfdcDxqoiMbqheIsJk' \
--header 'x-client-secret: cs_0198ccb737837d90b70939489421999b' \
--header 'Authorization: api-key=dev_uf0UlpOafwdX9RSG1PcLVpW7X2QBwM9h3XQ0dYplnSaUxz19t18ylXpa7KcLMZK5' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_1c90c0f7679f4edd8544c8dfe39fc46d' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "26",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
     "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    }
}'
```
Response:
```
{
    "id": "12345_pay_0198ccb7376f74a38cad615be26fa5a8",
    "status": "succeeded",
    "amount": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 100
    },
    "customer_id": null,
    "connector": "worldpay",
    "created": "2025-08-21T13:00:16.122Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT9TAfq0WMxFYyAoD6mMf6Crhf7XoNg6BSaRfnbGX:1Ranv7RKyexxN4UZGNvq4ZuRjjszRbCOMdf1GwWUwp05qAqWWPHGXgnjILdaJfxgAakBurvk:7t7Hx793s0jicYqEU4sbE4TxIcxVuGWepjm49witK5xZ3XDNLML2TKoEMEhI+bQbMnX8zOFyl9tDujZnveoWvbcKsU0kCH69a7ZfVd6u38N8OTvVGU+L0IvQTMgnGh5Fkg:0WwlgnJokKmtPBi4oU3Cnnm+nW8BSObf1OW7W1blA9xV3jt84HBWb3g==",
    "connector_reference_id": "6632a554-bf74-46cb-be9c-c03c0f6e597d",
    "merchant_connector_id": "mca_fRb8a8ohINpIeEdELcwq",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": null,
    "raw_connector_response": null,
    "feature_metadata": null
}
```
<img width="1325" height="1039" alt="image" src="https://github.com/user-attachments/assets/a4d6841d-2819-4605-b2ac-f848ecaa468a" />
<img width="1721" height="205" alt="image" src="https://github.com/user-attachments/assets/850533c8-a55f-49fb-b1a4-acc3b88d692c" />
closes #9016 
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9015 | 
	Bug: [REFACTOR] propagate merchant_reference_id for PaymentsAuthorizeData
propagate merchant_reference_id for PaymentsAuthorizeData in v2
 | 
	diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 348a364c569..cf91b2bcc36 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -406,7 +406,10 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
         authentication_data: None,
         customer_acceptance: None,
         split_payments: None,
-        merchant_order_reference_id: None,
+        merchant_order_reference_id: payment_data
+            .payment_intent
+            .merchant_reference_id
+            .map(|reference_id| reference_id.get_string_repr().to_owned()),
         integrity_object: None,
         shipping_cost: payment_data.payment_intent.amount_details.shipping_cost,
         additional_payment_method_data: None,
 | 
	2025-08-21T13:04:33Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR adds support for propagating merchant_reference_id for PaymentsAuthorizeData v2.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
enable UCS 
```
curl --location 'http://localhost:8080/v2/configs/' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'Content-Type: application/json' \
--data '{
      "key": "ucs_rollout_config_cloth_seller1756197165_9PGBS852vwot2udmMevW_razorpay_upi_Authorize",
      "value": "1.0"
  }'
```
payment create
```
curl --location 'http://localhost:8080/v2/payments' \
--header 'x-profile-id: pro_jbuydwkItzTQj5EOqLaA' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_W97mjtX47mRRBIJWGgGMLZ8vEqUGQuymwlmsD32QpNhJM6318Vs25V21U6Kr665R' \
--data-raw '{
    "amount_details": {
        "currency": "INR",
        "order_amount": 100
    },
    "return_raw_connector_response" : true,
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "success@razorpay"
            }
        },
        "billing": {
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_method_subtype": "upi_collect",
    "payment_method_type": "upi",
     "metadata" : {
        "__notes_91_txn_uuid_93_" : "frefer",
        "__notes_91_transaction_id_93_" : "sdfccewf"
    },
     "browser_info": {
        "user_agent": "Mozilla\/5.0 (iPhone NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "ip_address": "128.0.0.1"
    },
    "merchant_reference_id": "1756197223"
}'
```
Response
```
{
    "id": "12345_pay_0198e582efb27dd19d65039d63fdee24",
    "status": "requires_customer_action",
    "amount": {
        "order_amount": 100,
        "currency": "INR",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": null
    },
    "customer_id": null,
    "connector": "razorpay",
    "created": "2025-08-26T08:33:40.275Z",
    "payment_method_data": {
        "billing": {
            "address": null,
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_method_type": "upi",
    "payment_method_subtype": "upi_collect",
    "connector_transaction_id": "pay_R9tm9SQPe1lw99",
    "connector_reference_id": "order_R9tm8rO2C9Po6a",
    "merchant_connector_id": "mca_bYbJJ3mQjcf6SDC8cULu",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": {
        "type": "wait_screen_information",
        "display_from_timestamp": 1756197222581835000,
        "display_to_timestamp": 1756197522581835000,
        "poll_config": {
            "delay_in_secs": 5,
            "frequency": 5
        }
    },
    "return_url": "https://google.com/success",
    "authentication_type": null,
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": "1756197220",
    "raw_connector_response": "{\"razorpay_payment_id\":\"pay_R9tm9SQPe1lw99\"}",
    "feature_metadata": null
}
```
check merchant_order_reference_id in UCS logs
<img width="1374" height="248" alt="image" src="https://github.com/user-attachments/assets/fbc60337-6809-4727-9da7-26e0a6c83ad6" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a819b4639b1e4279b117f4693cb0716b08e5e2e9 | 
	
enable UCS 
```
curl --location 'http://localhost:8080/v2/configs/' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'Content-Type: application/json' \
--data '{
      "key": "ucs_rollout_config_cloth_seller1756197165_9PGBS852vwot2udmMevW_razorpay_upi_Authorize",
      "value": "1.0"
  }'
```
payment create
```
curl --location 'http://localhost:8080/v2/payments' \
--header 'x-profile-id: pro_jbuydwkItzTQj5EOqLaA' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_W97mjtX47mRRBIJWGgGMLZ8vEqUGQuymwlmsD32QpNhJM6318Vs25V21U6Kr665R' \
--data-raw '{
    "amount_details": {
        "currency": "INR",
        "order_amount": 100
    },
    "return_raw_connector_response" : true,
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "success@razorpay"
            }
        },
        "billing": {
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_method_subtype": "upi_collect",
    "payment_method_type": "upi",
     "metadata" : {
        "__notes_91_txn_uuid_93_" : "frefer",
        "__notes_91_transaction_id_93_" : "sdfccewf"
    },
     "browser_info": {
        "user_agent": "Mozilla\/5.0 (iPhone NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "ip_address": "128.0.0.1"
    },
    "merchant_reference_id": "1756197223"
}'
```
Response
```
{
    "id": "12345_pay_0198e582efb27dd19d65039d63fdee24",
    "status": "requires_customer_action",
    "amount": {
        "order_amount": 100,
        "currency": "INR",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": null
    },
    "customer_id": null,
    "connector": "razorpay",
    "created": "2025-08-26T08:33:40.275Z",
    "payment_method_data": {
        "billing": {
            "address": null,
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_method_type": "upi",
    "payment_method_subtype": "upi_collect",
    "connector_transaction_id": "pay_R9tm9SQPe1lw99",
    "connector_reference_id": "order_R9tm8rO2C9Po6a",
    "merchant_connector_id": "mca_bYbJJ3mQjcf6SDC8cULu",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": {
        "type": "wait_screen_information",
        "display_from_timestamp": 1756197222581835000,
        "display_to_timestamp": 1756197522581835000,
        "poll_config": {
            "delay_in_secs": 5,
            "frequency": 5
        }
    },
    "return_url": "https://google.com/success",
    "authentication_type": null,
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": "1756197220",
    "raw_connector_response": "{\"razorpay_payment_id\":\"pay_R9tm9SQPe1lw99\"}",
    "feature_metadata": null
}
```
check merchant_order_reference_id in UCS logs
<img width="1374" height="248" alt="image" src="https://github.com/user-attachments/assets/fbc60337-6809-4727-9da7-26e0a6c83ad6" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9014 | 
	Bug: Add gsm api for v2
Add gsm api for v2 | 
	diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 8fbc29c6963..c874271285b 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -8385,6 +8385,8 @@ pub enum ErrorCategory {
     ProcessorDeclineUnauthorized,
     IssueWithPaymentMethod,
     ProcessorDeclineIncorrectData,
+    HardDecline,
+    SoftDecline,
 }
 
 impl ErrorCategory {
@@ -8393,7 +8395,9 @@ impl ErrorCategory {
             Self::ProcessorDowntime | Self::ProcessorDeclineUnauthorized => true,
             Self::IssueWithPaymentMethod
             | Self::ProcessorDeclineIncorrectData
-            | Self::FrmDecline => false,
+            | Self::FrmDecline
+            | Self::HardDecline
+            | Self::SoftDecline => false,
         }
     }
 }
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index 00a661527a1..1bccb5134bb 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -49,7 +49,7 @@ use crate::{
 };
 
 type RecoveryResult<T> = error_stack::Result<T, errors::RecoveryError>;
-
+pub const REVENUE_RECOVERY: &str = "revenue_recovery";
 /// The status of Passive Churn Payments
 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
 pub enum RevenueRecoveryPaymentsAttemptStatus {
@@ -559,7 +559,7 @@ impl Action {
             revenue_recovery_payment_data,
         )
         .await;
-        let db = &*state.store;
+
         match response {
             Ok(_payment_data) => match payment_attempt.status.foreign_into() {
                 RevenueRecoveryPaymentsAttemptStatus::Succeeded => {
@@ -757,7 +757,35 @@ impl Action {
         payment_attempt: &PaymentAttempt,
         payment_intent: &PaymentIntent,
     ) -> RecoveryResult<Self> {
+        let db = &*state.store;
         let next_retry_count = pt.retry_count + 1;
+        let error_message = payment_attempt
+            .error
+            .as_ref()
+            .map(|details| details.message.clone());
+        let error_code = payment_attempt
+            .error
+            .as_ref()
+            .map(|details| details.code.clone());
+        let connector_name = payment_attempt
+            .connector
+            .clone()
+            .ok_or(errors::RecoveryError::ValueNotFound)
+            .attach_printable("unable to derive payment connector from payment attempt")?;
+        let gsm_record = helpers::get_gsm_record(
+            state,
+            error_code,
+            error_message,
+            connector_name,
+            REVENUE_RECOVERY.to_string(),
+        )
+        .await;
+        let is_hard_decline = gsm_record
+            .and_then(|gsm_record| gsm_record.error_category)
+            .map(|gsm_error_category| {
+                gsm_error_category == common_enums::ErrorCategory::HardDecline
+            })
+            .unwrap_or(false);
         let schedule_time = revenue_recovery_payment_data
             .get_schedule_time_based_on_retry_type(
                 state,
@@ -765,6 +793,7 @@ impl Action {
                 next_retry_count,
                 payment_attempt,
                 payment_intent,
+                is_hard_decline,
             )
             .await;
 
@@ -775,7 +804,6 @@ impl Action {
         }
     }
 }
-
 // TODO: Move these to impl based functions
 async fn record_back_to_billing_connector(
     state: &SessionState,
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 828986aeeee..4584bee1725 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -219,7 +219,8 @@ pub fn mk_app(
             server_app = server_app
                 .service(routes::UserDeprecated::server(state.clone()))
                 .service(routes::ProcessTrackerDeprecated::server(state.clone()))
-                .service(routes::ProcessTracker::server(state.clone()));
+                .service(routes::ProcessTracker::server(state.clone()))
+                .service(routes::Gsm::server(state.clone()));
         }
     }
 
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index f5e7eee7347..cf684a680e8 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2292,7 +2292,7 @@ impl ProfileNew {
 
 pub struct Gsm;
 
-#[cfg(all(feature = "olap", feature = "v1"))]
+#[cfg(all(feature = "v1", feature = "olap"))]
 impl Gsm {
     pub fn server(state: AppState) -> Scope {
         web::scope("/gsm")
@@ -2304,6 +2304,17 @@ impl Gsm {
     }
 }
 
+#[cfg(all(feature = "v2", feature = "olap"))]
+impl Gsm {
+    pub fn server(state: AppState) -> Scope {
+        web::scope("/v2/gsm")
+            .app_data(web::Data::new(state))
+            .service(web::resource("").route(web::post().to(gsm::create_gsm_rule)))
+            .service(web::resource("/get").route(web::post().to(gsm::get_gsm_rule)))
+            .service(web::resource("/update").route(web::post().to(gsm::update_gsm_rule)))
+            .service(web::resource("/delete").route(web::post().to(gsm::delete_gsm_rule)))
+    }
+}
 pub struct Chat;
 
 #[cfg(feature = "olap")]
diff --git a/crates/router/src/routes/gsm.rs b/crates/router/src/routes/gsm.rs
index 77a0cb0a645..886b24bbdb9 100644
--- a/crates/router/src/routes/gsm.rs
+++ b/crates/router/src/routes/gsm.rs
@@ -7,7 +7,10 @@ use crate::{
     core::{api_locking, gsm},
     services::{api, authentication as auth},
 };
-
+#[cfg(feature = "v1")]
+const ADMIN_API_AUTH: auth::AdminApiAuth = auth::AdminApiAuth;
+#[cfg(feature = "v2")]
+const ADMIN_API_AUTH: auth::V2AdminApiAuth = auth::V2AdminApiAuth;
 /// Gsm - Create
 ///
 /// To create a Gsm Rule
@@ -40,7 +43,7 @@ pub async fn create_gsm_rule(
         &req,
         payload,
         |state, _, payload, _| gsm::create_gsm_rule(state, payload),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     ))
     .await
@@ -77,7 +80,7 @@ pub async fn get_gsm_rule(
         &req,
         gsm_retrieve_req,
         |state, _, gsm_retrieve_req, _| gsm::retrieve_gsm_rule(state, gsm_retrieve_req),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     ))
     .await
@@ -115,7 +118,7 @@ pub async fn update_gsm_rule(
         &req,
         payload,
         |state, _, payload, _| gsm::update_gsm_rule(state, payload),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     ))
     .await
@@ -154,7 +157,7 @@ pub async fn delete_gsm_rule(
         &req,
         payload,
         |state, _, payload, _| gsm::delete_gsm_rule(state, payload),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     ))
     .await
diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs
index 4b0dd2f2bc8..1c1a076fd01 100644
--- a/crates/router/src/types/storage/revenue_recovery.rs
+++ b/crates/router/src/types/storage/revenue_recovery.rs
@@ -1,7 +1,7 @@
 use std::fmt::Debug;
 
 use common_enums::enums;
-use common_utils::{ext_traits::ValueExt, id_type};
+use common_utils::{date_time, ext_traits::ValueExt, id_type};
 use external_services::grpc_client::{self as external_grpc_client, GrpcHeaders};
 use hyperswitch_domain_models::{
     business_profile, merchant_account, merchant_connector_account, merchant_key_store,
@@ -38,6 +38,7 @@ impl RevenueRecoveryPaymentData {
         retry_count: i32,
         payment_attempt: &PaymentAttempt,
         payment_intent: &PaymentIntent,
+        is_hard_decline: bool,
     ) -> Option<time::PrimitiveDateTime> {
         match self.retry_algorithm {
             enums::RevenueRecoveryAlgorithmType::Monitoring => {
@@ -53,13 +54,18 @@ impl RevenueRecoveryPaymentData {
                 .await
             }
             enums::RevenueRecoveryAlgorithmType::Smart => {
-                revenue_recovery::get_schedule_time_for_smart_retry(
-                    state,
-                    payment_attempt,
-                    payment_intent,
-                    retry_count,
-                )
-                .await
+                if is_hard_decline {
+                    None
+                } else {
+                    // TODO: Integrate the smart retry call to return back a schedule time
+                    revenue_recovery::get_schedule_time_for_smart_retry(
+                        state,
+                        payment_attempt,
+                        payment_intent,
+                        retry_count,
+                    )
+                    .await
+                }
             }
         }
     }
 | 
	2025-08-08T12:35:12Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Add support for hard-decline switch for revenue-recovery service. If we encounter a hard-decline we would not call the external service . This PR also adds support for gsm apis in v2
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
- hit this curl
``` curl
 curl --location 'http://localhost:8080/v2/gsm' \
--header 'Authorization: admin-api-key=test_admin' \ 
--header 'Content-Type: application/json' \
  --data '{
  "connector": "authipay",
  "flow": "revenue_recovery",
  "sub_flow": "sub_flow",
  "code": "100",
  "message": "Insuffiecient Funds",
  "status": "Failure",
  "decision": "retry",
"clear_pan_possible":false,
"step_up_possible":false,
  "error_category": "hard_decline"
}'
```
- Response ```{"connector":"authipay","flow":"revenue_recovery","sub_flow":"sub_flow","code":"100","message":"Insuffiecient Funds","status":"Failure","router_error":null,"decision":"retry","step_up_possible":false,"unified_code":null,"unified_message":null,"error_category":"hard_decline","clear_pan_possible":false,"feature":"retry","feature_data":{"retry":{"step_up_possible":false,"clear_pan_possible":false,"alternate_network_possible":false,"decision":"retry"}}}%   ```
- Db entry would be present 
<img width="1017" height="385" alt="Screenshot 2025-08-21 at 5 45 52 PM" src="https://github.com/user-attachments/assets/7f9da820-f793-4e57-81dd-cd34608979e9" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a819b4639b1e4279b117f4693cb0716b08e5e2e9 | 
	- hit this curl
``` curl
 curl --location 'http://localhost:8080/v2/gsm' \
--header 'Authorization: admin-api-key=test_admin' \ 
--header 'Content-Type: application/json' \
  --data '{
  "connector": "authipay",
  "flow": "revenue_recovery",
  "sub_flow": "sub_flow",
  "code": "100",
  "message": "Insuffiecient Funds",
  "status": "Failure",
  "decision": "retry",
"clear_pan_possible":false,
"step_up_possible":false,
  "error_category": "hard_decline"
}'
```
- Response ```{"connector":"authipay","flow":"revenue_recovery","sub_flow":"sub_flow","code":"100","message":"Insuffiecient Funds","status":"Failure","router_error":null,"decision":"retry","step_up_possible":false,"unified_code":null,"unified_message":null,"error_category":"hard_decline","clear_pan_possible":false,"feature":"retry","feature_data":{"retry":{"step_up_possible":false,"clear_pan_possible":false,"alternate_network_possible":false,"decision":"retry"}}}%   ```
- Db entry would be present 
<img width="1017" height="385" alt="Screenshot 2025-08-21 at 5 45 52 PM" src="https://github.com/user-attachments/assets/7f9da820-f793-4e57-81dd-cd34608979e9" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9004 | 
	Bug: [BUG] Incremental authorization proceeds even when requested amount equals original
### Bug Description
Incremental authorization proceeds even when requested amount equals original
### Expected Behavior
Incremental authorization should not proceed when requested amount equals original
### Actual Behavior
Incremental authorization proceeds even when requested amount equals original
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs
index fc27effefca..b7810310369 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs
@@ -1086,7 +1086,7 @@ impl
             MinorUnit::new(req.request.total_amount),
             req.request.currency,
         )?;
-        let connector_req = stripe::StripeIncrementalAuthRequest { amount };
+        let connector_req = stripe::StripeIncrementalAuthRequest { amount }; // Incremental authorization can be done a maximum of 10 times in Stripe
 
         Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
     }
@@ -1162,7 +1162,8 @@ impl
                 .unwrap_or_else(|| NO_ERROR_CODE.to_string()),
             message: response
                 .error
-                .code
+                .message
+                .clone()
                 .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
             reason: response.error.message.map(|message| {
                 response
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index a32f89ef4d3..862fcd8ff18 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -101,7 +101,7 @@ impl<F: Send + Clone + Sync>
 
         // Incremental authorization should be performed on an amount greater than the original authorized amount (in this case, greater than the net_amount which is sent for authorization)
         // request.amount is the total amount that should be authorized in incremental authorization which should be greater than the original authorized amount
-        if payment_attempt.get_total_amount() > request.amount {
+        if payment_attempt.get_total_amount() >= request.amount {
             Err(errors::ApiErrorResponse::PreconditionFailed {
                 message: "Amount should be greater than original authorized amount".to_owned(),
             })?
 | 
	2025-08-20T13:37:11Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes these issues - 
[Issue 1](https://github.com/juspay/hyperswitch/issues/9003)
[Issue 2](https://github.com/juspay/hyperswitch/issues/9004)
## Description
<!-- Describe your changes in detail -->
Populated Error Message in Incremental Authorization Flow. Added check for same amount in incremental authorization requests.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
1. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}'
```
Response:
```
{
    "payment_id": "pay_fXzLwsUeDagw7Cdyp8Sh",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_fXzLwsUeDagw7Cdyp8Sh_secret_Uoa82RaRfj6xcV3MnUtO",
    "created": "2025-08-20T12:16:31.560Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755692191,
        "expires": 1755695791,
        "secret": "epk_c558a24e699a4b9db808d953a8df38f5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T12:31:31.560Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T12:16:32.579Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
2. Payments - Incremental Authorization (with same amount)
Request:
```
curl --location 'http://localhost:8080/payments/pay_fXzLwsUeDagw7Cdyp8Sh/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6500
}'
```
Response:
```
{
    "error": {
        "type": "invalid_request",
        "message": "Amount should be greater than original authorized amount",
        "code": "IR_16"
    }
}
```
3. Payments - Incremental Authorization (exceeding the maximum amount of time the flow can be called in Stripe)
Request:
```
curl --location 'http://localhost:8080/payments/pay_gIQKmooikg2npSvaM9xZ/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6511
}'
```
Response:
```
{
    "payment_id": "pay_gIQKmooikg2npSvaM9xZ",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6510,
    "net_amount": 6510,
    "shipping_cost": null,
    "amount_capturable": 6510,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_gIQKmooikg2npSvaM9xZ_secret_cmcrBTpMQL6Prbvudezo",
    "created": "2025-08-20T13:28:31.692Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": 11,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_RI9tMBRwaju7LpkDhNrT_1",
            "amount": 6501,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6500
        },
        {
            "authorization_id": "auth_BoyLq9eHomflrMn5f2kD_2",
            "amount": 6502,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6501
        },
        {
            "authorization_id": "auth_LZZQWDEHw57lbLcqqKv2_3",
            "amount": 6503,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6502
        },
        {
            "authorization_id": "auth_RQeNDy0sdQnaLEW7f4Rm_4",
            "amount": 6504,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6503
        },
        {
            "authorization_id": "auth_2MRj0ANmGIW6BvFARHAe_5",
            "amount": 6505,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6504
        },
        {
            "authorization_id": "auth_egVuyLWfl6jGIZKdgLrt_6",
            "amount": 6506,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6505
        },
        {
            "authorization_id": "auth_M33NayFU2GQicIGYMMkU_7",
            "amount": 6507,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6506
        },
        {
            "authorization_id": "auth_UHtSahoOk1wVd8yacnJx_8",
            "amount": 6508,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6507
        },
        {
            "authorization_id": "auth_IejW3q4wdP5LcRouVvGs_9",
            "amount": 6509,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6508
        },
        {
            "authorization_id": "auth_sZNDStbUEPdqMMEZMlOV_10",
            "amount": 6510,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6509
        },
        {
            "authorization_id": "auth_33dxNtWv6DiOdu3kGC4l_11",
            "amount": 6511,
            "status": "failure",
            "error_code": "No error code",
            "error_message": "The PaymentIntent has reached the maximum number of 10 allowed increments and cannot be incremented further.",
            "previously_authorized_amount": 6510
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T13:43:31.691Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T13:29:27.355Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e1fc14135cc3527cfb5afeccd4934bad8386c7b1 | 
	
Postman Test
1. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}'
```
Response:
```
{
    "payment_id": "pay_fXzLwsUeDagw7Cdyp8Sh",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_fXzLwsUeDagw7Cdyp8Sh_secret_Uoa82RaRfj6xcV3MnUtO",
    "created": "2025-08-20T12:16:31.560Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755692191,
        "expires": 1755695791,
        "secret": "epk_c558a24e699a4b9db808d953a8df38f5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T12:31:31.560Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T12:16:32.579Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
2. Payments - Incremental Authorization (with same amount)
Request:
```
curl --location 'http://localhost:8080/payments/pay_fXzLwsUeDagw7Cdyp8Sh/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6500
}'
```
Response:
```
{
    "error": {
        "type": "invalid_request",
        "message": "Amount should be greater than original authorized amount",
        "code": "IR_16"
    }
}
```
3. Payments - Incremental Authorization (exceeding the maximum amount of time the flow can be called in Stripe)
Request:
```
curl --location 'http://localhost:8080/payments/pay_gIQKmooikg2npSvaM9xZ/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6511
}'
```
Response:
```
{
    "payment_id": "pay_gIQKmooikg2npSvaM9xZ",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6510,
    "net_amount": 6510,
    "shipping_cost": null,
    "amount_capturable": 6510,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_gIQKmooikg2npSvaM9xZ_secret_cmcrBTpMQL6Prbvudezo",
    "created": "2025-08-20T13:28:31.692Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": 11,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_RI9tMBRwaju7LpkDhNrT_1",
            "amount": 6501,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6500
        },
        {
            "authorization_id": "auth_BoyLq9eHomflrMn5f2kD_2",
            "amount": 6502,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6501
        },
        {
            "authorization_id": "auth_LZZQWDEHw57lbLcqqKv2_3",
            "amount": 6503,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6502
        },
        {
            "authorization_id": "auth_RQeNDy0sdQnaLEW7f4Rm_4",
            "amount": 6504,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6503
        },
        {
            "authorization_id": "auth_2MRj0ANmGIW6BvFARHAe_5",
            "amount": 6505,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6504
        },
        {
            "authorization_id": "auth_egVuyLWfl6jGIZKdgLrt_6",
            "amount": 6506,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6505
        },
        {
            "authorization_id": "auth_M33NayFU2GQicIGYMMkU_7",
            "amount": 6507,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6506
        },
        {
            "authorization_id": "auth_UHtSahoOk1wVd8yacnJx_8",
            "amount": 6508,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6507
        },
        {
            "authorization_id": "auth_IejW3q4wdP5LcRouVvGs_9",
            "amount": 6509,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6508
        },
        {
            "authorization_id": "auth_sZNDStbUEPdqMMEZMlOV_10",
            "amount": 6510,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6509
        },
        {
            "authorization_id": "auth_33dxNtWv6DiOdu3kGC4l_11",
            "amount": 6511,
            "status": "failure",
            "error_code": "No error code",
            "error_message": "The PaymentIntent has reached the maximum number of 10 allowed increments and cannot be incremented further.",
            "previously_authorized_amount": 6510
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T13:43:31.691Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T13:29:27.355Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9003 | 
	Bug: [BUG] Error message not getting populated in Stripe Incremental Authorization Flow
### Bug Description
Error message not getting populated in Stripe Incremental Authorization Flow 
### Expected Behavior
Error message should be populated in Stripe Incremental Authorization Flow 
### Actual Behavior
Error message not getting populated in Stripe Incremental Authorization Flow 
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs
index fc27effefca..b7810310369 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs
@@ -1086,7 +1086,7 @@ impl
             MinorUnit::new(req.request.total_amount),
             req.request.currency,
         )?;
-        let connector_req = stripe::StripeIncrementalAuthRequest { amount };
+        let connector_req = stripe::StripeIncrementalAuthRequest { amount }; // Incremental authorization can be done a maximum of 10 times in Stripe
 
         Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
     }
@@ -1162,7 +1162,8 @@ impl
                 .unwrap_or_else(|| NO_ERROR_CODE.to_string()),
             message: response
                 .error
-                .code
+                .message
+                .clone()
                 .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
             reason: response.error.message.map(|message| {
                 response
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index a32f89ef4d3..862fcd8ff18 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -101,7 +101,7 @@ impl<F: Send + Clone + Sync>
 
         // Incremental authorization should be performed on an amount greater than the original authorized amount (in this case, greater than the net_amount which is sent for authorization)
         // request.amount is the total amount that should be authorized in incremental authorization which should be greater than the original authorized amount
-        if payment_attempt.get_total_amount() > request.amount {
+        if payment_attempt.get_total_amount() >= request.amount {
             Err(errors::ApiErrorResponse::PreconditionFailed {
                 message: "Amount should be greater than original authorized amount".to_owned(),
             })?
 | 
	2025-08-20T13:37:11Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes these issues - 
[Issue 1](https://github.com/juspay/hyperswitch/issues/9003)
[Issue 2](https://github.com/juspay/hyperswitch/issues/9004)
## Description
<!-- Describe your changes in detail -->
Populated Error Message in Incremental Authorization Flow. Added check for same amount in incremental authorization requests.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
1. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}'
```
Response:
```
{
    "payment_id": "pay_fXzLwsUeDagw7Cdyp8Sh",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_fXzLwsUeDagw7Cdyp8Sh_secret_Uoa82RaRfj6xcV3MnUtO",
    "created": "2025-08-20T12:16:31.560Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755692191,
        "expires": 1755695791,
        "secret": "epk_c558a24e699a4b9db808d953a8df38f5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T12:31:31.560Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T12:16:32.579Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
2. Payments - Incremental Authorization (with same amount)
Request:
```
curl --location 'http://localhost:8080/payments/pay_fXzLwsUeDagw7Cdyp8Sh/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6500
}'
```
Response:
```
{
    "error": {
        "type": "invalid_request",
        "message": "Amount should be greater than original authorized amount",
        "code": "IR_16"
    }
}
```
3. Payments - Incremental Authorization (exceeding the maximum amount of time the flow can be called in Stripe)
Request:
```
curl --location 'http://localhost:8080/payments/pay_gIQKmooikg2npSvaM9xZ/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6511
}'
```
Response:
```
{
    "payment_id": "pay_gIQKmooikg2npSvaM9xZ",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6510,
    "net_amount": 6510,
    "shipping_cost": null,
    "amount_capturable": 6510,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_gIQKmooikg2npSvaM9xZ_secret_cmcrBTpMQL6Prbvudezo",
    "created": "2025-08-20T13:28:31.692Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": 11,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_RI9tMBRwaju7LpkDhNrT_1",
            "amount": 6501,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6500
        },
        {
            "authorization_id": "auth_BoyLq9eHomflrMn5f2kD_2",
            "amount": 6502,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6501
        },
        {
            "authorization_id": "auth_LZZQWDEHw57lbLcqqKv2_3",
            "amount": 6503,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6502
        },
        {
            "authorization_id": "auth_RQeNDy0sdQnaLEW7f4Rm_4",
            "amount": 6504,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6503
        },
        {
            "authorization_id": "auth_2MRj0ANmGIW6BvFARHAe_5",
            "amount": 6505,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6504
        },
        {
            "authorization_id": "auth_egVuyLWfl6jGIZKdgLrt_6",
            "amount": 6506,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6505
        },
        {
            "authorization_id": "auth_M33NayFU2GQicIGYMMkU_7",
            "amount": 6507,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6506
        },
        {
            "authorization_id": "auth_UHtSahoOk1wVd8yacnJx_8",
            "amount": 6508,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6507
        },
        {
            "authorization_id": "auth_IejW3q4wdP5LcRouVvGs_9",
            "amount": 6509,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6508
        },
        {
            "authorization_id": "auth_sZNDStbUEPdqMMEZMlOV_10",
            "amount": 6510,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6509
        },
        {
            "authorization_id": "auth_33dxNtWv6DiOdu3kGC4l_11",
            "amount": 6511,
            "status": "failure",
            "error_code": "No error code",
            "error_message": "The PaymentIntent has reached the maximum number of 10 allowed increments and cannot be incremented further.",
            "previously_authorized_amount": 6510
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T13:43:31.691Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T13:29:27.355Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e1fc14135cc3527cfb5afeccd4934bad8386c7b1 | 
	
Postman Test
1. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}'
```
Response:
```
{
    "payment_id": "pay_fXzLwsUeDagw7Cdyp8Sh",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_fXzLwsUeDagw7Cdyp8Sh_secret_Uoa82RaRfj6xcV3MnUtO",
    "created": "2025-08-20T12:16:31.560Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755692191,
        "expires": 1755695791,
        "secret": "epk_c558a24e699a4b9db808d953a8df38f5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T12:31:31.560Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T12:16:32.579Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
2. Payments - Incremental Authorization (with same amount)
Request:
```
curl --location 'http://localhost:8080/payments/pay_fXzLwsUeDagw7Cdyp8Sh/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6500
}'
```
Response:
```
{
    "error": {
        "type": "invalid_request",
        "message": "Amount should be greater than original authorized amount",
        "code": "IR_16"
    }
}
```
3. Payments - Incremental Authorization (exceeding the maximum amount of time the flow can be called in Stripe)
Request:
```
curl --location 'http://localhost:8080/payments/pay_gIQKmooikg2npSvaM9xZ/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6511
}'
```
Response:
```
{
    "payment_id": "pay_gIQKmooikg2npSvaM9xZ",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6510,
    "net_amount": 6510,
    "shipping_cost": null,
    "amount_capturable": 6510,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_gIQKmooikg2npSvaM9xZ_secret_cmcrBTpMQL6Prbvudezo",
    "created": "2025-08-20T13:28:31.692Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": 11,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_RI9tMBRwaju7LpkDhNrT_1",
            "amount": 6501,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6500
        },
        {
            "authorization_id": "auth_BoyLq9eHomflrMn5f2kD_2",
            "amount": 6502,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6501
        },
        {
            "authorization_id": "auth_LZZQWDEHw57lbLcqqKv2_3",
            "amount": 6503,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6502
        },
        {
            "authorization_id": "auth_RQeNDy0sdQnaLEW7f4Rm_4",
            "amount": 6504,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6503
        },
        {
            "authorization_id": "auth_2MRj0ANmGIW6BvFARHAe_5",
            "amount": 6505,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6504
        },
        {
            "authorization_id": "auth_egVuyLWfl6jGIZKdgLrt_6",
            "amount": 6506,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6505
        },
        {
            "authorization_id": "auth_M33NayFU2GQicIGYMMkU_7",
            "amount": 6507,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6506
        },
        {
            "authorization_id": "auth_UHtSahoOk1wVd8yacnJx_8",
            "amount": 6508,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6507
        },
        {
            "authorization_id": "auth_IejW3q4wdP5LcRouVvGs_9",
            "amount": 6509,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6508
        },
        {
            "authorization_id": "auth_sZNDStbUEPdqMMEZMlOV_10",
            "amount": 6510,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6509
        },
        {
            "authorization_id": "auth_33dxNtWv6DiOdu3kGC4l_11",
            "amount": 6511,
            "status": "failure",
            "error_code": "No error code",
            "error_message": "The PaymentIntent has reached the maximum number of 10 allowed increments and cannot be incremented further.",
            "previously_authorized_amount": 6510
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T13:43:31.691Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T13:29:27.355Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9000 | 
	Bug: [REFACTOR] Adyen's balance platform webhooks
Webhooks for balance platform are different for different payout methods -
Banks - https://docs.adyen.com/payouts/payout-service/pay-out-to-bank-accounts/payout-webhooks/
Cards - https://docs.adyen.com/payouts/payout-service/pay-out-to-cards/payout-webhooks/ | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
index 78c8c4c8067..2158fece4c9 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
@@ -402,6 +402,7 @@ impl IncomingWebhook for Adyenplatform {
                 webhook_body.webhook_type,
                 webhook_body.data.status,
                 webhook_body.data.tracking,
+                webhook_body.data.category.as_ref(),
             ))
         }
         #[cfg(not(feature = "payouts"))]
diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
index 6c964aea20f..b04ca410d39 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
@@ -513,6 +513,7 @@ pub struct AdyenplatformIncomingWebhookData {
     pub status: AdyenplatformWebhookStatus,
     pub reference: String,
     pub tracking: Option<AdyenplatformInstantStatus>,
+    pub category: Option<AdyenPayoutMethod>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -551,6 +552,7 @@ pub fn get_adyen_webhook_event(
     event_type: AdyenplatformWebhookEventType,
     status: AdyenplatformWebhookStatus,
     instant_status: Option<AdyenplatformInstantStatus>,
+    category: Option<&AdyenPayoutMethod>,
 ) -> webhooks::IncomingWebhookEvent {
     match (event_type, status, instant_status) {
         (AdyenplatformWebhookEventType::PayoutCreated, _, _) => {
@@ -565,9 +567,25 @@ pub fn get_adyen_webhook_event(
             }
         }
         (AdyenplatformWebhookEventType::PayoutUpdated, status, _) => match status {
-            AdyenplatformWebhookStatus::Authorised
-            | AdyenplatformWebhookStatus::Booked
-            | AdyenplatformWebhookStatus::Received => webhooks::IncomingWebhookEvent::PayoutCreated,
+            AdyenplatformWebhookStatus::Authorised | AdyenplatformWebhookStatus::Received => {
+                webhooks::IncomingWebhookEvent::PayoutCreated
+            }
+            AdyenplatformWebhookStatus::Booked => {
+                match category {
+                    Some(AdyenPayoutMethod::Card) => {
+                        // For card payouts, "booked" is the final success state
+                        webhooks::IncomingWebhookEvent::PayoutSuccess
+                    }
+                    Some(AdyenPayoutMethod::Bank) => {
+                        // For bank payouts, "booked" is intermediate - wait for final confirmation
+                        webhooks::IncomingWebhookEvent::PayoutProcessing
+                    }
+                    None => {
+                        // Default to processing if category is unknown
+                        webhooks::IncomingWebhookEvent::PayoutProcessing
+                    }
+                }
+            }
             AdyenplatformWebhookStatus::Pending => webhooks::IncomingWebhookEvent::PayoutProcessing,
             AdyenplatformWebhookStatus::Failed => webhooks::IncomingWebhookEvent::PayoutFailure,
             AdyenplatformWebhookStatus::Returned => webhooks::IncomingWebhookEvent::PayoutReversed,
 | 
	2025-08-20T10:56:53Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR updates the webhooks for Adyen's BalancePlatform for payouts.
Main changes -
For status `booked` from Adyen, map it to
`success` for cards
`processing` for banks - reason being status `credited` is received from Adyen for successful credits.
Check the relevant issue for more details.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Enhances payout webhooks for Adyen's BalancePlatform.
## How did you test it?
<details>
    <summary>1. Create a successful card payout</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_3ItwbKI2nwx45BPimAEaYP7QwnwKuC5a5GsG0aaow5wWefb62tXAcldZUrntn0jd' \
        --data '{"amount":100,"currency":"EUR","profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","city":"San Fransico","country":"FR","first_name":"John","last_name":"Doe"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_5nv2qm3avmPmQTbvFBZg","merchant_id":"merchant_1755690193","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":{"card":{"card_issuer":null,"card_network":null,"card_type":null,"card_issuing_country":null,"bank_code":null,"last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"FR","line1":"1467","line2":"Harrison Street","line3":null,"zip":null,"state":null,"first_name":"John","last_name":"Doe","origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","customer":{"id":"cus_2bXx7dm7bRTOLOMlBAQi","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_5nv2qm3avmPmQTbvFBZg_secret_j2B52JTji1yRrEOtd6FI","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_NsHlFe2GsWvK9CdftrLt","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","created":"2025-08-20T11:49:11.757Z","connector_transaction_id":"38EBIY681J48U2JS","priority":null,"payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_ywYBGKd0jKSUhIFyNho9"}
Wait for incoming webhook
Check for outgoing webhooks
Initiated
<img width="1726" height="906" alt="Screenshot 2025-08-20 at 5 21 04 PM" src="https://github.com/user-attachments/assets/74cc3db1-2338-4a31-8045-b5c54e156cfe" />
Successful
<img width="1726" height="891" alt="Screenshot 2025-08-20 at 5 21 12 PM" src="https://github.com/user-attachments/assets/ae8fd898-a3f8-4f78-adcf-12d6ddb4c8f8" />
</details>
<details>
    <summary>2. Create a successful SEPA payout</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Accept-Language: fr' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_3ItwbKI2nwx45BPimAEaYP7QwnwKuC5a5GsG0aaow5wWefb62tXAcldZUrntn0jd' \
        --data '{"amount":1,"currency":"EUR","customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","description":"Its my first payout request","payout_type":"bank","priority":"regular","payout_method_data":{"bank":{"iban":"NL57INGB4654188101"}},"connector":["adyenplatform"],"billing":{"address":{"line1":"Raadhuisplein","line2":"92","city":"Hoogeveen","country":"NL","first_name":"John"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ"}'
Response
    {"payout_id":"payout_FywtoqrSxKtwDDsbCvGa","merchant_id":"merchant_1755690193","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyenplatform","payout_type":"bank","payout_method_data":{"bank":{"iban":"NL57I********88101","bank_name":null,"bank_country_code":null,"bank_city":null,"bic":null}},"billing":{"address":{"city":"Hoogeveen","country":"NL","line1":"Raadhuisplein","line2":"92","line3":null,"zip":null,"state":null,"first_name":"John","last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","customer":{"id":"cus_2bXx7dm7bRTOLOMlBAQi","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_FywtoqrSxKtwDDsbCvGa_secret_fC2TqhM2tucPGuzvQcDr","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_NsHlFe2GsWvK9CdftrLt","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","created":"2025-08-20T11:51:48.487Z","connector_transaction_id":"38EBH1681J56C4WZ","priority":"regular","payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_Vc6t4FK6HmbM2TUXsaBs"}
Wait for incoming webhook
Check for outgoing webhooks
Initiated
<img width="1728" height="898" alt="Screenshot 2025-08-20 at 5 22 39 PM" src="https://github.com/user-attachments/assets/a435370c-7954-4d02-8dc3-09b7bd242349" />
Successful
<img width="1728" height="892" alt="Screenshot 2025-08-20 at 5 22 46 PM" src="https://github.com/user-attachments/assets/5b17c1e3-2990-4b9b-9b42-4685a7271a97" />
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328 | 
	<details>
    <summary>1. Create a successful card payout</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_3ItwbKI2nwx45BPimAEaYP7QwnwKuC5a5GsG0aaow5wWefb62tXAcldZUrntn0jd' \
        --data '{"amount":100,"currency":"EUR","profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","city":"San Fransico","country":"FR","first_name":"John","last_name":"Doe"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_5nv2qm3avmPmQTbvFBZg","merchant_id":"merchant_1755690193","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":{"card":{"card_issuer":null,"card_network":null,"card_type":null,"card_issuing_country":null,"bank_code":null,"last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"FR","line1":"1467","line2":"Harrison Street","line3":null,"zip":null,"state":null,"first_name":"John","last_name":"Doe","origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","customer":{"id":"cus_2bXx7dm7bRTOLOMlBAQi","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_5nv2qm3avmPmQTbvFBZg_secret_j2B52JTji1yRrEOtd6FI","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_NsHlFe2GsWvK9CdftrLt","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","created":"2025-08-20T11:49:11.757Z","connector_transaction_id":"38EBIY681J48U2JS","priority":null,"payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_ywYBGKd0jKSUhIFyNho9"}
Wait for incoming webhook
Check for outgoing webhooks
Initiated
<img width="1726" height="906" alt="Screenshot 2025-08-20 at 5 21 04 PM" src="https://github.com/user-attachments/assets/74cc3db1-2338-4a31-8045-b5c54e156cfe" />
Successful
<img width="1726" height="891" alt="Screenshot 2025-08-20 at 5 21 12 PM" src="https://github.com/user-attachments/assets/ae8fd898-a3f8-4f78-adcf-12d6ddb4c8f8" />
</details>
<details>
    <summary>2. Create a successful SEPA payout</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Accept-Language: fr' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_3ItwbKI2nwx45BPimAEaYP7QwnwKuC5a5GsG0aaow5wWefb62tXAcldZUrntn0jd' \
        --data '{"amount":1,"currency":"EUR","customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","description":"Its my first payout request","payout_type":"bank","priority":"regular","payout_method_data":{"bank":{"iban":"NL57INGB4654188101"}},"connector":["adyenplatform"],"billing":{"address":{"line1":"Raadhuisplein","line2":"92","city":"Hoogeveen","country":"NL","first_name":"John"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ"}'
Response
    {"payout_id":"payout_FywtoqrSxKtwDDsbCvGa","merchant_id":"merchant_1755690193","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyenplatform","payout_type":"bank","payout_method_data":{"bank":{"iban":"NL57I********88101","bank_name":null,"bank_country_code":null,"bank_city":null,"bic":null}},"billing":{"address":{"city":"Hoogeveen","country":"NL","line1":"Raadhuisplein","line2":"92","line3":null,"zip":null,"state":null,"first_name":"John","last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","customer":{"id":"cus_2bXx7dm7bRTOLOMlBAQi","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_FywtoqrSxKtwDDsbCvGa_secret_fC2TqhM2tucPGuzvQcDr","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_NsHlFe2GsWvK9CdftrLt","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","created":"2025-08-20T11:51:48.487Z","connector_transaction_id":"38EBH1681J56C4WZ","priority":"regular","payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_Vc6t4FK6HmbM2TUXsaBs"}
Wait for incoming webhook
Check for outgoing webhooks
Initiated
<img width="1728" height="898" alt="Screenshot 2025-08-20 at 5 22 39 PM" src="https://github.com/user-attachments/assets/a435370c-7954-4d02-8dc3-09b7bd242349" />
Successful
<img width="1728" height="892" alt="Screenshot 2025-08-20 at 5 22 46 PM" src="https://github.com/user-attachments/assets/5b17c1e3-2990-4b9b-9b42-4685a7271a97" />
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9010 | 
	Bug: [FEATURE] extend PSP token provisioning through Adyen Platform
### Feature Description
Enable processing payouts using Adyen stored payment method tokens (storedPaymentMethodId) in the AdyenPlatform connector. Currently, the connector only supports raw card details for payouts. This feature will add support for tokenized card payouts, allowing merchants to process payouts using previously stored payment methods using PSP tokens.
### Possible Implementation
Add support for both raw card details and tokenized payments with proper fallback logic, following Adyen's Balance Platform API specifications for payouts with tokenized card details - https://docs.adyen.com/payouts/payout-service/pay-out-to-cards/card-payout-request/?tab=recurring-payouts_3
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
index b04ca410d39..35636889d71 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
@@ -11,7 +11,9 @@ use super::{AdyenPlatformRouterData, Error};
 use crate::{
     connectors::adyen::transformers as adyen,
     types::PayoutsResponseRouterData,
-    utils::{self, AddressDetailsData, PayoutsData as _, RouterData as _},
+    utils::{
+        self, AddressDetailsData, PayoutFulfillRequestData, PayoutsData as _, RouterData as _,
+    },
 };
 
 #[derive(Debug, Default, Serialize, Deserialize)]
@@ -54,8 +56,6 @@ pub enum AdyenPayoutMethod {
 pub enum AdyenPayoutMethodDetails {
     BankAccount(AdyenBankAccountDetails),
     Card(AdyenCardDetails),
-    #[serde(rename = "card")]
-    CardToken(AdyenCardTokenDetails),
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -117,9 +117,16 @@ pub struct AdyenCardDetails {
     card_identification: AdyenCardIdentification,
 }
 
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum AdyenCardIdentification {
+    Card(AdyenRawCardIdentification),
+    Stored(AdyenStoredCardIdentification),
+}
+
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
-pub struct AdyenCardIdentification {
+pub struct AdyenRawCardIdentification {
     #[serde(rename = "number")]
     card_number: cards::CardNumber,
     expiry_month: Secret<String>,
@@ -131,14 +138,7 @@ pub struct AdyenCardIdentification {
 
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
-pub struct AdyenCardTokenDetails {
-    card_holder: AdyenAccountHolder,
-    card_identification: AdyenCardTokenIdentification,
-}
-
-#[derive(Debug, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct AdyenCardTokenIdentification {
+pub struct AdyenStoredCardIdentification {
     stored_payment_method_id: Secret<String>,
 }
 
@@ -260,7 +260,6 @@ impl<F> TryFrom<(&PayoutsRouterData<F>, &payouts::CardPayout)> for AdyenAccountH
     ) -> Result<Self, Self::Error> {
         let billing_address = router_data.get_optional_billing();
 
-        // Address is required for both card and bank payouts
         let address = billing_address
             .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into()))
             .transpose()?
@@ -294,13 +293,25 @@ impl<F> TryFrom<(&PayoutsRouterData<F>, &payouts::CardPayout)> for AdyenAccountH
             .into());
         };
 
+        let customer_id_reference = match router_data.get_connector_customer_id() {
+            Ok(connector_customer_id) => connector_customer_id,
+            Err(_) => {
+                let customer_id = router_data.get_customer_id()?;
+                format!(
+                    "{}_{}",
+                    router_data.merchant_id.get_string_repr(),
+                    customer_id.get_string_repr()
+                )
+            }
+        };
+
         Ok(Self {
             address: Some(address),
             first_name,
             last_name,
             full_name: None,
             email: router_data.get_optional_billing_email(),
-            customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()),
+            customer_id: Some(customer_id_reference),
             entity_type: Some(EntityType::from(router_data.request.entity_type)),
         })
     }
@@ -314,7 +325,6 @@ impl<F> TryFrom<(&PayoutsRouterData<F>, &payouts::Bank)> for AdyenAccountHolder
     ) -> Result<Self, Self::Error> {
         let billing_address = router_data.get_optional_billing();
 
-        // Address is required for both card and bank payouts
         let address = billing_address
             .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into()))
             .transpose()?
@@ -324,46 +334,156 @@ impl<F> TryFrom<(&PayoutsRouterData<F>, &payouts::Bank)> for AdyenAccountHolder
 
         let full_name = router_data.get_billing_full_name()?;
 
+        let customer_id_reference = match router_data.get_connector_customer_id() {
+            Ok(connector_customer_id) => connector_customer_id,
+            Err(_) => {
+                let customer_id = router_data.get_customer_id()?;
+                format!(
+                    "{}_{}",
+                    router_data.merchant_id.get_string_repr(),
+                    customer_id.get_string_repr()
+                )
+            }
+        };
+
         Ok(Self {
             address: Some(address),
             first_name: None,
             last_name: None,
             full_name: Some(full_name),
             email: router_data.get_optional_billing_email(),
-            customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()),
+            customer_id: Some(customer_id_reference),
             entity_type: Some(EntityType::from(router_data.request.entity_type)),
         })
     }
 }
 
-impl<F> TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData<F>>> for AdyenTransferRequest {
+#[derive(Debug)]
+pub struct StoredPaymentCounterparty<'a, F> {
+    pub item: &'a AdyenPlatformRouterData<&'a PayoutsRouterData<F>>,
+    pub stored_payment_method_id: String,
+}
+
+#[derive(Debug)]
+pub struct RawPaymentCounterparty<'a, F> {
+    pub item: &'a AdyenPlatformRouterData<&'a PayoutsRouterData<F>>,
+    pub raw_payout_method_data: payouts::PayoutMethodData,
+}
+
+impl<F> TryFrom<StoredPaymentCounterparty<'_, F>>
+    for (AdyenPayoutMethodDetails, Option<AdyenPayoutPriority>)
+{
     type Error = Error;
-    fn try_from(
-        item: &AdyenPlatformRouterData<&PayoutsRouterData<F>>,
-    ) -> Result<Self, Self::Error> {
-        let request = &item.router_data.request;
-        let (counterparty, priority) = match item.router_data.get_payout_method_data()? {
+
+    fn try_from(stored_payment: StoredPaymentCounterparty<'_, F>) -> Result<Self, Self::Error> {
+        let request = &stored_payment.item.router_data.request;
+        let payout_type = request.get_payout_type()?;
+
+        match payout_type {
+            enums::PayoutType::Card => {
+                let billing_address = stored_payment.item.router_data.get_optional_billing();
+                let address = billing_address
+                    .and_then(|billing| billing.address.as_ref())
+                    .ok_or(ConnectorError::MissingRequiredField {
+                        field_name: "address",
+                    })?
+                    .try_into()?;
+
+                let customer_id_reference =
+                    match stored_payment.item.router_data.get_connector_customer_id() {
+                        Ok(connector_customer_id) => connector_customer_id,
+                        Err(_) => {
+                            let customer_id = stored_payment.item.router_data.get_customer_id()?;
+                            format!(
+                                "{}_{}",
+                                stored_payment
+                                    .item
+                                    .router_data
+                                    .merchant_id
+                                    .get_string_repr(),
+                                customer_id.get_string_repr()
+                            )
+                        }
+                    };
+
+                let card_holder = AdyenAccountHolder {
+                    address: Some(address),
+                    first_name: stored_payment
+                        .item
+                        .router_data
+                        .get_optional_billing_first_name(),
+                    last_name: stored_payment
+                        .item
+                        .router_data
+                        .get_optional_billing_last_name(),
+                    full_name: stored_payment
+                        .item
+                        .router_data
+                        .get_optional_billing_full_name(),
+                    email: stored_payment.item.router_data.get_optional_billing_email(),
+                    customer_id: Some(customer_id_reference),
+                    entity_type: Some(EntityType::from(request.entity_type)),
+                };
+
+                let card_identification =
+                    AdyenCardIdentification::Stored(AdyenStoredCardIdentification {
+                        stored_payment_method_id: Secret::new(
+                            stored_payment.stored_payment_method_id,
+                        ),
+                    });
+
+                let counterparty = AdyenPayoutMethodDetails::Card(AdyenCardDetails {
+                    card_holder,
+                    card_identification,
+                });
+
+                Ok((counterparty, None))
+            }
+            _ => Err(ConnectorError::NotSupported {
+                message: "Stored payment method is only supported for card payouts".to_string(),
+                connector: "Adyenplatform",
+            }
+            .into()),
+        }
+    }
+}
+
+impl<F> TryFrom<RawPaymentCounterparty<'_, F>>
+    for (AdyenPayoutMethodDetails, Option<AdyenPayoutPriority>)
+{
+    type Error = Error;
+
+    fn try_from(raw_payment: RawPaymentCounterparty<'_, F>) -> Result<Self, Self::Error> {
+        let request = &raw_payment.item.router_data.request;
+
+        match raw_payment.raw_payout_method_data {
             payouts::PayoutMethodData::Wallet(_) => Err(ConnectorError::NotImplemented(
                 utils::get_unimplemented_payment_method_error_message("Adyenplatform"),
             ))?,
             payouts::PayoutMethodData::Card(c) => {
-                let card_holder: AdyenAccountHolder = (item.router_data, &c).try_into()?;
-                let card_identification = AdyenCardIdentification {
-                    card_number: c.card_number,
-                    expiry_month: c.expiry_month,
-                    expiry_year: c.expiry_year,
-                    issue_number: None,
-                    start_month: None,
-                    start_year: None,
-                };
+                let card_holder: AdyenAccountHolder =
+                    (raw_payment.item.router_data, &c).try_into()?;
+
+                let card_identification =
+                    AdyenCardIdentification::Card(AdyenRawCardIdentification {
+                        card_number: c.card_number,
+                        expiry_month: c.expiry_month,
+                        expiry_year: c.expiry_year,
+                        issue_number: None,
+                        start_month: None,
+                        start_year: None,
+                    });
+
                 let counterparty = AdyenPayoutMethodDetails::Card(AdyenCardDetails {
                     card_holder,
                     card_identification,
                 });
-                (counterparty, None)
+
+                Ok((counterparty, None))
             }
             payouts::PayoutMethodData::Bank(bd) => {
-                let account_holder: AdyenAccountHolder = (item.router_data, &bd).try_into()?;
+                let account_holder: AdyenAccountHolder =
+                    (raw_payment.item.router_data, &bd).try_into()?;
                 let bank_details = match bd {
                     payouts::Bank::Sepa(b) => AdyenBankAccountIdentification {
                         bank_type: "iban".to_string(),
@@ -393,9 +513,42 @@ impl<F> TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData<F>>> for AdyenTransf
                     .ok_or(ConnectorError::MissingRequiredField {
                         field_name: "priority",
                     })?;
-                (counterparty, Some(AdyenPayoutPriority::from(priority)))
+
+                Ok((counterparty, Some(AdyenPayoutPriority::from(priority))))
             }
-        };
+        }
+    }
+}
+
+impl<F> TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData<F>>> for AdyenTransferRequest {
+    type Error = Error;
+    fn try_from(
+        item: &AdyenPlatformRouterData<&PayoutsRouterData<F>>,
+    ) -> Result<Self, Self::Error> {
+        let request = &item.router_data.request;
+        let stored_payment_method_result =
+            item.router_data.request.get_connector_transfer_method_id();
+        let raw_payout_method_result = item.router_data.get_payout_method_data();
+
+        let (counterparty, priority) =
+            if let Ok(stored_payment_method_id) = stored_payment_method_result {
+                StoredPaymentCounterparty {
+                    item,
+                    stored_payment_method_id,
+                }
+                .try_into()?
+            } else if let Ok(raw_payout_method_data) = raw_payout_method_result {
+                RawPaymentCounterparty {
+                    item,
+                    raw_payout_method_data,
+                }
+                .try_into()?
+            } else {
+                return Err(ConnectorError::MissingRequiredField {
+                    field_name: "payout_method_data or stored_payment_method_id",
+                }
+                .into());
+            };
         let adyen_connector_metadata_object =
             AdyenPlatformConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?;
         let balance_account_id = adyen_connector_metadata_object
@@ -570,22 +723,11 @@ pub fn get_adyen_webhook_event(
             AdyenplatformWebhookStatus::Authorised | AdyenplatformWebhookStatus::Received => {
                 webhooks::IncomingWebhookEvent::PayoutCreated
             }
-            AdyenplatformWebhookStatus::Booked => {
-                match category {
-                    Some(AdyenPayoutMethod::Card) => {
-                        // For card payouts, "booked" is the final success state
-                        webhooks::IncomingWebhookEvent::PayoutSuccess
-                    }
-                    Some(AdyenPayoutMethod::Bank) => {
-                        // For bank payouts, "booked" is intermediate - wait for final confirmation
-                        webhooks::IncomingWebhookEvent::PayoutProcessing
-                    }
-                    None => {
-                        // Default to processing if category is unknown
-                        webhooks::IncomingWebhookEvent::PayoutProcessing
-                    }
-                }
-            }
+            AdyenplatformWebhookStatus::Booked => match category {
+                Some(AdyenPayoutMethod::Card) => webhooks::IncomingWebhookEvent::PayoutSuccess,
+                Some(AdyenPayoutMethod::Bank) => webhooks::IncomingWebhookEvent::PayoutProcessing,
+                None => webhooks::IncomingWebhookEvent::PayoutProcessing,
+            },
             AdyenplatformWebhookStatus::Pending => webhooks::IncomingWebhookEvent::PayoutProcessing,
             AdyenplatformWebhookStatus::Failed => webhooks::IncomingWebhookEvent::PayoutFailure,
             AdyenplatformWebhookStatus::Returned => webhooks::IncomingWebhookEvent::PayoutReversed,
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index a06b6140da4..c7784118847 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -188,7 +188,19 @@ pub fn make_dsl_input_for_payouts(
         payment_method_type: payout_data
             .payout_method_data
             .as_ref()
-            .map(api_enums::PaymentMethodType::foreign_from),
+            .map(api_enums::PaymentMethodType::foreign_from)
+            .or_else(|| {
+                payout_data.payment_method.as_ref().and_then(|pm| {
+                    #[cfg(feature = "v1")]
+                    {
+                        pm.payment_method_type
+                    }
+                    #[cfg(feature = "v2")]
+                    {
+                        pm.payment_method_subtype
+                    }
+                })
+            }),
         card_network: None,
     };
     Ok(dsl_inputs::BackendInput {
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 66a824fc01b..dee0d3f130a 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -58,7 +58,7 @@ use crate::{
         api::{self, payments as payment_api_types, payouts},
         domain,
         storage::{self, PaymentRoutingInfo},
-        transformers::ForeignFrom,
+        transformers::{ForeignFrom, ForeignTryFrom},
     },
     utils::{self, OptionExt},
 };
@@ -78,6 +78,7 @@ pub struct PayoutData {
     pub payout_link: Option<PayoutLink>,
     pub current_locale: String,
     pub payment_method: Option<PaymentMethod>,
+    pub connector_transfer_method_id: Option<String>,
 }
 
 // ********************************************** CORE FLOWS **********************************************
@@ -693,27 +694,8 @@ pub async fn payouts_fulfill_core(
         .attach_printable("Connector not found for payout fulfillment")?,
     };
 
-    // Trigger fulfillment
-    let customer_id = payout_data
-        .payouts
-        .customer_id
-        .clone()
-        .get_required_value("customer_id")?;
-    payout_data.payout_method_data = Some(
-        helpers::make_payout_method_data(
-            &state,
-            None,
-            payout_attempt.payout_token.as_deref(),
-            &customer_id,
-            &payout_attempt.merchant_id,
-            payout_data.payouts.payout_type,
-            merchant_context.get_merchant_key_store(),
-            Some(&mut payout_data),
-            merchant_context.get_merchant_account().storage_scheme,
-        )
-        .await?
-        .get_required_value("payout_method_data")?,
-    );
+    helpers::fetch_payout_method_data(&state, &mut payout_data, &connector_data, &merchant_context)
+        .await?;
     Box::pin(fulfill_payout(
         &state,
         &merchant_context,
@@ -1072,25 +1054,8 @@ pub async fn call_connector_payout(
 
     // Fetch / store payout_method_data
     if payout_data.payout_method_data.is_none() || payout_attempt.payout_token.is_none() {
-        let customer_id = payouts
-            .customer_id
-            .clone()
-            .get_required_value("customer_id")?;
-        payout_data.payout_method_data = Some(
-            helpers::make_payout_method_data(
-                state,
-                payout_data.payout_method_data.to_owned().as_ref(),
-                payout_attempt.payout_token.as_deref(),
-                &customer_id,
-                &payout_attempt.merchant_id,
-                payouts.payout_type,
-                merchant_context.get_merchant_key_store(),
-                Some(payout_data),
-                merchant_context.get_merchant_account().storage_scheme,
-            )
-            .await?
-            .get_required_value("payout_method_data")?,
-        );
+        helpers::fetch_payout_method_data(state, payout_data, connector_data, merchant_context)
+            .await?;
     }
     // Eligibility flow
     Box::pin(complete_payout_eligibility(
@@ -2002,8 +1967,7 @@ pub async fn complete_create_recipient_disburse_account(
         && connector_data
             .connector_name
             .supports_vendor_disburse_account_create_for_payout()
-        && helpers::should_create_connector_transfer_method(&*payout_data, connector_data)?
-            .is_none()
+        && helpers::should_create_connector_transfer_method(payout_data, connector_data)?.is_none()
     {
         Box::pin(create_recipient_disburse_account(
             state,
@@ -2706,12 +2670,29 @@ pub async fn payout_create_db_entries(
                 .map(|pm| pm.payment_method_id.clone()),
             Some(api_enums::PayoutType::foreign_from(payout_method_data)),
         ),
-        None => (
-            payment_method
-                .as_ref()
-                .map(|pm| pm.payment_method_id.clone()),
-            req.payout_type.to_owned(),
-        ),
+        None => {
+            (
+                payment_method
+                    .as_ref()
+                    .map(|pm| pm.payment_method_id.clone()),
+                match req.payout_type {
+                    None => payment_method
+                        .as_ref()
+                        .and_then(|pm| pm.payment_method)
+                        .map(|payment_method_enum| {
+                            api_enums::PayoutType::foreign_try_from(payment_method_enum)
+                                .change_context(errors::ApiErrorResponse::InvalidRequestData {
+                                    message: format!(
+                                        "PaymentMethod {payment_method_enum:?} is not supported for payouts"
+                                    ),
+                                })
+                                .attach_printable("Failed to convert PaymentMethod to PayoutType")
+                        })
+                        .transpose()?,
+                    payout_type => payout_type,
+                },
+            )
+        }
     };
 
     let client_secret = utils::generate_id(
@@ -2837,6 +2818,7 @@ pub async fn payout_create_db_entries(
         payout_link,
         current_locale: locale.to_string(),
         payment_method,
+        connector_transfer_method_id: None,
     })
 }
 
@@ -3031,11 +3013,10 @@ pub async fn make_payout_data(
         .await
         .transpose()?;
 
-    let payout_method_id = payouts.payout_method_id.clone();
-    let mut payment_method: Option<PaymentMethod> = None;
-
-    if let Some(pm_id) = payout_method_id {
-        payment_method = Some(
+    let payment_method = payouts
+        .payout_method_id
+        .clone()
+        .async_map(|pm_id| async move {
             db.find_payment_method(
                 &(state.into()),
                 merchant_context.get_merchant_key_store(),
@@ -3044,9 +3025,10 @@ pub async fn make_payout_data(
             )
             .await
             .change_context(errors::ApiErrorResponse::PaymentMethodNotFound)
-            .attach_printable("Unable to find payment method")?,
-        );
-    }
+            .attach_printable("Unable to find payment method")
+        })
+        .await
+        .transpose()?;
 
     Ok(PayoutData {
         billing_address,
@@ -3061,6 +3043,7 @@ pub async fn make_payout_data(
         payout_link,
         current_locale: locale.to_string(),
         payment_method,
+        connector_transfer_method_id: None,
     })
 }
 
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index d74baa2011d..8f104451be5 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -222,6 +222,49 @@ pub fn should_create_connector_transfer_method(
     Ok(connector_transfer_method_id)
 }
 
+pub async fn fetch_payout_method_data(
+    state: &SessionState,
+    payout_data: &mut PayoutData,
+    connector_data: &api::ConnectorData,
+    merchant_context: &domain::MerchantContext,
+) -> RouterResult<()> {
+    let connector_transfer_method_id =
+        should_create_connector_transfer_method(payout_data, connector_data)?;
+
+    if connector_transfer_method_id.is_some() {
+        logger::info!("Using stored transfer_method_id, skipping payout_method_data fetch");
+    } else {
+        let customer_id = payout_data
+            .payouts
+            .customer_id
+            .clone()
+            .get_required_value("customer_id")?;
+
+        let payout_method_data_clone = payout_data.payout_method_data.clone();
+        let payout_token = payout_data.payout_attempt.payout_token.clone();
+        let merchant_id = payout_data.payout_attempt.merchant_id.clone();
+        let payout_type = payout_data.payouts.payout_type;
+
+        let payout_method_data = make_payout_method_data(
+            state,
+            payout_method_data_clone.as_ref(),
+            payout_token.as_deref(),
+            &customer_id,
+            &merchant_id,
+            payout_type,
+            merchant_context.get_merchant_key_store(),
+            Some(payout_data),
+            merchant_context.get_merchant_account().storage_scheme,
+        )
+        .await?
+        .get_required_value("payout_method_data")?;
+
+        payout_data.payout_method_data = Some(payout_method_data);
+    }
+
+    Ok(())
+}
+
 #[cfg(feature = "v1")]
 pub async fn save_payout_data_to_locker(
     state: &SessionState,
diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs
index 198caa4b893..87a0748e5f4 100644
--- a/crates/router/src/core/payouts/validator.rs
+++ b/crates/router/src/core/payouts/validator.rs
@@ -223,34 +223,48 @@ pub async fn validate_create_request(
             .await
         }
         (_, Some(_), Some(payment_method)) => {
-            match get_pm_list_context(
-                state,
-                payment_method
-                    .payment_method
-                    .as_ref()
-                    .get_required_value("payment_method_id")?,
-                merchant_context.get_merchant_key_store(),
-                payment_method,
-                None,
-                false,
-                true,
-                merchant_context,
-            )
-            .await?
+            // Check if we have a stored transfer_method_id first
+            if payment_method
+                .get_common_mandate_reference()
+                .ok()
+                .and_then(|common_mandate_ref| common_mandate_ref.payouts)
+                .map(|payouts_mandate_ref| !payouts_mandate_ref.0.is_empty())
+                .unwrap_or(false)
             {
-                Some(pm) => match (pm.card_details, pm.bank_transfer_details) {
-                    (Some(card), _) => Ok(Some(payouts::PayoutMethodData::Card(
-                        api_models::payouts::CardPayout {
-                            card_number: card.card_number.get_required_value("card_number")?,
-                            card_holder_name: card.card_holder_name,
-                            expiry_month: card.expiry_month.get_required_value("expiry_month")?,
-                            expiry_year: card.expiry_year.get_required_value("expiry_year")?,
-                        },
-                    ))),
-                    (_, Some(bank)) => Ok(Some(payouts::PayoutMethodData::Bank(bank))),
-                    _ => Ok(None),
-                },
-                None => Ok(None),
+                Ok(None)
+            } else {
+                // No transfer_method_id available, proceed with vault fetch for raw card details
+                match get_pm_list_context(
+                    state,
+                    payment_method
+                        .payment_method
+                        .as_ref()
+                        .get_required_value("payment_method_id")?,
+                    merchant_context.get_merchant_key_store(),
+                    payment_method,
+                    None,
+                    false,
+                    true,
+                    merchant_context,
+                )
+                .await?
+                {
+                    Some(pm) => match (pm.card_details, pm.bank_transfer_details) {
+                        (Some(card), _) => Ok(Some(payouts::PayoutMethodData::Card(
+                            api_models::payouts::CardPayout {
+                                card_number: card.card_number.get_required_value("card_number")?,
+                                card_holder_name: card.card_holder_name,
+                                expiry_month: card
+                                    .expiry_month
+                                    .get_required_value("expiry_month")?,
+                                expiry_year: card.expiry_year.get_required_value("expiry_year")?,
+                            },
+                        ))),
+                        (_, Some(bank)) => Ok(Some(payouts::PayoutMethodData::Bank(bank))),
+                        _ => Ok(None),
+                    },
+                    None => Ok(None),
+                }
             }
         }
         _ => Ok(None),
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 8109df07554..81d72101fe4 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1251,6 +1251,24 @@ impl ForeignFrom<api_models::enums::PayoutType> for api_enums::PaymentMethod {
     }
 }
 
+#[cfg(feature = "payouts")]
+impl ForeignTryFrom<api_enums::PaymentMethod> for api_models::enums::PayoutType {
+    type Error = error_stack::Report<errors::ApiErrorResponse>;
+
+    fn foreign_try_from(value: api_enums::PaymentMethod) -> Result<Self, Self::Error> {
+        match value {
+            api_enums::PaymentMethod::Card => Ok(Self::Card),
+            api_enums::PaymentMethod::BankTransfer => Ok(Self::Bank),
+            api_enums::PaymentMethod::Wallet => Ok(Self::Wallet),
+            _ => Err(errors::ApiErrorResponse::InvalidRequestData {
+                message: format!("PaymentMethod {value:?} is not supported for payouts"),
+            })
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("Failed to convert PaymentMethod to PayoutType"),
+        }
+    }
+}
+
 #[cfg(feature = "v1")]
 impl ForeignTryFrom<&HeaderMap> for hyperswitch_domain_models::payments::HeaderPayload {
     type Error = error_stack::Report<errors::ApiErrorResponse>;
diff --git a/nix/modules/flake/devshell.nix b/nix/modules/flake/devshell.nix
index 6df0f5951f1..2fdcdd78627 100644
--- a/nix/modules/flake/devshell.nix
+++ b/nix/modules/flake/devshell.nix
@@ -35,6 +35,8 @@
           shellHook = ''
             echo 1>&2 "Ready to work on hyperswitch!"
             rustc --version
+            export OPENSSL_DIR="${pkgs.openssl.dev}"
+            export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
           '';
         };
         qa = pkgs.mkShell {
 | 
	2025-08-22T15:11:48Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR adds support for Adyen tokenized card payouts in the AdyenPlatform connector. This enables processing payouts using stored PSP tokens
- Restructured `AdyenCardIdentification` as an enum supporting both raw card data and stored payment method IDs
- Added `StoredPaymentCounterparty` and `RawPaymentCounterparty` for handling different payment method types
- Implemented fallback logic: stored payment method ID → raw card details
- Added `fetch_payout_method_data` helper function to centralize payout method data retrieval
- Enhanced validator to check for stored transfer method IDs before fetching raw card details
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Enables merchants to process Adyen payouts using previously stored PSP tokens without requiring raw card data. This is helpful for migrated PSP tokens (created outside of HS).
## How did you test it?
<details>
    <summary>1. Create a payment CIT</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_ACto5kMwzvZvAZCM5LMfFoDaBxAKHNeQkYVRuitCrf2Q30DrqxbPr6YFOe8c2f3l' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_payment_cit_1","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_type":"debit","payment_method_data":{"card":{"card_number":"4111111111111111","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":2890}'
Response
    {"payment_id":"pay_funVtY7kQ3avj2SN3Lzm","merchant_id":"merchant_1755863240","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"adyen","client_secret":"pay_funVtY7kQ3avj2SN3Lzm_secret_cR7UTM6j2h1jabVHAFHq","created":"2025-08-22T12:57:49.884Z","currency":"EUR","customer_id":"cus_uRtCHhDU0C2hafZMVHx1","customer":{"id":"cus_uRtCHhDU0C2hafZMVHx1","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1111","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_uRtCHhDU0C2hafZMVHx1","created_at":1755867469,"expires":1755871069,"secret":"epk_fdc03a4797ef451a98b2929bcfc398ca"},"manual_retry_allowed":false,"connector_transaction_id":"VCV7F35F2L3C37V5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_funVtY7kQ3avj2SN3Lzm_1","payment_link":null,"profile_id":"pro_sHtakSPxfG6JnK0wpCKG","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_A3zlBnD9y8WvakW0ratr","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T13:45:59.884Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_L6rQCpfqi5f1OAG4DHIG","network_transaction_id":"056847192959811","payment_method_status":"active","updated":"2025-08-22T12:57:50.457Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"X99D3DNTHP447NV5","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
Manually update `connector_mandate_detail` to include payout MCA as well
    {
        "mca_A3zlBnD9y8WvakW0ratr": {
            "mandate_metadata": null,
            "payment_method_type": "debit",
            "connector_mandate_id": "X99D3DNTHP447NV5",
            "connector_mandate_status": "active",
            "original_payment_authorized_amount": 4500,
            "original_payment_authorized_currency": "EUR",
            "connector_mandate_request_reference_id": "GOSHRSEHXi2emhKCLC"
        }
    }
Updated to
    {
        "mca_A3zlBnD9y8WvakW0ratr": {
            "mandate_metadata": null,
            "payment_method_type": "debit",
            "connector_mandate_id": "X99D3DNTHP447NV5",
            "connector_mandate_status": "active",
            "original_payment_authorized_amount": 4500,
            "original_payment_authorized_currency": "EUR",
            "connector_mandate_request_reference_id": "GOSHRSEHXi2emhKCLC"
        },
        "payouts": {
            "mca_NsHlFe2GsWvK9CdftrLt": {
                "transfer_method_id": "X99D3DNTHP447NV5"
            }
        }
    }
</details>
<details>
    <summary>2. Create a payout using payout_method_id</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_XKQaI34jBT7ZKVNZtpbrc1feIuijxd7MgPf8GMFvqLxniEGUdbNoKPcm0r8aHZhg' \
        --data '{"payout_method_id":"pm_L6rQCpfqi5f1OAG4DHIG","amount":100,"currency":"EUR","customer_id":"cus_CzI1yN5av9n1nICj0ofl","connector":["adyenplatform"],"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"DE","first_name":"Albert","last_name":"Klassen"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_wJvyBtv3lJXXYe2f2Zlo","merchant_id":"merchant_1755867774","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":null,"billing":{"address":{"city":"San Fransico","country":"DE","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"Albert","last_name":"Klassen","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_CzI1yN5av9n1nICj0ofl","customer":{"id":"cus_CzI1yN5av9n1nICj0ofl","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_wJvyBtv3lJXXYe2f2Zlo_secret_jgJ0TCCA8exlXEeh5KsK","return_url":null,"business_country":null,"business_label":null,"description":null,"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_8gi7OlijF22Wv9ImMR4w","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_8lrTNA9EX88OGfPXiElF","created":"2025-08-22T14:57:13.628Z","connector_transaction_id":"38EBH7682DK7VMVK","priority":null,"payout_link":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_L6rQCpfqi5f1OAG4DHIG"}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	ad05dc4176114dad3420a78af238d3842160e464 | 
	<details>
    <summary>1. Create a payment CIT</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_ACto5kMwzvZvAZCM5LMfFoDaBxAKHNeQkYVRuitCrf2Q30DrqxbPr6YFOe8c2f3l' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_payment_cit_1","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_type":"debit","payment_method_data":{"card":{"card_number":"4111111111111111","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":2890}'
Response
    {"payment_id":"pay_funVtY7kQ3avj2SN3Lzm","merchant_id":"merchant_1755863240","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"adyen","client_secret":"pay_funVtY7kQ3avj2SN3Lzm_secret_cR7UTM6j2h1jabVHAFHq","created":"2025-08-22T12:57:49.884Z","currency":"EUR","customer_id":"cus_uRtCHhDU0C2hafZMVHx1","customer":{"id":"cus_uRtCHhDU0C2hafZMVHx1","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1111","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_uRtCHhDU0C2hafZMVHx1","created_at":1755867469,"expires":1755871069,"secret":"epk_fdc03a4797ef451a98b2929bcfc398ca"},"manual_retry_allowed":false,"connector_transaction_id":"VCV7F35F2L3C37V5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_funVtY7kQ3avj2SN3Lzm_1","payment_link":null,"profile_id":"pro_sHtakSPxfG6JnK0wpCKG","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_A3zlBnD9y8WvakW0ratr","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T13:45:59.884Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_L6rQCpfqi5f1OAG4DHIG","network_transaction_id":"056847192959811","payment_method_status":"active","updated":"2025-08-22T12:57:50.457Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"X99D3DNTHP447NV5","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
Manually update `connector_mandate_detail` to include payout MCA as well
    {
        "mca_A3zlBnD9y8WvakW0ratr": {
            "mandate_metadata": null,
            "payment_method_type": "debit",
            "connector_mandate_id": "X99D3DNTHP447NV5",
            "connector_mandate_status": "active",
            "original_payment_authorized_amount": 4500,
            "original_payment_authorized_currency": "EUR",
            "connector_mandate_request_reference_id": "GOSHRSEHXi2emhKCLC"
        }
    }
Updated to
    {
        "mca_A3zlBnD9y8WvakW0ratr": {
            "mandate_metadata": null,
            "payment_method_type": "debit",
            "connector_mandate_id": "X99D3DNTHP447NV5",
            "connector_mandate_status": "active",
            "original_payment_authorized_amount": 4500,
            "original_payment_authorized_currency": "EUR",
            "connector_mandate_request_reference_id": "GOSHRSEHXi2emhKCLC"
        },
        "payouts": {
            "mca_NsHlFe2GsWvK9CdftrLt": {
                "transfer_method_id": "X99D3DNTHP447NV5"
            }
        }
    }
</details>
<details>
    <summary>2. Create a payout using payout_method_id</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_XKQaI34jBT7ZKVNZtpbrc1feIuijxd7MgPf8GMFvqLxniEGUdbNoKPcm0r8aHZhg' \
        --data '{"payout_method_id":"pm_L6rQCpfqi5f1OAG4DHIG","amount":100,"currency":"EUR","customer_id":"cus_CzI1yN5av9n1nICj0ofl","connector":["adyenplatform"],"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"DE","first_name":"Albert","last_name":"Klassen"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_wJvyBtv3lJXXYe2f2Zlo","merchant_id":"merchant_1755867774","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":null,"billing":{"address":{"city":"San Fransico","country":"DE","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"Albert","last_name":"Klassen","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_CzI1yN5av9n1nICj0ofl","customer":{"id":"cus_CzI1yN5av9n1nICj0ofl","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_wJvyBtv3lJXXYe2f2Zlo_secret_jgJ0TCCA8exlXEeh5KsK","return_url":null,"business_country":null,"business_label":null,"description":null,"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_8gi7OlijF22Wv9ImMR4w","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_8lrTNA9EX88OGfPXiElF","created":"2025-08-22T14:57:13.628Z","connector_transaction_id":"38EBH7682DK7VMVK","priority":null,"payout_link":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_L6rQCpfqi5f1OAG4DHIG"}
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8998 | 
	Bug: [FEATURE] feat(router): verify service for applepay merchant registration v2
### Feature Description
verify service for applepay merchant registration in v2
### Possible Implementation
Add POST /v2/verify/apple-pay/{merchant_id} endpoint for verify domains with Apple
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index 3c1b95dd982..f7ed33be642 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -117,11 +117,16 @@ pub async fn get_verified_apple_domains_with_mid_mca_id(
         .unwrap_or_default();
 
     #[cfg(feature = "v2")]
-    let verified_domains = {
-        let _ = merchant_connector_id;
-        let _ = key_store;
-        todo!()
-    };
+    let verified_domains = db
+        .find_merchant_connector_account_by_id(
+            key_manager_state,
+            &merchant_connector_id,
+            &key_store,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?
+        .applepay_verified_domains
+        .unwrap_or_default();
 
     Ok(services::api::ApplicationResponse::Json(
         verifications::ApplepayVerifiedDomainsResponse { verified_domains },
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
index 81b916206af..fb38d0a619a 100644
--- a/crates/router/src/core/verification/utils.rs
+++ b/crates/router/src/core/verification/utils.rs
@@ -43,12 +43,15 @@ pub async fn check_existence_and_add_domain_to_db(
         .change_context(errors::ApiErrorResponse::InternalServerError)?;
 
     #[cfg(feature = "v2")]
-    let merchant_connector_account: hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount = {
-        let _ = merchant_connector_id;
-        let _ = key_store;
-        let _ = domain_from_req;
-        todo!()
-    };
+    let merchant_connector_account = state
+        .store
+        .find_merchant_connector_account_by_id(
+            key_manager_state,
+            &merchant_connector_id,
+            &key_store,
+        )
+        .await
+        .change_context(errors::ApiErrorResponse::InternalServerError)?;
     utils::validate_profile_id_from_auth_layer(
         profile_id_from_auth_layer,
         &merchant_connector_account,
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 828986aeeee..48e9845c06b 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -198,6 +198,11 @@ pub fn mk_app(
             .service(routes::Routing::server(state.clone()))
             .service(routes::Chat::server(state.clone()));
 
+        #[cfg(all(feature = "olap", any(feature = "v1", feature = "v2")))]
+        {
+            server_app = server_app.service(routes::Verify::server(state.clone()));
+        }
+
         #[cfg(feature = "v1")]
         {
             server_app = server_app
@@ -208,7 +213,6 @@ pub fn mk_app(
                 .service(routes::ApplePayCertificatesMigration::server(state.clone()))
                 .service(routes::PaymentLink::server(state.clone()))
                 .service(routes::ConnectorOnboarding::server(state.clone()))
-                .service(routes::Verify::server(state.clone()))
                 .service(routes::Analytics::server(state.clone()))
                 .service(routes::WebhookEvents::server(state.clone()))
                 .service(routes::FeatureMatrix::server(state.clone()));
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 01455e9e17b..5b0471537c8 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -56,7 +56,7 @@ use super::refunds;
 use super::routing;
 #[cfg(all(feature = "oltp", feature = "v2"))]
 use super::tokenization as tokenization_routes;
-#[cfg(all(feature = "olap", feature = "v1"))]
+#[cfg(all(feature = "olap", any(feature = "v1", feature = "v2")))]
 use super::verification::{apple_pay_merchant_registration, retrieve_apple_pay_verified_domains};
 #[cfg(feature = "oltp")]
 use super::webhooks::*;
@@ -2325,7 +2325,6 @@ impl ThreeDsDecisionRule {
 
 #[cfg(feature = "olap")]
 pub struct Verify;
-
 #[cfg(all(feature = "olap", feature = "v1"))]
 impl Verify {
     pub fn server(state: AppState) -> Scope {
@@ -2342,6 +2341,22 @@ impl Verify {
     }
 }
 
+#[cfg(all(feature = "olap", feature = "v2"))]
+impl Verify {
+    pub fn server(state: AppState) -> Scope {
+        web::scope("/v2/verify")
+            .app_data(web::Data::new(state))
+            .service(
+                web::resource("/apple-pay/{merchant_id}")
+                    .route(web::post().to(apple_pay_merchant_registration)),
+            )
+            .service(
+                web::resource("/applepay-verified-domains")
+                    .route(web::get().to(retrieve_apple_pay_verified_domains)),
+            )
+    }
+}
+
 pub struct UserDeprecated;
 
 #[cfg(all(feature = "olap", feature = "v2"))]
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index ed987fb76ad..71b3c12dd75 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -46,6 +46,44 @@ pub async fn apple_pay_merchant_registration(
     .await
 }
 
+#[cfg(all(feature = "olap", feature = "v2"))]
+#[instrument(skip_all, fields(flow = ?Flow::Verification))]
+pub async fn apple_pay_merchant_registration(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    json_payload: web::Json<verifications::ApplepayMerchantVerificationRequest>,
+    path: web::Path<common_utils::id_type::MerchantId>,
+) -> impl Responder {
+    let flow = Flow::Verification;
+    let merchant_id = path.into_inner();
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        json_payload.into_inner(),
+        |state, auth: auth::AuthenticationData, body, _| {
+            verification::verify_merchant_creds_for_applepay(
+                state.clone(),
+                body,
+                merchant_id.clone(),
+                Some(auth.profile.get_id().clone()),
+            )
+        },
+        auth::auth_type(
+            &auth::V2ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            },
+            &auth::JWTAuth {
+                permission: Permission::ProfileAccountWrite,
+            },
+            req.headers(),
+        ),
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
+
 #[instrument(skip_all, fields(flow = ?Flow::Verification))]
 pub async fn retrieve_apple_pay_verified_domains(
     state: web::Data<AppState>,
 | 
	2025-08-20T09:01:30Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [X] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add Apple Pay merchant registration and verified domains retrieval for v2
### Additional Changes
- [X] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Request:
```
curl --location 'http://localhost:8080/v2/verify/apple-pay/cloth_seller_4hdx8pW2mxW0V6TZEQfm' \
--header 'x-client-secret: cs_0198af34cbcd72d0becd4db96e800bd9' \
--header 'x-profile-id: pro_833jt2bQKinLLA4pucBK' \
--header 'Authorization: api-key=dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \
--data '{
    "domain_names": ["hyperswitch-demo-store.netlify.app","sdk-test-app.netlify.app"],
    "merchant_connector_account_id": "mca_zYpPX5yTd3vo5NeMn26P"
  }'
```
Response:
```
{
    "status_message": "Applepay verification Completed"
}
```
Request:
```
curl --location 'http://localhost:8080/v2/verify/applepay-verified-domains?merchant_id=cloth_seller_4hdx8pW2mxW0V6TZEQfm&merchant_connector_account_id=mca_zYpPX5yTd3vo5NeMn26P' \
--header 'x-profile-id: pro_833jt2bQKinLLA4pucBK' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \
--data ''
```
Response:
```
{
    "verified_domains": [
        "hyperswitch-demo-store.netlify.app",
        "sdk-test-app.netlify.app"
    ]
}
```
<img width="1329" height="886" alt="image" src="https://github.com/user-attachments/assets/6077be64-5e4e-42a5-854e-f2872aa4e8a4" />
<img width="1338" height="904" alt="image" src="https://github.com/user-attachments/assets/08ef59d1-7ed2-4ad1-850f-12ce5118e67e" />
closes #8998 
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [X] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c09c936643170c595303293601d41c4207e12068 | 
	
Request:
```
curl --location 'http://localhost:8080/v2/verify/apple-pay/cloth_seller_4hdx8pW2mxW0V6TZEQfm' \
--header 'x-client-secret: cs_0198af34cbcd72d0becd4db96e800bd9' \
--header 'x-profile-id: pro_833jt2bQKinLLA4pucBK' \
--header 'Authorization: api-key=dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \
--data '{
    "domain_names": ["hyperswitch-demo-store.netlify.app","sdk-test-app.netlify.app"],
    "merchant_connector_account_id": "mca_zYpPX5yTd3vo5NeMn26P"
  }'
```
Response:
```
{
    "status_message": "Applepay verification Completed"
}
```
Request:
```
curl --location 'http://localhost:8080/v2/verify/applepay-verified-domains?merchant_id=cloth_seller_4hdx8pW2mxW0V6TZEQfm&merchant_connector_account_id=mca_zYpPX5yTd3vo5NeMn26P' \
--header 'x-profile-id: pro_833jt2bQKinLLA4pucBK' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \
--data ''
```
Response:
```
{
    "verified_domains": [
        "hyperswitch-demo-store.netlify.app",
        "sdk-test-app.netlify.app"
    ]
}
```
<img width="1329" height="886" alt="image" src="https://github.com/user-attachments/assets/6077be64-5e4e-42a5-854e-f2872aa4e8a4" />
<img width="1338" height="904" alt="image" src="https://github.com/user-attachments/assets/08ef59d1-7ed2-4ad1-850f-12ce5118e67e" />
closes #8998 
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8977 | 
	Bug: [FEATURE] add payment method filter in v2
### Feature Description
List all the available currencies and countries for the given connector and payment method type.
### Possible Implementation
Add the filter route to the V2 PaymentMethods implementation.
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 01455e9e17b..be17d98ff47 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1344,38 +1344,52 @@ impl Payouts {
     }
 }
 
-#[cfg(all(feature = "oltp", feature = "v2"))]
+#[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))]
 impl PaymentMethods {
     pub fn server(state: AppState) -> Scope {
         let mut route = web::scope("/v2/payment-methods").app_data(web::Data::new(state));
-        route = route
-            .service(
-                web::resource("").route(web::post().to(payment_methods::create_payment_method_api)),
-            )
-            .service(
-                web::resource("/create-intent")
-                    .route(web::post().to(payment_methods::create_payment_method_intent_api)),
-            );
 
-        route = route.service(
-            web::scope("/{id}")
+        #[cfg(feature = "olap")]
+        {
+            route =
+                route.service(web::resource("/filter").route(
+                    web::get().to(
+                        payment_methods::list_countries_currencies_for_connector_payment_method,
+                    ),
+                ));
+        }
+        #[cfg(feature = "oltp")]
+        {
+            route = route
                 .service(
                     web::resource("")
-                        .route(web::get().to(payment_methods::payment_method_retrieve_api))
-                        .route(web::delete().to(payment_methods::payment_method_delete_api)),
-                )
-                .service(web::resource("/list-enabled-payment-methods").route(
-                    web::get().to(payment_methods::payment_method_session_list_payment_methods),
-                ))
-                .service(
-                    web::resource("/update-saved-payment-method")
-                        .route(web::put().to(payment_methods::payment_method_update_api)),
+                        .route(web::post().to(payment_methods::create_payment_method_api)),
                 )
                 .service(
-                    web::resource("/get-token")
-                        .route(web::get().to(payment_methods::get_payment_method_token_data)),
-                ),
-        );
+                    web::resource("/create-intent")
+                        .route(web::post().to(payment_methods::create_payment_method_intent_api)),
+                );
+
+            route = route.service(
+                web::scope("/{id}")
+                    .service(
+                        web::resource("")
+                            .route(web::get().to(payment_methods::payment_method_retrieve_api))
+                            .route(web::delete().to(payment_methods::payment_method_delete_api)),
+                    )
+                    .service(web::resource("/list-enabled-payment-methods").route(
+                        web::get().to(payment_methods::payment_method_session_list_payment_methods),
+                    ))
+                    .service(
+                        web::resource("/update-saved-payment-method")
+                            .route(web::put().to(payment_methods::payment_method_update_api)),
+                    )
+                    .service(
+                        web::resource("/get-token")
+                            .route(web::get().to(payment_methods::get_payment_method_token_data)),
+                    ),
+            );
+        }
 
         route
     }
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 367ece308c3..08b84e40977 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -913,6 +913,47 @@ pub async fn list_countries_currencies_for_connector_payment_method(
     .await
 }
 
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::ListCountriesCurrencies))]
+pub async fn list_countries_currencies_for_connector_payment_method(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    query_payload: web::Query<payment_methods::ListCountriesCurrenciesRequest>,
+) -> HttpResponse {
+    let flow = Flow::ListCountriesCurrencies;
+    let payload = query_payload.into_inner();
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        payload,
+        |state, auth: auth::AuthenticationData, req, _| {
+            cards::list_countries_currencies_for_connector_payment_method(
+                state,
+                req,
+                Some(auth.profile.get_id().clone()),
+            )
+        },
+        #[cfg(not(feature = "release"))]
+        auth::auth_type(
+            &auth::V2ApiKeyAuth {
+                is_connected_allowed: false,
+                is_platform_allowed: false,
+            },
+            &auth::JWTAuth {
+                permission: Permission::ProfileConnectorRead,
+            },
+            req.headers(),
+        ),
+        #[cfg(feature = "release")]
+        &auth::JWTAuth {
+            permission: Permission::ProfileConnectorRead,
+        },
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
+
 #[cfg(feature = "v1")]
 #[instrument(skip_all, fields(flow = ?Flow::DefaultPaymentMethodsSet))]
 pub async fn default_payment_method_set_api(
 | 
	2025-08-18T10:55:59Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [X] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add the payment method filter route to the V2 PaymentMethods implementation which list all available countries and currencies based on connector and payment method type.
### Additional Changes
- [X] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Request:
```
curl --location 'http://localhost:8080/v2/payment-methods/filter?connector=stripe&paymentMethodType=debit' \
--header 'Authorization: api-key=dev_4DIYNBJfJIQ2Tr1wLavfp48BJvXLtHmBWdkkALwWj6U91DAjP7h2RfQmhnDMATmB' \
--header 'x-profile-id: pro_9dDVfbJRfEb7o7qxBatP' \
--header 'api-key: dev_4DIYNBJfJIQ2Tr1wLavfp48BJvXLtHmBWdkkALwWj6U91DAjP7h2RfQmhnDMATmB' \
--data ''
```
Response:
```
{
    "currencies": [
        "QAR",
        "BMD",
        "ERN",
        "ETB",
        "ILS",
        "MOP",
        "STN",
        "TND",
        "SRD",
        "TOP",
        "JMD",
        "BHD",
        "SSP",
        "BRL",
        "COP",
        "KMF",
        "PEN",
        "SLE",
        "TZS",
        "KZT",
        "CUP",
        "MDL",
        "XCD",
        "BGN",
        "NIO",
        "BTN",
        "MXN",
        "FKP",
        "CLF",
        "OMR",
        "GHS",
        "DZD",
        "BSD",
        "SEK",
        "VND",
        "ZAR",
        "VES",
        "DOP",
        "RON",
        "BND",
        "PGK",
        "SVC",
        "HTG",
        "KWD",
        "TMT",
        "SBD",
        "AED",
        "HKD",
        "CRC",
        "DKK",
        "TTD",
        "TWD",
        "UGX",
        "SLL",
        "FJD",
        "ZWL",
        "ANG",
        "JPY",
        "CNY",
        "DJF",
        "PLN",
        "BBD",
        "WST",
        "PHP",
        "PKR",
        "MVR",
        "LSL",
        "HRK",
        "UZS",
        "NAD",
        "KRW",
        "RUB",
        "TJS",
        "TRY",
        "BWP",
        "KHR",
        "BZD",
        "YER",
        "CDF",
        "NOK",
        "IDR",
        "MAD",
        "MMK",
        "MZN",
        "BAM",
        "JOD",
        "XOF",
        "NZD",
        "KES",
        "BIF",
        "MUR",
        "IRR",
        "UAH",
        "XPF",
        "THB",
        "AWG",
        "GBP",
        "GMD",
        "INR",
        "MYR",
        "PAB",
        "BDT",
        "HNL",
        "PYG",
        "CZK",
        "GEL",
        "ISK",
        "GTQ",
        "CAD",
        "KPW",
        "MWK",
        "NGN",
        "SYP",
        "LAK",
        "RWF",
        "KGS",
        "MKD",
        "MNT",
        "HUF",
        "LYD",
        "SCR",
        "XAF",
        "AOA",
        "NPR",
        "CLP",
        "MRU",
        "SDG",
        "STD",
        "ARS",
        "SAR",
        "AUD",
        "SZL",
        "VUV",
        "CVE",
        "ALL",
        "RSD",
        "AFN",
        "ZMW",
        "AMD",
        "MGA",
        "LRD",
        "BOB",
        "AZN",
        "CUC",
        "KYD",
        "BYN",
        "USD",
        "EUR",
        "SGD",
        "SHP",
        "SOS",
        "GYD",
        "GIP",
        "GNF",
        "EGP",
        "CHF",
        "LBP",
        "UYU",
        "LKR",
        "IQD"
    ],
    "countries": [
        {
            "code": "GU",
            "name": "Guam"
        },
        {
            "code": "AW",
            "name": "Aruba"
        },
        {
            "code": "HR",
            "name": "Croatia"
        },
        {
            "code": "TD",
            "name": "Chad"
        },
        {
            "code": "TM",
            "name": "Turkmenistan"
        },
        {
            "code": "GB",
            "name": "UnitedKingdomOfGreatBritainAndNorthernIreland"
        },
        {
            "code": "CL",
            "name": "Chile"
        },
        {
            "code": "LK",
            "name": "SriLanka"
        },
        {
            "code": "SI",
            "name": "Slovenia"
        },
        {
            "code": "PA",
            "name": "Panama"
        },
        {
            "code": "NE",
            "name": "Niger"
        },
        {
            "code": "AZ",
            "name": "Azerbaijan"
        },
        {
            "code": "MQ",
            "name": "Martinique"
        },
        {
            "code": "BY",
            "name": "Belarus"
        },
        {
            "code": "FJ",
            "name": "Fiji"
        },
        {
            "code": "PY",
            "name": "Paraguay"
        },
        {
            "code": "HK",
            "name": "HongKong"
        },
        {
            "code": "UZ",
            "name": "Uzbekistan"
        },
        {
            "code": "DE",
            "name": "Germany"
        },
        {
            "code": "CX",
            "name": "ChristmasIsland"
        },
        {
            "code": "BB",
            "name": "Barbados"
        },
        {
            "code": "DJ",
            "name": "Djibouti"
        },
        {
            "code": "GP",
            "name": "Guadeloupe"
        },
        {
            "code": "CR",
            "name": "CostaRica"
        },
        {
            "code": "ZM",
            "name": "Zambia"
        },
        {
            "code": "ST",
            "name": "SaoTomeAndPrincipe"
        },
        {
            "code": "BA",
            "name": "BosniaAndHerzegovina"
        },
        {
            "code": "NI",
            "name": "Nicaragua"
        },
        {
            "code": "SO",
            "name": "Somalia"
        },
        {
            "code": "PR",
            "name": "PuertoRico"
        },
        {
            "code": "SC",
            "name": "Seychelles"
        },
        {
            "code": "KR",
            "name": "KoreaRepublic"
        },
        {
            "code": "FM",
            "name": "MicronesiaFederatedStates"
        },
        {
            "code": "DO",
            "name": "DominicanRepublic"
        },
        {
            "code": "MO",
            "name": "Macao"
        },
        {
            "code": "JP",
            "name": "Japan"
        },
        {
            "code": "MH",
            "name": "MarshallIslands"
        },
        {
            "code": "AQ",
            "name": "Antarctica"
        },
        {
            "code": "CD",
            "name": "CongoDemocraticRepublic"
        },
        {
            "code": "NA",
            "name": "Namibia"
        },
        {
            "code": "TV",
            "name": "Tuvalu"
        },
        {
            "code": "EE",
            "name": "Estonia"
        },
        {
            "code": "ML",
            "name": "Mali"
        },
        {
            "code": "IS",
            "name": "Iceland"
        },
        {
            "code": "SR",
            "name": "Suriname"
        },
        {
            "code": "UM",
            "name": "UnitedStatesMinorOutlyingIslands"
        },
        {
            "code": "SB",
            "name": "SolomonIslands"
        },
        {
            "code": "RO",
            "name": "Romania"
        },
        {
            "code": "CI",
            "name": "CotedIvoire"
        },
        {
            "code": "MD",
            "name": "MoldovaRepublic"
        },
        {
            "code": "GS",
            "name": "SouthGeorgiaAndTheSouthSandwichIslands"
        },
        {
            "code": "PF",
            "name": "FrenchPolynesia"
        },
        {
            "code": "GE",
            "name": "Georgia"
        },
        {
            "code": "JE",
            "name": "Jersey"
        },
        {
            "code": "SK",
            "name": "Slovakia"
        },
        {
            "code": "ID",
            "name": "Indonesia"
        },
        {
            "code": "NR",
            "name": "Nauru"
        },
        {
            "code": "CO",
            "name": "Colombia"
        },
        {
            "code": "GR",
            "name": "Greece"
        },
        {
            "code": "KW",
            "name": "Kuwait"
        },
        {
            "code": "TH",
            "name": "Thailand"
        },
        {
            "code": "KI",
            "name": "Kiribati"
        },
        {
            "code": "BN",
            "name": "BruneiDarussalam"
        },
        {
            "code": "WS",
            "name": "Samoa"
        },
        {
            "code": "AI",
            "name": "Anguilla"
        },
        {
            "code": "TC",
            "name": "TurksAndCaicosIslands"
        },
        {
            "code": "BG",
            "name": "Bulgaria"
        },
        {
            "code": "RS",
            "name": "Serbia"
        },
        {
            "code": "BW",
            "name": "Botswana"
        },
        {
            "code": "KM",
            "name": "Comoros"
        },
        {
            "code": "SN",
            "name": "Senegal"
        },
        {
            "code": "TR",
            "name": "Turkey"
        },
        {
            "code": "SL",
            "name": "SierraLeone"
        },
        {
            "code": "MC",
            "name": "Monaco"
        },
        {
            "code": "BL",
            "name": "SaintBarthelemy"
        },
        {
            "code": "GL",
            "name": "Greenland"
        },
        {
            "code": "KG",
            "name": "Kyrgyzstan"
        },
        {
            "code": "MT",
            "name": "Malta"
        },
        {
            "code": "VA",
            "name": "HolySee"
        },
        {
            "code": "AS",
            "name": "AmericanSamoa"
        },
        {
            "code": "TJ",
            "name": "Tajikistan"
        },
        {
            "code": "TN",
            "name": "Tunisia"
        },
        {
            "code": "IT",
            "name": "Italy"
        },
        {
            "code": "CV",
            "name": "CaboVerde"
        },
        {
            "code": "IN",
            "name": "India"
        },
        {
            "code": "ME",
            "name": "Montenegro"
        },
        {
            "code": "LR",
            "name": "Liberia"
        },
        {
            "code": "AE",
            "name": "UnitedArabEmirates"
        },
        {
            "code": "TK",
            "name": "Tokelau"
        },
        {
            "code": "IQ",
            "name": "Iraq"
        },
        {
            "code": "FO",
            "name": "FaroeIslands"
        },
        {
            "code": "MW",
            "name": "Malawi"
        },
        {
            "code": "SY",
            "name": "SyrianArabRepublic"
        },
        {
            "code": "CA",
            "name": "Canada"
        },
        {
            "code": "GF",
            "name": "FrenchGuiana"
        },
        {
            "code": "ER",
            "name": "Eritrea"
        },
        {
            "code": "MY",
            "name": "Malaysia"
        },
        {
            "code": "VG",
            "name": "VirginIslandsBritish"
        },
        {
            "code": "RE",
            "name": "Reunion"
        },
        {
            "code": "JM",
            "name": "Jamaica"
        },
        {
            "code": "AF",
            "name": "Afghanistan"
        },
        {
            "code": "MN",
            "name": "Mongolia"
        },
        {
            "code": "CW",
            "name": "Curacao"
        },
        {
            "code": "IE",
            "name": "Ireland"
        },
        {
            "code": "CG",
            "name": "Congo"
        },
        {
            "code": "NG",
            "name": "Nigeria"
        },
        {
            "code": "VC",
            "name": "SaintVincentAndTheGrenadines"
        },
        {
            "code": "TO",
            "name": "Tonga"
        },
        {
            "code": "LU",
            "name": "Luxembourg"
        },
        {
            "code": "TL",
            "name": "TimorLeste"
        },
        {
            "code": "MF",
            "name": "SaintMartinFrenchpart"
        },
        {
            "code": "AT",
            "name": "Austria"
        },
        {
            "code": "ET",
            "name": "Ethiopia"
        },
        {
            "code": "SX",
            "name": "SintMaartenDutchpart"
        },
        {
            "code": "GT",
            "name": "Guatemala"
        },
        {
            "code": "TF",
            "name": "FrenchSouthernTerritories"
        },
        {
            "code": "KP",
            "name": "KoreaDemocraticPeoplesRepublic"
        },
        {
            "code": "LC",
            "name": "SaintLucia"
        },
        {
            "code": "BT",
            "name": "Bhutan"
        },
        {
            "code": "SM",
            "name": "SanMarino"
        },
        {
            "code": "QA",
            "name": "Qatar"
        },
        {
            "code": "DM",
            "name": "Dominica"
        },
        {
            "code": "BJ",
            "name": "Benin"
        },
        {
            "code": "GA",
            "name": "Gabon"
        },
        {
            "code": "YT",
            "name": "Mayotte"
        },
        {
            "code": "KZ",
            "name": "Kazakhstan"
        },
        {
            "code": "LV",
            "name": "Latvia"
        },
        {
            "code": "GG",
            "name": "Guernsey"
        },
        {
            "code": "CH",
            "name": "Switzerland"
        },
        {
            "code": "HM",
            "name": "HeardIslandAndMcDonaldIslands"
        },
        {
            "code": "AG",
            "name": "AntiguaAndBarbuda"
        },
        {
            "code": "WF",
            "name": "WallisAndFutuna"
        },
        {
            "code": "CC",
            "name": "CocosKeelingIslands"
        },
        {
            "code": "ZW",
            "name": "Zimbabwe"
        },
        {
            "code": "IL",
            "name": "Israel"
        },
        {
            "code": "TG",
            "name": "Togo"
        },
        {
            "code": "MG",
            "name": "Madagascar"
        },
        {
            "code": "NP",
            "name": "Nepal"
        },
        {
            "code": "GW",
            "name": "GuineaBissau"
        },
        {
            "code": "PW",
            "name": "Palau"
        },
        {
            "code": "LY",
            "name": "Libya"
        },
        {
            "code": "FI",
            "name": "Finland"
        },
        {
            "code": "AR",
            "name": "Argentina"
        },
        {
            "code": "TT",
            "name": "TrinidadAndTobago"
        },
        {
            "code": "FR",
            "name": "France"
        },
        {
            "code": "MS",
            "name": "Montserrat"
        },
        {
            "code": "IO",
            "name": "BritishIndianOceanTerritory"
        },
        {
            "code": "TW",
            "name": "TaiwanProvinceOfChina"
        },
        {
            "code": "EC",
            "name": "Ecuador"
        },
        {
            "code": "NO",
            "name": "Norway"
        },
        {
            "code": "MZ",
            "name": "Mozambique"
        },
        {
            "code": "GH",
            "name": "Ghana"
        },
        {
            "code": "HU",
            "name": "Hungary"
        },
        {
            "code": "CU",
            "name": "Cuba"
        },
        {
            "code": "LI",
            "name": "Liechtenstein"
        },
        {
            "code": "MU",
            "name": "Mauritius"
        },
        {
            "code": "EG",
            "name": "Egypt"
        },
        {
            "code": "MX",
            "name": "Mexico"
        },
        {
            "code": "MV",
            "name": "Maldives"
        },
        {
            "code": "BE",
            "name": "Belgium"
        },
        {
            "code": "VN",
            "name": "Vietnam"
        },
        {
            "code": "NU",
            "name": "Niue"
        },
        {
            "code": "CY",
            "name": "Cyprus"
        },
        {
            "code": "GQ",
            "name": "EquatorialGuinea"
        },
        {
            "code": "SD",
            "name": "Sudan"
        },
        {
            "code": "LT",
            "name": "Lithuania"
        },
        {
            "code": "BD",
            "name": "Bangladesh"
        },
        {
            "code": "NL",
            "name": "Netherlands"
        },
        {
            "code": "BH",
            "name": "Bahrain"
        },
        {
            "code": "AX",
            "name": "AlandIslands"
        },
        {
            "code": "BR",
            "name": "Brazil"
        },
        {
            "code": "AM",
            "name": "Armenia"
        },
        {
            "code": "UY",
            "name": "Uruguay"
        },
        {
            "code": "MP",
            "name": "NorthernMarianaIslands"
        },
        {
            "code": "NZ",
            "name": "NewZealand"
        },
        {
            "code": "GY",
            "name": "Guyana"
        },
        {
            "code": "CZ",
            "name": "Czechia"
        },
        {
            "code": "AU",
            "name": "Australia"
        },
        {
            "code": "SH",
            "name": "SaintHelenaAscensionAndTristandaCunha"
        },
        {
            "code": "HT",
            "name": "Haiti"
        },
        {
            "code": "SA",
            "name": "SaudiArabia"
        },
        {
            "code": "CM",
            "name": "Cameroon"
        },
        {
            "code": "JO",
            "name": "Jordan"
        },
        {
            "code": "UA",
            "name": "Ukraine"
        },
        {
            "code": "BV",
            "name": "BouvetIsland"
        },
        {
            "code": "GI",
            "name": "Gibraltar"
        },
        {
            "code": "GD",
            "name": "Grenada"
        },
        {
            "code": "UG",
            "name": "Uganda"
        },
        {
            "code": "TZ",
            "name": "TanzaniaUnitedRepublic"
        },
        {
            "code": "DZ",
            "name": "Algeria"
        },
        {
            "code": "PM",
            "name": "SaintPierreAndMiquelon"
        },
        {
            "code": "ZA",
            "name": "SouthAfrica"
        },
        {
            "code": "OM",
            "name": "Oman"
        },
        {
            "code": "KY",
            "name": "CaymanIslands"
        },
        {
            "code": "LS",
            "name": "Lesotho"
        },
        {
            "code": "ES",
            "name": "Spain"
        },
        {
            "code": "MM",
            "name": "Myanmar"
        },
        {
            "code": "AO",
            "name": "Angola"
        },
        {
            "code": "EH",
            "name": "WesternSahara"
        },
        {
            "code": "IR",
            "name": "IranIslamicRepublic"
        },
        {
            "code": "HN",
            "name": "Honduras"
        },
        {
            "code": "KH",
            "name": "Cambodia"
        },
        {
            "code": "KE",
            "name": "Kenya"
        },
        {
            "code": "MK",
            "name": "MacedoniaTheFormerYugoslavRepublic"
        },
        {
            "code": "AL",
            "name": "Albania"
        },
        {
            "code": "US",
            "name": "UnitedStatesOfAmerica"
        },
        {
            "code": "YE",
            "name": "Yemen"
        },
        {
            "code": "DK",
            "name": "Denmark"
        },
        {
            "code": "MR",
            "name": "Mauritania"
        },
        {
            "code": "SG",
            "name": "Singapore"
        },
        {
            "code": "CN",
            "name": "China"
        },
        {
            "code": "IM",
            "name": "IsleOfMan"
        },
        {
            "code": "PH",
            "name": "Philippines"
        },
        {
            "code": "SZ",
            "name": "Swaziland"
        },
        {
            "code": "BO",
            "name": "BoliviaPlurinationalState"
        },
        {
            "code": "CF",
            "name": "CentralAfricanRepublic"
        },
        {
            "code": "PE",
            "name": "Peru"
        },
        {
            "code": "BQ",
            "name": "BonaireSintEustatiusAndSaba"
        },
        {
            "code": "SV",
            "name": "ElSalvador"
        },
        {
            "code": "NC",
            "name": "NewCaledonia"
        },
        {
            "code": "VU",
            "name": "Vanuatu"
        },
        {
            "code": "MA",
            "name": "Morocco"
        },
        {
            "code": "SS",
            "name": "SouthSudan"
        },
        {
            "code": "BZ",
            "name": "Belize"
        },
        {
            "code": "PS",
            "name": "PalestineState"
        },
        {
            "code": "CK",
            "name": "CookIslands"
        },
        {
            "code": "BF",
            "name": "BurkinaFaso"
        },
        {
            "code": "FK",
            "name": "FalklandIslandsMalvinas"
        },
        {
            "code": "SJ",
            "name": "SvalbardAndJanMayen"
        },
        {
            "code": "VE",
            "name": "VenezuelaBolivarianRepublic"
        },
        {
            "code": "BI",
            "name": "Burundi"
        },
        {
            "code": "PT",
            "name": "Portugal"
        },
        {
            "code": "VI",
            "name": "VirginIslandsUS"
        },
        {
            "code": "PG",
            "name": "PapuaNewGuinea"
        },
        {
            "code": "RU",
            "name": "RussianFederation"
        },
        {
            "code": "AD",
            "name": "Andorra"
        },
        {
            "code": "NF",
            "name": "NorfolkIsland"
        },
        {
            "code": "LB",
            "name": "Lebanon"
        },
        {
            "code": "GM",
            "name": "Gambia"
        },
        {
            "code": "BM",
            "name": "Bermuda"
        },
        {
            "code": "BS",
            "name": "Bahamas"
        },
        {
            "code": "KN",
            "name": "SaintKittsAndNevis"
        },
        {
            "code": "PN",
            "name": "Pitcairn"
        },
        {
            "code": "PL",
            "name": "Poland"
        },
        {
            "code": "SE",
            "name": "Sweden"
        },
        {
            "code": "RW",
            "name": "Rwanda"
        },
        {
            "code": "PK",
            "name": "Pakistan"
        },
        {
            "code": "GN",
            "name": "Guinea"
        },
        {
            "code": "LA",
            "name": "LaoPeoplesDemocraticRepublic"
        }
    ]
}
```
Request with JWT Authentication:
```
curl --location 'http://localhost:8081/v2/payment-methods/filter?connector=stripe&paymentMethodType=debit' \
--header 'x-profile-id: pro_vJRG8ITXZXHXQuoHA59p' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjIwY2E1NzAtY2I1Ni00YTUwLTk4MTctODEzYzEyNjljOWUwIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1NTkyMzYyIiwicm9sZV9pZCI6InByb2ZpbGVfdmlld19vbmx5IiwiZXhwIjoxNzU1NzY1NjI3LCJvcmdfaWQiOiJvcmdfelFiZUprcUlPWWhMUTNmeDVMOHQiLCJwcm9maWxlX2lkIjoicHJvX3ZKUkc4SVRYWlhIWFF1b0hBNTlwIiwidGVuYW50X2lkIjoicHVibGljIn0.9DafPc6vkoO8K-JLHxetMmmDYQDek35-HV8zrVe5QTg' \
--data ''
```
Respone:
```
{
    "currencies": [
        "ERN",
        "LSL",
        "MMK",
        "LKR",
        "THB",
        "SHP",
        "FKP",
        "XCD",
        "NIO",
        "GIP",
        "RWF",
        "CUP",
        "OMR",
        "UYU",
        "GTQ",
        "GNF",
        "FJD",
        "GBP",
        "KMF",
        "ILS",
        "ETB",
        "SYP",
        "GHS",
        "GMD",
        "MUR",
        "BSD",
        "KRW",
        "MZN",
        "TMT",
        "TOP",
        "SBD",
        "KGS",
        "UGX",
        "UZS",
        "YER",
        "RUB",
        "TZS",
        "COP",
        "PYG",
        "NAD",
        "SSP",
        "GYD",
        "CHF",
        "KWD",
        "MYR",
        "PKR",
        "SAR",
        "WST",
        "EGP",
        "BAM",
        "QAR",
        "XOF",
        "DZD",
        "SZL",
        "CZK",
        "VND",
        "SCR",
        "IDR",
        "ANG",
        "LAK",
        "DJF",
        "TTD",
        "HUF",
        "PLN",
        "VES",
        "ALL",
        "MRU",
        "ZMW",
        "STN",
        "ZWL",
        "AFN",
        "NOK",
        "ISK",
        "AED",
        "EUR",
        "MVR",
        "CRC",
        "GEL",
        "TND",
        "XAF",
        "KHR",
        "IRR",
        "JOD",
        "CNY",
        "CVE",
        "AWG",
        "CUC",
        "NGN",
        "STD",
        "MXN",
        "LYD",
        "SRD",
        "BWP",
        "CDF",
        "KPW",
        "SEK",
        "PGK",
        "AMD",
        "NZD",
        "BOB",
        "CAD",
        "NPR",
        "PEN",
        "SDG",
        "MNT",
        "AZN",
        "MOP",
        "BDT",
        "CLF",
        "BMD",
        "BTN",
        "PAB",
        "USD",
        "BGN",
        "HNL",
        "DKK",
        "ZAR",
        "AOA",
        "TJS",
        "VUV",
        "BHD",
        "BZD",
        "TRY",
        "HKD",
        "ARS",
        "BND",
        "HTG",
        "LRD",
        "MGA",
        "SVC",
        "SLL",
        "KES",
        "HRK",
        "SLE",
        "RON",
        "MKD",
        "MDL",
        "UAH",
        "BIF",
        "KYD",
        "BBD",
        "BRL",
        "CLP",
        "SOS",
        "JPY",
        "RSD",
        "INR",
        "MWK",
        "AUD",
        "PHP",
        "IQD",
        "LBP",
        "MAD",
        "XPF",
        "JMD",
        "DOP",
        "TWD",
        "KZT",
        "SGD",
        "BYN"
    ],
    "countries": [
        {
            "code": "VU",
            "name": "Vanuatu"
        },
        {
            "code": "AI",
            "name": "Anguilla"
        },
        {
            "code": "UA",
            "name": "Ukraine"
        },
        {
            "code": "PW",
            "name": "Palau"
        },
        {
            "code": "FR",
            "name": "France"
        },
        {
            "code": "TO",
            "name": "Tonga"
        },
        {
            "code": "JO",
            "name": "Jordan"
        },
        {
            "code": "ZW",
            "name": "Zimbabwe"
        },
        {
            "code": "KZ",
            "name": "Kazakhstan"
        },
        {
            "code": "AW",
            "name": "Aruba"
        },
        {
            "code": "GY",
            "name": "Guyana"
        },
        {
            "code": "KE",
            "name": "Kenya"
        },
        {
            "code": "LS",
            "name": "Lesotho"
        },
        {
            "code": "NP",
            "name": "Nepal"
        },
        {
            "code": "US",
            "name": "UnitedStatesOfAmerica"
        },
        {
            "code": "ER",
            "name": "Eritrea"
        },
        {
            "code": "LY",
            "name": "Libya"
        },
        {
            "code": "GW",
            "name": "GuineaBissau"
        },
        {
            "code": "GP",
            "name": "Guadeloupe"
        },
        {
            "code": "NO",
            "name": "Norway"
        },
        {
            "code": "TM",
            "name": "Turkmenistan"
        },
        {
            "code": "BY",
            "name": "Belarus"
        },
        {
            "code": "KH",
            "name": "Cambodia"
        },
        {
            "code": "KW",
            "name": "Kuwait"
        },
        {
            "code": "JM",
            "name": "Jamaica"
        },
        {
            "code": "MQ",
            "name": "Martinique"
        },
        {
            "code": "CY",
            "name": "Cyprus"
        },
        {
            "code": "TH",
            "name": "Thailand"
        },
        {
            "code": "CF",
            "name": "CentralAfricanRepublic"
        },
        {
            "code": "PH",
            "name": "Philippines"
        },
        {
            "code": "IO",
            "name": "BritishIndianOceanTerritory"
        },
        {
            "code": "FK",
            "name": "FalklandIslandsMalvinas"
        },
        {
            "code": "EH",
            "name": "WesternSahara"
        },
        {
            "code": "TC",
            "name": "TurksAndCaicosIslands"
        },
        {
            "code": "KN",
            "name": "SaintKittsAndNevis"
        },
        {
            "code": "MW",
            "name": "Malawi"
        },
        {
            "code": "UY",
            "name": "Uruguay"
        },
        {
            "code": "SI",
            "name": "Slovenia"
        },
        {
            "code": "HN",
            "name": "Honduras"
        },
        {
            "code": "PT",
            "name": "Portugal"
        },
        {
            "code": "RO",
            "name": "Romania"
        },
        {
            "code": "BF",
            "name": "BurkinaFaso"
        },
        {
            "code": "GH",
            "name": "Ghana"
        },
        {
            "code": "KP",
            "name": "KoreaDemocraticPeoplesRepublic"
        },
        {
            "code": "CC",
            "name": "CocosKeelingIslands"
        },
        {
            "code": "BE",
            "name": "Belgium"
        },
        {
            "code": "BT",
            "name": "Bhutan"
        },
        {
            "code": "CG",
            "name": "Congo"
        },
        {
            "code": "SX",
            "name": "SintMaartenDutchpart"
        },
        {
            "code": "CL",
            "name": "Chile"
        },
        {
            "code": "DM",
            "name": "Dominica"
        },
        {
            "code": "TF",
            "name": "FrenchSouthernTerritories"
        },
        {
            "code": "MZ",
            "name": "Mozambique"
        },
        {
            "code": "PL",
            "name": "Poland"
        },
        {
            "code": "YE",
            "name": "Yemen"
        },
        {
            "code": "MX",
            "name": "Mexico"
        },
        {
            "code": "AS",
            "name": "AmericanSamoa"
        },
        {
            "code": "TG",
            "name": "Togo"
        },
        {
            "code": "OM",
            "name": "Oman"
        },
        {
            "code": "CH",
            "name": "Switzerland"
        },
        {
            "code": "AD",
            "name": "Andorra"
        },
        {
            "code": "WS",
            "name": "Samoa"
        },
        {
            "code": "TN",
            "name": "Tunisia"
        },
        {
            "code": "GG",
            "name": "Guernsey"
        },
        {
            "code": "SD",
            "name": "Sudan"
        },
        {
            "code": "CD",
            "name": "CongoDemocraticRepublic"
        },
        {
            "code": "CM",
            "name": "Cameroon"
        },
        {
            "code": "CU",
            "name": "Cuba"
        },
        {
            "code": "SY",
            "name": "SyrianArabRepublic"
        },
        {
            "code": "BM",
            "name": "Bermuda"
        },
        {
            "code": "PR",
            "name": "PuertoRico"
        },
        {
            "code": "PK",
            "name": "Pakistan"
        },
        {
            "code": "BI",
            "name": "Burundi"
        },
        {
            "code": "ET",
            "name": "Ethiopia"
        },
        {
            "code": "BJ",
            "name": "Benin"
        },
        {
            "code": "AQ",
            "name": "Antarctica"
        },
        {
            "code": "CX",
            "name": "ChristmasIsland"
        },
        {
            "code": "IE",
            "name": "Ireland"
        },
        {
            "code": "VI",
            "name": "VirginIslandsUS"
        },
        {
            "code": "PM",
            "name": "SaintPierreAndMiquelon"
        },
        {
            "code": "GQ",
            "name": "EquatorialGuinea"
        },
        {
            "code": "IM",
            "name": "IsleOfMan"
        },
        {
            "code": "SA",
            "name": "SaudiArabia"
        },
        {
            "code": "BZ",
            "name": "Belize"
        },
        {
            "code": "CO",
            "name": "Colombia"
        },
        {
            "code": "MT",
            "name": "Malta"
        },
        {
            "code": "AU",
            "name": "Australia"
        },
        {
            "code": "EE",
            "name": "Estonia"
        },
        {
            "code": "NR",
            "name": "Nauru"
        },
        {
            "code": "KR",
            "name": "KoreaRepublic"
        },
        {
            "code": "AZ",
            "name": "Azerbaijan"
        },
        {
            "code": "NG",
            "name": "Nigeria"
        },
        {
            "code": "TW",
            "name": "TaiwanProvinceOfChina"
        },
        {
            "code": "UZ",
            "name": "Uzbekistan"
        },
        {
            "code": "IS",
            "name": "Iceland"
        },
        {
            "code": "BQ",
            "name": "BonaireSintEustatiusAndSaba"
        },
        {
            "code": "MG",
            "name": "Madagascar"
        },
        {
            "code": "MC",
            "name": "Monaco"
        },
        {
            "code": "LK",
            "name": "SriLanka"
        },
        {
            "code": "NF",
            "name": "NorfolkIsland"
        },
        {
            "code": "MM",
            "name": "Myanmar"
        },
        {
            "code": "GS",
            "name": "SouthGeorgiaAndTheSouthSandwichIslands"
        },
        {
            "code": "LI",
            "name": "Liechtenstein"
        },
        {
            "code": "CZ",
            "name": "Czechia"
        },
        {
            "code": "TK",
            "name": "Tokelau"
        },
        {
            "code": "GI",
            "name": "Gibraltar"
        },
        {
            "code": "PS",
            "name": "PalestineState"
        },
        {
            "code": "SG",
            "name": "Singapore"
        },
        {
            "code": "SM",
            "name": "SanMarino"
        },
        {
            "code": "AG",
            "name": "AntiguaAndBarbuda"
        },
        {
            "code": "ZA",
            "name": "SouthAfrica"
        },
        {
            "code": "YT",
            "name": "Mayotte"
        },
        {
            "code": "MP",
            "name": "NorthernMarianaIslands"
        },
        {
            "code": "RW",
            "name": "Rwanda"
        },
        {
            "code": "HK",
            "name": "HongKong"
        },
        {
            "code": "HT",
            "name": "Haiti"
        },
        {
            "code": "PA",
            "name": "Panama"
        },
        {
            "code": "PN",
            "name": "Pitcairn"
        },
        {
            "code": "LT",
            "name": "Lithuania"
        },
        {
            "code": "VA",
            "name": "HolySee"
        },
        {
            "code": "MF",
            "name": "SaintMartinFrenchpart"
        },
        {
            "code": "LC",
            "name": "SaintLucia"
        },
        {
            "code": "GE",
            "name": "Georgia"
        },
        {
            "code": "BB",
            "name": "Barbados"
        },
        {
            "code": "BD",
            "name": "Bangladesh"
        },
        {
            "code": "VN",
            "name": "Vietnam"
        },
        {
            "code": "AX",
            "name": "AlandIslands"
        },
        {
            "code": "TJ",
            "name": "Tajikistan"
        },
        {
            "code": "GU",
            "name": "Guam"
        },
        {
            "code": "FJ",
            "name": "Fiji"
        },
        {
            "code": "BS",
            "name": "Bahamas"
        },
        {
            "code": "PG",
            "name": "PapuaNewGuinea"
        },
        {
            "code": "IQ",
            "name": "Iraq"
        },
        {
            "code": "UG",
            "name": "Uganda"
        },
        {
            "code": "MN",
            "name": "Mongolia"
        },
        {
            "code": "GM",
            "name": "Gambia"
        },
        {
            "code": "UM",
            "name": "UnitedStatesMinorOutlyingIslands"
        },
        {
            "code": "NZ",
            "name": "NewZealand"
        },
        {
            "code": "JE",
            "name": "Jersey"
        },
        {
            "code": "SC",
            "name": "Seychelles"
        },
        {
            "code": "IT",
            "name": "Italy"
        },
        {
            "code": "RE",
            "name": "Reunion"
        },
        {
            "code": "GF",
            "name": "FrenchGuiana"
        },
        {
            "code": "TD",
            "name": "Chad"
        },
        {
            "code": "NC",
            "name": "NewCaledonia"
        },
        {
            "code": "CV",
            "name": "CaboVerde"
        },
        {
            "code": "SL",
            "name": "SierraLeone"
        },
        {
            "code": "GT",
            "name": "Guatemala"
        },
        {
            "code": "KY",
            "name": "CaymanIslands"
        },
        {
            "code": "ID",
            "name": "Indonesia"
        },
        {
            "code": "SR",
            "name": "Suriname"
        },
        {
            "code": "WF",
            "name": "WallisAndFutuna"
        },
        {
            "code": "LA",
            "name": "LaoPeoplesDemocraticRepublic"
        },
        {
            "code": "TT",
            "name": "TrinidadAndTobago"
        },
        {
            "code": "NA",
            "name": "Namibia"
        },
        {
            "code": "ZM",
            "name": "Zambia"
        },
        {
            "code": "SN",
            "name": "Senegal"
        },
        {
            "code": "MA",
            "name": "Morocco"
        },
        {
            "code": "NL",
            "name": "Netherlands"
        },
        {
            "code": "NI",
            "name": "Nicaragua"
        },
        {
            "code": "KG",
            "name": "Kyrgyzstan"
        },
        {
            "code": "MY",
            "name": "Malaysia"
        },
        {
            "code": "TR",
            "name": "Turkey"
        },
        {
            "code": "NE",
            "name": "Niger"
        },
        {
            "code": "MH",
            "name": "MarshallIslands"
        },
        {
            "code": "LR",
            "name": "Liberia"
        },
        {
            "code": "FI",
            "name": "Finland"
        },
        {
            "code": "MD",
            "name": "MoldovaRepublic"
        },
        {
            "code": "ME",
            "name": "Montenegro"
        },
        {
            "code": "AL",
            "name": "Albania"
        },
        {
            "code": "HM",
            "name": "HeardIslandAndMcDonaldIslands"
        },
        {
            "code": "FM",
            "name": "MicronesiaFederatedStates"
        },
        {
            "code": "CR",
            "name": "CostaRica"
        },
        {
            "code": "CW",
            "name": "Curacao"
        },
        {
            "code": "SO",
            "name": "Somalia"
        },
        {
            "code": "MK",
            "name": "MacedoniaTheFormerYugoslavRepublic"
        },
        {
            "code": "TZ",
            "name": "TanzaniaUnitedRepublic"
        },
        {
            "code": "RS",
            "name": "Serbia"
        },
        {
            "code": "KM",
            "name": "Comoros"
        },
        {
            "code": "VG",
            "name": "VirginIslandsBritish"
        },
        {
            "code": "AM",
            "name": "Armenia"
        },
        {
            "code": "BH",
            "name": "Bahrain"
        },
        {
            "code": "BL",
            "name": "SaintBarthelemy"
        },
        {
            "code": "NU",
            "name": "Niue"
        },
        {
            "code": "LU",
            "name": "Luxembourg"
        },
        {
            "code": "MO",
            "name": "Macao"
        },
        {
            "code": "BA",
            "name": "BosniaAndHerzegovina"
        },
        {
            "code": "AF",
            "name": "Afghanistan"
        },
        {
            "code": "EG",
            "name": "Egypt"
        },
        {
            "code": "CK",
            "name": "CookIslands"
        },
        {
            "code": "CA",
            "name": "Canada"
        },
        {
            "code": "SZ",
            "name": "Swaziland"
        },
        {
            "code": "ML",
            "name": "Mali"
        },
        {
            "code": "BR",
            "name": "Brazil"
        },
        {
            "code": "LV",
            "name": "Latvia"
        },
        {
            "code": "TL",
            "name": "TimorLeste"
        },
        {
            "code": "BG",
            "name": "Bulgaria"
        },
        {
            "code": "AT",
            "name": "Austria"
        },
        {
            "code": "KI",
            "name": "Kiribati"
        },
        {
            "code": "IR",
            "name": "IranIslamicRepublic"
        },
        {
            "code": "MV",
            "name": "Maldives"
        },
        {
            "code": "RU",
            "name": "RussianFederation"
        },
        {
            "code": "VE",
            "name": "VenezuelaBolivarianRepublic"
        },
        {
            "code": "AE",
            "name": "UnitedArabEmirates"
        },
        {
            "code": "VC",
            "name": "SaintVincentAndTheGrenadines"
        },
        {
            "code": "MS",
            "name": "Montserrat"
        },
        {
            "code": "AO",
            "name": "Angola"
        },
        {
            "code": "PY",
            "name": "Paraguay"
        },
        {
            "code": "BV",
            "name": "BouvetIsland"
        },
        {
            "code": "DO",
            "name": "DominicanRepublic"
        },
        {
            "code": "SH",
            "name": "SaintHelenaAscensionAndTristandaCunha"
        },
        {
            "code": "ES",
            "name": "Spain"
        },
        {
            "code": "AR",
            "name": "Argentina"
        },
        {
            "code": "LB",
            "name": "Lebanon"
        },
        {
            "code": "PF",
            "name": "FrenchPolynesia"
        },
        {
            "code": "IL",
            "name": "Israel"
        },
        {
            "code": "DJ",
            "name": "Djibouti"
        },
        {
            "code": "DZ",
            "name": "Algeria"
        },
        {
            "code": "TV",
            "name": "Tuvalu"
        },
        {
            "code": "MU",
            "name": "Mauritius"
        },
        {
            "code": "JP",
            "name": "Japan"
        },
        {
            "code": "DK",
            "name": "Denmark"
        },
        {
            "code": "SE",
            "name": "Sweden"
        },
        {
            "code": "CN",
            "name": "China"
        },
        {
            "code": "PE",
            "name": "Peru"
        },
        {
            "code": "BW",
            "name": "Botswana"
        },
        {
            "code": "SV",
            "name": "ElSalvador"
        },
        {
            "code": "CI",
            "name": "CotedIvoire"
        },
        {
            "code": "HR",
            "name": "Croatia"
        },
        {
            "code": "SK",
            "name": "Slovakia"
        },
        {
            "code": "GD",
            "name": "Grenada"
        },
        {
            "code": "SS",
            "name": "SouthSudan"
        },
        {
            "code": "BO",
            "name": "BoliviaPlurinationalState"
        },
        {
            "code": "QA",
            "name": "Qatar"
        },
        {
            "code": "HU",
            "name": "Hungary"
        },
        {
            "code": "SB",
            "name": "SolomonIslands"
        },
        {
            "code": "BN",
            "name": "BruneiDarussalam"
        },
        {
            "code": "GB",
            "name": "UnitedKingdomOfGreatBritainAndNorthernIreland"
        },
        {
            "code": "GL",
            "name": "Greenland"
        },
        {
            "code": "ST",
            "name": "SaoTomeAndPrincipe"
        },
        {
            "code": "GR",
            "name": "Greece"
        },
        {
            "code": "FO",
            "name": "FaroeIslands"
        },
        {
            "code": "SJ",
            "name": "SvalbardAndJanMayen"
        },
        {
            "code": "IN",
            "name": "India"
        },
        {
            "code": "EC",
            "name": "Ecuador"
        },
        {
            "code": "MR",
            "name": "Mauritania"
        },
        {
            "code": "GA",
            "name": "Gabon"
        },
        {
            "code": "DE",
            "name": "Germany"
        },
        {
            "code": "GN",
            "name": "Guinea"
        }
    ]
}
```
Closes #8977 
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [X] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f762f4f5854eeb7a78c78149075804ee4f07bb25 | 
	
Request:
```
curl --location 'http://localhost:8080/v2/payment-methods/filter?connector=stripe&paymentMethodType=debit' \
--header 'Authorization: api-key=dev_4DIYNBJfJIQ2Tr1wLavfp48BJvXLtHmBWdkkALwWj6U91DAjP7h2RfQmhnDMATmB' \
--header 'x-profile-id: pro_9dDVfbJRfEb7o7qxBatP' \
--header 'api-key: dev_4DIYNBJfJIQ2Tr1wLavfp48BJvXLtHmBWdkkALwWj6U91DAjP7h2RfQmhnDMATmB' \
--data ''
```
Response:
```
{
    "currencies": [
        "QAR",
        "BMD",
        "ERN",
        "ETB",
        "ILS",
        "MOP",
        "STN",
        "TND",
        "SRD",
        "TOP",
        "JMD",
        "BHD",
        "SSP",
        "BRL",
        "COP",
        "KMF",
        "PEN",
        "SLE",
        "TZS",
        "KZT",
        "CUP",
        "MDL",
        "XCD",
        "BGN",
        "NIO",
        "BTN",
        "MXN",
        "FKP",
        "CLF",
        "OMR",
        "GHS",
        "DZD",
        "BSD",
        "SEK",
        "VND",
        "ZAR",
        "VES",
        "DOP",
        "RON",
        "BND",
        "PGK",
        "SVC",
        "HTG",
        "KWD",
        "TMT",
        "SBD",
        "AED",
        "HKD",
        "CRC",
        "DKK",
        "TTD",
        "TWD",
        "UGX",
        "SLL",
        "FJD",
        "ZWL",
        "ANG",
        "JPY",
        "CNY",
        "DJF",
        "PLN",
        "BBD",
        "WST",
        "PHP",
        "PKR",
        "MVR",
        "LSL",
        "HRK",
        "UZS",
        "NAD",
        "KRW",
        "RUB",
        "TJS",
        "TRY",
        "BWP",
        "KHR",
        "BZD",
        "YER",
        "CDF",
        "NOK",
        "IDR",
        "MAD",
        "MMK",
        "MZN",
        "BAM",
        "JOD",
        "XOF",
        "NZD",
        "KES",
        "BIF",
        "MUR",
        "IRR",
        "UAH",
        "XPF",
        "THB",
        "AWG",
        "GBP",
        "GMD",
        "INR",
        "MYR",
        "PAB",
        "BDT",
        "HNL",
        "PYG",
        "CZK",
        "GEL",
        "ISK",
        "GTQ",
        "CAD",
        "KPW",
        "MWK",
        "NGN",
        "SYP",
        "LAK",
        "RWF",
        "KGS",
        "MKD",
        "MNT",
        "HUF",
        "LYD",
        "SCR",
        "XAF",
        "AOA",
        "NPR",
        "CLP",
        "MRU",
        "SDG",
        "STD",
        "ARS",
        "SAR",
        "AUD",
        "SZL",
        "VUV",
        "CVE",
        "ALL",
        "RSD",
        "AFN",
        "ZMW",
        "AMD",
        "MGA",
        "LRD",
        "BOB",
        "AZN",
        "CUC",
        "KYD",
        "BYN",
        "USD",
        "EUR",
        "SGD",
        "SHP",
        "SOS",
        "GYD",
        "GIP",
        "GNF",
        "EGP",
        "CHF",
        "LBP",
        "UYU",
        "LKR",
        "IQD"
    ],
    "countries": [
        {
            "code": "GU",
            "name": "Guam"
        },
        {
            "code": "AW",
            "name": "Aruba"
        },
        {
            "code": "HR",
            "name": "Croatia"
        },
        {
            "code": "TD",
            "name": "Chad"
        },
        {
            "code": "TM",
            "name": "Turkmenistan"
        },
        {
            "code": "GB",
            "name": "UnitedKingdomOfGreatBritainAndNorthernIreland"
        },
        {
            "code": "CL",
            "name": "Chile"
        },
        {
            "code": "LK",
            "name": "SriLanka"
        },
        {
            "code": "SI",
            "name": "Slovenia"
        },
        {
            "code": "PA",
            "name": "Panama"
        },
        {
            "code": "NE",
            "name": "Niger"
        },
        {
            "code": "AZ",
            "name": "Azerbaijan"
        },
        {
            "code": "MQ",
            "name": "Martinique"
        },
        {
            "code": "BY",
            "name": "Belarus"
        },
        {
            "code": "FJ",
            "name": "Fiji"
        },
        {
            "code": "PY",
            "name": "Paraguay"
        },
        {
            "code": "HK",
            "name": "HongKong"
        },
        {
            "code": "UZ",
            "name": "Uzbekistan"
        },
        {
            "code": "DE",
            "name": "Germany"
        },
        {
            "code": "CX",
            "name": "ChristmasIsland"
        },
        {
            "code": "BB",
            "name": "Barbados"
        },
        {
            "code": "DJ",
            "name": "Djibouti"
        },
        {
            "code": "GP",
            "name": "Guadeloupe"
        },
        {
            "code": "CR",
            "name": "CostaRica"
        },
        {
            "code": "ZM",
            "name": "Zambia"
        },
        {
            "code": "ST",
            "name": "SaoTomeAndPrincipe"
        },
        {
            "code": "BA",
            "name": "BosniaAndHerzegovina"
        },
        {
            "code": "NI",
            "name": "Nicaragua"
        },
        {
            "code": "SO",
            "name": "Somalia"
        },
        {
            "code": "PR",
            "name": "PuertoRico"
        },
        {
            "code": "SC",
            "name": "Seychelles"
        },
        {
            "code": "KR",
            "name": "KoreaRepublic"
        },
        {
            "code": "FM",
            "name": "MicronesiaFederatedStates"
        },
        {
            "code": "DO",
            "name": "DominicanRepublic"
        },
        {
            "code": "MO",
            "name": "Macao"
        },
        {
            "code": "JP",
            "name": "Japan"
        },
        {
            "code": "MH",
            "name": "MarshallIslands"
        },
        {
            "code": "AQ",
            "name": "Antarctica"
        },
        {
            "code": "CD",
            "name": "CongoDemocraticRepublic"
        },
        {
            "code": "NA",
            "name": "Namibia"
        },
        {
            "code": "TV",
            "name": "Tuvalu"
        },
        {
            "code": "EE",
            "name": "Estonia"
        },
        {
            "code": "ML",
            "name": "Mali"
        },
        {
            "code": "IS",
            "name": "Iceland"
        },
        {
            "code": "SR",
            "name": "Suriname"
        },
        {
            "code": "UM",
            "name": "UnitedStatesMinorOutlyingIslands"
        },
        {
            "code": "SB",
            "name": "SolomonIslands"
        },
        {
            "code": "RO",
            "name": "Romania"
        },
        {
            "code": "CI",
            "name": "CotedIvoire"
        },
        {
            "code": "MD",
            "name": "MoldovaRepublic"
        },
        {
            "code": "GS",
            "name": "SouthGeorgiaAndTheSouthSandwichIslands"
        },
        {
            "code": "PF",
            "name": "FrenchPolynesia"
        },
        {
            "code": "GE",
            "name": "Georgia"
        },
        {
            "code": "JE",
            "name": "Jersey"
        },
        {
            "code": "SK",
            "name": "Slovakia"
        },
        {
            "code": "ID",
            "name": "Indonesia"
        },
        {
            "code": "NR",
            "name": "Nauru"
        },
        {
            "code": "CO",
            "name": "Colombia"
        },
        {
            "code": "GR",
            "name": "Greece"
        },
        {
            "code": "KW",
            "name": "Kuwait"
        },
        {
            "code": "TH",
            "name": "Thailand"
        },
        {
            "code": "KI",
            "name": "Kiribati"
        },
        {
            "code": "BN",
            "name": "BruneiDarussalam"
        },
        {
            "code": "WS",
            "name": "Samoa"
        },
        {
            "code": "AI",
            "name": "Anguilla"
        },
        {
            "code": "TC",
            "name": "TurksAndCaicosIslands"
        },
        {
            "code": "BG",
            "name": "Bulgaria"
        },
        {
            "code": "RS",
            "name": "Serbia"
        },
        {
            "code": "BW",
            "name": "Botswana"
        },
        {
            "code": "KM",
            "name": "Comoros"
        },
        {
            "code": "SN",
            "name": "Senegal"
        },
        {
            "code": "TR",
            "name": "Turkey"
        },
        {
            "code": "SL",
            "name": "SierraLeone"
        },
        {
            "code": "MC",
            "name": "Monaco"
        },
        {
            "code": "BL",
            "name": "SaintBarthelemy"
        },
        {
            "code": "GL",
            "name": "Greenland"
        },
        {
            "code": "KG",
            "name": "Kyrgyzstan"
        },
        {
            "code": "MT",
            "name": "Malta"
        },
        {
            "code": "VA",
            "name": "HolySee"
        },
        {
            "code": "AS",
            "name": "AmericanSamoa"
        },
        {
            "code": "TJ",
            "name": "Tajikistan"
        },
        {
            "code": "TN",
            "name": "Tunisia"
        },
        {
            "code": "IT",
            "name": "Italy"
        },
        {
            "code": "CV",
            "name": "CaboVerde"
        },
        {
            "code": "IN",
            "name": "India"
        },
        {
            "code": "ME",
            "name": "Montenegro"
        },
        {
            "code": "LR",
            "name": "Liberia"
        },
        {
            "code": "AE",
            "name": "UnitedArabEmirates"
        },
        {
            "code": "TK",
            "name": "Tokelau"
        },
        {
            "code": "IQ",
            "name": "Iraq"
        },
        {
            "code": "FO",
            "name": "FaroeIslands"
        },
        {
            "code": "MW",
            "name": "Malawi"
        },
        {
            "code": "SY",
            "name": "SyrianArabRepublic"
        },
        {
            "code": "CA",
            "name": "Canada"
        },
        {
            "code": "GF",
            "name": "FrenchGuiana"
        },
        {
            "code": "ER",
            "name": "Eritrea"
        },
        {
            "code": "MY",
            "name": "Malaysia"
        },
        {
            "code": "VG",
            "name": "VirginIslandsBritish"
        },
        {
            "code": "RE",
            "name": "Reunion"
        },
        {
            "code": "JM",
            "name": "Jamaica"
        },
        {
            "code": "AF",
            "name": "Afghanistan"
        },
        {
            "code": "MN",
            "name": "Mongolia"
        },
        {
            "code": "CW",
            "name": "Curacao"
        },
        {
            "code": "IE",
            "name": "Ireland"
        },
        {
            "code": "CG",
            "name": "Congo"
        },
        {
            "code": "NG",
            "name": "Nigeria"
        },
        {
            "code": "VC",
            "name": "SaintVincentAndTheGrenadines"
        },
        {
            "code": "TO",
            "name": "Tonga"
        },
        {
            "code": "LU",
            "name": "Luxembourg"
        },
        {
            "code": "TL",
            "name": "TimorLeste"
        },
        {
            "code": "MF",
            "name": "SaintMartinFrenchpart"
        },
        {
            "code": "AT",
            "name": "Austria"
        },
        {
            "code": "ET",
            "name": "Ethiopia"
        },
        {
            "code": "SX",
            "name": "SintMaartenDutchpart"
        },
        {
            "code": "GT",
            "name": "Guatemala"
        },
        {
            "code": "TF",
            "name": "FrenchSouthernTerritories"
        },
        {
            "code": "KP",
            "name": "KoreaDemocraticPeoplesRepublic"
        },
        {
            "code": "LC",
            "name": "SaintLucia"
        },
        {
            "code": "BT",
            "name": "Bhutan"
        },
        {
            "code": "SM",
            "name": "SanMarino"
        },
        {
            "code": "QA",
            "name": "Qatar"
        },
        {
            "code": "DM",
            "name": "Dominica"
        },
        {
            "code": "BJ",
            "name": "Benin"
        },
        {
            "code": "GA",
            "name": "Gabon"
        },
        {
            "code": "YT",
            "name": "Mayotte"
        },
        {
            "code": "KZ",
            "name": "Kazakhstan"
        },
        {
            "code": "LV",
            "name": "Latvia"
        },
        {
            "code": "GG",
            "name": "Guernsey"
        },
        {
            "code": "CH",
            "name": "Switzerland"
        },
        {
            "code": "HM",
            "name": "HeardIslandAndMcDonaldIslands"
        },
        {
            "code": "AG",
            "name": "AntiguaAndBarbuda"
        },
        {
            "code": "WF",
            "name": "WallisAndFutuna"
        },
        {
            "code": "CC",
            "name": "CocosKeelingIslands"
        },
        {
            "code": "ZW",
            "name": "Zimbabwe"
        },
        {
            "code": "IL",
            "name": "Israel"
        },
        {
            "code": "TG",
            "name": "Togo"
        },
        {
            "code": "MG",
            "name": "Madagascar"
        },
        {
            "code": "NP",
            "name": "Nepal"
        },
        {
            "code": "GW",
            "name": "GuineaBissau"
        },
        {
            "code": "PW",
            "name": "Palau"
        },
        {
            "code": "LY",
            "name": "Libya"
        },
        {
            "code": "FI",
            "name": "Finland"
        },
        {
            "code": "AR",
            "name": "Argentina"
        },
        {
            "code": "TT",
            "name": "TrinidadAndTobago"
        },
        {
            "code": "FR",
            "name": "France"
        },
        {
            "code": "MS",
            "name": "Montserrat"
        },
        {
            "code": "IO",
            "name": "BritishIndianOceanTerritory"
        },
        {
            "code": "TW",
            "name": "TaiwanProvinceOfChina"
        },
        {
            "code": "EC",
            "name": "Ecuador"
        },
        {
            "code": "NO",
            "name": "Norway"
        },
        {
            "code": "MZ",
            "name": "Mozambique"
        },
        {
            "code": "GH",
            "name": "Ghana"
        },
        {
            "code": "HU",
            "name": "Hungary"
        },
        {
            "code": "CU",
            "name": "Cuba"
        },
        {
            "code": "LI",
            "name": "Liechtenstein"
        },
        {
            "code": "MU",
            "name": "Mauritius"
        },
        {
            "code": "EG",
            "name": "Egypt"
        },
        {
            "code": "MX",
            "name": "Mexico"
        },
        {
            "code": "MV",
            "name": "Maldives"
        },
        {
            "code": "BE",
            "name": "Belgium"
        },
        {
            "code": "VN",
            "name": "Vietnam"
        },
        {
            "code": "NU",
            "name": "Niue"
        },
        {
            "code": "CY",
            "name": "Cyprus"
        },
        {
            "code": "GQ",
            "name": "EquatorialGuinea"
        },
        {
            "code": "SD",
            "name": "Sudan"
        },
        {
            "code": "LT",
            "name": "Lithuania"
        },
        {
            "code": "BD",
            "name": "Bangladesh"
        },
        {
            "code": "NL",
            "name": "Netherlands"
        },
        {
            "code": "BH",
            "name": "Bahrain"
        },
        {
            "code": "AX",
            "name": "AlandIslands"
        },
        {
            "code": "BR",
            "name": "Brazil"
        },
        {
            "code": "AM",
            "name": "Armenia"
        },
        {
            "code": "UY",
            "name": "Uruguay"
        },
        {
            "code": "MP",
            "name": "NorthernMarianaIslands"
        },
        {
            "code": "NZ",
            "name": "NewZealand"
        },
        {
            "code": "GY",
            "name": "Guyana"
        },
        {
            "code": "CZ",
            "name": "Czechia"
        },
        {
            "code": "AU",
            "name": "Australia"
        },
        {
            "code": "SH",
            "name": "SaintHelenaAscensionAndTristandaCunha"
        },
        {
            "code": "HT",
            "name": "Haiti"
        },
        {
            "code": "SA",
            "name": "SaudiArabia"
        },
        {
            "code": "CM",
            "name": "Cameroon"
        },
        {
            "code": "JO",
            "name": "Jordan"
        },
        {
            "code": "UA",
            "name": "Ukraine"
        },
        {
            "code": "BV",
            "name": "BouvetIsland"
        },
        {
            "code": "GI",
            "name": "Gibraltar"
        },
        {
            "code": "GD",
            "name": "Grenada"
        },
        {
            "code": "UG",
            "name": "Uganda"
        },
        {
            "code": "TZ",
            "name": "TanzaniaUnitedRepublic"
        },
        {
            "code": "DZ",
            "name": "Algeria"
        },
        {
            "code": "PM",
            "name": "SaintPierreAndMiquelon"
        },
        {
            "code": "ZA",
            "name": "SouthAfrica"
        },
        {
            "code": "OM",
            "name": "Oman"
        },
        {
            "code": "KY",
            "name": "CaymanIslands"
        },
        {
            "code": "LS",
            "name": "Lesotho"
        },
        {
            "code": "ES",
            "name": "Spain"
        },
        {
            "code": "MM",
            "name": "Myanmar"
        },
        {
            "code": "AO",
            "name": "Angola"
        },
        {
            "code": "EH",
            "name": "WesternSahara"
        },
        {
            "code": "IR",
            "name": "IranIslamicRepublic"
        },
        {
            "code": "HN",
            "name": "Honduras"
        },
        {
            "code": "KH",
            "name": "Cambodia"
        },
        {
            "code": "KE",
            "name": "Kenya"
        },
        {
            "code": "MK",
            "name": "MacedoniaTheFormerYugoslavRepublic"
        },
        {
            "code": "AL",
            "name": "Albania"
        },
        {
            "code": "US",
            "name": "UnitedStatesOfAmerica"
        },
        {
            "code": "YE",
            "name": "Yemen"
        },
        {
            "code": "DK",
            "name": "Denmark"
        },
        {
            "code": "MR",
            "name": "Mauritania"
        },
        {
            "code": "SG",
            "name": "Singapore"
        },
        {
            "code": "CN",
            "name": "China"
        },
        {
            "code": "IM",
            "name": "IsleOfMan"
        },
        {
            "code": "PH",
            "name": "Philippines"
        },
        {
            "code": "SZ",
            "name": "Swaziland"
        },
        {
            "code": "BO",
            "name": "BoliviaPlurinationalState"
        },
        {
            "code": "CF",
            "name": "CentralAfricanRepublic"
        },
        {
            "code": "PE",
            "name": "Peru"
        },
        {
            "code": "BQ",
            "name": "BonaireSintEustatiusAndSaba"
        },
        {
            "code": "SV",
            "name": "ElSalvador"
        },
        {
            "code": "NC",
            "name": "NewCaledonia"
        },
        {
            "code": "VU",
            "name": "Vanuatu"
        },
        {
            "code": "MA",
            "name": "Morocco"
        },
        {
            "code": "SS",
            "name": "SouthSudan"
        },
        {
            "code": "BZ",
            "name": "Belize"
        },
        {
            "code": "PS",
            "name": "PalestineState"
        },
        {
            "code": "CK",
            "name": "CookIslands"
        },
        {
            "code": "BF",
            "name": "BurkinaFaso"
        },
        {
            "code": "FK",
            "name": "FalklandIslandsMalvinas"
        },
        {
            "code": "SJ",
            "name": "SvalbardAndJanMayen"
        },
        {
            "code": "VE",
            "name": "VenezuelaBolivarianRepublic"
        },
        {
            "code": "BI",
            "name": "Burundi"
        },
        {
            "code": "PT",
            "name": "Portugal"
        },
        {
            "code": "VI",
            "name": "VirginIslandsUS"
        },
        {
            "code": "PG",
            "name": "PapuaNewGuinea"
        },
        {
            "code": "RU",
            "name": "RussianFederation"
        },
        {
            "code": "AD",
            "name": "Andorra"
        },
        {
            "code": "NF",
            "name": "NorfolkIsland"
        },
        {
            "code": "LB",
            "name": "Lebanon"
        },
        {
            "code": "GM",
            "name": "Gambia"
        },
        {
            "code": "BM",
            "name": "Bermuda"
        },
        {
            "code": "BS",
            "name": "Bahamas"
        },
        {
            "code": "KN",
            "name": "SaintKittsAndNevis"
        },
        {
            "code": "PN",
            "name": "Pitcairn"
        },
        {
            "code": "PL",
            "name": "Poland"
        },
        {
            "code": "SE",
            "name": "Sweden"
        },
        {
            "code": "RW",
            "name": "Rwanda"
        },
        {
            "code": "PK",
            "name": "Pakistan"
        },
        {
            "code": "GN",
            "name": "Guinea"
        },
        {
            "code": "LA",
            "name": "LaoPeoplesDemocraticRepublic"
        }
    ]
}
```
Request with JWT Authentication:
```
curl --location 'http://localhost:8081/v2/payment-methods/filter?connector=stripe&paymentMethodType=debit' \
--header 'x-profile-id: pro_vJRG8ITXZXHXQuoHA59p' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjIwY2E1NzAtY2I1Ni00YTUwLTk4MTctODEzYzEyNjljOWUwIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1NTkyMzYyIiwicm9sZV9pZCI6InByb2ZpbGVfdmlld19vbmx5IiwiZXhwIjoxNzU1NzY1NjI3LCJvcmdfaWQiOiJvcmdfelFiZUprcUlPWWhMUTNmeDVMOHQiLCJwcm9maWxlX2lkIjoicHJvX3ZKUkc4SVRYWlhIWFF1b0hBNTlwIiwidGVuYW50X2lkIjoicHVibGljIn0.9DafPc6vkoO8K-JLHxetMmmDYQDek35-HV8zrVe5QTg' \
--data ''
```
Respone:
```
{
    "currencies": [
        "ERN",
        "LSL",
        "MMK",
        "LKR",
        "THB",
        "SHP",
        "FKP",
        "XCD",
        "NIO",
        "GIP",
        "RWF",
        "CUP",
        "OMR",
        "UYU",
        "GTQ",
        "GNF",
        "FJD",
        "GBP",
        "KMF",
        "ILS",
        "ETB",
        "SYP",
        "GHS",
        "GMD",
        "MUR",
        "BSD",
        "KRW",
        "MZN",
        "TMT",
        "TOP",
        "SBD",
        "KGS",
        "UGX",
        "UZS",
        "YER",
        "RUB",
        "TZS",
        "COP",
        "PYG",
        "NAD",
        "SSP",
        "GYD",
        "CHF",
        "KWD",
        "MYR",
        "PKR",
        "SAR",
        "WST",
        "EGP",
        "BAM",
        "QAR",
        "XOF",
        "DZD",
        "SZL",
        "CZK",
        "VND",
        "SCR",
        "IDR",
        "ANG",
        "LAK",
        "DJF",
        "TTD",
        "HUF",
        "PLN",
        "VES",
        "ALL",
        "MRU",
        "ZMW",
        "STN",
        "ZWL",
        "AFN",
        "NOK",
        "ISK",
        "AED",
        "EUR",
        "MVR",
        "CRC",
        "GEL",
        "TND",
        "XAF",
        "KHR",
        "IRR",
        "JOD",
        "CNY",
        "CVE",
        "AWG",
        "CUC",
        "NGN",
        "STD",
        "MXN",
        "LYD",
        "SRD",
        "BWP",
        "CDF",
        "KPW",
        "SEK",
        "PGK",
        "AMD",
        "NZD",
        "BOB",
        "CAD",
        "NPR",
        "PEN",
        "SDG",
        "MNT",
        "AZN",
        "MOP",
        "BDT",
        "CLF",
        "BMD",
        "BTN",
        "PAB",
        "USD",
        "BGN",
        "HNL",
        "DKK",
        "ZAR",
        "AOA",
        "TJS",
        "VUV",
        "BHD",
        "BZD",
        "TRY",
        "HKD",
        "ARS",
        "BND",
        "HTG",
        "LRD",
        "MGA",
        "SVC",
        "SLL",
        "KES",
        "HRK",
        "SLE",
        "RON",
        "MKD",
        "MDL",
        "UAH",
        "BIF",
        "KYD",
        "BBD",
        "BRL",
        "CLP",
        "SOS",
        "JPY",
        "RSD",
        "INR",
        "MWK",
        "AUD",
        "PHP",
        "IQD",
        "LBP",
        "MAD",
        "XPF",
        "JMD",
        "DOP",
        "TWD",
        "KZT",
        "SGD",
        "BYN"
    ],
    "countries": [
        {
            "code": "VU",
            "name": "Vanuatu"
        },
        {
            "code": "AI",
            "name": "Anguilla"
        },
        {
            "code": "UA",
            "name": "Ukraine"
        },
        {
            "code": "PW",
            "name": "Palau"
        },
        {
            "code": "FR",
            "name": "France"
        },
        {
            "code": "TO",
            "name": "Tonga"
        },
        {
            "code": "JO",
            "name": "Jordan"
        },
        {
            "code": "ZW",
            "name": "Zimbabwe"
        },
        {
            "code": "KZ",
            "name": "Kazakhstan"
        },
        {
            "code": "AW",
            "name": "Aruba"
        },
        {
            "code": "GY",
            "name": "Guyana"
        },
        {
            "code": "KE",
            "name": "Kenya"
        },
        {
            "code": "LS",
            "name": "Lesotho"
        },
        {
            "code": "NP",
            "name": "Nepal"
        },
        {
            "code": "US",
            "name": "UnitedStatesOfAmerica"
        },
        {
            "code": "ER",
            "name": "Eritrea"
        },
        {
            "code": "LY",
            "name": "Libya"
        },
        {
            "code": "GW",
            "name": "GuineaBissau"
        },
        {
            "code": "GP",
            "name": "Guadeloupe"
        },
        {
            "code": "NO",
            "name": "Norway"
        },
        {
            "code": "TM",
            "name": "Turkmenistan"
        },
        {
            "code": "BY",
            "name": "Belarus"
        },
        {
            "code": "KH",
            "name": "Cambodia"
        },
        {
            "code": "KW",
            "name": "Kuwait"
        },
        {
            "code": "JM",
            "name": "Jamaica"
        },
        {
            "code": "MQ",
            "name": "Martinique"
        },
        {
            "code": "CY",
            "name": "Cyprus"
        },
        {
            "code": "TH",
            "name": "Thailand"
        },
        {
            "code": "CF",
            "name": "CentralAfricanRepublic"
        },
        {
            "code": "PH",
            "name": "Philippines"
        },
        {
            "code": "IO",
            "name": "BritishIndianOceanTerritory"
        },
        {
            "code": "FK",
            "name": "FalklandIslandsMalvinas"
        },
        {
            "code": "EH",
            "name": "WesternSahara"
        },
        {
            "code": "TC",
            "name": "TurksAndCaicosIslands"
        },
        {
            "code": "KN",
            "name": "SaintKittsAndNevis"
        },
        {
            "code": "MW",
            "name": "Malawi"
        },
        {
            "code": "UY",
            "name": "Uruguay"
        },
        {
            "code": "SI",
            "name": "Slovenia"
        },
        {
            "code": "HN",
            "name": "Honduras"
        },
        {
            "code": "PT",
            "name": "Portugal"
        },
        {
            "code": "RO",
            "name": "Romania"
        },
        {
            "code": "BF",
            "name": "BurkinaFaso"
        },
        {
            "code": "GH",
            "name": "Ghana"
        },
        {
            "code": "KP",
            "name": "KoreaDemocraticPeoplesRepublic"
        },
        {
            "code": "CC",
            "name": "CocosKeelingIslands"
        },
        {
            "code": "BE",
            "name": "Belgium"
        },
        {
            "code": "BT",
            "name": "Bhutan"
        },
        {
            "code": "CG",
            "name": "Congo"
        },
        {
            "code": "SX",
            "name": "SintMaartenDutchpart"
        },
        {
            "code": "CL",
            "name": "Chile"
        },
        {
            "code": "DM",
            "name": "Dominica"
        },
        {
            "code": "TF",
            "name": "FrenchSouthernTerritories"
        },
        {
            "code": "MZ",
            "name": "Mozambique"
        },
        {
            "code": "PL",
            "name": "Poland"
        },
        {
            "code": "YE",
            "name": "Yemen"
        },
        {
            "code": "MX",
            "name": "Mexico"
        },
        {
            "code": "AS",
            "name": "AmericanSamoa"
        },
        {
            "code": "TG",
            "name": "Togo"
        },
        {
            "code": "OM",
            "name": "Oman"
        },
        {
            "code": "CH",
            "name": "Switzerland"
        },
        {
            "code": "AD",
            "name": "Andorra"
        },
        {
            "code": "WS",
            "name": "Samoa"
        },
        {
            "code": "TN",
            "name": "Tunisia"
        },
        {
            "code": "GG",
            "name": "Guernsey"
        },
        {
            "code": "SD",
            "name": "Sudan"
        },
        {
            "code": "CD",
            "name": "CongoDemocraticRepublic"
        },
        {
            "code": "CM",
            "name": "Cameroon"
        },
        {
            "code": "CU",
            "name": "Cuba"
        },
        {
            "code": "SY",
            "name": "SyrianArabRepublic"
        },
        {
            "code": "BM",
            "name": "Bermuda"
        },
        {
            "code": "PR",
            "name": "PuertoRico"
        },
        {
            "code": "PK",
            "name": "Pakistan"
        },
        {
            "code": "BI",
            "name": "Burundi"
        },
        {
            "code": "ET",
            "name": "Ethiopia"
        },
        {
            "code": "BJ",
            "name": "Benin"
        },
        {
            "code": "AQ",
            "name": "Antarctica"
        },
        {
            "code": "CX",
            "name": "ChristmasIsland"
        },
        {
            "code": "IE",
            "name": "Ireland"
        },
        {
            "code": "VI",
            "name": "VirginIslandsUS"
        },
        {
            "code": "PM",
            "name": "SaintPierreAndMiquelon"
        },
        {
            "code": "GQ",
            "name": "EquatorialGuinea"
        },
        {
            "code": "IM",
            "name": "IsleOfMan"
        },
        {
            "code": "SA",
            "name": "SaudiArabia"
        },
        {
            "code": "BZ",
            "name": "Belize"
        },
        {
            "code": "CO",
            "name": "Colombia"
        },
        {
            "code": "MT",
            "name": "Malta"
        },
        {
            "code": "AU",
            "name": "Australia"
        },
        {
            "code": "EE",
            "name": "Estonia"
        },
        {
            "code": "NR",
            "name": "Nauru"
        },
        {
            "code": "KR",
            "name": "KoreaRepublic"
        },
        {
            "code": "AZ",
            "name": "Azerbaijan"
        },
        {
            "code": "NG",
            "name": "Nigeria"
        },
        {
            "code": "TW",
            "name": "TaiwanProvinceOfChina"
        },
        {
            "code": "UZ",
            "name": "Uzbekistan"
        },
        {
            "code": "IS",
            "name": "Iceland"
        },
        {
            "code": "BQ",
            "name": "BonaireSintEustatiusAndSaba"
        },
        {
            "code": "MG",
            "name": "Madagascar"
        },
        {
            "code": "MC",
            "name": "Monaco"
        },
        {
            "code": "LK",
            "name": "SriLanka"
        },
        {
            "code": "NF",
            "name": "NorfolkIsland"
        },
        {
            "code": "MM",
            "name": "Myanmar"
        },
        {
            "code": "GS",
            "name": "SouthGeorgiaAndTheSouthSandwichIslands"
        },
        {
            "code": "LI",
            "name": "Liechtenstein"
        },
        {
            "code": "CZ",
            "name": "Czechia"
        },
        {
            "code": "TK",
            "name": "Tokelau"
        },
        {
            "code": "GI",
            "name": "Gibraltar"
        },
        {
            "code": "PS",
            "name": "PalestineState"
        },
        {
            "code": "SG",
            "name": "Singapore"
        },
        {
            "code": "SM",
            "name": "SanMarino"
        },
        {
            "code": "AG",
            "name": "AntiguaAndBarbuda"
        },
        {
            "code": "ZA",
            "name": "SouthAfrica"
        },
        {
            "code": "YT",
            "name": "Mayotte"
        },
        {
            "code": "MP",
            "name": "NorthernMarianaIslands"
        },
        {
            "code": "RW",
            "name": "Rwanda"
        },
        {
            "code": "HK",
            "name": "HongKong"
        },
        {
            "code": "HT",
            "name": "Haiti"
        },
        {
            "code": "PA",
            "name": "Panama"
        },
        {
            "code": "PN",
            "name": "Pitcairn"
        },
        {
            "code": "LT",
            "name": "Lithuania"
        },
        {
            "code": "VA",
            "name": "HolySee"
        },
        {
            "code": "MF",
            "name": "SaintMartinFrenchpart"
        },
        {
            "code": "LC",
            "name": "SaintLucia"
        },
        {
            "code": "GE",
            "name": "Georgia"
        },
        {
            "code": "BB",
            "name": "Barbados"
        },
        {
            "code": "BD",
            "name": "Bangladesh"
        },
        {
            "code": "VN",
            "name": "Vietnam"
        },
        {
            "code": "AX",
            "name": "AlandIslands"
        },
        {
            "code": "TJ",
            "name": "Tajikistan"
        },
        {
            "code": "GU",
            "name": "Guam"
        },
        {
            "code": "FJ",
            "name": "Fiji"
        },
        {
            "code": "BS",
            "name": "Bahamas"
        },
        {
            "code": "PG",
            "name": "PapuaNewGuinea"
        },
        {
            "code": "IQ",
            "name": "Iraq"
        },
        {
            "code": "UG",
            "name": "Uganda"
        },
        {
            "code": "MN",
            "name": "Mongolia"
        },
        {
            "code": "GM",
            "name": "Gambia"
        },
        {
            "code": "UM",
            "name": "UnitedStatesMinorOutlyingIslands"
        },
        {
            "code": "NZ",
            "name": "NewZealand"
        },
        {
            "code": "JE",
            "name": "Jersey"
        },
        {
            "code": "SC",
            "name": "Seychelles"
        },
        {
            "code": "IT",
            "name": "Italy"
        },
        {
            "code": "RE",
            "name": "Reunion"
        },
        {
            "code": "GF",
            "name": "FrenchGuiana"
        },
        {
            "code": "TD",
            "name": "Chad"
        },
        {
            "code": "NC",
            "name": "NewCaledonia"
        },
        {
            "code": "CV",
            "name": "CaboVerde"
        },
        {
            "code": "SL",
            "name": "SierraLeone"
        },
        {
            "code": "GT",
            "name": "Guatemala"
        },
        {
            "code": "KY",
            "name": "CaymanIslands"
        },
        {
            "code": "ID",
            "name": "Indonesia"
        },
        {
            "code": "SR",
            "name": "Suriname"
        },
        {
            "code": "WF",
            "name": "WallisAndFutuna"
        },
        {
            "code": "LA",
            "name": "LaoPeoplesDemocraticRepublic"
        },
        {
            "code": "TT",
            "name": "TrinidadAndTobago"
        },
        {
            "code": "NA",
            "name": "Namibia"
        },
        {
            "code": "ZM",
            "name": "Zambia"
        },
        {
            "code": "SN",
            "name": "Senegal"
        },
        {
            "code": "MA",
            "name": "Morocco"
        },
        {
            "code": "NL",
            "name": "Netherlands"
        },
        {
            "code": "NI",
            "name": "Nicaragua"
        },
        {
            "code": "KG",
            "name": "Kyrgyzstan"
        },
        {
            "code": "MY",
            "name": "Malaysia"
        },
        {
            "code": "TR",
            "name": "Turkey"
        },
        {
            "code": "NE",
            "name": "Niger"
        },
        {
            "code": "MH",
            "name": "MarshallIslands"
        },
        {
            "code": "LR",
            "name": "Liberia"
        },
        {
            "code": "FI",
            "name": "Finland"
        },
        {
            "code": "MD",
            "name": "MoldovaRepublic"
        },
        {
            "code": "ME",
            "name": "Montenegro"
        },
        {
            "code": "AL",
            "name": "Albania"
        },
        {
            "code": "HM",
            "name": "HeardIslandAndMcDonaldIslands"
        },
        {
            "code": "FM",
            "name": "MicronesiaFederatedStates"
        },
        {
            "code": "CR",
            "name": "CostaRica"
        },
        {
            "code": "CW",
            "name": "Curacao"
        },
        {
            "code": "SO",
            "name": "Somalia"
        },
        {
            "code": "MK",
            "name": "MacedoniaTheFormerYugoslavRepublic"
        },
        {
            "code": "TZ",
            "name": "TanzaniaUnitedRepublic"
        },
        {
            "code": "RS",
            "name": "Serbia"
        },
        {
            "code": "KM",
            "name": "Comoros"
        },
        {
            "code": "VG",
            "name": "VirginIslandsBritish"
        },
        {
            "code": "AM",
            "name": "Armenia"
        },
        {
            "code": "BH",
            "name": "Bahrain"
        },
        {
            "code": "BL",
            "name": "SaintBarthelemy"
        },
        {
            "code": "NU",
            "name": "Niue"
        },
        {
            "code": "LU",
            "name": "Luxembourg"
        },
        {
            "code": "MO",
            "name": "Macao"
        },
        {
            "code": "BA",
            "name": "BosniaAndHerzegovina"
        },
        {
            "code": "AF",
            "name": "Afghanistan"
        },
        {
            "code": "EG",
            "name": "Egypt"
        },
        {
            "code": "CK",
            "name": "CookIslands"
        },
        {
            "code": "CA",
            "name": "Canada"
        },
        {
            "code": "SZ",
            "name": "Swaziland"
        },
        {
            "code": "ML",
            "name": "Mali"
        },
        {
            "code": "BR",
            "name": "Brazil"
        },
        {
            "code": "LV",
            "name": "Latvia"
        },
        {
            "code": "TL",
            "name": "TimorLeste"
        },
        {
            "code": "BG",
            "name": "Bulgaria"
        },
        {
            "code": "AT",
            "name": "Austria"
        },
        {
            "code": "KI",
            "name": "Kiribati"
        },
        {
            "code": "IR",
            "name": "IranIslamicRepublic"
        },
        {
            "code": "MV",
            "name": "Maldives"
        },
        {
            "code": "RU",
            "name": "RussianFederation"
        },
        {
            "code": "VE",
            "name": "VenezuelaBolivarianRepublic"
        },
        {
            "code": "AE",
            "name": "UnitedArabEmirates"
        },
        {
            "code": "VC",
            "name": "SaintVincentAndTheGrenadines"
        },
        {
            "code": "MS",
            "name": "Montserrat"
        },
        {
            "code": "AO",
            "name": "Angola"
        },
        {
            "code": "PY",
            "name": "Paraguay"
        },
        {
            "code": "BV",
            "name": "BouvetIsland"
        },
        {
            "code": "DO",
            "name": "DominicanRepublic"
        },
        {
            "code": "SH",
            "name": "SaintHelenaAscensionAndTristandaCunha"
        },
        {
            "code": "ES",
            "name": "Spain"
        },
        {
            "code": "AR",
            "name": "Argentina"
        },
        {
            "code": "LB",
            "name": "Lebanon"
        },
        {
            "code": "PF",
            "name": "FrenchPolynesia"
        },
        {
            "code": "IL",
            "name": "Israel"
        },
        {
            "code": "DJ",
            "name": "Djibouti"
        },
        {
            "code": "DZ",
            "name": "Algeria"
        },
        {
            "code": "TV",
            "name": "Tuvalu"
        },
        {
            "code": "MU",
            "name": "Mauritius"
        },
        {
            "code": "JP",
            "name": "Japan"
        },
        {
            "code": "DK",
            "name": "Denmark"
        },
        {
            "code": "SE",
            "name": "Sweden"
        },
        {
            "code": "CN",
            "name": "China"
        },
        {
            "code": "PE",
            "name": "Peru"
        },
        {
            "code": "BW",
            "name": "Botswana"
        },
        {
            "code": "SV",
            "name": "ElSalvador"
        },
        {
            "code": "CI",
            "name": "CotedIvoire"
        },
        {
            "code": "HR",
            "name": "Croatia"
        },
        {
            "code": "SK",
            "name": "Slovakia"
        },
        {
            "code": "GD",
            "name": "Grenada"
        },
        {
            "code": "SS",
            "name": "SouthSudan"
        },
        {
            "code": "BO",
            "name": "BoliviaPlurinationalState"
        },
        {
            "code": "QA",
            "name": "Qatar"
        },
        {
            "code": "HU",
            "name": "Hungary"
        },
        {
            "code": "SB",
            "name": "SolomonIslands"
        },
        {
            "code": "BN",
            "name": "BruneiDarussalam"
        },
        {
            "code": "GB",
            "name": "UnitedKingdomOfGreatBritainAndNorthernIreland"
        },
        {
            "code": "GL",
            "name": "Greenland"
        },
        {
            "code": "ST",
            "name": "SaoTomeAndPrincipe"
        },
        {
            "code": "GR",
            "name": "Greece"
        },
        {
            "code": "FO",
            "name": "FaroeIslands"
        },
        {
            "code": "SJ",
            "name": "SvalbardAndJanMayen"
        },
        {
            "code": "IN",
            "name": "India"
        },
        {
            "code": "EC",
            "name": "Ecuador"
        },
        {
            "code": "MR",
            "name": "Mauritania"
        },
        {
            "code": "GA",
            "name": "Gabon"
        },
        {
            "code": "DE",
            "name": "Germany"
        },
        {
            "code": "GN",
            "name": "Guinea"
        }
    ]
}
```
Closes #8977 
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8993 | 
	Bug: refactor: [Netcetera] Handle response deserialization error
 | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
index 8444c7b9dd3..b6e85aea3ce 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
@@ -163,7 +163,10 @@ impl
                     .authentication_request
                     .as_ref()
                     .and_then(|req| req.three_ds_requestor_challenge_ind.as_ref())
-                    .and_then(|v| v.first().cloned());
+                    .and_then(|ind| match ind {
+                        ThreedsRequestorChallengeInd::Single(s) => Some(s.clone()),
+                        ThreedsRequestorChallengeInd::Multiple(v) => v.first().cloned(),
+                    });
 
                 let message_extension = response
                     .authentication_request
@@ -680,10 +683,17 @@ pub struct NetceteraAuthenticationFailureResponse {
 #[serde(rename_all = "camelCase")]
 pub struct AuthenticationRequest {
     #[serde(rename = "threeDSRequestorChallengeInd")]
-    pub three_ds_requestor_challenge_ind: Option<Vec<String>>,
+    pub three_ds_requestor_challenge_ind: Option<ThreedsRequestorChallengeInd>,
     pub message_extension: Option<serde_json::Value>,
 }
 
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ThreedsRequestorChallengeInd {
+    Single(String),
+    Multiple(Vec<String>),
+}
+
 #[derive(Debug, Deserialize, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct AuthenticationResponse {
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
index a26d0c7689f..1c6977ac5c9 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
@@ -75,7 +75,7 @@ pub struct MessageExtensionAttribute {
     pub id: String,
     pub name: String,
     pub criticality_indicator: bool,
-    pub data: String,
+    pub data: serde_json::Value,
 }
 
 #[derive(Clone, Default, Debug)]
 | 
	2025-08-19T08:46:13Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
- Handle response deserialization error
- three_ds_requestor_challenge_ind can be vector or string
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
Sanity flow with netcetra and cybersource
Profile update 
```
curl --location 'http://localhost:8080/account/merchant_1755510755/business_profile/pro_BwyTBsmG8NfDWCJNSozM' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_QBdrxdNVk1Qi1kfHVAxfkkN4It60LAsZB1Zfb1SWaXePTncdQ8qS6v0ikHyHcXJy' \
--data '{
    
    "authentication_connector_details": {
        "authentication_connectors": ["netcetera"],
        "three_ds_requestor_url": "https://google.com"
    }
}'
```
Response
```
{
    "merchant_id": "merchant_1755510755",
    "profile_id": "pro_BwyTBsmG8NfDWCJNSozM",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "iCpLwpK7rw6BuAvVHhA4n73QtuDLJ82MUwAqMzWsiAhytB8SnxVVjrqRmOhRuLD4",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": null,
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": {
        "authentication_connectors": [
            "netcetera"
        ],
        "three_ds_requestor_url": "https://google.com",
        "three_ds_requestor_app_url": null
    },
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null
}
```
Card request
```
{
    "amount": 2540,
    "currency": "USD",
    "profile_id": "pro_BwyTBsmG8NfDWCJNSozM",
    "confirm": true,
    "amount_to_capture": 2540,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "request_external_three_ds_authentication": true,
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://google.com",
    "setup_future_usage": "on_session",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "routing": {
        "type": "single",
        "data": "nmi"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
         "card": {
            "card_number": "4035 5014 2814 6300",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
            // "card_network": "CartesBancaires"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}
```
response
```
{
    "payment_id": "pay_VIDTWLGUcRV3CD9htaVR",
    "merchant_id": "merchant_1755510755",
    "status": "requires_customer_action",
    "amount": 2540,
    "net_amount": 2540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_VIDTWLGUcRV3CD9htaVR_secret_oQT12tBHvaPkuODXoyex",
    "created": "2025-08-19T10:17:28.860Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "6300",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "403550",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_V0xBNOlCVuSJuByMCfEB",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "three_ds_invoke",
        "three_ds_data": {
            "three_ds_authentication_url": "http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/3ds/authentication",
            "three_ds_authorize_url": "http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/merchant_1755510755/authorize/cybersource",
            "three_ds_method_details": {
                "three_ds_method_key": "threeDSMethodData",
                "three_ds_method_data_submission": true,
                "three_ds_method_data": "eyJ0aHJlZURTTWV0aG9kTm90aWZpY2F0aW9uVVJMIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS8zZHMtbWV0aG9kLW5vdGlmaWNhdGlvbi11cmwiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNiMGRhOGE5LWJhY2UtNGNlMS05NWI4LTJhMWNmOTlmOThhOCJ9",
                "three_ds_method_url": "https://ndm-prev.3dss-non-prod.cloud.netcetera.com/acs/3ds-method"
            },
            "poll_config": {
                "poll_id": "external_authentication_pay_VIDTWLGUcRV3CD9htaVR",
                "delay_in_secs": 2,
                "frequency": 5
            },
            "message_version": "2.3.1",
            "directory_server_id": "A000000003"
        }
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755598648,
        "expires": 1755602248,
        "secret": "epk_fd1d2eec8768439685e62ee45dabb4bc"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_BwyTBsmG8NfDWCJNSozM",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_dRvP71fPP5fDcWrMaE2z",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": {
        "authentication_flow": null,
        "electronic_commerce_indicator": null,
        "status": "pending",
        "ds_transaction_id": "3b0da8a9-bace-4ce1-95b8-2a1cf99f98a8",
        "version": "2.3.1",
        "error_code": null,
        "error_message": null
    },
    "external_3ds_authentication_attempted": true,
    "expires_on": "2025-08-19T10:32:28.860Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T10:17:29.573Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
Create challenge
```
curl --location 'http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/3ds/authentication' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_5b6e1d248e7f412eaba54679208f9a84' \
--data '{
    "client_secret": "pay_VIDTWLGUcRV3CD9htaVR_secret_oQT12tBHvaPkuODXoyex",
    "device_channel": "BRW",
    "threeds_method_comp_ind": "Y"
}'
Response
```
{
    "trans_status": "C",
    "acs_url": "https://ndm-prev.3dss-non-prod.cloud.netcetera.com/acs/challenge",
    "challenge_request": "eyJtZXNzYWdlVHlwZSI6IkNSZXEiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNiMGRhOGE5LWJhY2UtNGNlMS05NWI4LTJhMWNmOTlmOThhOCIsImFjc1RyYW5zSUQiOiJlNjcxYWM4ZS0wZWEyLTRhNzQtOGY5NC0zMzAyMDRhMWI3NmUiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMy4xIn0",
    "acs_reference_number": "3DS_LOA_ACS_201_13579",
    "acs_trans_id": "e671ac8e-0ea2-4a74-8f94-330204a1b76e",
    "three_dsserver_trans_id": "3b0da8a9-bace-4ce1-95b8-2a1cf99f98a8",
    "acs_signed_content": null,
    "three_ds_requestor_url": "https://google.com",
    "three_ds_requestor_app_url": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	58abb604d7a89519befa296d59506857bbdb0b8b | 
	Sanity flow with netcetra and cybersource
Profile update 
```
curl --location 'http://localhost:8080/account/merchant_1755510755/business_profile/pro_BwyTBsmG8NfDWCJNSozM' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_QBdrxdNVk1Qi1kfHVAxfkkN4It60LAsZB1Zfb1SWaXePTncdQ8qS6v0ikHyHcXJy' \
--data '{
    
    "authentication_connector_details": {
        "authentication_connectors": ["netcetera"],
        "three_ds_requestor_url": "https://google.com"
    }
}'
```
Response
```
{
    "merchant_id": "merchant_1755510755",
    "profile_id": "pro_BwyTBsmG8NfDWCJNSozM",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "iCpLwpK7rw6BuAvVHhA4n73QtuDLJ82MUwAqMzWsiAhytB8SnxVVjrqRmOhRuLD4",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": null,
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": {
        "authentication_connectors": [
            "netcetera"
        ],
        "three_ds_requestor_url": "https://google.com",
        "three_ds_requestor_app_url": null
    },
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null
}
```
Card request
```
{
    "amount": 2540,
    "currency": "USD",
    "profile_id": "pro_BwyTBsmG8NfDWCJNSozM",
    "confirm": true,
    "amount_to_capture": 2540,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "request_external_three_ds_authentication": true,
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://google.com",
    "setup_future_usage": "on_session",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "routing": {
        "type": "single",
        "data": "nmi"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
         "card": {
            "card_number": "4035 5014 2814 6300",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
            // "card_network": "CartesBancaires"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}
```
response
```
{
    "payment_id": "pay_VIDTWLGUcRV3CD9htaVR",
    "merchant_id": "merchant_1755510755",
    "status": "requires_customer_action",
    "amount": 2540,
    "net_amount": 2540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_VIDTWLGUcRV3CD9htaVR_secret_oQT12tBHvaPkuODXoyex",
    "created": "2025-08-19T10:17:28.860Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "6300",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "403550",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_V0xBNOlCVuSJuByMCfEB",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "three_ds_invoke",
        "three_ds_data": {
            "three_ds_authentication_url": "http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/3ds/authentication",
            "three_ds_authorize_url": "http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/merchant_1755510755/authorize/cybersource",
            "three_ds_method_details": {
                "three_ds_method_key": "threeDSMethodData",
                "three_ds_method_data_submission": true,
                "three_ds_method_data": "eyJ0aHJlZURTTWV0aG9kTm90aWZpY2F0aW9uVVJMIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS8zZHMtbWV0aG9kLW5vdGlmaWNhdGlvbi11cmwiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNiMGRhOGE5LWJhY2UtNGNlMS05NWI4LTJhMWNmOTlmOThhOCJ9",
                "three_ds_method_url": "https://ndm-prev.3dss-non-prod.cloud.netcetera.com/acs/3ds-method"
            },
            "poll_config": {
                "poll_id": "external_authentication_pay_VIDTWLGUcRV3CD9htaVR",
                "delay_in_secs": 2,
                "frequency": 5
            },
            "message_version": "2.3.1",
            "directory_server_id": "A000000003"
        }
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755598648,
        "expires": 1755602248,
        "secret": "epk_fd1d2eec8768439685e62ee45dabb4bc"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_BwyTBsmG8NfDWCJNSozM",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_dRvP71fPP5fDcWrMaE2z",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": {
        "authentication_flow": null,
        "electronic_commerce_indicator": null,
        "status": "pending",
        "ds_transaction_id": "3b0da8a9-bace-4ce1-95b8-2a1cf99f98a8",
        "version": "2.3.1",
        "error_code": null,
        "error_message": null
    },
    "external_3ds_authentication_attempted": true,
    "expires_on": "2025-08-19T10:32:28.860Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T10:17:29.573Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
Create challenge
```
curl --location 'http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/3ds/authentication' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_5b6e1d248e7f412eaba54679208f9a84' \
--data '{
    "client_secret": "pay_VIDTWLGUcRV3CD9htaVR_secret_oQT12tBHvaPkuODXoyex",
    "device_channel": "BRW",
    "threeds_method_comp_ind": "Y"
}'
Response
```
{
    "trans_status": "C",
    "acs_url": "https://ndm-prev.3dss-non-prod.cloud.netcetera.com/acs/challenge",
    "challenge_request": "eyJtZXNzYWdlVHlwZSI6IkNSZXEiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNiMGRhOGE5LWJhY2UtNGNlMS05NWI4LTJhMWNmOTlmOThhOCIsImFjc1RyYW5zSUQiOiJlNjcxYWM4ZS0wZWEyLTRhNzQtOGY5NC0zMzAyMDRhMWI3NmUiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMy4xIn0",
    "acs_reference_number": "3DS_LOA_ACS_201_13579",
    "acs_trans_id": "e671ac8e-0ea2-4a74-8f94-330204a1b76e",
    "three_dsserver_trans_id": "3b0da8a9-bace-4ce1-95b8-2a1cf99f98a8",
    "acs_signed_content": null,
    "three_ds_requestor_url": "https://google.com",
    "three_ds_requestor_app_url": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8971 | 
	Bug: refactor(routing): receive json value instead of string
 | 
	diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 0b1395ed4ba..98b71748b35 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -2481,7 +2481,7 @@ pub async fn enable_decision_engine_dynamic_routing_setup(
     create_merchant_in_decision_engine_if_not_exists(state, profile_id, dynamic_routing_algo_ref)
         .await;
 
-    routing_utils::ConfigApiClient::send_decision_engine_request::<_, String>(
+    routing_utils::ConfigApiClient::send_decision_engine_request::<_, serde_json::Value>(
         state,
         services::Method::Post,
         DECISION_ENGINE_RULE_CREATE_ENDPOINT,
@@ -2559,7 +2559,7 @@ pub async fn update_decision_engine_dynamic_routing_setup(
     create_merchant_in_decision_engine_if_not_exists(state, profile_id, dynamic_routing_algo_ref)
         .await;
 
-    routing_utils::ConfigApiClient::send_decision_engine_request::<_, String>(
+    routing_utils::ConfigApiClient::send_decision_engine_request::<_, serde_json::Value>(
         state,
         services::Method::Post,
         DECISION_ENGINE_RULE_UPDATE_ENDPOINT,
@@ -2640,7 +2640,7 @@ pub async fn disable_decision_engine_dynamic_routing_setup(
     create_merchant_in_decision_engine_if_not_exists(state, profile_id, dynamic_routing_algo_ref)
         .await;
 
-    routing_utils::ConfigApiClient::send_decision_engine_request::<_, String>(
+    routing_utils::ConfigApiClient::send_decision_engine_request::<_, serde_json::Value>(
         state,
         services::Method::Post,
         DECISION_ENGINE_RULE_DELETE_ENDPOINT,
@@ -2691,7 +2691,7 @@ pub async fn create_decision_engine_merchant(
         gateway_success_rate_based_decider_input: None,
     };
 
-    routing_utils::ConfigApiClient::send_decision_engine_request::<_, String>(
+    routing_utils::ConfigApiClient::send_decision_engine_request::<_, serde_json::Value>(
         state,
         services::Method::Post,
         DECISION_ENGINE_MERCHANT_CREATE_ENDPOINT,
@@ -2717,7 +2717,7 @@ pub async fn delete_decision_engine_merchant(
         DECISION_ENGINE_MERCHANT_BASE_ENDPOINT,
         profile_id.get_string_repr()
     );
-    routing_utils::ConfigApiClient::send_decision_engine_request::<_, String>(
+    routing_utils::ConfigApiClient::send_decision_engine_request::<_, serde_json::Value>(
         state,
         services::Method::Delete,
         &path,
 | 
	2025-08-14T14:11:07Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Refactoring to recieve json response instead of string
Updated `ConfigApiClient::send_decision_engine_request` calls in `crates/router/src/core/routing/helpers.rs` to return `serde_json::Value` instead of `String`.
This ensures the response is parsed as JSON for better type safety and avoids manual string-to-JSON conversions in downstream logic.
### Changes Made
* Replaced generic type parameter `String` with `serde_json::Value` in the following functions:
  * `enable_decision_engine_dynamic_routing_setup`
  * `update_decision_engine_dynamic_routing_setup`
  * `disable_decision_engine_dynamic_routing_setup`
  * `create_decision_engine_merchant`
  * `delete_decision_engine_merchant`
### Purpose
Switching to `serde_json::Value` directly improves clarity, reduces redundant parsing, and enforces better response handling.
### Screenshot
create
<img width="1717" height="93" alt="Screenshot 2025-08-21 at 4 11 10 PM" src="https://github.com/user-attachments/assets/68f8bc6a-ffa4-48fc-b030-68fc0a98da2c" />
update
<img width="1709" height="141" alt="Screenshot 2025-08-21 at 4 30 10 PM" src="https://github.com/user-attachments/assets/1dbf40ea-87d9-40fc-83dc-ac39036262db" />
delete
<img width="1725" height="71" alt="Screenshot 2025-08-21 at 4 31 25 PM" src="https://github.com/user-attachments/assets/bffe1bc7-28ac-43ab-9e4f-e1403dd6bca7" />
<img width="1612" height="992" alt="Screenshot 2025-08-19 at 6 23 55 PM" src="https://github.com/user-attachments/assets/14d788c3-9645-456f-a924-7988e46e9b10" />
<img width="1299" height="962" alt="Screenshot 2025-08-19 at 6 24 33 PM" src="https://github.com/user-attachments/assets/1ef46ebd-e286-4ae4-afcd-a33e3d505d7e" />
<img width="1335" height="637" alt="Screenshot 2025-08-19 at 6 25 46 PM" src="https://github.com/user-attachments/assets/c3a52c37-bbc4-4574-877b-e952406730c8" />
Curls and responses
create
```
curl --location 'http://localhost:8080/account/merchant_1756381962/business_profile/pro_nbWFu0RUhkjNIV4YgAJF/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 200,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
```
{
    "id": "routing_51b92mSgs0B0PJz5xM9R",
    "profile_id": "pro_nbWFu0RUhkjNIV4YgAJF",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756381971,
    "modified_at": 1756381971,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
update
```
curl --location --request PATCH 'http://localhost:8080/account/merchant_1756381962/business_profile/pro_nbWFu0RUhkjNIV4YgAJF/dynamic_routing/success_based/config/routing_51b92mSgs0B0PJz5xM9R' \
--header 'api-key:****' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 100,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
```
{
    "id": "routing_PTySs5RDUL22VinElTAn",
    "profile_id": "pro_nbWFu0RUhkjNIV4YgAJF",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756382062,
    "modified_at": 1756382062,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
activate 
```
curl --location 'http://localhost:8080/routing/routing_51b92mSgs0B0PJz5xM9R/activate' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{}'
```
```
{
    "id": "routing_51b92mSgs0B0PJz5xM9R",
    "profile_id": "pro_nbWFu0RUhkjNIV4YgAJF",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756381971,
    "modified_at": 1756381971,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
```
deactivate(deletion)
```
curl --location 'http://localhost:8080/account/merchant_1756381962/business_profile/pro_nbWFu0RUhkjNIV4YgAJF/dynamic_routing/success_based/create?enable=none' \
--header 'Content-Type: application/json' \
--header 'api-key:****' \
--data '{
    "decision_engine_configs": {
        "defaultLatencyThreshold": 90,
        "defaultBucketSize": 200,
        "defaultHedgingPercent": 5,
        "subLevelInputConfig": [
            {
                "paymentMethodType": "card",
                "paymentMethod": "credit",
                "bucketSize": 250,
                "hedgingPercent": 1
            }
        ]
    }
}'
```
```
{
    "id": "routing_51b92mSgs0B0PJz5xM9R",
    "profile_id": "pro_nbWFu0RUhkjNIV4YgAJF",
    "name": "Success rate based dynamic routing algorithm",
    "kind": "dynamic",
    "description": "",
    "created_at": 1756381971,
    "modified_at": 1756381971,
    "algorithm_for": "payment",
    "decision_engine_routing_id": null
}
``` | 
	aae1994ea147fa1ebdc9555f00b072bb9ed57abc | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8969 | 
	Bug: [BUG] Logging sensitive information on deserialization failure
### Bug Description
In `common_utils/src/ext_traits.rs` we are logging serde_json Values in plaintext when deserialization fails. This is a problem in cases where the JSON objects contain sensitive data.
### Expected Behavior
Sensitive data is not logged. Values are logged after masking.
### Actual Behavior
Sensitive information is logged.
### Steps To Reproduce
Supply malformed data to the `parse_value` method in `ValueExt` trait.
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/common_utils/src/ext_traits.rs b/crates/common_utils/src/ext_traits.rs
index 6bdeae9b6d9..b60ef5a22f2 100644
--- a/crates/common_utils/src/ext_traits.rs
+++ b/crates/common_utils/src/ext_traits.rs
@@ -175,7 +175,13 @@ impl BytesExt for bytes::Bytes {
             .change_context(errors::ParsingError::StructParseFailure(type_name))
             .attach_printable_lazy(|| {
                 let variable_type = std::any::type_name::<T>();
-                format!("Unable to parse {variable_type} from bytes {self:?}")
+                let value = serde_json::from_slice::<serde_json::Value>(self)
+                    .unwrap_or_else(|_| serde_json::Value::String(String::new()));
+
+                format!(
+                    "Unable to parse {variable_type} from bytes {:?}",
+                    Secret::<_, masking::JsonMaskStrategy>::new(value)
+                )
             })
     }
 }
@@ -202,7 +208,15 @@ impl ByteSliceExt for [u8] {
     {
         serde_json::from_slice(self)
             .change_context(errors::ParsingError::StructParseFailure(type_name))
-            .attach_printable_lazy(|| format!("Unable to parse {type_name} from &[u8] {:?}", &self))
+            .attach_printable_lazy(|| {
+                let value = serde_json::from_slice::<serde_json::Value>(self)
+                    .unwrap_or_else(|_| serde_json::Value::String(String::new()));
+
+                format!(
+                    "Unable to parse {type_name} from &[u8] {:?}",
+                    Secret::<_, masking::JsonMaskStrategy>::new(value)
+                )
+            })
     }
 }
 
@@ -219,13 +233,15 @@ impl ValueExt for serde_json::Value {
     where
         T: serde::de::DeserializeOwned,
     {
-        let debug = format!(
-            "Unable to parse {type_name} from serde_json::Value: {:?}",
-            &self
-        );
-        serde_json::from_value::<T>(self)
+        serde_json::from_value::<T>(self.clone())
             .change_context(errors::ParsingError::StructParseFailure(type_name))
-            .attach_printable_lazy(|| debug)
+            .attach_printable_lazy(|| {
+                format!(
+                    "Unable to parse {type_name} from serde_json::Value: {:?}",
+                    // Required to prevent logging sensitive data in case of deserialization failure
+                    Secret::<_, masking::JsonMaskStrategy>::new(self)
+                )
+            })
     }
 }
 
@@ -289,7 +305,12 @@ impl<T> StringExt<T> for String {
         serde_json::from_str::<T>(self)
             .change_context(errors::ParsingError::StructParseFailure(type_name))
             .attach_printable_lazy(|| {
-                format!("Unable to parse {type_name} from string {:?}", &self)
+                format!(
+                    "Unable to parse {type_name} from string {:?}",
+                    Secret::<_, masking::JsonMaskStrategy>::new(serde_json::Value::String(
+                        self.clone()
+                    ))
+                )
             })
     }
 }
 | 
	2025-08-18T04:03:57Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
- Modified `parse_value` method in `ValueExt` trait to log the JSON object after masking on deserialization failure.
- Modified `parse_struct` method in `BytesExt`, `ByteSliceExt` and `StringExt` to log values after converting them into a `serde_json::Value` and then masking
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #8969 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Tested by supplying malformed data to the method and verified it logs data after masking.
Object:
<img width="1079" height="49" alt="image" src="https://github.com/user-attachments/assets/a7f917af-b356-475d-b3d8-c29fcae29fc0" />
String:
<img width="1079" height="47" alt="image" src="https://github.com/user-attachments/assets/d009c43d-f114-4d0b-bda2-4fc8797ee45d" />
Array:
<img width="728" height="47" alt="image" src="https://github.com/user-attachments/assets/10929436-aec4-45ef-bec3-8f653dc48cb3" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	b133c534fb1ce40bd6cca27fac4f2d58b0863e30 | 
	
Tested by supplying malformed data to the method and verified it logs data after masking.
Object:
<img width="1079" height="49" alt="image" src="https://github.com/user-attachments/assets/a7f917af-b356-475d-b3d8-c29fcae29fc0" />
String:
<img width="1079" height="47" alt="image" src="https://github.com/user-attachments/assets/d009c43d-f114-4d0b-bda2-4fc8797ee45d" />
Array:
<img width="728" height="47" alt="image" src="https://github.com/user-attachments/assets/10929436-aec4-45ef-bec3-8f653dc48cb3" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8973 | 
	Bug: [REFACTOR] remove non mandatory fields for Adyen Platform payouts
Hyperswitch mandates a few fields for AdyenPlatform connector which are not needed. These are needed to be made optional.
List of fields
- Billing address details | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
index 82c9afadeed..6c964aea20f 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
@@ -2,9 +2,9 @@ use api_models::{payouts, webhooks};
 use common_enums::enums;
 use common_utils::pii;
 use error_stack::{report, ResultExt};
-use hyperswitch_domain_models::types;
+use hyperswitch_domain_models::types::{self, PayoutsRouterData};
 use hyperswitch_interfaces::errors::ConnectorError;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
 
 use super::{AdyenPlatformRouterData, Error};
@@ -68,10 +68,11 @@ pub struct AdyenBankAccountDetails {
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct AdyenAccountHolder {
-    address: AdyenAddress,
+    address: Option<AdyenAddress>,
     first_name: Option<Secret<String>>,
     last_name: Option<Secret<String>>,
     full_name: Option<Secret<String>>,
+    email: Option<pii::Email>,
     #[serde(rename = "reference")]
     customer_id: Option<String>,
     #[serde(rename = "type")]
@@ -251,40 +252,94 @@ impl TryFrom<&hyperswitch_domain_models::address::AddressDetails> for AdyenAddre
     }
 }
 
-impl<F> TryFrom<(&types::PayoutsRouterData<F>, enums::PayoutType)> for AdyenAccountHolder {
+impl<F> TryFrom<(&PayoutsRouterData<F>, &payouts::CardPayout)> for AdyenAccountHolder {
     type Error = Error;
 
     fn try_from(
-        (router_data, payout_type): (&types::PayoutsRouterData<F>, enums::PayoutType),
+        (router_data, card): (&PayoutsRouterData<F>, &payouts::CardPayout),
     ) -> Result<Self, Self::Error> {
-        let billing_address = router_data.get_billing_address()?;
-        let (first_name, last_name, full_name) = match payout_type {
-            enums::PayoutType::Card => (
-                Some(router_data.get_billing_first_name()?),
-                Some(router_data.get_billing_last_name()?),
-                None,
-            ),
-            enums::PayoutType::Bank => (None, None, Some(router_data.get_billing_full_name()?)),
-            _ => Err(ConnectorError::NotSupported {
-                message: "Payout method not supported".to_string(),
-                connector: "Adyen",
-            })?,
+        let billing_address = router_data.get_optional_billing();
+
+        // Address is required for both card and bank payouts
+        let address = billing_address
+            .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into()))
+            .transpose()?
+            .ok_or(ConnectorError::MissingRequiredField {
+                field_name: "address",
+            })?;
+
+        let (first_name, last_name) = if let Some(card_holder_name) = &card.card_holder_name {
+            let exposed_name = card_holder_name.clone().expose();
+            let name_parts: Vec<&str> = exposed_name.split_whitespace().collect();
+            let first_name = name_parts
+                .first()
+                .map(|s| Secret::new(s.to_string()))
+                .ok_or(ConnectorError::MissingRequiredField {
+                    field_name: "card_holder_name.first_name",
+                })?;
+            let last_name = if name_parts.len() > 1 {
+                let remaining_names: Vec<&str> = name_parts.iter().skip(1).copied().collect();
+                Some(Secret::new(remaining_names.join(" ")))
+            } else {
+                return Err(ConnectorError::MissingRequiredField {
+                    field_name: "card_holder_name.last_name",
+                }
+                .into());
+            };
+            (Some(first_name), last_name)
+        } else {
+            return Err(ConnectorError::MissingRequiredField {
+                field_name: "card_holder_name",
+            }
+            .into());
         };
+
         Ok(Self {
-            address: billing_address.try_into()?,
+            address: Some(address),
             first_name,
             last_name,
-            full_name,
+            full_name: None,
+            email: router_data.get_optional_billing_email(),
+            customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()),
+            entity_type: Some(EntityType::from(router_data.request.entity_type)),
+        })
+    }
+}
+
+impl<F> TryFrom<(&PayoutsRouterData<F>, &payouts::Bank)> for AdyenAccountHolder {
+    type Error = Error;
+
+    fn try_from(
+        (router_data, _bank): (&PayoutsRouterData<F>, &payouts::Bank),
+    ) -> Result<Self, Self::Error> {
+        let billing_address = router_data.get_optional_billing();
+
+        // Address is required for both card and bank payouts
+        let address = billing_address
+            .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into()))
+            .transpose()?
+            .ok_or(ConnectorError::MissingRequiredField {
+                field_name: "address",
+            })?;
+
+        let full_name = router_data.get_billing_full_name()?;
+
+        Ok(Self {
+            address: Some(address),
+            first_name: None,
+            last_name: None,
+            full_name: Some(full_name),
+            email: router_data.get_optional_billing_email(),
             customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()),
             entity_type: Some(EntityType::from(router_data.request.entity_type)),
         })
     }
 }
 
-impl<F> TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData<F>>> for AdyenTransferRequest {
+impl<F> TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData<F>>> for AdyenTransferRequest {
     type Error = Error;
     fn try_from(
-        item: &AdyenPlatformRouterData<&types::PayoutsRouterData<F>>,
+        item: &AdyenPlatformRouterData<&PayoutsRouterData<F>>,
     ) -> Result<Self, Self::Error> {
         let request = &item.router_data.request;
         let (counterparty, priority) = match item.router_data.get_payout_method_data()? {
@@ -292,8 +347,7 @@ impl<F> TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData<F>>> for Adye
                 utils::get_unimplemented_payment_method_error_message("Adyenplatform"),
             ))?,
             payouts::PayoutMethodData::Card(c) => {
-                let card_holder: AdyenAccountHolder =
-                    (item.router_data, enums::PayoutType::Card).try_into()?;
+                let card_holder: AdyenAccountHolder = (item.router_data, &c).try_into()?;
                 let card_identification = AdyenCardIdentification {
                     card_number: c.card_number,
                     expiry_month: c.expiry_month,
@@ -309,8 +363,7 @@ impl<F> TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData<F>>> for Adye
                 (counterparty, None)
             }
             payouts::PayoutMethodData::Bank(bd) => {
-                let account_holder: AdyenAccountHolder =
-                    (item.router_data, enums::PayoutType::Bank).try_into()?;
+                let account_holder: AdyenAccountHolder = (item.router_data, &bd).try_into()?;
                 let bank_details = match bd {
                     payouts::Bank::Sepa(b) => AdyenBankAccountIdentification {
                         bank_type: "iban".to_string(),
@@ -367,9 +420,7 @@ impl<F> TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData<F>>> for Adye
     }
 }
 
-impl<F> TryFrom<PayoutsResponseRouterData<F, AdyenTransferResponse>>
-    for types::PayoutsRouterData<F>
-{
+impl<F> TryFrom<PayoutsResponseRouterData<F, AdyenTransferResponse>> for PayoutsRouterData<F> {
     type Error = Error;
     fn try_from(
         item: PayoutsResponseRouterData<F, AdyenTransferResponse>,
diff --git a/crates/router/src/configs/defaults/payout_required_fields.rs b/crates/router/src/configs/defaults/payout_required_fields.rs
index a056a3ac931..d6b316c42b4 100644
--- a/crates/router/src/configs/defaults/payout_required_fields.rs
+++ b/crates/router/src/configs/defaults/payout_required_fields.rs
@@ -66,12 +66,81 @@ impl Default for PayoutRequiredFields {
     }
 }
 
+fn get_billing_details_for_payment_method(
+    connector: PayoutConnectors,
+    payment_method_type: PaymentMethodType,
+) -> HashMap<String, RequiredFieldInfo> {
+    match connector {
+        PayoutConnectors::Adyenplatform => {
+            let mut fields = HashMap::from([
+                (
+                    "billing.address.line1".to_string(),
+                    RequiredFieldInfo {
+                        required_field: "billing.address.line1".to_string(),
+                        display_name: "billing_address_line1".to_string(),
+                        field_type: FieldType::Text,
+                        value: None,
+                    },
+                ),
+                (
+                    "billing.address.line2".to_string(),
+                    RequiredFieldInfo {
+                        required_field: "billing.address.line2".to_string(),
+                        display_name: "billing_address_line2".to_string(),
+                        field_type: FieldType::Text,
+                        value: None,
+                    },
+                ),
+                (
+                    "billing.address.city".to_string(),
+                    RequiredFieldInfo {
+                        required_field: "billing.address.city".to_string(),
+                        display_name: "billing_address_city".to_string(),
+                        field_type: FieldType::Text,
+                        value: None,
+                    },
+                ),
+                (
+                    "billing.address.country".to_string(),
+                    RequiredFieldInfo {
+                        required_field: "billing.address.country".to_string(),
+                        display_name: "billing_address_country".to_string(),
+                        field_type: FieldType::UserAddressCountry {
+                            options: get_countries_for_connector(connector)
+                                .iter()
+                                .map(|country| country.to_string())
+                                .collect::<Vec<String>>(),
+                        },
+                        value: None,
+                    },
+                ),
+            ]);
+
+            // Add first_name for bank payouts only
+            if payment_method_type == PaymentMethodType::Sepa {
+                fields.insert(
+                    "billing.address.first_name".to_string(),
+                    RequiredFieldInfo {
+                        required_field: "billing.address.first_name".to_string(),
+                        display_name: "billing_address_first_name".to_string(),
+                        field_type: FieldType::Text,
+                        value: None,
+                    },
+                );
+            }
+
+            fields
+        }
+        _ => get_billing_details(connector),
+    }
+}
+
 #[cfg(feature = "v1")]
 fn get_connector_payment_method_type_fields(
     connector: PayoutConnectors,
     payment_method_type: PaymentMethodType,
 ) -> (PaymentMethodType, ConnectorFields) {
-    let mut common_fields = get_billing_details(connector);
+    let mut common_fields = get_billing_details_for_payment_method(connector, payment_method_type);
     match payment_method_type {
         // Card
         PaymentMethodType::Debit => {
@@ -409,67 +478,6 @@ fn get_billing_details(connector: PayoutConnectors) -> HashMap<String, RequiredF
                 },
             ),
         ]),
-        PayoutConnectors::Adyenplatform => HashMap::from([
-            (
-                "billing.address.line1".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.line1".to_string(),
-                    display_name: "billing_address_line1".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.line2".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.line2".to_string(),
-                    display_name: "billing_address_line2".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.city".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.city".to_string(),
-                    display_name: "billing_address_city".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.country".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.country".to_string(),
-                    display_name: "billing_address_country".to_string(),
-                    field_type: FieldType::UserAddressCountry {
-                        options: get_countries_for_connector(connector)
-                            .iter()
-                            .map(|country| country.to_string())
-                            .collect::<Vec<String>>(),
-                    },
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.first_name".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.first_name".to_string(),
-                    display_name: "billing_address_first_name".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.last_name".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.last_name".to_string(),
-                    display_name: "billing_address_last_name".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-        ]),
         PayoutConnectors::Wise => HashMap::from([
             (
                 "billing.address.line1".to_string(),
@@ -531,75 +539,6 @@ fn get_billing_details(connector: PayoutConnectors) -> HashMap<String, RequiredF
                 },
             ),
         ]),
-        _ => HashMap::from([
-            (
-                "billing.address.line1".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.line1".to_string(),
-                    display_name: "billing_address_line1".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.line2".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.line2".to_string(),
-                    display_name: "billing_address_line2".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.city".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.city".to_string(),
-                    display_name: "billing_address_city".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.zip".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.zip".to_string(),
-                    display_name: "billing_address_zip".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.country".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.country".to_string(),
-                    display_name: "billing_address_country".to_string(),
-                    field_type: FieldType::UserAddressCountry {
-                        options: get_countries_for_connector(connector)
-                            .iter()
-                            .map(|country| country.to_string())
-                            .collect::<Vec<String>>(),
-                    },
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.first_name".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.first_name".to_string(),
-                    display_name: "billing_address_first_name".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-            (
-                "billing.address.last_name".to_string(),
-                RequiredFieldInfo {
-                    required_field: "billing.address.last_name".to_string(),
-                    display_name: "billing_address_last_name".to_string(),
-                    field_type: FieldType::Text,
-                    value: None,
-                },
-            ),
-        ]),
+        _ => HashMap::from([]),
     }
 }
 | 
	2025-08-19T09:27:54Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR removes any non mandatory fields from AdyenPlatform connector for card and SEPA payouts.
New list
- Card payouts
[payout_method_data.card.card_number](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-card-number)
[payout_method_data.card.expiry_month](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-expiry-month)
[payout_method_data.card.expiry_year](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-expiry-year)
[payout_method_data.card.card_holder_name](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-card-holder-name)
[billing.address.line1](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line1)
[billing.address.line2](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line2)
[billing.address.city](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-city)
[billing.address.country](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-country)
- Bank payouts
Along with the payout method data depending on the bank (https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-bank)
[billing.address.line1](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line1)
[billing.address.line2](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line2)
[billing.address.city](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-city)
[billing.address.country](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-country)
[billing.address.first_name](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-first-name)
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
This PR removes any mandatory fields that were needed for processing payouts via Adyenplatform
## How did you test it?
Tested locally
<details>
    <summary>[Negative] 1. Create SEPA payout with missing billing details</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":1,"currency":"EUR","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","description":"Its my first payout request","payout_type":"bank","priority":"instant","payout_method_data":{"bank":{"iban":"NL06INGB5632579034"}},"connector":["adyenplatform"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5"}'
Response
    {
        "error": {
            "type": "invalid_request",
            "message": "Missing required param: address",
            "code": "IR_04"
        }
    }
</details>
<details>
    <summary>[Negative] 2. Create Card payout with missing billing details</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":100,"currency":"EUR","profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {
        "error": {
            "type": "invalid_request",
            "message": "Missing required param: address",
            "code": "IR_04"
        }
    }
</details>
<details>
    <summary>3. Create a SEPA payout with mandatory fields</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":1,"currency":"EUR","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","description":"Its my first payout request","payout_type":"bank","priority":"instant","payout_method_data":{"bank":{"iban":"NL06INGB5632579034"}},"connector":["adyenplatform"],"billing":{"address":{"line1":"Raadhuisplein","line2":"92","city":"Hoogeveen","country":"NL","first_name":"John"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5"}'
Response
    {"payout_id":"payout_rBKFN2yzDxmULDYFUApY","merchant_id":"merchant_1755587924","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyenplatform","payout_type":"bank","payout_method_data":{"bank":{"iban":"NL06I********79034","bank_name":null,"bank_country_code":null,"bank_city":null,"bic":null}},"billing":{"address":{"city":"Hoogeveen","country":"NL","line1":"Raadhuisplein","line2":"92","line3":null,"zip":null,"state":null,"first_name":"John","last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_5SyQoohBVj6cdUfmqLLK","customer":{"id":"cus_5SyQoohBVj6cdUfmqLLK","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_rBKFN2yzDxmULDYFUApY_secret_3G01mWdnAttOAfeC2wa8","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_KrzAoNCxtUDCf6kAzESd","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","created":"2025-08-19T09:31:28.239Z","connector_transaction_id":"38EBH16813GN2MVG","priority":"instant","payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_jod7TuYT46i6dCHkGmev"}
</details>
<details>
    <summary>4. Card payout with required fields</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":100,"currency":"EUR","profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","city":"San Fransico","country":"FR"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_Lg2UYU0m2wQQC23NIGSD","merchant_id":"merchant_1755587924","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":{"card":{"card_issuer":null,"card_network":null,"card_type":null,"card_issuing_country":null,"bank_code":null,"last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"FR","line1":"1467","line2":"Harrison Street","line3":null,"zip":null,"state":null,"first_name":null,"last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_5SyQoohBVj6cdUfmqLLK","customer":{"id":"cus_5SyQoohBVj6cdUfmqLLK","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_Lg2UYU0m2wQQC23NIGSD_secret_52k9WAGvV9OkAbfIZ4t4","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_KrzAoNCxtUDCf6kAzESd","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","created":"2025-08-19T09:32:26.497Z","connector_transaction_id":"38EBH66813GZBWSE","priority":null,"payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_sKZq1HLWSxrszfZGuubX"}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	58abb604d7a89519befa296d59506857bbdb0b8b | 
	Tested locally
<details>
    <summary>[Negative] 1. Create SEPA payout with missing billing details</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":1,"currency":"EUR","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","description":"Its my first payout request","payout_type":"bank","priority":"instant","payout_method_data":{"bank":{"iban":"NL06INGB5632579034"}},"connector":["adyenplatform"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5"}'
Response
    {
        "error": {
            "type": "invalid_request",
            "message": "Missing required param: address",
            "code": "IR_04"
        }
    }
</details>
<details>
    <summary>[Negative] 2. Create Card payout with missing billing details</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":100,"currency":"EUR","profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {
        "error": {
            "type": "invalid_request",
            "message": "Missing required param: address",
            "code": "IR_04"
        }
    }
</details>
<details>
    <summary>3. Create a SEPA payout with mandatory fields</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":1,"currency":"EUR","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","description":"Its my first payout request","payout_type":"bank","priority":"instant","payout_method_data":{"bank":{"iban":"NL06INGB5632579034"}},"connector":["adyenplatform"],"billing":{"address":{"line1":"Raadhuisplein","line2":"92","city":"Hoogeveen","country":"NL","first_name":"John"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5"}'
Response
    {"payout_id":"payout_rBKFN2yzDxmULDYFUApY","merchant_id":"merchant_1755587924","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyenplatform","payout_type":"bank","payout_method_data":{"bank":{"iban":"NL06I********79034","bank_name":null,"bank_country_code":null,"bank_city":null,"bic":null}},"billing":{"address":{"city":"Hoogeveen","country":"NL","line1":"Raadhuisplein","line2":"92","line3":null,"zip":null,"state":null,"first_name":"John","last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_5SyQoohBVj6cdUfmqLLK","customer":{"id":"cus_5SyQoohBVj6cdUfmqLLK","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_rBKFN2yzDxmULDYFUApY_secret_3G01mWdnAttOAfeC2wa8","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_KrzAoNCxtUDCf6kAzESd","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","created":"2025-08-19T09:31:28.239Z","connector_transaction_id":"38EBH16813GN2MVG","priority":"instant","payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_jod7TuYT46i6dCHkGmev"}
</details>
<details>
    <summary>4. Card payout with required fields</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \
        --data '{"amount":100,"currency":"EUR","profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","city":"San Fransico","country":"FR"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
    {"payout_id":"payout_Lg2UYU0m2wQQC23NIGSD","merchant_id":"merchant_1755587924","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":{"card":{"card_issuer":null,"card_network":null,"card_type":null,"card_issuing_country":null,"bank_code":null,"last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"FR","line1":"1467","line2":"Harrison Street","line3":null,"zip":null,"state":null,"first_name":null,"last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_5SyQoohBVj6cdUfmqLLK","customer":{"id":"cus_5SyQoohBVj6cdUfmqLLK","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_Lg2UYU0m2wQQC23NIGSD_secret_52k9WAGvV9OkAbfIZ4t4","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_KrzAoNCxtUDCf6kAzESd","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","created":"2025-08-19T09:32:26.497Z","connector_transaction_id":"38EBH66813GZBWSE","priority":null,"payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_sKZq1HLWSxrszfZGuubX"}
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-9022 | 
	Bug: [FEATURE]:  [Paysafe] add connector template code
- add connector template code for Paysafe | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index 0467346ec72..5fe3dbd05fa 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -276,6 +276,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://sandbox.payme.io/"
 payone.base_url = "https://payment.preprod.payone.com/"
 paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.snd.payu.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index a7dc0f04156..21ac732394f 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -113,6 +113,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://sandbox.payme.io/"
 payone.base_url = "https://payment.preprod.payone.com/"
 paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.snd.payu.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 07fc2b06cee..853ec279f66 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -117,6 +117,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://live.payme.io/"
 payone.base_url = "https://payment.payone.com/"
 paypal.base_url = "https://api-m.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.payu.com/api/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index dbbe67f07ff..dbd5e87e520 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -117,6 +117,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://sandbox.payme.io/"
 payone.base_url = "https://payment.preprod.payone.com/"
 paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.snd.payu.com/"
diff --git a/config/development.toml b/config/development.toml
index 0a2caf35505..1215c323628 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -315,6 +315,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://sandbox.payme.io/"
 payone.base_url = "https://payment.preprod.payone.com/"
 paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.snd.payu.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 5c753b91568..75305234278 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -202,6 +202,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://sandbox.payme.io/"
 payone.base_url = "https://payment.preprod.payone.com/"
 paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.snd.payu.com/"
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index c1cae71ffe1..fbdb974574a 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -270,6 +270,7 @@ pub struct ConnectorConfig {
     #[cfg(feature = "payouts")]
     pub payone_payout: Option<ConnectorTomlConfig>,
     pub paypal: Option<ConnectorTomlConfig>,
+    pub paysafe: Option<ConnectorTomlConfig>,
     #[cfg(feature = "payouts")]
     pub paypal_payout: Option<ConnectorTomlConfig>,
     pub paystack: Option<ConnectorTomlConfig>,
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index bdedcf9d1f7..ac14c55982f 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -6696,3 +6696,7 @@ payment_experience = "redirect_to_url"
 [hyperwallet.connector_auth.BodyKey]
 api_key = "Password"
 key1 = "Username"
+
+[paysafe]
+[paysafe.connector_auth.HeaderKey]
+api_key = "API Key"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 21c9f20fedc..5b14d328a68 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -5366,3 +5366,7 @@ type = "Text"
 [hyperwallet.connector_auth.BodyKey]
 api_key = "Password"
 key1 = "Username"
+
+[paysafe]
+[paysafe.connector_auth.HeaderKey]
+api_key = "API Key"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 597c3fb7276..486af69301f 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -6679,4 +6679,8 @@ payment_experience = "redirect_to_url"
 [hyperwallet]
 [hyperwallet.connector_auth.BodyKey]
 api_key = "Password"
-key1 = "Username"
\ No newline at end of file
+key1 = "Username"
+
+[paysafe]
+[paysafe.connector_auth.HeaderKey]
+api_key = "API Key"
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index e6494a5971a..60d6866beea 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -83,6 +83,7 @@ pub mod payload;
 pub mod payme;
 pub mod payone;
 pub mod paypal;
+pub mod paysafe;
 pub mod paystack;
 pub mod paytm;
 pub mod payu;
@@ -148,13 +149,13 @@ pub use self::{
     netcetera::Netcetera, nexinets::Nexinets, nexixpay::Nexixpay, nmi::Nmi, nomupay::Nomupay,
     noon::Noon, nordea::Nordea, novalnet::Novalnet, nuvei::Nuvei, opayo::Opayo, opennode::Opennode,
     paybox::Paybox, payeezy::Payeezy, payload::Payload, payme::Payme, payone::Payone,
-    paypal::Paypal, paystack::Paystack, paytm::Paytm, payu::Payu, phonepe::Phonepe,
-    placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz, prophetpay::Prophetpay,
-    rapyd::Rapyd, razorpay::Razorpay, recurly::Recurly, redsys::Redsys, riskified::Riskified,
-    santander::Santander, shift4::Shift4, sift::Sift, signifyd::Signifyd, silverflow::Silverflow,
-    square::Square, stax::Stax, stripe::Stripe, stripebilling::Stripebilling, taxjar::Taxjar,
-    threedsecureio::Threedsecureio, thunes::Thunes, tokenio::Tokenio, trustpay::Trustpay,
-    trustpayments::Trustpayments, tsys::Tsys,
+    paypal::Paypal, paysafe::Paysafe, paystack::Paystack, paytm::Paytm, payu::Payu,
+    phonepe::Phonepe, placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz,
+    prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, recurly::Recurly, redsys::Redsys,
+    riskified::Riskified, santander::Santander, shift4::Shift4, sift::Sift, signifyd::Signifyd,
+    silverflow::Silverflow, square::Square, stax::Stax, stripe::Stripe,
+    stripebilling::Stripebilling, taxjar::Taxjar, threedsecureio::Threedsecureio, thunes::Thunes,
+    tokenio::Tokenio, trustpay::Trustpay, trustpayments::Trustpayments, tsys::Tsys,
     unified_authentication_service::UnifiedAuthenticationService, vgs::Vgs, volt::Volt,
     wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, worldline::Worldline,
     worldpay::Worldpay, worldpayvantiv::Worldpayvantiv, worldpayxml::Worldpayxml, xendit::Xendit,
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
new file mode 100644
index 00000000000..fc76cece514
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
@@ -0,0 +1,621 @@
+pub mod transformers;
+
+use std::sync::LazyLock;
+
+use common_enums::enums;
+use common_utils::{
+    errors::CustomResult,
+    ext_traits::BytesExt,
+    request::{Method, Request, RequestBuilder, RequestContent},
+    types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+    payment_method_data::PaymentMethodData,
+    router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+    router_flow_types::{
+        access_token_auth::AccessTokenAuth,
+        payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+        refunds::{Execute, RSync},
+    },
+    router_request_types::{
+        AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+        RefundsData, SetupMandateRequestData,
+    },
+    router_response_types::{
+        ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods,
+    },
+    types::{
+        PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+        RefundSyncRouterData, RefundsRouterData,
+    },
+};
+use hyperswitch_interfaces::{
+    api::{
+        self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+        ConnectorValidation,
+    },
+    configs::Connectors,
+    errors,
+    events::connector_api_logs::ConnectorEvent,
+    types::{self, Response},
+    webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as paysafe;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Paysafe {
+    amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Paysafe {
+    pub fn new() -> &'static Self {
+        &Self {
+            amount_converter: &StringMinorUnitForConnector,
+        }
+    }
+}
+
+impl api::Payment for Paysafe {}
+impl api::PaymentSession for Paysafe {}
+impl api::ConnectorAccessToken for Paysafe {}
+impl api::MandateSetup for Paysafe {}
+impl api::PaymentAuthorize for Paysafe {}
+impl api::PaymentSync for Paysafe {}
+impl api::PaymentCapture for Paysafe {}
+impl api::PaymentVoid for Paysafe {}
+impl api::Refund for Paysafe {}
+impl api::RefundExecute for Paysafe {}
+impl api::RefundSync for Paysafe {}
+impl api::PaymentToken for Paysafe {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+    for Paysafe
+{
+    // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Paysafe
+where
+    Self: ConnectorIntegration<Flow, Request, Response>,
+{
+    fn build_headers(
+        &self,
+        req: &RouterData<Flow, Request, Response>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        let mut header = vec![(
+            headers::CONTENT_TYPE.to_string(),
+            self.get_content_type().to_string().into(),
+        )];
+        let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+        header.append(&mut api_key);
+        Ok(header)
+    }
+}
+
+impl ConnectorCommon for Paysafe {
+    fn id(&self) -> &'static str {
+        "paysafe"
+    }
+
+    fn get_currency_unit(&self) -> api::CurrencyUnit {
+        api::CurrencyUnit::Minor
+    }
+
+    fn common_get_content_type(&self) -> &'static str {
+        "application/json"
+    }
+
+    fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+        connectors.paysafe.base_url.as_ref()
+    }
+
+    fn get_auth_header(
+        &self,
+        auth_type: &ConnectorAuthType,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        let auth = paysafe::PaysafeAuthType::try_from(auth_type)
+            .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+        Ok(vec![(
+            headers::AUTHORIZATION.to_string(),
+            auth.api_key.expose().into_masked(),
+        )])
+    }
+
+    fn build_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        let response: paysafe::PaysafeErrorResponse = res
+            .response
+            .parse_struct("PaysafeErrorResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+
+        Ok(ErrorResponse {
+            status_code: res.status_code,
+            code: response.code,
+            message: response.message,
+            reason: response.reason,
+            attempt_status: None,
+            connector_transaction_id: None,
+            network_advice_code: None,
+            network_decline_code: None,
+            network_error_message: None,
+            connector_metadata: None,
+        })
+    }
+}
+
+impl ConnectorValidation for Paysafe {
+    fn validate_mandate_payment(
+        &self,
+        _pm_type: Option<enums::PaymentMethodType>,
+        pm_data: PaymentMethodData,
+    ) -> CustomResult<(), errors::ConnectorError> {
+        match pm_data {
+            PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
+                "validate_mandate_payment does not support cards".to_string(),
+            )
+            .into()),
+            _ => Ok(()),
+        }
+    }
+
+    fn validate_psync_reference_id(
+        &self,
+        _data: &PaymentsSyncData,
+        _is_three_ds: bool,
+        _status: enums::AttemptStatus,
+        _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
+    ) -> CustomResult<(), errors::ConnectorError> {
+        Ok(())
+    }
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Paysafe {
+    //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Paysafe {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Paysafe {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Paysafe {
+    fn get_headers(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &PaymentsAuthorizeRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let amount = utils::convert_amount(
+            self.amount_converter,
+            req.request.minor_amount,
+            req.request.currency,
+        )?;
+
+        let connector_router_data = paysafe::PaysafeRouterData::from((amount, req));
+        let connector_req = paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::PaymentsAuthorizeType::get_url(
+                    self, req, connectors,
+                )?)
+                .attach_default_headers()
+                .headers(types::PaymentsAuthorizeType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::PaymentsAuthorizeType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsAuthorizeRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+        let response: paysafe::PaysafePaymentsResponse = res
+            .response
+            .parse_struct("Paysafe PaymentsAuthorizeResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Paysafe {
+    fn get_headers(
+        &self,
+        req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &PaymentsSyncRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Get)
+                .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+                .attach_default_headers()
+                .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsSyncRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+        let response: paysafe::PaysafePaymentsResponse = res
+            .response
+            .parse_struct("paysafe PaymentsSyncResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Paysafe {
+    fn get_headers(
+        &self,
+        req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &PaymentsCaptureRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    }
+
+    fn get_request_body(
+        &self,
+        _req: &PaymentsCaptureRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Post)
+                .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+                .attach_default_headers()
+                .headers(types::PaymentsCaptureType::get_headers(
+                    self, req, connectors,
+                )?)
+                .set_body(types::PaymentsCaptureType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsCaptureRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+        let response: paysafe::PaysafePaymentsResponse = res
+            .response
+            .parse_struct("Paysafe PaymentsCaptureResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Paysafe {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Paysafe {
+    fn get_headers(
+        &self,
+        req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &RefundsRouterData<Execute>,
+        _connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    }
+
+    fn get_request_body(
+        &self,
+        req: &RefundsRouterData<Execute>,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let refund_amount = utils::convert_amount(
+            self.amount_converter,
+            req.request.minor_refund_amount,
+            req.request.currency,
+        )?;
+
+        let connector_router_data = paysafe::PaysafeRouterData::from((refund_amount, req));
+        let connector_req = paysafe::PaysafeRefundRequest::try_from(&connector_router_data)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        let request = RequestBuilder::new()
+            .method(Method::Post)
+            .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+            .attach_default_headers()
+            .headers(types::RefundExecuteType::get_headers(
+                self, req, connectors,
+            )?)
+            .set_body(types::RefundExecuteType::get_request_body(
+                self, req, connectors,
+            )?)
+            .build();
+        Ok(Some(request))
+    }
+
+    fn handle_response(
+        &self,
+        data: &RefundsRouterData<Execute>,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+        let response: paysafe::RefundResponse = res
+            .response
+            .parse_struct("paysafe RefundResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Paysafe {
+    fn get_headers(
+        &self,
+        req: &RefundSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &RefundSyncRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+    }
+
+    fn build_request(
+        &self,
+        req: &RefundSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        Ok(Some(
+            RequestBuilder::new()
+                .method(Method::Get)
+                .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+                .attach_default_headers()
+                .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+                .set_body(types::RefundSyncType::get_request_body(
+                    self, req, connectors,
+                )?)
+                .build(),
+        ))
+    }
+
+    fn handle_response(
+        &self,
+        data: &RefundSyncRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+        let response: paysafe::RefundResponse = res
+            .response
+            .parse_struct("paysafe RefundSyncResponse")
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Paysafe {
+    fn get_webhook_object_reference_id(
+        &self,
+        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+    ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+        Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+    }
+
+    fn get_webhook_event_type(
+        &self,
+        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+    ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+        Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+    }
+
+    fn get_webhook_resource_object(
+        &self,
+        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+    ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+        Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+    }
+}
+
+static PAYSAFE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+    LazyLock::new(SupportedPaymentMethods::new);
+
+static PAYSAFE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+    display_name: "Paysafe",
+    description: "Paysafe connector",
+    connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
+    integration_status: enums::ConnectorIntegrationStatus::Sandbox,
+};
+
+static PAYSAFE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Paysafe {
+    fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+        Some(&PAYSAFE_CONNECTOR_INFO)
+    }
+
+    fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+        Some(&*PAYSAFE_SUPPORTED_PAYMENT_METHODS)
+    }
+
+    fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+        Some(&PAYSAFE_SUPPORTED_WEBHOOK_FLOWS)
+    }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
new file mode 100644
index 00000000000..f1a7dbdc237
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
@@ -0,0 +1,219 @@
+use common_enums::enums;
+use common_utils::types::StringMinorUnit;
+use hyperswitch_domain_models::{
+    payment_method_data::PaymentMethodData,
+    router_data::{ConnectorAuthType, RouterData},
+    router_flow_types::refunds::{Execute, RSync},
+    router_request_types::ResponseId,
+    router_response_types::{PaymentsResponseData, RefundsResponseData},
+    types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::types::{RefundsResponseRouterData, ResponseRouterData};
+
+//TODO: Fill the struct with respective fields
+pub struct PaysafeRouterData<T> {
+    pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+    pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for PaysafeRouterData<T> {
+    fn from((amount, item): (StringMinorUnit, T)) -> Self {
+        //Todo :  use utils to convert the amount to the type of amount that a connector accepts
+        Self {
+            amount,
+            router_data: item,
+        }
+    }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct PaysafePaymentsRequest {
+    amount: StringMinorUnit,
+    card: PaysafeCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct PaysafeCard {
+    number: cards::CardNumber,
+    expiry_month: Secret<String>,
+    expiry_year: Secret<String>,
+    cvc: Secret<String>,
+    complete: bool,
+}
+
+impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymentsRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: &PaysafeRouterData<&PaymentsAuthorizeRouterData>,
+    ) -> Result<Self, Self::Error> {
+        match item.router_data.request.payment_method_data.clone() {
+            PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
+                "Card payment method not implemented".to_string(),
+            )
+            .into()),
+            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+        }
+    }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct PaysafeAuthType {
+    pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for PaysafeAuthType {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+        match auth_type {
+            ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+                api_key: api_key.to_owned(),
+            }),
+            _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+        }
+    }
+}
+// PaymentsResponse
+//TODO: Append the remaining status flags
+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum PaysafePaymentStatus {
+    Succeeded,
+    Failed,
+    #[default]
+    Processing,
+}
+
+impl From<PaysafePaymentStatus> for common_enums::AttemptStatus {
+    fn from(item: PaysafePaymentStatus) -> Self {
+        match item {
+            PaysafePaymentStatus::Succeeded => Self::Charged,
+            PaysafePaymentStatus::Failed => Self::Failure,
+            PaysafePaymentStatus::Processing => Self::Authorizing,
+        }
+    }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PaysafePaymentsResponse {
+    status: PaysafePaymentStatus,
+    id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, PaysafePaymentsResponse, T, PaymentsResponseData>>
+    for RouterData<F, T, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<F, PaysafePaymentsResponse, T, PaymentsResponseData>,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            status: common_enums::AttemptStatus::from(item.response.status),
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(None),
+                connector_metadata: None,
+                network_txn_id: None,
+                connector_response_reference_id: None,
+                incremental_authorization_allowed: None,
+                charges: None,
+            }),
+            ..item.data
+        })
+    }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct PaysafeRefundRequest {
+    pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&PaysafeRouterData<&RefundsRouterData<F>>> for PaysafeRefundRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: &PaysafeRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+        Ok(Self {
+            amount: item.amount.to_owned(),
+        })
+    }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+    Succeeded,
+    Failed,
+    #[default]
+    Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+    fn from(item: RefundStatus) -> Self {
+        match item {
+            RefundStatus::Succeeded => Self::Success,
+            RefundStatus::Failed => Self::Failure,
+            RefundStatus::Processing => Self::Pending,
+            //TODO: Review mapping
+        }
+    }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+    id: String,
+    status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: RefundsResponseRouterData<Execute, RefundResponse>,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            response: Ok(RefundsResponseData {
+                connector_refund_id: item.response.id.to_string(),
+                refund_status: enums::RefundStatus::from(item.response.status),
+            }),
+            ..item.data
+        })
+    }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: RefundsResponseRouterData<RSync, RefundResponse>,
+    ) -> Result<Self, Self::Error> {
+        Ok(Self {
+            response: Ok(RefundsResponseData {
+                connector_refund_id: item.response.id.to_string(),
+                refund_status: enums::RefundStatus::from(item.response.status),
+            }),
+            ..item.data
+        })
+    }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct PaysafeErrorResponse {
+    pub status_code: u16,
+    pub code: String,
+    pub message: String,
+    pub reason: Option<String>,
+    pub network_advice_code: Option<String>,
+    pub network_decline_code: Option<String>,
+    pub network_error_message: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index f18b659184e..8b87e0c098a 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -228,6 +228,7 @@ default_imp_for_authorize_session_token!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -374,6 +375,7 @@ default_imp_for_calculate_tax!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -432,6 +434,7 @@ macro_rules! default_imp_for_session_update {
 }
 
 default_imp_for_session_update!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyen,
@@ -573,6 +576,7 @@ macro_rules! default_imp_for_post_session_tokens {
 }
 
 default_imp_for_post_session_tokens!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyen,
@@ -802,6 +806,7 @@ default_imp_for_create_order!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -908,6 +913,7 @@ default_imp_for_update_metadata!(
     connectors::Katapult,
     connectors::Klarna,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Rapyd,
     connectors::Razorpay,
     connectors::Recurly,
@@ -1049,6 +1055,7 @@ default_imp_for_cancel_post_capture!(
     connectors::Katapult,
     connectors::Klarna,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Rapyd,
     connectors::Razorpay,
     connectors::Recurly,
@@ -1138,6 +1145,7 @@ macro_rules! default_imp_for_complete_authorize {
 }
 
 default_imp_for_complete_authorize!(
+    connectors::Paysafe,
     connectors::Silverflow,
     connectors::Vgs,
     connectors::Aci,
@@ -1257,6 +1265,7 @@ macro_rules! default_imp_for_incremental_authorization {
 }
 
 default_imp_for_incremental_authorization!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyen,
@@ -1473,6 +1482,7 @@ default_imp_for_create_customer!(
     connectors::Payload,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1533,6 +1543,7 @@ macro_rules! default_imp_for_connector_redirect_response {
 }
 
 default_imp_for_connector_redirect_response!(
+    connectors::Paysafe,
     connectors::Trustpayments,
     connectors::Vgs,
     connectors::Aci,
@@ -1653,6 +1664,7 @@ macro_rules! default_imp_for_pre_processing_steps{
 }
 
 default_imp_for_pre_processing_steps!(
+    connectors::Paysafe,
     connectors::Trustpayments,
     connectors::Silverflow,
     connectors::Vgs,
@@ -1858,6 +1870,7 @@ default_imp_for_post_processing_steps!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1999,6 +2012,7 @@ default_imp_for_approve!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payone,
@@ -2143,6 +2157,7 @@ default_imp_for_reject!(
     connectors::Payone,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2208,6 +2223,7 @@ macro_rules! default_imp_for_webhook_source_verification {
 }
 
 default_imp_for_webhook_source_verification!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyen,
@@ -2427,6 +2443,7 @@ default_imp_for_accept_dispute!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2566,6 +2583,7 @@ default_imp_for_submit_evidence!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Payone,
     connectors::Paystack,
     connectors::Paytm,
@@ -2706,6 +2724,7 @@ default_imp_for_defend_dispute!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2849,6 +2868,7 @@ default_imp_for_fetch_disputes!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Payu,
     connectors::Paytm,
@@ -2991,6 +3011,7 @@ default_imp_for_dispute_sync!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Payu,
     connectors::Paytm,
@@ -3140,6 +3161,7 @@ default_imp_for_file_upload!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3196,6 +3218,7 @@ macro_rules! default_imp_for_payouts {
 }
 
 default_imp_for_payouts!(
+    connectors::Paysafe,
     connectors::Affirm,
     connectors::Vgs,
     connectors::Aci,
@@ -3331,6 +3354,7 @@ macro_rules! default_imp_for_payouts_create {
 
 #[cfg(feature = "payouts")]
 default_imp_for_payouts_create!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyenplatform,
@@ -3470,6 +3494,7 @@ macro_rules! default_imp_for_payouts_retrieve {
 
 #[cfg(feature = "payouts")]
 default_imp_for_payouts_retrieve!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyen,
@@ -3686,6 +3711,7 @@ default_imp_for_payouts_eligibility!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payone,
@@ -3753,6 +3779,7 @@ macro_rules! default_imp_for_payouts_fulfill {
 
 #[cfg(feature = "payouts")]
 default_imp_for_payouts_fulfill!(
+    connectors::Paysafe,
     connectors::Affirm,
     connectors::Vgs,
     connectors::Aci,
@@ -3963,6 +3990,7 @@ default_imp_for_payouts_cancel!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payone,
@@ -4105,6 +4133,7 @@ default_imp_for_payouts_quote!(
     connectors::Payone,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4247,6 +4276,7 @@ default_imp_for_payouts_recipient!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4389,6 +4419,7 @@ default_imp_for_payouts_recipient_account!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4533,6 +4564,7 @@ default_imp_for_frm_sale!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4676,6 +4708,7 @@ default_imp_for_frm_checkout!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4819,6 +4852,7 @@ default_imp_for_frm_transaction!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4962,6 +4996,7 @@ default_imp_for_frm_fulfillment!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -5105,6 +5140,7 @@ default_imp_for_frm_record_return!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -5242,6 +5278,7 @@ default_imp_for_revoking_mandates!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -5382,6 +5419,7 @@ default_imp_for_uas_pre_authentication!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -5522,6 +5560,7 @@ default_imp_for_uas_post_authentication!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -5675,6 +5714,7 @@ default_imp_for_uas_authentication_confirmation!(
     connectors::Multisafepay,
     connectors::Paybox,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Placetopay,
     connectors::Plaid,
     connectors::Rapyd,
@@ -5799,6 +5839,7 @@ default_imp_for_connector_request_id!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Powertranz,
     connectors::Prophetpay,
     connectors::Mifinity,
@@ -5931,6 +5972,7 @@ default_imp_for_fraud_check!(
     connectors::Paystack,
     connectors::Paytm,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Payu,
     connectors::Phonepe,
     connectors::Powertranz,
@@ -6107,6 +6149,7 @@ default_imp_for_connector_authentication!(
     connectors::Paybox,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Placetopay,
     connectors::Plaid,
     connectors::Rapyd,
@@ -6229,6 +6272,7 @@ default_imp_for_uas_authentication!(
     connectors::Payeezy,
     connectors::Payload,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -6370,6 +6414,7 @@ default_imp_for_revenue_recovery!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Powertranz,
     connectors::Prophetpay,
     connectors::Mifinity,
@@ -6514,6 +6559,7 @@ default_imp_for_billing_connector_payment_sync!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Powertranz,
     connectors::Prophetpay,
     connectors::Mifinity,
@@ -6656,6 +6702,7 @@ default_imp_for_revenue_recovery_record_back!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Powertranz,
     connectors::Prophetpay,
     connectors::Mifinity,
@@ -6798,6 +6845,7 @@ default_imp_for_billing_connector_invoice_sync!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Powertranz,
     connectors::Prophetpay,
     connectors::Mifinity,
@@ -6934,6 +6982,7 @@ default_imp_for_external_vault!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Plaid,
     connectors::Powertranz,
     connectors::Prophetpay,
@@ -7076,6 +7125,7 @@ default_imp_for_external_vault_insert!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Plaid,
     connectors::Powertranz,
     connectors::Prophetpay,
@@ -7218,6 +7268,7 @@ default_imp_for_external_vault_retrieve!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Plaid,
     connectors::Powertranz,
     connectors::Prophetpay,
@@ -7360,6 +7411,7 @@ default_imp_for_external_vault_delete!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Plaid,
     connectors::Powertranz,
     connectors::Prophetpay,
@@ -7502,6 +7554,7 @@ default_imp_for_external_vault_create!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Plaid,
     connectors::Powertranz,
     connectors::Prophetpay,
@@ -7645,6 +7698,7 @@ default_imp_for_connector_authentication_token!(
     connectors::Payu,
     connectors::Phonepe,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Plaid,
     connectors::Powertranz,
     connectors::Prophetpay,
@@ -7789,6 +7843,7 @@ default_imp_for_external_vault_proxy_payments_create!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 2d346a0e7c2..5dc07ab43d4 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -338,6 +338,7 @@ default_imp_for_new_connector_integration_payment!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -481,6 +482,7 @@ default_imp_for_new_connector_integration_refund!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -616,6 +618,7 @@ default_imp_for_new_connector_integration_connector_authentication_token!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Payu,
     connectors::Placetopay,
@@ -750,6 +753,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -893,6 +897,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1041,6 +1046,7 @@ default_imp_for_new_connector_integration_fetch_disputes!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1185,6 +1191,7 @@ default_imp_for_new_connector_integration_dispute_sync!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1324,6 +1331,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1466,6 +1474,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Payu,
     connectors::Paytm,
@@ -1619,6 +1628,7 @@ default_imp_for_new_connector_integration_file_upload!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1764,6 +1774,7 @@ default_imp_for_new_connector_integration_payouts_create!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -1909,6 +1920,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2054,6 +2066,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2199,6 +2212,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2344,6 +2358,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2489,6 +2504,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2634,6 +2650,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2779,6 +2796,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -2922,6 +2940,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3067,6 +3086,7 @@ default_imp_for_new_connector_integration_frm_sale!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3212,6 +3232,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3357,6 +3378,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3502,6 +3524,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3647,6 +3670,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -3711,6 +3735,7 @@ macro_rules! default_imp_for_new_connector_integration_revoking_mandates {
 }
 
 default_imp_for_new_connector_integration_revoking_mandates!(
+    connectors::Paysafe,
     connectors::Vgs,
     connectors::Aci,
     connectors::Adyen,
@@ -3847,6 +3872,7 @@ macro_rules! default_imp_for_new_connector_integration_frm {
 
 #[cfg(feature = "frm")]
 default_imp_for_new_connector_integration_frm!(
+    connectors::Paysafe,
     connectors::Trustpayments,
     connectors::Affirm,
     connectors::Paytm,
@@ -3989,6 +4015,7 @@ macro_rules! default_imp_for_new_connector_integration_connector_authentication
 }
 
 default_imp_for_new_connector_integration_connector_authentication!(
+    connectors::Paysafe,
     connectors::Trustpayments,
     connectors::Affirm,
     connectors::Paytm,
@@ -4120,6 +4147,7 @@ macro_rules! default_imp_for_new_connector_integration_revenue_recovery {
 }
 
 default_imp_for_new_connector_integration_revenue_recovery!(
+    connectors::Paysafe,
     connectors::Trustpayments,
     connectors::Affirm,
     connectors::Paytm,
@@ -4339,6 +4367,7 @@ default_imp_for_new_connector_integration_external_vault!(
     connectors::Payload,
     connectors::Payme,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
@@ -4486,6 +4515,7 @@ default_imp_for_new_connector_integration_external_vault_proxy!(
     connectors::Payme,
     connectors::Payone,
     connectors::Paypal,
+    connectors::Paysafe,
     connectors::Paystack,
     connectors::Paytm,
     connectors::Payu,
diff --git a/crates/hyperswitch_domain_models/src/connector_endpoints.rs b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
index 53b17691fea..d6b62a5eb45 100644
--- a/crates/hyperswitch_domain_models/src/connector_endpoints.rs
+++ b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
@@ -98,6 +98,7 @@ pub struct Connectors {
     pub payme: ConnectorParams,
     pub payone: ConnectorParams,
     pub paypal: ConnectorParams,
+    pub paysafe: ConnectorParams,
     pub paystack: ConnectorParams,
     pub paytm: ConnectorParams,
     pub payu: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 5e375593ea3..a8e859cc5b3 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -31,20 +31,20 @@ pub use hyperswitch_connectors::connectors::{
     nexixpay, nexixpay::Nexixpay, nmi, nmi::Nmi, nomupay, nomupay::Nomupay, noon, noon::Noon,
     nordea, nordea::Nordea, novalnet, novalnet::Novalnet, nuvei, nuvei::Nuvei, opayo, opayo::Opayo,
     opennode, opennode::Opennode, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payload,
-    payload::Payload, payme, payme::Payme, payone, payone::Payone, paypal, paypal::Paypal,
-    paystack, paystack::Paystack, paytm, paytm::Paytm, payu, payu::Payu, phonepe, phonepe::Phonepe,
-    placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz, powertranz::Powertranz,
-    prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, recurly,
-    recurly::Recurly, redsys, redsys::Redsys, riskified, riskified::Riskified, santander,
-    santander::Santander, shift4, shift4::Shift4, sift, sift::Sift, signifyd, signifyd::Signifyd,
-    silverflow, silverflow::Silverflow, square, square::Square, stax, stax::Stax, stripe,
-    stripe::Stripe, stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar,
-    threedsecureio, threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenio,
-    tokenio::Tokenio, trustpay, trustpay::Trustpay, trustpayments, trustpayments::Trustpayments,
-    tsys, tsys::Tsys, unified_authentication_service,
-    unified_authentication_service::UnifiedAuthenticationService, vgs, vgs::Vgs, volt, volt::Volt,
-    wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, wellsfargopayout::Wellsfargopayout, wise,
-    wise::Wise, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, worldpayvantiv,
-    worldpayvantiv::Worldpayvantiv, worldpayxml, worldpayxml::Worldpayxml, xendit, xendit::Xendit,
-    zen, zen::Zen, zsl, zsl::Zsl,
+    payload::Payload, payme, payme::Payme, payone, payone::Payone, paypal, paypal::Paypal, paysafe,
+    paysafe::Paysafe, paystack, paystack::Paystack, paytm, paytm::Paytm, payu, payu::Payu, phonepe,
+    phonepe::Phonepe, placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz,
+    powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay,
+    razorpay::Razorpay, recurly, recurly::Recurly, redsys, redsys::Redsys, riskified,
+    riskified::Riskified, santander, santander::Santander, shift4, shift4::Shift4, sift,
+    sift::Sift, signifyd, signifyd::Signifyd, silverflow, silverflow::Silverflow, square,
+    square::Square, stax, stax::Stax, stripe, stripe::Stripe, stripebilling,
+    stripebilling::Stripebilling, taxjar, taxjar::Taxjar, threedsecureio,
+    threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenio, tokenio::Tokenio, trustpay,
+    trustpay::Trustpay, trustpayments, trustpayments::Trustpayments, tsys, tsys::Tsys,
+    unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService,
+    vgs, vgs::Vgs, volt, volt::Volt, wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout,
+    wellsfargopayout::Wellsfargopayout, wise, wise::Wise, worldline, worldline::Worldline,
+    worldpay, worldpay::Worldpay, worldpayvantiv, worldpayvantiv::Worldpayvantiv, worldpayxml,
+    worldpayxml::Worldpayxml, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
 };
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index ca96206e0af..87434a0e6dd 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -87,6 +87,7 @@ mod payload;
 mod payme;
 mod payone;
 mod paypal;
+mod paysafe;
 mod paystack;
 mod paytm;
 mod payu;
diff --git a/crates/router/tests/connectors/paysafe.rs b/crates/router/tests/connectors/paysafe.rs
new file mode 100644
index 00000000000..36afbb0368c
--- /dev/null
+++ b/crates/router/tests/connectors/paysafe.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct PaysafeTest;
+impl ConnectorActions for PaysafeTest {}
+impl utils::Connector for PaysafeTest {
+    fn get_data(&self) -> api::ConnectorData {
+        use router::connector::Paysafe;
+        utils::construct_connector_data_old(
+            Box::new(Paysafe::new()),
+            types::Connector::Plaid,
+            api::GetToken::Connector,
+            None,
+        )
+    }
+
+    fn get_auth_token(&self) -> types::ConnectorAuthType {
+        utils::to_connector_auth_type(
+            connector_auth::ConnectorAuthentication::new()
+                .paysafe
+                .expect("Missing connector authentication configuration")
+                .into(),
+        )
+    }
+
+    fn get_name(&self) -> String {
+        "paysafe".to_string()
+    }
+}
+
+static CONNECTOR: PaysafeTest = PaysafeTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+    None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+    None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+    let response = CONNECTOR
+        .authorize_payment(payment_method_details(), get_default_payment_info())
+        .await
+        .expect("Authorize payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+    let response = CONNECTOR
+        .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+        .await
+        .expect("Capture payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+    let response = CONNECTOR
+        .authorize_and_capture_payment(
+            payment_method_details(),
+            Some(types::PaymentsCaptureData {
+                amount_to_capture: 50,
+                ..utils::PaymentCaptureType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("Capture payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+    let authorize_response = CONNECTOR
+        .authorize_payment(payment_method_details(), get_default_payment_info())
+        .await
+        .expect("Authorize payment response");
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    let response = CONNECTOR
+        .psync_retry_till_status_matches(
+            enums::AttemptStatus::Authorized,
+            Some(types::PaymentsSyncData {
+                connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+                    txn_id.unwrap(),
+                ),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("PSync response");
+    assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+    let response = CONNECTOR
+        .authorize_and_void_payment(
+            payment_method_details(),
+            Some(types::PaymentsCancelData {
+                connector_transaction_id: String::from(""),
+                cancellation_reason: Some("requested_by_customer".to_string()),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .expect("Void payment response");
+    assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+    let response = CONNECTOR
+        .capture_payment_and_refund(
+            payment_method_details(),
+            None,
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+    let response = CONNECTOR
+        .capture_payment_and_refund(
+            payment_method_details(),
+            None,
+            Some(types::RefundsData {
+                refund_amount: 50,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+    let refund_response = CONNECTOR
+        .capture_payment_and_refund(
+            payment_method_details(),
+            None,
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    let response = CONNECTOR
+        .rsync_retry_till_status_matches(
+            enums::RefundStatus::Success,
+            refund_response.response.unwrap().connector_refund_id,
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+    let authorize_response = CONNECTOR
+        .make_payment(payment_method_details(), get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+    let authorize_response = CONNECTOR
+        .make_payment(payment_method_details(), get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    assert_ne!(txn_id, None, "Empty connector transaction id");
+    let response = CONNECTOR
+        .psync_retry_till_status_matches(
+            enums::AttemptStatus::Charged,
+            Some(types::PaymentsSyncData {
+                connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+                    txn_id.unwrap(),
+                ),
+                capture_method: Some(enums::CaptureMethod::Automatic),
+                ..Default::default()
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+    let response = CONNECTOR
+        .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+    let refund_response = CONNECTOR
+        .make_payment_and_refund(
+            payment_method_details(),
+            Some(types::RefundsData {
+                refund_amount: 50,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        refund_response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+    CONNECTOR
+        .make_payment_and_multiple_refund(
+            payment_method_details(),
+            Some(types::RefundsData {
+                refund_amount: 50,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+    let refund_response = CONNECTOR
+        .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+        .await
+        .unwrap();
+    let response = CONNECTOR
+        .rsync_retry_till_status_matches(
+            enums::RefundStatus::Success,
+            refund_response.response.unwrap().connector_refund_id,
+            None,
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap().refund_status,
+        enums::RefundStatus::Success,
+    );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+    let response = CONNECTOR
+        .make_payment(
+            Some(types::PaymentsAuthorizeData {
+                payment_method_data: PaymentMethodData::Card(Card {
+                    card_cvc: Secret::new("12345".to_string()),
+                    ..utils::CCardType::default().0
+                }),
+                ..utils::PaymentAuthorizeType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap_err().message,
+        "Your card's security code is invalid.".to_string(),
+    );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+    let response = CONNECTOR
+        .make_payment(
+            Some(types::PaymentsAuthorizeData {
+                payment_method_data: PaymentMethodData::Card(Card {
+                    card_exp_month: Secret::new("20".to_string()),
+                    ..utils::CCardType::default().0
+                }),
+                ..utils::PaymentAuthorizeType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap_err().message,
+        "Your card's expiration month is invalid.".to_string(),
+    );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+    let response = CONNECTOR
+        .make_payment(
+            Some(types::PaymentsAuthorizeData {
+                payment_method_data: PaymentMethodData::Card(Card {
+                    card_exp_year: Secret::new("2000".to_string()),
+                    ..utils::CCardType::default().0
+                }),
+                ..utils::PaymentAuthorizeType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap_err().message,
+        "Your card's expiration year is invalid.".to_string(),
+    );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+    let authorize_response = CONNECTOR
+        .make_payment(payment_method_details(), get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+    let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+    assert_ne!(txn_id, None, "Empty connector transaction id");
+    let void_response = CONNECTOR
+        .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(
+        void_response.response.unwrap_err().message,
+        "You cannot cancel this PaymentIntent because it has a status of succeeded."
+    );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+    let capture_response = CONNECTOR
+        .capture_payment("123456789".to_string(), None, get_default_payment_info())
+        .await
+        .unwrap();
+    assert_eq!(
+        capture_response.response.unwrap_err().message,
+        String::from("No such payment_intent: '123456789'")
+    );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+    let response = CONNECTOR
+        .make_payment_and_refund(
+            payment_method_details(),
+            Some(types::RefundsData {
+                refund_amount: 150,
+                ..utils::PaymentRefundType::default().0
+            }),
+            get_default_payment_info(),
+        )
+        .await
+        .unwrap();
+    assert_eq!(
+        response.response.unwrap_err().message,
+        "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+    );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 49cb0717c76..720bdb32a61 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -94,6 +94,7 @@ pub struct ConnectorAuthentication {
     pub payme: Option<BodyKey>,
     pub payone: Option<HeaderKey>,
     pub paypal: Option<BodyKey>,
+    pub paysafe: Option<HeaderKey>,
     pub paystack: Option<HeaderKey>,
     pub paytm: Option<HeaderKey>,
     pub payu: Option<BodyKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 9c0a2efd561..374119bebbc 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -169,6 +169,7 @@ payload.base_url = "https://api.payload.com"
 payme.base_url = "https://sandbox.payme.io/"
 payone.base_url = "https://payment.preprod.payone.com/"
 paypal.base_url = "https://api-m.sandbox.paypal.com/"
+paysafe.base_url = "https://api.test.paysafe.com/paymenthub/"
 paystack.base_url = "https://api.paystack.co"
 paytm.base_url = "https://securegw-stage.paytm.in/"
 payu.base_url = "https://secure.snd.payu.com/"
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index b826b23850c..6f041b8fa01 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
     git checkout $self
     cp $self $self.tmp
     # Add new connector to existing list and sort it
-    connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluecode bluesnap boku braintree breadpay cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu flexiti forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paystack paytm payu phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar threedsecureio thunes tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1")
+    connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluecode bluesnap boku braintree breadpay cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu flexiti forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paysafe paystack paytm payu phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar threedsecureio thunes tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1")
 
 
     IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
 | 
	2025-08-21T12:05:44Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Add connector template code for Paysafe
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
No test required as it is template PR
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	d18a94188ea93d07c4581888880088a9e676b1fd | 
	No test required as it is template PR
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8968 | 
	Bug: [FEATURE] Cypress test for UCS through Hyperswitch
### Feature Description
there should be a cypress test supported for ucs through hyperswitch
### Possible Implementation
make code changes in cypress folder and call ucs related api's
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	2025-08-18T03:51:27Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
added cypress test for ucs by maintaing the flow
Closes #8968 
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
You can test it with 
`npm run cypress:ucs`
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
ScreenShot of the tests
<img width="1728" height="1056" alt="Screenshot 2025-08-18 at 9 15 17 AM" src="https://github.com/user-attachments/assets/20040bb1-c6a1-4158-a387-50c66330bbdd" />
<img width="1728" height="1062" alt="Screenshot 2025-08-18 at 9 15 30 AM" src="https://github.com/user-attachments/assets/809c8e81-0bc4-4d15-a754-aa1a08be7c30" />
 | 
	e2d72bef7dc07540ee4d54bfc79b934bc303dca7 | 
	
You can test it with 
`npm run cypress:ucs`
 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8945 | 
	Bug: [BUG] Webhook source verification is `false` for NMI
[Connector documentation](https://docs.nmi.com/reference/overview) php example says this:
```php
  function webhookIsVerified($webhookBody, $signingKey, $nonce, $sig) {
    return $sig === hash_hmac("sha256", $nonce . "." . $webhookBody, $signingKey);
  }
  try {
    $signingKey = "YOUR_SIGNING_KEY_HERE";
    $webhookBody = file_get_contents("php://input");
    $headers = getallheaders();
    $sigHeader = $headers['Webhook-Signature'];
    if (!is_null($sigHeader) && strlen($sigHeader) < 1) {
      throw new Exception("invalid webhook - signature header missing");
    }
    if (preg_match('/t=(.*),s=(.*)/', $sigHeader, $matches)) {
      $nonce = $matches[1];
      $signature = $matches[2];
    } else {
      throw new Exception("unrecognized webhook signature format");
    }
    if (!webhookIsVerified($webhookBody, $signingKey, $nonce, $signature)) {
      throw new Exception("invalid webhook - invalid signature, cannot verify sender");
    }
    // webhook is now verified to have been sent by us, continue processing
    echo "webhook is verified";
    $webhook = json_decode($webhookBody);
    var_export($webhook);
  } catch (Exception $e) {
    echo "error: $e\n";
  }
```
In Hyperswitch code:
`signature` and `nonce` extraction is wrong. We are extracting `nonce` instead of the signature from the `Webhook-Signature` header and the entire match instead of just the `nonce` value here:
- `captures.get(0)` -- entire match instead of nonce, because 0 contains entire regex match
- `captures.get(1)` -- nonce instead of signature | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rs
index 7ae21664e73..50e5db86e5a 100644
--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs
@@ -9,6 +9,7 @@ use common_utils::{
     types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
 };
 use error_stack::{report, ResultExt};
+use hex;
 use hyperswitch_domain_models::{
     router_data::{AccessToken, ErrorResponse, RouterData},
     router_flow_types::{
@@ -859,13 +860,15 @@ impl IncomingWebhook for Nmi {
             .captures(sig_header)
         {
             let signature = captures
-                .get(1)
+                .get(2)
                 .ok_or(ConnectorError::WebhookSignatureNotFound)?
                 .as_str();
-            return Ok(signature.as_bytes().to_vec());
-        }
 
-        Err(report!(ConnectorError::WebhookSignatureNotFound))
+            // Decode hex signature to bytes
+            hex::decode(signature).change_context(ConnectorError::WebhookSignatureNotFound)
+        } else {
+            Err(report!(ConnectorError::WebhookSignatureNotFound))
+        }
     }
 
     fn get_webhook_source_verification_message(
@@ -883,15 +886,16 @@ impl IncomingWebhook for Nmi {
             .captures(sig_header)
         {
             let nonce = captures
-                .get(0)
+                .get(1)
                 .ok_or(ConnectorError::WebhookSignatureNotFound)?
                 .as_str();
 
             let message = format!("{}.{}", nonce, String::from_utf8_lossy(request.body));
 
-            return Ok(message.into_bytes());
+            Ok(message.into_bytes())
+        } else {
+            Err(report!(ConnectorError::WebhookSignatureNotFound))
         }
-        Err(report!(ConnectorError::WebhookSignatureNotFound))
     }
 
     fn get_webhook_object_reference_id(
 | 
	2025-08-13T14:43:55Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
the problem is that we previously extracted `nonce` instead of `signature` and entire regex match instead of `nonce`. this pr fixes webhook source verification for nmi connector by properly extracting `signature` (`2`) and `nonce` (`1`) values.
check attached issue for detailed explanation.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
webhook source verification must not be `false` unless connector does not support it. in this case, it was a mistake from our end where we parsed wrong values.
closes https://github.com/juspay/hyperswitch/issues/8945
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<details>
<summary>Setup webhooks for NMI connector and also the signature verification</summary>
<img width="1212" height="130" alt="image" src="https://github.com/user-attachments/assets/3759cb84-57f6-441e-845e-d6c53868764a" />
<img width="385" height="30" alt="image" src="https://github.com/user-attachments/assets/2df31bc8-54a4-4779-b112-433526318be3" />
<img width="193" height="55" alt="image" src="https://github.com/user-attachments/assets/eeb4287f-e309-49b0-9943-19334a8c7994" />
</details>
<details>
<summary>Make a Payment</summary>
```curl
curl --location 'https://pix-mbp.orthrus-monster.ts.net/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_A3aKSnvxEuazXkjOdUMlrNTSpmIlH9MlaWJj9Ax9xEpFqGN4aVBUGINJjkjSlRdz' \
--data-raw '{
    "amount": 60159,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 60159,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```json
{
	"payment_id": "pay_46yfYfNcSmMZ847bso0p",
	"merchant_id": "postman_merchant_GHAction_1755093166",
	"status": "succeeded",
	"amount": 15429,
	"net_amount": 15429,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 15429,
	"connector": "nmi",
	"client_secret": "pay_46yfYfNcSmMZ847bso0p_secret_55lzxYdXlKlBI80u1Y8w",
	"created": "2025-08-13T14:25:56.929Z",
	"currency": "USD",
	"customer_id": "StripeCustomer",
	"customer": {
		"id": "StripeCustomer",
		"name": "John Doe",
		"email": "guest@example.com",
		"phone": "999999999",
		"phone_country_code": "+1"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "1111",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "JP Morgan",
			"card_issuing_country": "INDIA",
			"card_isin": "411111",
			"card_extended_bin": null,
			"card_exp_month": "10",
			"card_exp_year": "25",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": "token_0k7Cgt2Xh8LXsZAxF3gz",
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "PiX",
			"last_name": null,
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "PiX",
			"last_name": null,
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"order_details": null,
	"email": "guest@example.com",
	"name": "John Doe",
	"phone": "999999999",
	"return_url": "https://duck.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "joseph",
	"statement_descriptor_suffix": "JS",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "StripeCustomer",
		"created_at": 1755095156,
		"expires": 1755098756,
		"secret": "epk_12014a82ba5c4c97980e8e0ff9a64b7a"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "11025492335",
	"frm_message": null,
	"metadata": {
		"udf1": "value1",
		"login_date": "2019-09-10T10:11:12Z",
		"new_customer": "true"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "pay_46yfYfNcSmMZ847bso0p_1",
	"payment_link": null,
	"profile_id": "pro_9TabQmBmCO93BbyuDbqZ",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_kMejAtGh3Rsbobtc3dOq",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-13T14:40:56.929Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": null,
	"network_transaction_id": null,
	"payment_method_status": null,
	"updated": "2025-08-13T14:25:58.919Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": null,
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
<details>
<summary>In logs, source verified should be true</summary>
```log
  2025-08-13T14:25:59.722386Z  INFO router::core::webhooks::incoming: source_verified: true
    at crates/router/src/core/webhooks/incoming.rs:597
    in router::core::webhooks::incoming::incoming_webhooks_core
    in router::services::api::server_wrap_util with flow: IncomingWebhookReceive, lock_action: NotApplicable, merchant_id: "postman_merchant_GHAction_1755093166"
    in router::services::api::server_wrap with flow: IncomingWebhookReceive, lock_action: NotApplicable, request_method: "POST", request_url_path: "/webhooks/postman_merchant_GHAction_1755093166/nmi"
    in router::routes::webhooks::receive_incoming_webhook with flow: IncomingWebhookReceive
    in router::middleware::ROOT_SPAN with flow: "UNKNOWN"
```
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `just clippy && just clippy_v2`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	6950c04eaebc0499040556d8bbf5c684aebd2c9e | 
	
<details>
<summary>Setup webhooks for NMI connector and also the signature verification</summary>
<img width="1212" height="130" alt="image" src="https://github.com/user-attachments/assets/3759cb84-57f6-441e-845e-d6c53868764a" />
<img width="385" height="30" alt="image" src="https://github.com/user-attachments/assets/2df31bc8-54a4-4779-b112-433526318be3" />
<img width="193" height="55" alt="image" src="https://github.com/user-attachments/assets/eeb4287f-e309-49b0-9943-19334a8c7994" />
</details>
<details>
<summary>Make a Payment</summary>
```curl
curl --location 'https://pix-mbp.orthrus-monster.ts.net/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_A3aKSnvxEuazXkjOdUMlrNTSpmIlH9MlaWJj9Ax9xEpFqGN4aVBUGINJjkjSlRdz' \
--data-raw '{
    "amount": 60159,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 60159,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```json
{
	"payment_id": "pay_46yfYfNcSmMZ847bso0p",
	"merchant_id": "postman_merchant_GHAction_1755093166",
	"status": "succeeded",
	"amount": 15429,
	"net_amount": 15429,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 15429,
	"connector": "nmi",
	"client_secret": "pay_46yfYfNcSmMZ847bso0p_secret_55lzxYdXlKlBI80u1Y8w",
	"created": "2025-08-13T14:25:56.929Z",
	"currency": "USD",
	"customer_id": "StripeCustomer",
	"customer": {
		"id": "StripeCustomer",
		"name": "John Doe",
		"email": "guest@example.com",
		"phone": "999999999",
		"phone_country_code": "+1"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "card",
	"payment_method_data": {
		"card": {
			"last4": "1111",
			"card_type": "CREDIT",
			"card_network": "Visa",
			"card_issuer": "JP Morgan",
			"card_issuing_country": "INDIA",
			"card_isin": "411111",
			"card_extended_bin": null,
			"card_exp_month": "10",
			"card_exp_year": "25",
			"card_holder_name": "joseph Doe",
			"payment_checks": null,
			"authentication_data": null
		},
		"billing": null
	},
	"payment_token": "token_0k7Cgt2Xh8LXsZAxF3gz",
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "PiX",
			"last_name": null,
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "PiX",
			"last_name": null,
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"order_details": null,
	"email": "guest@example.com",
	"name": "John Doe",
	"phone": "999999999",
	"return_url": "https://duck.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "joseph",
	"statement_descriptor_suffix": "JS",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "credit",
	"connector_label": null,
	"business_country": null,
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "StripeCustomer",
		"created_at": 1755095156,
		"expires": 1755098756,
		"secret": "epk_12014a82ba5c4c97980e8e0ff9a64b7a"
	},
	"manual_retry_allowed": false,
	"connector_transaction_id": "11025492335",
	"frm_message": null,
	"metadata": {
		"udf1": "value1",
		"login_date": "2019-09-10T10:11:12Z",
		"new_customer": "true"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": "pay_46yfYfNcSmMZ847bso0p_1",
	"payment_link": null,
	"profile_id": "pro_9TabQmBmCO93BbyuDbqZ",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_kMejAtGh3Rsbobtc3dOq",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-08-13T14:40:56.929Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": null,
	"network_transaction_id": null,
	"payment_method_status": null,
	"updated": "2025-08-13T14:25:58.919Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": null,
	"card_discovery": "manual",
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null
}
```
</details>
<details>
<summary>In logs, source verified should be true</summary>
```log
  2025-08-13T14:25:59.722386Z  INFO router::core::webhooks::incoming: source_verified: true
    at crates/router/src/core/webhooks/incoming.rs:597
    in router::core::webhooks::incoming::incoming_webhooks_core
    in router::services::api::server_wrap_util with flow: IncomingWebhookReceive, lock_action: NotApplicable, merchant_id: "postman_merchant_GHAction_1755093166"
    in router::services::api::server_wrap with flow: IncomingWebhookReceive, lock_action: NotApplicable, request_method: "POST", request_url_path: "/webhooks/postman_merchant_GHAction_1755093166/nmi"
    in router::routes::webhooks::receive_incoming_webhook with flow: IncomingWebhookReceive
    in router::middleware::ROOT_SPAN with flow: "UNKNOWN"
```
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8947 | 
	Bug: [BUG] Payments in Integ Dashboard failing to load due to backward compatibility issue
### Bug Description
Payments in Integ Dashboard failing to load due to backward compatibility issue
### Expected Behavior
Payments in Integ Dashboard shouldn't fail to load.
### Actual Behavior
Payments in Integ Dashboard failing to load due to backward compatibility issue
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution: macOS
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index ec8d55ed000..3b61b810baf 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2850,6 +2850,7 @@ pub enum RequestIncrementalAuthorization {
     True,
     #[default]
     False,
+    Default,
 }
 
 #[derive(Clone, Copy, Eq, Hash, PartialEq, Debug, Serialize, Deserialize, strum::Display, ToSchema,)]
 | 
	2025-08-13T20:34:28Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/8947)
## Description
<!-- Describe your changes in detail -->
Added Default Enum Variant in RequestIncrementalAuthorization
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Tests
1. Create a payment with old version confirm with new (old and new application should be able to retrieve)
Payments - Create (with Confirm: false)
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_nDwiGI0dyLcP8uP4zJj6TPrzetozj6rVGm7o9WV3KZJX4nKVPrB1VaIhnrcUrkXv' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            
            "zip": "94122",
            
            "country": "US",
            
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    }
}'
```
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "requires_confirmation",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755160902,
        "expires": 1755164502,
        "secret": "epk_c95c09ba12954fa88c93d7216e216242"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T08:41:43.114Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Confirm
Request:
```
curl --location 'http://localhost:8080/payments/pay_QpckxK3eCQr65QznPuuN/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_nDwiGI0dyLcP8uP4zJj6TPrzetozj6rVGm7o9WV3KZJX4nKVPrB1VaIhnrcUrkXv' \
--data-raw '{
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            
            "zip": "94122",
            
            "country": "US",
            
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    }
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "amount": 6500,
    "currency": "USD"   
}'
```
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T08:53:35.933Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - sync (with old application):
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": [
        {
            "refund_id": "ref_nzAqQ7BbLsGuCu7K00Gm",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T08:55:59.292Z",
            "updated_at": "2025-08-14T08:56:00.603Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        },
        {
            "refund_id": "ref_KehvNBg796Hhj5AnjLIU",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T09:04:53.067Z",
            "updated_at": "2025-08-14T09:04:54.257Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        }
    ],
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_BOcKiwB3ujDSu3H3yheb",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-14T09:05:00.035Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RvwugE9cSvqiivY5A84TvB3",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (New Application)
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": [
        {
            "refund_id": "ref_nzAqQ7BbLsGuCu7K00Gm",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T08:55:59.292Z",
            "updated_at": "2025-08-14T08:56:00.603Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        },
        {
            "refund_id": "ref_KehvNBg796Hhj5AnjLIU",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T09:04:53.067Z",
            "updated_at": "2025-08-14T09:04:54.257Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        }
    ],
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_BOcKiwB3ujDSu3H3yheb",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-14T09:05:00.035Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RvwugE9cSvqiivY5A84TvB3",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
2. Create + confirm on old version (old and new application should be able to retrieve)
Create + Confirm: 
Response:
```
{
    "payment_id": "pay_qDAKyiWXL2BToORLLOed",
    "merchant_id": "merchant_1755163699",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_qDAKyiWXL2BToORLLOed_secret_ApS6p4I8eCgpO7LfReIB",
    "created": "2025-08-14T09:28:48.465Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755163728,
        "expires": 1755167328,
        "secret": "epk_abc7e336d4c840f1a5ccd8067c76f0d5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:43:48.465Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:28:51.204Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (on old version)
Response:
```
{
    "payment_id": "pay_qDAKyiWXL2BToORLLOed",
    "merchant_id": "merchant_1755163699",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_qDAKyiWXL2BToORLLOed_secret_ApS6p4I8eCgpO7LfReIB",
    "created": "2025-08-14T09:28:48.465Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:43:48.465Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:29:05.152Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (on this branch):
Response:
```
{
    "payment_id": "pay_qDAKyiWXL2BToORLLOed",
    "merchant_id": "merchant_1755163699",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_qDAKyiWXL2BToORLLOed_secret_ApS6p4I8eCgpO7LfReIB",
    "created": "2025-08-14T09:28:48.465Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:43:48.465Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:29:05.152Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
3. Manually override the db enum to store Default and see if the new and old application can retrieve it
Payments - Create
Response:
```
{
    "payment_id": "pay_RbtTfVKPmNN6AipdXDBy",
    "merchant_id": "merchant_1755163699",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_RbtTfVKPmNN6AipdXDBy_secret_KgqxaJ94DXsIMOOhWNez",
    "created": "2025-08-14T10:04:50.873Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755165890,
        "expires": 1755169490,
        "secret": "epk_c08c26656b7d437e9c2bfc248bc39ab3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T10:19:50.873Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T10:04:52.820Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (on this branch, after changing the value of request_incremental_authorization to default and incremental_authorization_allowed to true):
<img width="1259" height="583" alt="Screenshot 2025-08-14 at 3 44 16 PM" src="https://github.com/user-attachments/assets/5d8d45e6-a843-47b7-86e4-314b23502c9c" />
Response:
```
{
    "payment_id": "pay_RbtTfVKPmNN6AipdXDBy",
    "merchant_id": "merchant_1755163699",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_RbtTfVKPmNN6AipdXDBy_secret_KgqxaJ94DXsIMOOhWNez",
    "created": "2025-08-14T10:04:50.873Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T10:19:50.873Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T10:07:49.655Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1Rvy1gE9cSvqiivYCvmNitR6",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
``` 
Payments - Sync (on old version):
Response:
```
{
    "payment_id": "pay_yySze0C1AcjjVbTE3ecr",
    "merchant_id": "merchant_1755163699",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_yySze0C1AcjjVbTE3ecr_secret_GI3GZQZxrsMa6bdmnSZD",
    "created": "2025-08-14T10:26:23.998Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvyMWE9cSvqiivY16aXbZ8T",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvyMWE9cSvqiivY16aXbZ8T",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T10:41:23.998Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T10:29:43.256Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RvyMWE9cSvqiivYxCV2kKOB",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a0a4b9239dd2fff7a79fabe641ed9f71f56ef254 | 
	
Postman Tests
1. Create a payment with old version confirm with new (old and new application should be able to retrieve)
Payments - Create (with Confirm: false)
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_nDwiGI0dyLcP8uP4zJj6TPrzetozj6rVGm7o9WV3KZJX4nKVPrB1VaIhnrcUrkXv' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            
            "zip": "94122",
            
            "country": "US",
            
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    }
}'
```
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "requires_confirmation",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755160902,
        "expires": 1755164502,
        "secret": "epk_c95c09ba12954fa88c93d7216e216242"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T08:41:43.114Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Confirm
Request:
```
curl --location 'http://localhost:8080/payments/pay_QpckxK3eCQr65QznPuuN/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_nDwiGI0dyLcP8uP4zJj6TPrzetozj6rVGm7o9WV3KZJX4nKVPrB1VaIhnrcUrkXv' \
--data-raw '{
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            
            "zip": "94122",
            
            "country": "US",
            
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    }
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "amount": 6500,
    "currency": "USD"   
}'
```
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T08:53:35.933Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - sync (with old application):
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": [
        {
            "refund_id": "ref_nzAqQ7BbLsGuCu7K00Gm",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T08:55:59.292Z",
            "updated_at": "2025-08-14T08:56:00.603Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        },
        {
            "refund_id": "ref_KehvNBg796Hhj5AnjLIU",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T09:04:53.067Z",
            "updated_at": "2025-08-14T09:04:54.257Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        }
    ],
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_BOcKiwB3ujDSu3H3yheb",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-14T09:05:00.035Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RvwugE9cSvqiivY5A84TvB3",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (New Application)
Response:
```
{
    "payment_id": "pay_QpckxK3eCQr65QznPuuN",
    "merchant_id": "merchant_1755160879",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_QpckxK3eCQr65QznPuuN_secret_qV2I7iHAdO5nQb9g1NiG",
    "created": "2025-08-14T08:41:43.016Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": [
        {
            "refund_id": "ref_nzAqQ7BbLsGuCu7K00Gm",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T08:55:59.292Z",
            "updated_at": "2025-08-14T08:56:00.603Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        },
        {
            "refund_id": "ref_KehvNBg796Hhj5AnjLIU",
            "payment_id": "pay_QpckxK3eCQr65QznPuuN",
            "amount": 1000,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-08-14T09:04:53.067Z",
            "updated_at": "2025-08-14T09:04:54.257Z",
            "connector": "stripe",
            "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
            "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
            "split_refunds": null,
            "issuer_error_code": null,
            "issuer_error_message": null
        }
    ],
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_yMCfQBl7o3zcFKRn1moK",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvwugE9cSvqiivY0X0CxZg6",
    "payment_link": null,
    "profile_id": "pro_8SHbxLW1M8ueBNJ7tqAf",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_E0iaiKWU18mDERnGMckX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T08:56:43.016Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_BOcKiwB3ujDSu3H3yheb",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-14T09:05:00.035Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RvwugE9cSvqiivY5A84TvB3",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
2. Create + confirm on old version (old and new application should be able to retrieve)
Create + Confirm: 
Response:
```
{
    "payment_id": "pay_qDAKyiWXL2BToORLLOed",
    "merchant_id": "merchant_1755163699",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_qDAKyiWXL2BToORLLOed_secret_ApS6p4I8eCgpO7LfReIB",
    "created": "2025-08-14T09:28:48.465Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755163728,
        "expires": 1755167328,
        "secret": "epk_abc7e336d4c840f1a5ccd8067c76f0d5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:43:48.465Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:28:51.204Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (on old version)
Response:
```
{
    "payment_id": "pay_qDAKyiWXL2BToORLLOed",
    "merchant_id": "merchant_1755163699",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_qDAKyiWXL2BToORLLOed_secret_ApS6p4I8eCgpO7LfReIB",
    "created": "2025-08-14T09:28:48.465Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:43:48.465Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:29:05.152Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (on this branch):
Response:
```
{
    "payment_id": "pay_qDAKyiWXL2BToORLLOed",
    "merchant_id": "merchant_1755163699",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "stripe",
    "client_secret": "pay_qDAKyiWXL2BToORLLOed_secret_ApS6p4I8eCgpO7LfReIB",
    "created": "2025-08-14T09:28:48.465Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvxSoE9cSvqiivY0Q00nWP3",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:43:48.465Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:29:05.152Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
3. Manually override the db enum to store Default and see if the new and old application can retrieve it
Payments - Create
Response:
```
{
    "payment_id": "pay_RbtTfVKPmNN6AipdXDBy",
    "merchant_id": "merchant_1755163699",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_RbtTfVKPmNN6AipdXDBy_secret_KgqxaJ94DXsIMOOhWNez",
    "created": "2025-08-14T10:04:50.873Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755165890,
        "expires": 1755169490,
        "secret": "epk_c08c26656b7d437e9c2bfc248bc39ab3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T10:19:50.873Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T10:04:52.820Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments - Sync (on this branch, after changing the value of request_incremental_authorization to default and incremental_authorization_allowed to true):
<img width="1259" height="583" alt="Screenshot 2025-08-14 at 3 44 16 PM" src="https://github.com/user-attachments/assets/5d8d45e6-a843-47b7-86e4-314b23502c9c" />
Response:
```
{
    "payment_id": "pay_RbtTfVKPmNN6AipdXDBy",
    "merchant_id": "merchant_1755163699",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_RbtTfVKPmNN6AipdXDBy_secret_KgqxaJ94DXsIMOOhWNez",
    "created": "2025-08-14T10:04:50.873Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3Rvy1gE9cSvqiivY1bcNshY0",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T10:19:50.873Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T10:07:49.655Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1Rvy1gE9cSvqiivYCvmNitR6",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
``` 
Payments - Sync (on old version):
Response:
```
{
    "payment_id": "pay_yySze0C1AcjjVbTE3ecr",
    "merchant_id": "merchant_1755163699",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_yySze0C1AcjjVbTE3ecr_secret_GI3GZQZxrsMa6bdmnSZD",
    "created": "2025-08-14T10:26:23.998Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RvyMWE9cSvqiivY16aXbZ8T",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RvyMWE9cSvqiivY16aXbZ8T",
    "payment_link": null,
    "profile_id": "pro_mQ5idcJcr37iO0GmRSQU",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_2lED1Q9w5btK5Tgsx6CB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T10:41:23.998Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T10:29:43.256Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RvyMWE9cSvqiivYxCV2kKOB",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8963 | 
	Bug: refactor(euclid): add logs for euclid routing
 | 
	diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 0c0061e7918..44a4602ffa6 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -8103,6 +8103,7 @@ where
         .attach_printable("Invalid connector name received in 'routed_through'")?;
 
         routing_data.routed_through = Some(connector_name.clone());
+        logger::debug!("euclid_routing: predetermined connector present in attempt");
         return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
     }
 
@@ -8122,6 +8123,7 @@ where
             .merchant_connector_id
             .clone_from(&mandate_connector_details.merchant_connector_id);
 
+        logger::debug!("euclid_routing: predetermined mandate connector");
         return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
     }
 
@@ -8206,6 +8208,8 @@ where
                 }
             }
 
+            logger::debug!("euclid_routing: pre-routing connector present");
+
             let first_pre_routing_connector_data_list = pre_routing_connector_data_list
                 .first()
                 .ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?;
@@ -8269,6 +8273,7 @@ where
             .change_context(errors::ApiErrorResponse::InternalServerError)
             .attach_printable("Invalid connector name received")?;
 
+        logger::debug!("euclid_routing: straight through connector present");
         return decide_multiplex_connector_for_normal_or_recurring_payment(
             &state,
             payment_data,
@@ -8313,6 +8318,7 @@ where
             .attach_printable("failed eligibility analysis and fallback")?;
         }
 
+        logger::debug!("euclid_routing: single connector present in algorithm data");
         let connector_data = connectors
             .into_iter()
             .map(|conn| {
@@ -8400,7 +8406,7 @@ where
             Some(api::MandateTransactionType::RecurringMandateTransaction),
         )
         | (None, Some(_), None, Some(true), _) => {
-            logger::debug!("performing routing for token-based MIT flow");
+            logger::debug!("euclid_routing: performing routing for token-based MIT flow");
 
             let payment_method_info = payment_data
                 .get_payment_method_info()
@@ -8513,7 +8519,9 @@ where
                     .into(),
                 ))
             } else {
-                logger::error!("no eligible connector found for the ppt_mandate payment");
+                logger::error!(
+                    "euclid_routing: no eligible connector found for the ppt_mandate payment"
+                );
                 Err(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration.into())
             }
         }
@@ -8572,7 +8580,7 @@ where
             })
             .unwrap_or(false)
         {
-            logger::info!("using connector_mandate_id for MIT flow");
+            logger::info!("euclid_routing: using connector_mandate_id for MIT flow");
             if let Some(merchant_connector_id) = connector_data.merchant_connector_id.as_ref() {
                 if let Some(mandate_reference_record) = connector_mandate_details.clone()
                         .get_required_value("connector_mandate_details")
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 19ddeb7f15f..a06b6140da4 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -441,6 +441,7 @@ pub async fn perform_static_routing_v1(
     Vec<routing_types::RoutableConnectorChoice>,
     Option<common_enums::RoutingApproach>,
 )> {
+    logger::debug!("euclid_routing: performing routing for connector selection");
     let get_merchant_fallback_config = || async {
         #[cfg(feature = "v1")]
         return routing::helpers::get_merchant_default_config(
@@ -459,6 +460,7 @@ pub async fn perform_static_routing_v1(
         id
     } else {
         let fallback_config = get_merchant_fallback_config().await?;
+        logger::debug!("euclid_routing: active algorithm isn't present, default falling back");
         return Ok((fallback_config, None));
     };
     let cached_algorithm = ensure_algorithm_cached_v1(
@@ -1038,6 +1040,7 @@ pub async fn perform_eligibility_analysis_with_fallback(
     eligible_connectors: Option<Vec<api_enums::RoutableConnectors>>,
     business_profile: &domain::Profile,
 ) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
+    logger::debug!("euclid_routing: performing eligibility");
     let mut final_selection = perform_eligibility_analysis(
         state,
         key_store,
@@ -1072,7 +1075,7 @@ pub async fn perform_eligibility_analysis_with_fallback(
         .iter()
         .map(|item| item.connector)
         .collect::<Vec<_>>();
-    logger::debug!(final_selected_connectors_for_routing=?final_selected_connectors, "List of final selected connectors for routing");
+    logger::debug!(final_selected_connectors_for_routing=?final_selected_connectors, "euclid_routing: List of final selected connectors for routing");
 
     Ok(final_selection)
 }
 | 
	2025-08-14T11:42:09Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Added logs for routing engine.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
This PR only introduces logs, hence no testing is required.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	b797d93433d996e5d22269bcab1980c292b0121e | 
	
This PR only introduces logs, hence no testing is required.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8934 | 
	Bug: Update traditional chinese locale for payent link expired
Update traditional chinese locale for payent link expired | 
	diff --git a/crates/router/src/core/payment_link/locale.js b/crates/router/src/core/payment_link/locale.js
index 5a404c93a5b..e07285a1ef8 100644
--- a/crates/router/src/core/payment_link/locale.js
+++ b/crates/router/src/core/payment_link/locale.js
@@ -586,7 +586,7 @@ const locales = {
     },
     zh_hant: {
       expiresOn: "連結到期日期:",
-      refId: "參考編號:",
+      refId: "參考編號",
       requestedBy: "請求者 ",
       payNow: "立即付款",
       addPaymentMethod: "新增付款方式",
@@ -600,7 +600,7 @@ const locales = {
       paymentTakingLonger: "抱歉!您的付款處理時間比預期長。請稍後再查看。",
       paymentLinkExpired: "付款連結已過期",
       paymentReceived: "我們已成功收到您的付款",
-      paymentLinkExpiredMessage: "抱歉,此付款連結已過期。請使用以下參考進行進一步調查。",
+      paymentLinkExpiredMessage: "抱歉,此支付链接已过期。 请使用以下参考进行进一步调查。",
       paidSuccessfully: "付款成功",
       paymentPending: "付款待處理",
       paymentFailed: "付款失敗!",
 | 
	2025-08-12T16:23:43Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
We need to update traditional chinese locale for payment link expired.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Raised by the merchant to update the locale to the correct one as shared by them.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
use below curl for payment link create and wait for 60 secs for payment link to get expired:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ***' \
--header 'Accept-Language: zh-Hant' \
--data '{
    "amount": 10,
    "setup_future_usage": "off_session",
    "currency": "EUR",
    "payment_link": true,
    "session_expiry": 60,
    "return_url": "https://google.com",
    "payment_link_config": {
        "theme": "#14356f",
        "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg",
        "seller_name": "Zurich Inc."
    }
}'
```
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/8c4e4fcb-f5ab-4988-b559-5712e5f9f473" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a0c2a6bc823fdeac193875a04ea04e7d9a81cbc2 | 
	
use below curl for payment link create and wait for 60 secs for payment link to get expired:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ***' \
--header 'Accept-Language: zh-Hant' \
--data '{
    "amount": 10,
    "setup_future_usage": "off_session",
    "currency": "EUR",
    "payment_link": true,
    "session_expiry": 60,
    "return_url": "https://google.com",
    "payment_link_config": {
        "theme": "#14356f",
        "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg",
        "seller_name": "Zurich Inc."
    }
}'
```
<img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/8c4e4fcb-f5ab-4988-b559-5712e5f9f473" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8924 | 
	Bug: [BUG] TrustPay Connector: Request Reference ID Length Validation Issue
### Bug Description
Bug Description:
  Summary:
  The TrustPay connector implementation fails when the connector_request_reference_id exceeds TrustPay's API limits for merchant reference fields.
  Impact:
  - Payment requests may be rejected by TrustPay API due to reference ID length violations
  Proposed Fix:
  - Add connector-specific validation in the transformer methods
### Expected Behavior
-TrustPay connector should validate connector_request_reference_id length against TrustPay's API requirements before sending requests
- Generate a shorter alternative reference ID
### Actual Behavior
- Reference IDs up to 64 characters (Hyperswitch limit) are passed through without consideration of TrustPay limits but The length of receipt for Trustpay order request should not exceed 35 characters.
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
index d3a6a2cdf71..878c4ed0c1c 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
@@ -1364,4 +1364,13 @@ impl ConnectorSpecifications for Trustpay {
     fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
         Some(&TRUSTPAY_SUPPORTED_WEBHOOK_FLOWS)
     }
+    #[cfg(feature = "v2")]
+    fn generate_connector_request_reference_id(
+        &self,
+        _payment_intent: &hyperswitch_domain_models::payments::PaymentIntent,
+        _payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt,
+    ) -> String {
+        // The length of receipt for Trustpay order request should not exceed 35 characters.
+        uuid::Uuid::now_v7().simple().to_string()
+    }
 }
 | 
	2025-08-12T11:08:39Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
 The length of receipt for Trustpay order request should not exceed 35 characters. So added generate_connector_request_reference_id specific to trustpay which generates less than 35 charcters.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
TrustPay API rejects payment requests when the reference field exceeds 35 characters, causing payment failures so now after this it generates uuid of 35 character for reference field specific to trustpay.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
PaymentCreateIntent
```
{
    "amount_details": {
        "order_amount": 10000,
        "currency": "USD"
    },
    "capture_method":"automatic",
    "customer_id": "{{customer_id}}",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "email": "example@example.com"
    }
}
```
Response:
```
{
    "id": "12345_pay_01989df58ff572d3b6b44f2b110eed5d",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 10000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": "cs_01989df590017d239418f1f4e74544b6",
    "profile_id": "pro_FUMMIiBgcHOyCYD5Fcy5",
    "merchant_reference_id": null,
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": "example@example.com"
    },
    "customer_id": "12345_cus_01989df586017c72a786fa20899c15ed",
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": null,
    "allowed_payment_method_types": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "expires_on": "2025-08-12T11:21:12.862Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip"
}
```
Confirm-intent:
```
{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "26",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
     "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    }
}
```
Response:
```
{
    "id": "12345_pay_01989df58ff572d3b6b44f2b110eed5d",
    "status": "succeeded",
    "amount": {
        "order_amount": 10000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 10000,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 10000
    },
    "customer_id": "12345_cus_01989df586017c72a786fa20899c15ed",
    "connector": "trustpay",
    "created": "2025-08-12T11:06:12.862Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "SV8ChATq2PXphJpZCzkK2A",
    "connector_reference_id": null,
    "merchant_connector_id": "mca_VLpyWHJKJ36kuAYfbmcW",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": null,
    "raw_connector_response": null,
    "feature_metadata": null
}
```
<img width="720" height="167" alt="image" src="https://github.com/user-attachments/assets/bc21eb59-5c41-422b-8e96-849b6d19b00f" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f79cf784c15df183b11c4b8ad4a3523e9b5c2280 | 
	
PaymentCreateIntent
```
{
    "amount_details": {
        "order_amount": 10000,
        "currency": "USD"
    },
    "capture_method":"automatic",
    "customer_id": "{{customer_id}}",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "email": "example@example.com"
    }
}
```
Response:
```
{
    "id": "12345_pay_01989df58ff572d3b6b44f2b110eed5d",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 10000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": "cs_01989df590017d239418f1f4e74544b6",
    "profile_id": "pro_FUMMIiBgcHOyCYD5Fcy5",
    "merchant_reference_id": null,
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": "example@example.com"
    },
    "customer_id": "12345_cus_01989df586017c72a786fa20899c15ed",
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": null,
    "allowed_payment_method_types": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "expires_on": "2025-08-12T11:21:12.862Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip"
}
```
Confirm-intent:
```
{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "26",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
     "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
        "language": "en-GB",
        "color_depth": 24,
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "0.0.0.0"
    }
}
```
Response:
```
{
    "id": "12345_pay_01989df58ff572d3b6b44f2b110eed5d",
    "status": "succeeded",
    "amount": {
        "order_amount": 10000,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 10000,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 10000
    },
    "customer_id": "12345_cus_01989df586017c72a786fa20899c15ed",
    "connector": "trustpay",
    "created": "2025-08-12T11:06:12.862Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "SV8ChATq2PXphJpZCzkK2A",
    "connector_reference_id": null,
    "merchant_connector_id": "mca_VLpyWHJKJ36kuAYfbmcW",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": null,
    "raw_connector_response": null,
    "feature_metadata": null
}
```
<img width="720" height="167" alt="image" src="https://github.com/user-attachments/assets/bc21eb59-5c41-422b-8e96-849b6d19b00f" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8931 | 
	Bug: [FIX] : refund sync process scheduled time
refund sync process scheduled time | 
	diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index ed44f61b4da..3d8463c2554 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -4,7 +4,7 @@ use std::collections::HashMap;
 #[cfg(feature = "olap")]
 use api_models::admin::MerchantConnectorInfo;
 use common_utils::{
-    ext_traits::AsyncExt,
+    ext_traits::{AsyncExt, StringExt},
     types::{ConnectorTransactionId, MinorUnit},
 };
 use diesel_models::{process_tracker::business_status, refund as diesel_refund};
@@ -14,7 +14,9 @@ use hyperswitch_domain_models::{
 };
 use hyperswitch_interfaces::integrity::{CheckIntegrity, FlowIntegrity, GetIntegrityObject};
 use router_env::{instrument, tracing};
-use scheduler::{consumer::types::process_data, utils as process_tracker_utils};
+use scheduler::{
+    consumer::types::process_data, errors as sch_errors, utils as process_tracker_utils,
+};
 #[cfg(feature = "olap")]
 use strum::IntoEnumIterator;
 
@@ -40,7 +42,6 @@ use crate::{
         transformers::{ForeignFrom, ForeignInto},
     },
     utils::{self, OptionExt},
-    workflows::payment_sync,
 };
 
 // ********************************************** REFUND EXECUTE **********************************************
@@ -1439,7 +1440,7 @@ pub async fn sync_refund_with_gateway_workflow(
                 .await?
         }
         _ => {
-            _ = payment_sync::retry_sync_task(
+            _ = retry_refund_sync_task(
                 &*state.store,
                 response.connector,
                 response.merchant_id,
@@ -1452,6 +1453,33 @@ pub async fn sync_refund_with_gateway_workflow(
     Ok(())
 }
 
+/// Schedule the task for refund retry
+///
+/// Returns bool which indicates whether this was the last refund retry or not
+pub async fn retry_refund_sync_task(
+    db: &dyn db::StorageInterface,
+    connector: String,
+    merchant_id: common_utils::id_type::MerchantId,
+    pt: storage::ProcessTracker,
+) -> Result<bool, sch_errors::ProcessTrackerError> {
+    let schedule_time =
+        get_refund_sync_process_schedule_time(db, &connector, &merchant_id, pt.retry_count + 1)
+            .await?;
+
+    match schedule_time {
+        Some(s_time) => {
+            db.as_scheduler().retry_process(pt, s_time).await?;
+            Ok(false)
+        }
+        None => {
+            db.as_scheduler()
+                .finish_process_with_business_status(pt, business_status::RETRIES_EXCEEDED)
+                .await?;
+            Ok(true)
+        }
+    }
+}
+
 #[instrument(skip_all)]
 pub async fn start_refund_workflow(
     state: &SessionState,
@@ -1614,7 +1642,12 @@ pub async fn add_refund_sync_task(
 ) -> RouterResult<storage::ProcessTracker> {
     let task = "SYNC_REFUND";
     let process_tracker_id = format!("{runner}_{task}_{}", refund.internal_reference_id);
-    let schedule_time = common_utils::date_time::now();
+    let schedule_time =
+        get_refund_sync_process_schedule_time(db, &refund.connector, &refund.merchant_id, 0)
+            .await
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("Failed to fetch schedule time for refund sync process")?
+            .unwrap_or_else(common_utils::date_time::now);
     let refund_workflow_tracking_data = refund_to_refund_core_workflow_model(refund);
     let tag = ["REFUND"];
     let process_tracker_entry = storage::ProcessTrackerNew::new(
@@ -1688,15 +1721,20 @@ pub async fn get_refund_sync_process_schedule_time(
     merchant_id: &common_utils::id_type::MerchantId,
     retry_count: i32,
 ) -> Result<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
-    let redis_mapping: errors::CustomResult<process_data::ConnectorPTMapping, errors::RedisError> =
-        db::get_and_deserialize_key(
-            db,
-            &format!("pt_mapping_refund_sync_{connector}"),
-            "ConnectorPTMapping",
-        )
-        .await;
-
-    let mapping = match redis_mapping {
+    let mapping: common_utils::errors::CustomResult<
+        process_data::ConnectorPTMapping,
+        errors::StorageError,
+    > = db
+        .find_config_by_key(&format!("pt_mapping_refund_sync_{connector}"))
+        .await
+        .map(|value| value.config)
+        .and_then(|config| {
+            config
+                .parse_struct("ConnectorPTMapping")
+                .change_context(errors::StorageError::DeserializationFailed)
+        });
+
+    let mapping = match mapping {
         Ok(x) => x,
         Err(err) => {
             logger::error!("Error: while getting connector mapping: {err:?}");
@@ -1704,8 +1742,7 @@ pub async fn get_refund_sync_process_schedule_time(
         }
     };
 
-    let time_delta =
-        process_tracker_utils::get_schedule_time(mapping, merchant_id, retry_count + 1);
+    let time_delta = process_tracker_utils::get_schedule_time(mapping, merchant_id, retry_count);
 
     Ok(process_tracker_utils::get_time_from_delta(time_delta))
 }
 | 
	2025-08-12T14:24:25Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Before refund sync process tracker task was using pt_mapping_{connector} for sync retries (this is config name of Psync which was incorrect) 
Fixes made in this PR - 
- We are using pt_mapping_refund_sync_{connector}
- refund sync which was using retry_sync_task so made retry_refund_sync_task which will handle the refund task
- fix refund sync workflow being incorrectly scheduled for 2nd retry attempt instead of 1st retry attempt
- ConnectorPTMapping should also be read from db , previously we were always reading only from redis
 
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
Create a process tracker config for Adyen connector
```
curl --location 'http://localhost:8080/configs/pt_mapping_refund_sync_adyen' \
--header 'Content-Type: application/json' \
--header 'api-key: _____' \
--data '{
    "key": "pt_mapping_refund_sync_adyen",
    "value": "{\"custom_merchant_mapping\":{},\"default_mapping\":{\"start_after\":180,\"frequencies\":[[20,2],[30,2],[40,2],[60,2],[2400,1],[43200,4],[86400,3],[345600,2]]},\"max_retries_count\":18}"
}'
```
Response
```
{
    "key": "pt_mapping_refund_sync_adyen",
    "value": "{\"custom_merchant_mapping\":{},\"default_mapping\":{\"start_after\":180,\"frequencies\":[[20,2],[30,2],[40,2],[60,2],[2400,1],[43200,4],[86400,3],[345600,2]]},\"max_retries_count\":18}"
}
```
Create a no 3ds card payment via Adyen
```
{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
        
    },
    "metadata": {
        "order_id": "ORD-12345",
        "sdata": {
            "customer_segment": "premium",
            "purchase_platform": "web_store"
        }
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "merchant_order_reference_id": "order_narvar12",
    "browser_info": {
        "os_type": "macOS",
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "103.159.11.202",
        "os_version": "10.15.7",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
        "color_depth": 24,
        "device_model": "Macintosh",
        "java_enabled": true,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1080,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "profile_id": "{{payment_profile_id}}"
}
```
Response
```
{
    "payment_id": "pay_PuKa9OvV1e3yrcdZcfEo",
    "merchant_id": "merchant_1755523756",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "adyen",
    "client_secret": "pay_PuKa9OvV1e3yrcdZcfEo_secret_V1Yu4MdVf3iEhwKygr0H",
    "created": "2025-08-19T06:21:08.206Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1111",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "JP Morgan",
            "card_issuing_country": "INDIA",
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755584468,
        "expires": 1755588068,
        "secret": "epk_eadaf298af8f4d58b46ac00860f9e440"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "HH2TDB3NBZXRHBV5",
    "frm_message": null,
    "metadata": {
        "sdata": {
            "customer_segment": "premium",
            "purchase_platform": "web_store"
        },
        "order_id": "ORD-12345"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_PuKa9OvV1e3yrcdZcfEo_1",
    "payment_link": null,
    "profile_id": "pro_IBcsy1G8u4AqtpDlpoQ6",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ST0rQKrUA8r95Bvci4FV",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-19T06:36:08.206Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": "macOS",
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "103.159.11.202",
        "os_version": "10.15.7",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
        "color_depth": 24,
        "device_model": "Macintosh",
        "java_enabled": true,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1080,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T06:21:11.290Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "order_narvar12",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Create a Refund Request
```
{
    "payment_id": "{{payment_id}}",
    "amount": 600,
    "reason": "Customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
Response
```
{
    "refund_id": "ref_ItP2mAScOD5yeWYmsgWA",
    "payment_id": "pay_PuKa9OvV1e3yrcdZcfEo",
    "amount": 600,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-19T06:21:25.378Z",
    "updated_at": "2025-08-19T06:21:25.738Z",
    "connector": "adyen",
    "profile_id": "pro_IBcsy1G8u4AqtpDlpoQ6",
    "merchant_connector_id": "mca_ST0rQKrUA8r95Bvci4FV",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
In db search for this refund id 
`select * from refund where refund_id = 'ref_ItP2mAScOD5yeWYmsgWA';`
We will get  internal_reference_id      | refid_DFtahM9L64gRSkyzkibF
<img width="964" height="715" alt="Screenshot 2025-08-19 at 11 57 31 AM" src="https://github.com/user-attachments/assets/c237e56e-f6a2-4ad0-b82c-e462f3f90017" />
Using this internal_reference_id we will check in process_tracker table to check the scheduled time
`select * from process_tracker where id like '%refid_DFtahM9L64gRSkyzkibF%';`
We can scheduled time is 3min after updated_at as in config start_after time was set 180 sec
<img width="1124" height="349" alt="Screenshot 2025-08-19 at 11 57 58 AM" src="https://github.com/user-attachments/assets/59250474-a27c-4815-8598-ca8ade392121" />
After 3 min if we check process_tracker 
scheduled time is 20sec min after updated_at as in config 1st frequency was set 20 sec 
<img width="1252" height="344" alt="Screenshot 2025-08-19 at 12 01 19 PM" src="https://github.com/user-attachments/assets/650b5b2f-f16b-4eae-a8ab-9ddc513925a0" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	a0c2a6bc823fdeac193875a04ea04e7d9a81cbc2 | 
	Create a process tracker config for Adyen connector
```
curl --location 'http://localhost:8080/configs/pt_mapping_refund_sync_adyen' \
--header 'Content-Type: application/json' \
--header 'api-key: _____' \
--data '{
    "key": "pt_mapping_refund_sync_adyen",
    "value": "{\"custom_merchant_mapping\":{},\"default_mapping\":{\"start_after\":180,\"frequencies\":[[20,2],[30,2],[40,2],[60,2],[2400,1],[43200,4],[86400,3],[345600,2]]},\"max_retries_count\":18}"
}'
```
Response
```
{
    "key": "pt_mapping_refund_sync_adyen",
    "value": "{\"custom_merchant_mapping\":{},\"default_mapping\":{\"start_after\":180,\"frequencies\":[[20,2],[30,2],[40,2],[60,2],[2400,1],[43200,4],[86400,3],[345600,2]]},\"max_retries_count\":18}"
}
```
Create a no 3ds card payment via Adyen
```
{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
        
    },
    "metadata": {
        "order_id": "ORD-12345",
        "sdata": {
            "customer_segment": "premium",
            "purchase_platform": "web_store"
        }
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "merchant_order_reference_id": "order_narvar12",
    "browser_info": {
        "os_type": "macOS",
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "103.159.11.202",
        "os_version": "10.15.7",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
        "color_depth": 24,
        "device_model": "Macintosh",
        "java_enabled": true,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1080,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "profile_id": "{{payment_profile_id}}"
}
```
Response
```
{
    "payment_id": "pay_PuKa9OvV1e3yrcdZcfEo",
    "merchant_id": "merchant_1755523756",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "adyen",
    "client_secret": "pay_PuKa9OvV1e3yrcdZcfEo_secret_V1Yu4MdVf3iEhwKygr0H",
    "created": "2025-08-19T06:21:08.206Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1111",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "JP Morgan",
            "card_issuing_country": "INDIA",
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755584468,
        "expires": 1755588068,
        "secret": "epk_eadaf298af8f4d58b46ac00860f9e440"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "HH2TDB3NBZXRHBV5",
    "frm_message": null,
    "metadata": {
        "sdata": {
            "customer_segment": "premium",
            "purchase_platform": "web_store"
        },
        "order_id": "ORD-12345"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_PuKa9OvV1e3yrcdZcfEo_1",
    "payment_link": null,
    "profile_id": "pro_IBcsy1G8u4AqtpDlpoQ6",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ST0rQKrUA8r95Bvci4FV",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-19T06:36:08.206Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": "macOS",
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "103.159.11.202",
        "os_version": "10.15.7",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
        "color_depth": 24,
        "device_model": "Macintosh",
        "java_enabled": true,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1080,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T06:21:11.290Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "order_narvar12",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Create a Refund Request
```
{
    "payment_id": "{{payment_id}}",
    "amount": 600,
    "reason": "Customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
Response
```
{
    "refund_id": "ref_ItP2mAScOD5yeWYmsgWA",
    "payment_id": "pay_PuKa9OvV1e3yrcdZcfEo",
    "amount": 600,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-19T06:21:25.378Z",
    "updated_at": "2025-08-19T06:21:25.738Z",
    "connector": "adyen",
    "profile_id": "pro_IBcsy1G8u4AqtpDlpoQ6",
    "merchant_connector_id": "mca_ST0rQKrUA8r95Bvci4FV",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
In db search for this refund id 
`select * from refund where refund_id = 'ref_ItP2mAScOD5yeWYmsgWA';`
We will get  internal_reference_id      | refid_DFtahM9L64gRSkyzkibF
<img width="964" height="715" alt="Screenshot 2025-08-19 at 11 57 31 AM" src="https://github.com/user-attachments/assets/c237e56e-f6a2-4ad0-b82c-e462f3f90017" />
Using this internal_reference_id we will check in process_tracker table to check the scheduled time
`select * from process_tracker where id like '%refid_DFtahM9L64gRSkyzkibF%';`
We can scheduled time is 3min after updated_at as in config start_after time was set 180 sec
<img width="1124" height="349" alt="Screenshot 2025-08-19 at 11 57 58 AM" src="https://github.com/user-attachments/assets/59250474-a27c-4815-8598-ca8ade392121" />
After 3 min if we check process_tracker 
scheduled time is 20sec min after updated_at as in config 1st frequency was set 20 sec 
<img width="1252" height="344" alt="Screenshot 2025-08-19 at 12 01 19 PM" src="https://github.com/user-attachments/assets/650b5b2f-f16b-4eae-a8ab-9ddc513925a0" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8928 | 
	Bug: [BUG] Fix incorrect consumer authenttication information fields
### Bug Description
Fix consumer authenttication information request field
1. Rename consumer_authentication_information.pares_status_reason field to consumer_authentication_information.signed_pares_status_reason
2. Move cavv_algorithm from processing_information to consumer_authentication_information
### Expected Behavior
n/a
### Actual Behavior
Request field struct is correctly incorrect for consumer_authentication_information -
- pares_status_reason
- cavv_algorithm
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index f080a76b051..ca41d12e9b8 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -335,7 +335,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
                 ))?
             }
         };
-        let cavv_algorithm = Some("2".to_string());
 
         let processing_information = ProcessingInformation {
             capture: Some(false),
@@ -345,7 +344,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
             authorization_options,
             commerce_indicator: String::from("internet"),
             payment_solution: solution.map(String::from),
-            cavv_algorithm,
         };
         Ok(Self {
             processing_information,
@@ -379,7 +377,6 @@ pub struct ProcessingInformation {
     capture: Option<bool>,
     capture_options: Option<CaptureOptions>,
     payment_solution: Option<String>,
-    cavv_algorithm: Option<String>,
 }
 
 #[derive(Debug, Serialize)]
@@ -425,13 +422,15 @@ pub struct CybersourceConsumerAuthInformation {
     /// This field indicates the authentication type or challenge presented to the cardholder at checkout.
     challenge_code: Option<String>,
     /// This field indicates the reason for payer authentication response status. It is only supported for secure transactions in France.
-    pares_status_reason: Option<String>,
+    signed_pares_status_reason: Option<String>,
     /// This field indicates the reason why strong authentication was cancelled. It is only supported for secure transactions in France.
     challenge_cancel_code: Option<String>,
     /// This field indicates the score calculated by the 3D Securing platform. It is only supported for secure transactions in France.
     network_score: Option<u32>,
     /// This is the transaction ID generated by the access control server. This field is supported only for secure transactions in France.
     acs_transaction_id: Option<String>,
+    /// This is the algorithm for generating a cardholder authentication verification value (CAVV) or universal cardholder authentication field (UCAF) data.
+    cavv_algorithm: Option<String>,
 }
 
 #[derive(Debug, Serialize)]
@@ -1007,11 +1006,6 @@ impl
                     .map(|eci| get_commerce_indicator_for_external_authentication(network, eci))
             });
 
-        // The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.
-        // In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.
-        // This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).
-        let cavv_algorithm = Some("2".to_string());
-
         Ok(Self {
             capture: Some(matches!(
                 item.router_data.request.capture_method,
@@ -1024,7 +1018,6 @@ impl
             capture_options: None,
             commerce_indicator: commerce_indicator_for_external_authentication
                 .unwrap_or(commerce_indicator),
-            cavv_algorithm,
         })
     }
 }
@@ -1121,7 +1114,6 @@ impl
             } else {
                 (None, None, None)
             };
-        let cavv_algorithm = Some("2".to_string());
 
         Ok(Self {
             capture: Some(matches!(
@@ -1137,7 +1129,6 @@ impl
                 .indicator
                 .to_owned()
                 .unwrap_or(String::from("internet")),
-            cavv_algorithm,
         })
     }
 }
@@ -1456,6 +1447,11 @@ impl
                         .and_then(|exts| extract_score_id(&exts))
                 });
 
+                // The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.
+                // In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.
+                // This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).
+                let cavv_algorithm = Some("2".to_string());
+
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1473,10 +1469,11 @@ impl
                     authentication_date,
                     effective_authentication_type,
                     challenge_code: authn_data.challenge_code.clone(),
-                    pares_status_reason: authn_data.challenge_code_reason.clone(),
+                    signed_pares_status_reason: authn_data.challenge_code_reason.clone(),
                     challenge_cancel_code: authn_data.challenge_cancel.clone(),
                     network_score,
                     acs_transaction_id: authn_data.acs_trans_id.clone(),
+                    cavv_algorithm,
                 }
             });
 
@@ -1577,6 +1574,8 @@ impl
                         .and_then(|exts| extract_score_id(&exts))
                 });
 
+                let cavv_algorithm = Some("2".to_string());
+
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1594,10 +1593,11 @@ impl
                     authentication_date,
                     effective_authentication_type,
                     challenge_code: authn_data.challenge_code.clone(),
-                    pares_status_reason: authn_data.challenge_code_reason.clone(),
+                    signed_pares_status_reason: authn_data.challenge_code_reason.clone(),
                     challenge_cancel_code: authn_data.challenge_cancel.clone(),
                     network_score,
                     acs_transaction_id: authn_data.acs_trans_id.clone(),
+                    cavv_algorithm,
                 }
             });
 
@@ -1702,6 +1702,8 @@ impl
                         .and_then(|exts| extract_score_id(&exts))
                 });
 
+                let cavv_algorithm = Some("2".to_string());
+
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1719,10 +1721,11 @@ impl
                     authentication_date,
                     effective_authentication_type,
                     challenge_code: authn_data.challenge_code.clone(),
-                    pares_status_reason: authn_data.challenge_code_reason.clone(),
+                    signed_pares_status_reason: authn_data.challenge_code_reason.clone(),
                     challenge_cancel_code: authn_data.challenge_cancel.clone(),
                     network_score,
                     acs_transaction_id: authn_data.acs_trans_id.clone(),
+                    cavv_algorithm,
                 }
             });
 
@@ -1907,10 +1910,11 @@ impl
             authentication_date: None,
             effective_authentication_type: None,
             challenge_code: None,
-            pares_status_reason: None,
+            signed_pares_status_reason: None,
             challenge_cancel_code: None,
             network_score: None,
             acs_transaction_id: None,
+            cavv_algorithm: None,
         });
 
         let merchant_defined_information = item
@@ -2014,10 +2018,11 @@ impl
                 authentication_date: None,
                 effective_authentication_type: None,
                 challenge_code: None,
-                pares_status_reason: None,
+                signed_pares_status_reason: None,
                 challenge_cancel_code: None,
                 network_score: None,
                 acs_transaction_id: None,
+                cavv_algorithm: None,
             }),
             merchant_defined_information,
         })
@@ -2166,10 +2171,11 @@ impl
                 authentication_date: None,
                 effective_authentication_type: None,
                 challenge_code: None,
-                pares_status_reason: None,
+                signed_pares_status_reason: None,
                 challenge_cancel_code: None,
                 network_score: None,
                 acs_transaction_id: None,
+                cavv_algorithm: None,
             }),
             merchant_defined_information,
         })
@@ -2384,10 +2390,11 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
                                                 authentication_date: None,
                                                 effective_authentication_type: None,
                                                 challenge_code: None,
-                                                pares_status_reason: None,
+                                                signed_pares_status_reason: None,
                                                 challenge_cancel_code: None,
                                                 network_score: None,
                                                 acs_transaction_id: None,
+                                                cavv_algorithm: None,
                                             },
                                         ),
                                     })
@@ -2658,7 +2665,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>
         )
         .then_some(true);
 
-        let cavv_algorithm = Some("2".to_string());
         Ok(Self {
             processing_information: ProcessingInformation {
                 capture_options: Some(CaptureOptions {
@@ -2672,7 +2678,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>
                 capture: None,
                 commerce_indicator: String::from("internet"),
                 payment_solution: None,
-                cavv_algorithm,
             },
             order_information: OrderInformationWithBill {
                 amount_details: Amount {
@@ -2698,7 +2703,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>
     ) -> Result<Self, Self::Error> {
         let connector_merchant_config =
             CybersourceConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?;
-        let cavv_algorithm = Some("2".to_string());
 
         Ok(Self {
             processing_information: ProcessingInformation {
@@ -2722,7 +2726,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>
                 capture: None,
                 capture_options: None,
                 payment_solution: None,
-                cavv_algorithm,
             },
             order_information: OrderInformationIncrementalAuthorization {
                 amount_details: AdditionalAmount {
 | 
	2025-08-12T11:56:14Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Fix consumer authenttication information fields
1. Renamed _consumer_authentication_information.pares_status_reason_ field to _consumer_authentication_information.signed_pares_status_reason_
2. Moved _cavv_algorithm_ from _processing_information_ to _consumer_authentication_information_
Verified with cybersouce api spec
<img width="531" height="634" alt="Screenshot 2025-08-12 at 5 24 33 PM" src="https://github.com/user-attachments/assets/4e8a1c93-1827-4991-b750-6449f52398fe" />
<img width="416" height="487" alt="Screenshot 2025-08-12 at 5 24 58 PM" src="https://github.com/user-attachments/assets/e80e3233-26ba-49f7-90af-4e2bce65456c" />
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
3. `crates/router/src/configs`
4. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Steps:
1. Do a 3ds payment via cybersource and netcetera
2. Check cybersource request fields for signed_pares_status_reason, cavv_algorithm
<img width="1496" height="359" alt="Screenshot 2025-08-12 at 5 22 54 PM" src="https://github.com/user-attachments/assets/82bcb9fc-4a0f-4dcf-a45b-fb7f6c4530c9" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	9de83ee767a14213ae114a6215d4c9e18df767f1 | 
	
Steps:
1. Do a 3ds payment via cybersource and netcetera
2. Check cybersource request fields for signed_pares_status_reason, cavv_algorithm
<img width="1496" height="359" alt="Screenshot 2025-08-12 at 5 22 54 PM" src="https://github.com/user-attachments/assets/82bcb9fc-4a0f-4dcf-a45b-fb7f6c4530c9" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8920 | 
	Bug: [BUG] [XENDIT] CVV needs to be optional
### Bug Description
CVV should be made an optional field for the connector Xendit.
### Expected Behavior
If we do not pass CVV payment is getting failed for Xendit PSP
### Actual Behavior
If we do not pass CVV payment should still get succeeded for Xendit PSP
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs
index ff84224a658..57c5978bdf3 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs
@@ -626,31 +626,18 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
-        let response: xendit::XenditPaymentResponse = res
+        let response: xendit::XenditCaptureResponse = res
             .response
             .parse_struct("Xendit PaymentsResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
-        let response_integrity_object = connector_utils::get_capture_integrity_object(
-            self.amount_converter,
-            Some(response.amount),
-            response.currency.to_string().clone(),
-        )?;
-
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-
-        let new_router_data = RouterData::try_from(ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
         })
-        .change_context(errors::ConnectorError::ResponseHandlingFailed);
-
-        new_router_data.map(|mut router_data| {
-            router_data.request.integrity_object = Some(response_integrity_object);
-            router_data
-        })
+        .change_context(errors::ConnectorError::ResponseHandlingFailed)
     }
 
     fn get_error_response(
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
index 7b649289ea0..ea10e96dcbf 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
@@ -133,7 +133,8 @@ pub struct CardInformation {
     pub card_number: CardNumber,
     pub expiry_month: Secret<String>,
     pub expiry_year: Secret<String>,
-    pub cvv: Secret<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cvv: Option<Secret<String>>,
     pub cardholder_name: Secret<String>,
     pub cardholder_email: pii::Email,
     pub cardholder_phone_number: Secret<String>,
@@ -201,6 +202,16 @@ fn map_payment_response_to_attempt_status(
     }
 }
 
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct XenditCaptureResponse {
+    pub id: String,
+    pub status: PaymentStatus,
+    pub actions: Option<Vec<Action>>,
+    pub payment_method: PaymentMethodInfo,
+    pub failure_code: Option<String>,
+    pub reference_id: Secret<String>,
+}
+
 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "UPPERCASE")]
 pub enum MethodType {
@@ -242,7 +253,11 @@ impl TryFrom<XenditRouterData<&PaymentsAuthorizeRouterData>> for XenditPaymentsR
                             card_number: card_data.card_number.clone(),
                             expiry_month: card_data.card_exp_month.clone(),
                             expiry_year: card_data.get_expiry_year_4_digit(),
-                            cvv: card_data.card_cvc.clone(),
+                            cvv: if card_data.card_cvc.clone().expose().is_empty() {
+                                None
+                            } else {
+                                Some(card_data.card_cvc.clone())
+                            },
                             cardholder_name: card_data
                                 .get_cardholder_name()
                                 .or(item.router_data.get_billing_full_name())?,
@@ -410,7 +425,7 @@ impl<F>
 }
 
 impl<F>
-    TryFrom<ResponseRouterData<F, XenditPaymentResponse, PaymentsCaptureData, PaymentsResponseData>>
+    TryFrom<ResponseRouterData<F, XenditCaptureResponse, PaymentsCaptureData, PaymentsResponseData>>
     for RouterData<F, PaymentsCaptureData, PaymentsResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
@@ -418,12 +433,18 @@ impl<F>
     fn try_from(
         item: ResponseRouterData<
             F,
-            XenditPaymentResponse,
+            XenditCaptureResponse,
             PaymentsCaptureData,
             PaymentsResponseData,
         >,
     ) -> Result<Self, Self::Error> {
-        let status = map_payment_response_to_attempt_status(item.response.clone(), true);
+        let status = match item.response.status {
+            PaymentStatus::Failed => enums::AttemptStatus::Failure,
+            PaymentStatus::Succeeded | PaymentStatus::Verified => enums::AttemptStatus::Charged,
+            PaymentStatus::Pending => enums::AttemptStatus::Pending,
+            PaymentStatus::RequiresAction => enums::AttemptStatus::AuthenticationPending,
+            PaymentStatus::AwaitingCapture => enums::AttemptStatus::Authorized,
+        };
         let response = if status == enums::AttemptStatus::Failure {
             Err(ErrorResponse {
                 code: item
 | 
	2025-08-12T09:54:21Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
1. CVV should be made an optional field for the connector Xendit.
2. Fix Capture Flow for Xendit
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
3. `crates/router/src/configs`
4. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
https://github.com/juspay/hyperswitch/issues/8920
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Testing CURL's:
Payments Create:
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_43StkeAliDdRysVQ1Bk58TfaGfqvDrRcQDIWNdnr9rx3WGPr7qnKR9ZQzdmf7P07' \
--data-raw '{
    "amount": 6540000,
    "currency": "IDR",
    "confirm": true,
    "capture_method": "manual",
    "email": "abc@def.com",
    "amount_to_capture": 6540000,
    "billing": {
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "card_number": "4000000000001091",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "credit",
    "retry_action": "manual_retry"
}'
```
Response:
```
{
    "payment_id": "pay_iapkM8sQja6Xvfdn9Tje",
    "merchant_id": "merchant_1754983663",
    "status": "processing",
    "amount": 6540000,
    "net_amount": 6540000,
    "shipping_cost": null,
    "amount_capturable": 6540000,
    "amount_received": null,
    "connector": "xendit",
    "client_secret": "pay_iapkM8sQja6Xvfdn9Tje_secret_83zsZQ4asN8r6n39cRgb",
    "created": "2025-08-12T09:59:40.385Z",
    "currency": "IDR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "abc@def.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "2aa664ab-6a91-417d-a9bb-db3f6fd1fc21",
    "payment_link": null,
    "profile_id": "pro_pRZDis5aB5cSfftyA4Dq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mJa8AsZOXYdYmggROjBG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-12T10:14:40.385Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-12T09:59:41.228Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments Retrieve:
Request:
```
curl --location 'http://localhost:8080/payments/pay_iapkM8sQja6Xvfdn9Tje?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_43StkeAliDdRysVQ1Bk58TfaGfqvDrRcQDIWNdnr9rx3WGPr7qnKR9ZQzdmf7P07'
```
Response:
```
{
    "payment_id": "pay_iapkM8sQja6Xvfdn9Tje",
    "merchant_id": "merchant_1754983663",
    "status": "requires_capture",
    "amount": 6540000,
    "net_amount": 6540000,
    "shipping_cost": null,
    "amount_capturable": 6540000,
    "amount_received": null,
    "connector": "xendit",
    "client_secret": "pay_iapkM8sQja6Xvfdn9Tje_secret_83zsZQ4asN8r6n39cRgb",
    "created": "2025-08-12T09:59:40.385Z",
    "currency": "IDR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "abc@def.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_iapkM8sQja6Xvfdn9Tje_1",
            "status": "pending",
            "amount": 6540000,
            "order_tax_amount": null,
            "currency": "IDR",
            "connector": "xendit",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
            "capture_method": "manual",
            "authentication_type": "no_three_ds",
            "created_at": "2025-08-12T09:59:40.385Z",
            "modified_at": "2025-08-12T09:59:41.229Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": "2aa664ab-6a91-417d-a9bb-db3f6fd1fc21",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "2aa664ab-6a91-417d-a9bb-db3f6fd1fc21",
    "payment_link": null,
    "profile_id": "pro_pRZDis5aB5cSfftyA4Dq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mJa8AsZOXYdYmggROjBG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-12T10:14:40.385Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-12T09:59:48.778Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments Capture:
Request:
```
curl --location 'http://localhost:8080/payments/pay_iapkM8sQja6Xvfdn9Tje/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_43StkeAliDdRysVQ1Bk58TfaGfqvDrRcQDIWNdnr9rx3WGPr7qnKR9ZQzdmf7P07' \
--data '{
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}'
```
Response:
```
{
    "payment_id": "pay_iapkM8sQja6Xvfdn9Tje",
    "merchant_id": "merchant_1754983663",
    "status": "succeeded",
    "amount": 6540000,
    "net_amount": 6540000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540000,
    "connector": "xendit",
    "client_secret": "pay_iapkM8sQja6Xvfdn9Tje_secret_83zsZQ4asN8r6n39cRgb",
    "created": "2025-08-12T09:59:40.385Z",
    "currency": "IDR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "abc@def.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "1746e4f7-36a7-4058-9301-aac9772f97b7",
    "payment_link": null,
    "profile_id": "pro_pRZDis5aB5cSfftyA4Dq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mJa8AsZOXYdYmggROjBG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-12T10:14:40.385Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-12T09:59:57.719Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Note: Existing CYPRESS not working on main branch for PSP Xendit and hence skipping Cypress tests for this PR
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8bb8b2062e84e8d7116a9ca0e76c8ebd71b2b3ec | 
	
Testing CURL's:
Payments Create:
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_43StkeAliDdRysVQ1Bk58TfaGfqvDrRcQDIWNdnr9rx3WGPr7qnKR9ZQzdmf7P07' \
--data-raw '{
    "amount": 6540000,
    "currency": "IDR",
    "confirm": true,
    "capture_method": "manual",
    "email": "abc@def.com",
    "amount_to_capture": 6540000,
    "billing": {
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "card_number": "4000000000001091",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "credit",
    "retry_action": "manual_retry"
}'
```
Response:
```
{
    "payment_id": "pay_iapkM8sQja6Xvfdn9Tje",
    "merchant_id": "merchant_1754983663",
    "status": "processing",
    "amount": 6540000,
    "net_amount": 6540000,
    "shipping_cost": null,
    "amount_capturable": 6540000,
    "amount_received": null,
    "connector": "xendit",
    "client_secret": "pay_iapkM8sQja6Xvfdn9Tje_secret_83zsZQ4asN8r6n39cRgb",
    "created": "2025-08-12T09:59:40.385Z",
    "currency": "IDR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "abc@def.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "2aa664ab-6a91-417d-a9bb-db3f6fd1fc21",
    "payment_link": null,
    "profile_id": "pro_pRZDis5aB5cSfftyA4Dq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mJa8AsZOXYdYmggROjBG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-12T10:14:40.385Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-12T09:59:41.228Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments Retrieve:
Request:
```
curl --location 'http://localhost:8080/payments/pay_iapkM8sQja6Xvfdn9Tje?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_43StkeAliDdRysVQ1Bk58TfaGfqvDrRcQDIWNdnr9rx3WGPr7qnKR9ZQzdmf7P07'
```
Response:
```
{
    "payment_id": "pay_iapkM8sQja6Xvfdn9Tje",
    "merchant_id": "merchant_1754983663",
    "status": "requires_capture",
    "amount": 6540000,
    "net_amount": 6540000,
    "shipping_cost": null,
    "amount_capturable": 6540000,
    "amount_received": null,
    "connector": "xendit",
    "client_secret": "pay_iapkM8sQja6Xvfdn9Tje_secret_83zsZQ4asN8r6n39cRgb",
    "created": "2025-08-12T09:59:40.385Z",
    "currency": "IDR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "abc@def.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_iapkM8sQja6Xvfdn9Tje_1",
            "status": "pending",
            "amount": 6540000,
            "order_tax_amount": null,
            "currency": "IDR",
            "connector": "xendit",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
            "capture_method": "manual",
            "authentication_type": "no_three_ds",
            "created_at": "2025-08-12T09:59:40.385Z",
            "modified_at": "2025-08-12T09:59:41.229Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": "2aa664ab-6a91-417d-a9bb-db3f6fd1fc21",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "2aa664ab-6a91-417d-a9bb-db3f6fd1fc21",
    "payment_link": null,
    "profile_id": "pro_pRZDis5aB5cSfftyA4Dq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mJa8AsZOXYdYmggROjBG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-12T10:14:40.385Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-12T09:59:48.778Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payments Capture:
Request:
```
curl --location 'http://localhost:8080/payments/pay_iapkM8sQja6Xvfdn9Tje/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_43StkeAliDdRysVQ1Bk58TfaGfqvDrRcQDIWNdnr9rx3WGPr7qnKR9ZQzdmf7P07' \
--data '{
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}'
```
Response:
```
{
    "payment_id": "pay_iapkM8sQja6Xvfdn9Tje",
    "merchant_id": "merchant_1754983663",
    "status": "succeeded",
    "amount": 6540000,
    "net_amount": 6540000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540000,
    "connector": "xendit",
    "client_secret": "pay_iapkM8sQja6Xvfdn9Tje_secret_83zsZQ4asN8r6n39cRgb",
    "created": "2025-08-12T09:59:40.385Z",
    "currency": "IDR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "abc@def.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "11",
            "card_exp_year": "29",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-d7afb058-5ecb-424b-af1a-60c6ce3f8df0",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "1746e4f7-36a7-4058-9301-aac9772f97b7",
    "payment_link": null,
    "profile_id": "pro_pRZDis5aB5cSfftyA4Dq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_mJa8AsZOXYdYmggROjBG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-12T10:14:40.385Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-12T09:59:57.719Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Note: Existing CYPRESS not working on main branch for PSP Xendit and hence skipping Cypress tests for this PR
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8919 | 
	Bug: [CHORE] fix typos in the repo
there exist a few typos in the repo. | 
	diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 3bdc756dc89..2e70e1a6c95 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -3002,7 +3002,7 @@ pub struct ProfileUpdate {
     #[schema(value_type = Option<MerchantCountryCode>, example = "840")]
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
 
-    /// Inidcates the state of revenue recovery algorithm type
+    /// Indicates the state of revenue recovery algorithm type
     #[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
     pub revenue_recovery_retry_algorithm_type:
         Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
index 1b8e2a65057..8444c7b9dd3 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
@@ -188,7 +188,7 @@ impl
                     ds_trans_id: response.authentication_response.ds_trans_id,
                     eci: response.eci,
                     challenge_code,
-                    challenge_cancel: None, // Note - challenge_cancel field is recieved in the RReq and updated in DB during external_authentication_incoming_webhook_flow
+                    challenge_cancel: None, // Note - challenge_cancel field is received in the RReq and updated in DB during external_authentication_incoming_webhook_flow
                     challenge_code_reason: response.authentication_response.trans_status_reason,
                     message_extension,
                 })
diff --git a/crates/router/src/core/payments/routing/utils.rs b/crates/router/src/core/payments/routing/utils.rs
index 3c7a081d41f..22c1681be04 100644
--- a/crates/router/src/core/payments/routing/utils.rs
+++ b/crates/router/src/core/payments/routing/utils.rs
@@ -420,14 +420,14 @@ pub async fn decision_engine_routing(
         return Ok(Vec::default());
     };
 
-    let de_output_conenctor = extract_de_output_connectors(de_euclid_response.output)
+    let de_output_connector = extract_de_output_connectors(de_euclid_response.output)
             .map_err(|e| {
                 logger::error!(error=?e, "decision_engine_euclid_evaluation_error: Failed to extract connector from Output");
                 e
             })?;
 
     transform_de_output_for_router(
-            de_output_conenctor.clone(),
+            de_output_connector.clone(),
             de_euclid_response.evaluated_output.clone(),
         )
         .map_err(|e| {
 | 
	2025-08-12T08:11:51Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
this pr fixes typos.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
fix typos in the repo.
closes https://github.com/juspay/hyperswitch/issues/8919
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
nothing to test.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `just clippy && just clippy_v2`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8bb8b2062e84e8d7116a9ca0e76c8ebd71b2b3ec | 
	
nothing to test.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8914 | 
	Bug: [REFACTOR]: [NUVIE] Fix card 3ds
Fix card 3ds for Nuvie connector | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 6d4b27f17e6..3e811b7dddf 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -62,6 +62,11 @@ fn to_boolean(string: String) -> bool {
     }
 }
 
+// The dimensions of the challenge window for full screen.
+const CHALLENGE_WINDOW_SIZE: &str = "05";
+// The challenge preference for the challenge flow.
+const CHALLENGE_PREFERNCE: &str = "01";
+
 trait NuveiAuthorizePreprocessingCommon {
     fn get_browser_info(&self) -> Option<BrowserInformation>;
     fn get_related_transaction_id(&self) -> Option<String>;
@@ -527,6 +532,7 @@ pub struct V2AdditionalParams {
     pub rebill_expiry: Option<String>,
     /// Recurring Frequency in days
     pub rebill_frequency: Option<String>,
+    pub challenge_preference: Option<String>,
 }
 
 #[derive(Debug, Clone, Default, Serialize, Deserialize)]
@@ -563,7 +569,7 @@ pub struct NuveiACSResponse {
     pub message_type: String,
     pub message_version: String,
     pub trans_status: Option<LiabilityShift>,
-    pub message_extension: Vec<MessageExtensionAttribute>,
+    pub message_extension: Option<Vec<MessageExtensionAttribute>>,
     pub acs_signed_content: Option<serde_json::Value>,
 }
 
@@ -1197,11 +1203,22 @@ where
                         ),
                         rebill_frequency: Some(mandate_meta.frequency),
                         challenge_window_size: None,
+                        challenge_preference: None,
                     }),
                     item.request.get_customer_id_required(),
                 )
             }
-            _ => (None, None, None),
+            // non mandate transactions
+            _ => (
+                None,
+                Some(V2AdditionalParams {
+                    rebill_expiry: None,
+                    rebill_frequency: None,
+                    challenge_window_size: Some(CHALLENGE_WINDOW_SIZE.to_string()),
+                    challenge_preference: Some(CHALLENGE_PREFERNCE.to_string()),
+                }),
+                None,
+            ),
         };
     let three_d = if item.is_three_ds() {
         let browser_details = match &browser_information {
@@ -1277,14 +1294,18 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret<String>)>
     ) -> Result<Self, Self::Error> {
         let item = data.0;
         let request_data = match item.request.payment_method_data.clone() {
-            Some(PaymentMethodData::Card(card)) => Ok(Self {
-                payment_option: PaymentOption::from(NuveiCardDetails {
-                    card,
-                    three_d: None,
-                    card_holder_name: item.get_optional_billing_full_name(),
-                }),
-                ..Default::default()
-            }),
+            Some(PaymentMethodData::Card(card)) => {
+                let device_details = DeviceDetails::foreign_try_from(&item.request.browser_info)?;
+                Ok(Self {
+                    payment_option: PaymentOption::from(NuveiCardDetails {
+                        card,
+                        three_d: None,
+                        card_holder_name: item.get_optional_billing_full_name(),
+                    }),
+                    device_details,
+                    ..Default::default()
+                })
+            }
             Some(PaymentMethodData::Wallet(..))
             | Some(PaymentMethodData::PayLater(..))
             | Some(PaymentMethodData::BankDebit(..))
@@ -1319,6 +1340,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret<String>)>
         Ok(Self {
             related_transaction_id: request_data.related_transaction_id,
             payment_option: request_data.payment_option,
+            device_details: request_data.device_details,
             ..request
         })
     }
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
index a26d0c7689f..1c6977ac5c9 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
@@ -75,7 +75,7 @@ pub struct MessageExtensionAttribute {
     pub id: String,
     pub name: String,
     pub criticality_indicator: bool,
-    pub data: String,
+    pub data: serde_json::Value,
 }
 
 #[derive(Clone, Default, Debug)]
 | 
	2025-08-11T14:21:59Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Fix deserlization  error for Nuvei card 3ds
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
Create nuvie card 3ds
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_5iub419oM0WIf9pI6nHrCbopoQ5dSKQEJkyPJZCmYbqECx5KC61S7N1yl7c1IdKD' \
--data-raw '{
    "amount": 15100,
    "currency": "EUR",
    "confirm": true,
    "customer_id":"nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_type": "credit",
    "authentication_type": "three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "card": {
            "card_number": "2221008123677736",
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "card_cvc": "217"
        }
    },
     "setup_future_usage": "on_session"
}'
```
response
```
{
    "payment_id": "pay_SwA17VK0vJc9lZyksSsp",
    "merchant_id": "merchant_1754896786",
    "status": "requires_customer_action",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 15100,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_SwA17VK0vJc9lZyksSsp_secret_1Le4qoHaeDahJN4pDv4N",
    "created": "2025-08-11T12:47:40.099Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "cReq": "eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjZjNzNkZWQ5LTRmMzEtNDNjMS1iYjdmLTEwMDA2YmYyMTBmYiIsImFjc1RyYW5zSUQiOiIzZmRhNGVjYS0xMzI3LTQyZjctOGU2Ny1mYzE4ZDUxNDM0NTIiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVHlwZSI6IkNSZXEiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0",
                "flow": "challenge",
                "acsUrl": "https://3dsn.sandbox.safecharge.com/ThreeDSACSEmulatorChallenge/api/ThreeDSACSChallengeController/ChallengePage?eyJub3RpZmljYXRpb25VUkwiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvcGF5bWVudHMvcGF5X1N3QTE3VkswdkpjOWxaeWtzU3NwL21lcmNoYW50XzE3NTQ4OTY3ODYvcmVkaXJlY3QvY29tcGxldGUvbnV2ZWkiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjZjNzNkZWQ5LTRmMzEtNDNjMS1iYjdmLTEwMDA2YmYyMTBmYiIsImFjc1RyYW5zSUQiOiIzZmRhNGVjYS0xMzI3LTQyZjctOGU2Ny1mYzE4ZDUxNDM0NTIiLCJkc1RyYW5zSUQiOiI3ZGUyY2YxZC00MmYxLTQ1ZWItOGE1Mi02MmQ5Mjk3OWEwOWUiLCJkYXRhIjpudWxsLCJNZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0=",
                "version": "2.2.0",
                "threeDFlow": "1",
                "decisionReason": "NoPreference",
                "threeDReasonId": "",
                "acquirerDecision": "ExemptionRequest",
                "challengePreferenceReason": "12",
                "isExemptionRequestInAuthentication": "0"
            }
        },
        "billing": null
    },
    "payment_token": "token_jptsctTb26hNYSmaPHom",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SwA17VK0vJc9lZyksSsp/merchant_1754896786/pay_SwA17VK0vJc9lZyksSsp_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1754916460,
        "expires": 1754920060,
        "secret": "epk_00825ca507a647b1a68b6e174af4ad28"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "8110000000012074375",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7784849111",
    "payment_link": null,
    "profile_id": "pro_Ff3vG29EedTBVrRtdf20",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_vvdYt5E4uXbNvYftGlYf",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-11T13:02:40.099Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-11T12:47:42.875Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Complete payment using redirection
2. Do psync
Response
```
{
    "payment_id": "pay_SwA17VK0vJc9lZyksSsp",
    "merchant_id": "merchant_1754896786",
    "status": "succeeded",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 15100,
    "connector": "nuvei",
    "client_secret": "pay_SwA17VK0vJc9lZyksSsp_secret_1Le4qoHaeDahJN4pDv4N",
    "created": "2025-08-11T12:47:40.099Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "flow": "challenge",
                "decisionReason": "NoPreference",
                "acquirerDecision": "ExemptionRequest",
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_jptsctTb26hNYSmaPHom",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012074525",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7784849111",
    "payment_link": null,
    "profile_id": "pro_Ff3vG29EedTBVrRtdf20",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_vvdYt5E4uXbNvYftGlYf",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-11T13:02:40.099Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-11T12:49:18.842Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
cypress test
<img width="1486" height="1756" alt="Screenshot 2025-08-12 at 1 41 17 PM" src="https://github.com/user-attachments/assets/e52ca0ab-1600-48ca-8430-3b3e80ba4545" />
<img width="1824" height="1550" alt="Screenshot 2025-08-12 at 4 44 25 PM" src="https://github.com/user-attachments/assets/42c36473-c99e-489c-b668-07782a3b7a99" />
<img width="855" height="792" alt="Screenshot 2025-08-19 at 3 30 24 PM" src="https://github.com/user-attachments/assets/78d85781-a5e4-4e6c-842a-26736dd57151" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	6950c04eaebc0499040556d8bbf5c684aebd2c9e | 
	Create nuvie card 3ds
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_5iub419oM0WIf9pI6nHrCbopoQ5dSKQEJkyPJZCmYbqECx5KC61S7N1yl7c1IdKD' \
--data-raw '{
    "amount": 15100,
    "currency": "EUR",
    "confirm": true,
    "customer_id":"nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_type": "credit",
    "authentication_type": "three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "card": {
            "card_number": "2221008123677736",
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "card_cvc": "217"
        }
    },
     "setup_future_usage": "on_session"
}'
```
response
```
{
    "payment_id": "pay_SwA17VK0vJc9lZyksSsp",
    "merchant_id": "merchant_1754896786",
    "status": "requires_customer_action",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 15100,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_SwA17VK0vJc9lZyksSsp_secret_1Le4qoHaeDahJN4pDv4N",
    "created": "2025-08-11T12:47:40.099Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "cReq": "eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjZjNzNkZWQ5LTRmMzEtNDNjMS1iYjdmLTEwMDA2YmYyMTBmYiIsImFjc1RyYW5zSUQiOiIzZmRhNGVjYS0xMzI3LTQyZjctOGU2Ny1mYzE4ZDUxNDM0NTIiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVHlwZSI6IkNSZXEiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0",
                "flow": "challenge",
                "acsUrl": "https://3dsn.sandbox.safecharge.com/ThreeDSACSEmulatorChallenge/api/ThreeDSACSChallengeController/ChallengePage?eyJub3RpZmljYXRpb25VUkwiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvcGF5bWVudHMvcGF5X1N3QTE3VkswdkpjOWxaeWtzU3NwL21lcmNoYW50XzE3NTQ4OTY3ODYvcmVkaXJlY3QvY29tcGxldGUvbnV2ZWkiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjZjNzNkZWQ5LTRmMzEtNDNjMS1iYjdmLTEwMDA2YmYyMTBmYiIsImFjc1RyYW5zSUQiOiIzZmRhNGVjYS0xMzI3LTQyZjctOGU2Ny1mYzE4ZDUxNDM0NTIiLCJkc1RyYW5zSUQiOiI3ZGUyY2YxZC00MmYxLTQ1ZWItOGE1Mi02MmQ5Mjk3OWEwOWUiLCJkYXRhIjpudWxsLCJNZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0=",
                "version": "2.2.0",
                "threeDFlow": "1",
                "decisionReason": "NoPreference",
                "threeDReasonId": "",
                "acquirerDecision": "ExemptionRequest",
                "challengePreferenceReason": "12",
                "isExemptionRequestInAuthentication": "0"
            }
        },
        "billing": null
    },
    "payment_token": "token_jptsctTb26hNYSmaPHom",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SwA17VK0vJc9lZyksSsp/merchant_1754896786/pay_SwA17VK0vJc9lZyksSsp_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1754916460,
        "expires": 1754920060,
        "secret": "epk_00825ca507a647b1a68b6e174af4ad28"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "8110000000012074375",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7784849111",
    "payment_link": null,
    "profile_id": "pro_Ff3vG29EedTBVrRtdf20",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_vvdYt5E4uXbNvYftGlYf",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-11T13:02:40.099Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-11T12:47:42.875Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Complete payment using redirection
2. Do psync
Response
```
{
    "payment_id": "pay_SwA17VK0vJc9lZyksSsp",
    "merchant_id": "merchant_1754896786",
    "status": "succeeded",
    "amount": 15100,
    "net_amount": 15100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 15100,
    "connector": "nuvei",
    "client_secret": "pay_SwA17VK0vJc9lZyksSsp_secret_1Le4qoHaeDahJN4pDv4N",
    "created": "2025-08-11T12:47:40.099Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "flow": "challenge",
                "decisionReason": "NoPreference",
                "acquirerDecision": "ExemptionRequest",
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_jptsctTb26hNYSmaPHom",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012074525",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7784849111",
    "payment_link": null,
    "profile_id": "pro_Ff3vG29EedTBVrRtdf20",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_vvdYt5E4uXbNvYftGlYf",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-11T13:02:40.099Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-11T12:49:18.842Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
cypress test
<img width="1486" height="1756" alt="Screenshot 2025-08-12 at 1 41 17 PM" src="https://github.com/user-attachments/assets/e52ca0ab-1600-48ca-8430-3b3e80ba4545" />
<img width="1824" height="1550" alt="Screenshot 2025-08-12 at 4 44 25 PM" src="https://github.com/user-attachments/assets/42c36473-c99e-489c-b668-07782a3b7a99" />
<img width="855" height="792" alt="Screenshot 2025-08-19 at 3 30 24 PM" src="https://github.com/user-attachments/assets/78d85781-a5e4-4e6c-842a-26736dd57151" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8910 | 
	Bug: refactor(euclid): transform enum types to include sub-variants of payment method types
 | 
	diff --git a/crates/router/src/core/payments/routing/utils.rs b/crates/router/src/core/payments/routing/utils.rs
index d9d5ed1de26..f7eafcc28d1 100644
--- a/crates/router/src/core/payments/routing/utils.rs
+++ b/crates/router/src/core/payments/routing/utils.rs
@@ -18,7 +18,10 @@ use diesel_models::{enums, routing_algorithm};
 use error_stack::ResultExt;
 use euclid::{
     backend::BackendInput,
-    frontend::ast::{self},
+    frontend::{
+        ast::{self},
+        dir::{self, transformers::IntoDirValue},
+    },
 };
 #[cfg(all(feature = "v1", feature = "dynamic_routing"))]
 use external_services::grpc_client::dynamic_routing as ir_client;
@@ -593,6 +596,17 @@ pub fn convert_backend_input_to_routing_eval(
             "payment_method".to_string(),
             Some(ValueType::EnumVariant(pm.to_string())),
         );
+        if let Some(pmt) = input.payment_method.payment_method_type {
+            match (pmt, pm).into_dir_value() {
+                Ok(dv) => insert_dirvalue_param(&mut params, dv),
+                Err(e) => logger::debug!(
+                    ?e,
+                    ?pmt,
+                    ?pm,
+                    "decision_engine_euclid: into_dir_value failed; skipping subset param"
+                ),
+            }
+        }
     }
     if let Some(pmt) = input.payment_method.payment_method_type {
         params.insert(
@@ -647,6 +661,110 @@ pub fn convert_backend_input_to_routing_eval(
     })
 }
 
+// All the independent variants of payment method types, configured via dashboard
+fn insert_dirvalue_param(params: &mut HashMap<String, Option<ValueType>>, dv: dir::DirValue) {
+    match dv {
+        dir::DirValue::RewardType(v) => {
+            params.insert(
+                "reward".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::CardType(v) => {
+            params.insert(
+                "card".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::PayLaterType(v) => {
+            params.insert(
+                "pay_later".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::WalletType(v) => {
+            params.insert(
+                "wallet".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::VoucherType(v) => {
+            params.insert(
+                "voucher".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::BankRedirectType(v) => {
+            params.insert(
+                "bank_redirect".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::BankDebitType(v) => {
+            params.insert(
+                "bank_debit".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::BankTransferType(v) => {
+            params.insert(
+                "bank_transfer".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::RealTimePaymentType(v) => {
+            params.insert(
+                "real_time_payment".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::UpiType(v) => {
+            params.insert(
+                "upi".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::GiftCardType(v) => {
+            params.insert(
+                "gift_card".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::CardRedirectType(v) => {
+            params.insert(
+                "card_redirect".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::OpenBankingType(v) => {
+            params.insert(
+                "open_banking".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::MobilePaymentType(v) => {
+            params.insert(
+                "mobile_payment".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        dir::DirValue::CryptoType(v) => {
+            params.insert(
+                "crypto".to_string(),
+                Some(ValueType::EnumVariant(v.to_string())),
+            );
+        }
+        other => {
+            // all other values can be ignored for now as they don't converge with
+            // payment method type
+            logger::warn!(
+                ?other,
+                "decision_engine_euclid: unmapped dir::DirValue; add a mapping here"
+            );
+        }
+    }
+}
+
 #[derive(Debug, Clone, serde::Deserialize)]
 struct DeErrorResponse {
     code: String,
 | 
	2025-08-11T12:19:51Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR refactors the Euclid routing parameter transformation logic to **include sub-variants of payment method types** in the Decision Engine evaluation request.  
Key updates:
- Added logic to **convert `(payment_method_type, payment_method)` pairs** into a `DirValue` representation.
- Introduced `insert_dirvalue_param()` to map each `DirValue` variant into a corresponding routing parameter key.
- Enhanced `convert_backend_input_to_routing_eval` to insert these sub-variant parameters alongside existing routing parameters.
- This ensures richer context is sent to Euclid for more granular routing decisions.
## Outcomes
- Enables **finer-grained routing rules** based on payment method sub-types (e.g., `WalletType`, `CryptoType`, `GiftCardType`).
- Improves compatibility with dashboard-configured payment method rules in Euclid.
- Makes routing evaluation requests **more descriptive and precise**, improving match accuracy.
## Diff Hunk Explanation
### `crates/router/src/core/payments/routing/utils.rs`
- **Modified** `convert_backend_input_to_routing_eval`:
  - Added check for both `payment_method_type` and `payment_method` presence.
  - Converted them into a `DirValue` using `into_dir_value()`.
  - Inserted the resulting parameters into the evaluation request map.
- **Added** new helper `insert_dirvalue_param()`:
  - Matches on each `DirValue` variant and inserts it as a `ValueType::EnumVariant` with an appropriate key (e.g., `"wallet"`, `"crypto"`, `"bank_transfer"`).
  - Ignores unsupported or non-converging variants for now.
- **No changes** to external APIs or DB schema — purely internal parameter transformation refactor.
This refactor lays the groundwork for **sub-type aware routing** in Euclid without requiring external schema changes.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Testing isn't required as this is just an enum mapping change.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	0e957854372f1e6a81ce72234b8a4fda16cb4b8d | 
	
Testing isn't required as this is just an enum mapping change.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8944 | 
	Bug: [BUG] Related to card ntw for ucs
### Bug Description
missing card network for ucs 
### Expected Behavior
there should be American Express card network for UCS
### Actual Behavior
card network was missing
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 8db71c930f3..4f6313ea31a 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -9,7 +9,8 @@ use tonic::{
 };
 use unified_connector_service_client::payments::{
     self as payments_grpc, payment_service_client::PaymentServiceClient,
-    PaymentServiceAuthorizeResponse,
+    PaymentServiceAuthorizeResponse, PaymentServiceTransformRequest,
+    PaymentServiceTransformResponse,
 };
 
 use crate::{
@@ -96,6 +97,10 @@ pub enum UnifiedConnectorServiceError {
     /// Failed to perform Payment Repeat Payment from gRPC Server
     #[error("Failed to perform Repeat Payment from gRPC Server")]
     PaymentRepeatEverythingFailure,
+
+    /// Failed to transform incoming webhook from gRPC Server
+    #[error("Failed to transform incoming webhook from gRPC Server")]
+    WebhookTransformFailure,
 }
 
 /// Result type for Dynamic Routing
@@ -194,6 +199,7 @@ impl UnifiedConnectorServiceClient {
     ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceAuthorizeResponse>> {
         let mut request = tonic::Request::new(payment_authorize_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -203,7 +209,14 @@ impl UnifiedConnectorServiceClient {
             .authorize(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentAuthorizeFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_authorize",
+                    connector_name=?connector_name,
+                    "UCS payment authorize gRPC call failed"
+                )
+            })
     }
 
     /// Performs Payment Sync/Get
@@ -216,6 +229,7 @@ impl UnifiedConnectorServiceClient {
     {
         let mut request = tonic::Request::new(payment_get_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -225,7 +239,14 @@ impl UnifiedConnectorServiceClient {
             .get(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentGetFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_get",
+                    connector_name=?connector_name,
+                    "UCS payment get/sync gRPC call failed"
+                )
+            })
     }
 
     /// Performs Payment Setup Mandate
@@ -238,6 +259,7 @@ impl UnifiedConnectorServiceClient {
     {
         let mut request = tonic::Request::new(payment_register_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -247,7 +269,14 @@ impl UnifiedConnectorServiceClient {
             .register(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentRegisterFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_setup_mandate",
+                    connector_name=?connector_name,
+                    "UCS payment setup mandate gRPC call failed"
+                )
+            })
     }
 
     /// Performs Payment repeat (MIT - Merchant Initiated Transaction).
@@ -261,6 +290,7 @@ impl UnifiedConnectorServiceClient {
     > {
         let mut request = tonic::Request::new(payment_repeat_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -270,7 +300,43 @@ impl UnifiedConnectorServiceClient {
             .repeat_everything(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentRepeatEverythingFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_repeat",
+                    connector_name=?connector_name,
+                    "UCS payment repeat gRPC call failed"
+                )
+            })
+    }
+
+    /// Transforms incoming webhook through UCS
+    pub async fn transform_incoming_webhook(
+        &self,
+        webhook_transform_request: PaymentServiceTransformRequest,
+        connector_auth_metadata: ConnectorAuthMetadata,
+        grpc_headers: GrpcHeaders,
+    ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceTransformResponse>> {
+        let mut request = tonic::Request::new(webhook_transform_request);
+
+        let connector_name = connector_auth_metadata.connector_name.clone();
+        let metadata =
+            build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
+        *request.metadata_mut() = metadata;
+
+        self.client
+            .clone()
+            .transform(request)
+            .await
+            .change_context(UnifiedConnectorServiceError::WebhookTransformFailure)
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="transform_incoming_webhook",
+                    connector_name=?connector_name,
+                    "UCS webhook transform gRPC call failed"
+                )
+            })
     }
 }
 
@@ -318,17 +384,18 @@ pub fn build_unified_connector_service_grpc_headers(
         parse(common_utils_consts::X_MERCHANT_ID, meta.merchant_id.peek())?,
     );
 
-    grpc_headers.tenant_id
-            .parse()
-            .map(|tenant_id| {
-                metadata.append(
-                    common_utils_consts::TENANT_HEADER,
-                    tenant_id)
-            })
-            .inspect_err(
-                |err| logger::warn!(header_parse_error=?err,"invalid {} received",common_utils_consts::TENANT_HEADER),
-            )
-            .ok();
+    if let Err(err) = grpc_headers
+        .tenant_id
+        .parse()
+        .map(|tenant_id| metadata.append(common_utils_consts::TENANT_HEADER, tenant_id))
+    {
+        logger::error!(
+            header_parse_error=?err,
+            tenant_id=?grpc_headers.tenant_id,
+            "Failed to parse tenant_id header for UCS gRPC request: {}",
+            common_utils_consts::TENANT_HEADER
+        );
+    }
 
     Ok(metadata)
 }
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index a6be59c8114..87f47a9b2bb 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4188,6 +4188,15 @@ impl MerchantConnectorAccountType {
             Self::CacheVal(_) => None,
         }
     }
+
+    pub fn get_webhook_details(
+        &self,
+    ) -> CustomResult<Option<&masking::Secret<serde_json::Value>>, errors::ApiErrorResponse> {
+        match self {
+            Self::DbVal(db_val) => Ok(db_val.connector_webhook_details.as_ref()),
+            Self::CacheVal(_) => Ok(None),
+        }
+    }
 }
 
 /// Query for merchant connector account either by business label or profile id
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 107b6e7e7a2..4e32095dea7 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1,3 +1,4 @@
+use api_models::admin;
 use common_enums::{AttemptStatus, PaymentMethodType};
 use common_utils::{errors::CustomResult, ext_traits::ValueExt};
 use error_stack::ResultExt;
@@ -13,6 +14,7 @@ use hyperswitch_domain_models::{
     router_response_types::PaymentsResponseData,
 };
 use masking::{ExposeInterface, PeekInterface, Secret};
+use router_env::logger;
 use unified_connector_service_client::payments::{
     self as payments_grpc, payment_method::PaymentMethod, CardDetails, CardPaymentMethodType,
     PaymentServiceAuthorizeResponse,
@@ -21,7 +23,7 @@ use unified_connector_service_client::payments::{
 use crate::{
     consts,
     core::{
-        errors::RouterResult,
+        errors::{ApiErrorResponse, RouterResult},
         payments::helpers::{
             is_ucs_enabled, should_execute_based_on_rollout, MerchantConnectorAccountType,
         },
@@ -29,9 +31,13 @@ use crate::{
     },
     routes::SessionState,
     types::transformers::ForeignTryFrom,
+    utils,
 };
 
-mod transformers;
+pub mod transformers;
+
+// Re-export webhook transformer types for easier access
+pub use transformers::WebhookTransformData;
 
 pub async fn should_call_unified_connector_service<F: Clone, T>(
     state: &SessionState,
@@ -80,6 +86,42 @@ pub async fn should_call_unified_connector_service<F: Clone, T>(
     Ok(should_execute)
 }
 
+pub async fn should_call_unified_connector_service_for_webhooks(
+    state: &SessionState,
+    merchant_context: &MerchantContext,
+    connector_name: &str,
+) -> RouterResult<bool> {
+    if state.grpc_client.unified_connector_service_client.is_none() {
+        logger::debug!(
+            connector = connector_name.to_string(),
+            "Unified Connector Service client is not available for webhooks"
+        );
+        return Ok(false);
+    }
+
+    let ucs_config_key = consts::UCS_ENABLED;
+
+    if !is_ucs_enabled(state, ucs_config_key).await {
+        return Ok(false);
+    }
+
+    let merchant_id = merchant_context
+        .get_merchant_account()
+        .get_id()
+        .get_string_repr();
+
+    let config_key = format!(
+        "{}_{}_{}_Webhooks",
+        consts::UCS_ROLLOUT_PERCENT_CONFIG_PREFIX,
+        merchant_id,
+        connector_name
+    );
+
+    let should_execute = should_execute_based_on_rollout(state, &config_key).await?;
+
+    Ok(should_execute)
+}
+
 pub fn build_unified_connector_service_payment_method(
     payment_method_data: hyperswitch_domain_models::payment_method_data::PaymentMethodData,
     payment_method_type: PaymentMethodType,
@@ -317,3 +359,161 @@ pub fn handle_unified_connector_service_response_for_payment_repeat(
 
     Ok((status, router_data_response, status_code))
 }
+
+pub fn build_webhook_secrets_from_merchant_connector_account(
+    #[cfg(feature = "v1")] merchant_connector_account: &MerchantConnectorAccountType,
+    #[cfg(feature = "v2")] merchant_connector_account: &MerchantConnectorAccountTypeDetails,
+) -> CustomResult<Option<payments_grpc::WebhookSecrets>, UnifiedConnectorServiceError> {
+    // Extract webhook credentials from merchant connector account
+    // This depends on how webhook secrets are stored in the merchant connector account
+
+    #[cfg(feature = "v1")]
+    let webhook_details = merchant_connector_account
+        .get_webhook_details()
+        .map_err(|_| UnifiedConnectorServiceError::FailedToObtainAuthType)?;
+
+    #[cfg(feature = "v2")]
+    let webhook_details = match merchant_connector_account {
+        MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(mca) => {
+            mca.connector_webhook_details.as_ref()
+        }
+        MerchantConnectorAccountTypeDetails::MerchantConnectorDetails(_) => None,
+    };
+
+    match webhook_details {
+        Some(details) => {
+            // Parse the webhook details JSON to extract secrets
+            let webhook_details: admin::MerchantConnectorWebhookDetails = details
+                .clone()
+                .parse_value("MerchantConnectorWebhookDetails")
+                .change_context(UnifiedConnectorServiceError::FailedToObtainAuthType)
+                .attach_printable("Failed to parse MerchantConnectorWebhookDetails")?;
+
+            // Build gRPC WebhookSecrets from parsed details
+            Ok(Some(payments_grpc::WebhookSecrets {
+                secret: webhook_details.merchant_secret.expose().to_string(),
+                additional_secret: webhook_details
+                    .additional_secret
+                    .map(|secret| secret.expose().to_string()),
+            }))
+        }
+        None => Ok(None),
+    }
+}
+
+/// High-level abstraction for calling UCS webhook transformation
+/// This provides a clean interface similar to payment flow UCS calls
+pub async fn call_unified_connector_service_for_webhook(
+    state: &SessionState,
+    merchant_context: &MerchantContext,
+    connector_name: &str,
+    body: &actix_web::web::Bytes,
+    request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+    merchant_connector_account: Option<
+        &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
+    >,
+) -> RouterResult<(
+    api_models::webhooks::IncomingWebhookEvent,
+    bool,
+    WebhookTransformData,
+)> {
+    let ucs_client = state
+        .grpc_client
+        .unified_connector_service_client
+        .as_ref()
+        .ok_or_else(|| {
+            error_stack::report!(ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable("UCS client is not available for webhook processing")
+        })?;
+
+    // Build webhook secrets from merchant connector account
+    let webhook_secrets = merchant_connector_account.and_then(|mca| {
+        #[cfg(feature = "v1")]
+        let mca_type = MerchantConnectorAccountType::DbVal(Box::new(mca.clone()));
+        #[cfg(feature = "v2")]
+        let mca_type =
+            MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(mca.clone()));
+
+        build_webhook_secrets_from_merchant_connector_account(&mca_type)
+            .map_err(|e| {
+                logger::warn!(
+                    build_error=?e,
+                    connector_name=connector_name,
+                    "Failed to build webhook secrets from merchant connector account in call_unified_connector_service_for_webhook"
+                );
+                e
+            })
+            .ok()
+            .flatten()
+    });
+
+    // Build UCS transform request using new webhook transformers
+    let transform_request = transformers::build_webhook_transform_request(
+        body,
+        request_details,
+        webhook_secrets,
+        merchant_context
+            .get_merchant_account()
+            .get_id()
+            .get_string_repr(),
+        connector_name,
+    )?;
+
+    // Build connector auth metadata
+    let connector_auth_metadata = merchant_connector_account
+        .map(|mca| {
+            #[cfg(feature = "v1")]
+            let mca_type = MerchantConnectorAccountType::DbVal(Box::new(mca.clone()));
+            #[cfg(feature = "v2")]
+            let mca_type = MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
+                mca.clone(),
+            ));
+
+            build_unified_connector_service_auth_metadata(mca_type, merchant_context)
+        })
+        .transpose()
+        .change_context(ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed to build UCS auth metadata")?
+        .ok_or_else(|| {
+            error_stack::report!(ApiErrorResponse::InternalServerError).attach_printable(
+                "Missing merchant connector account for UCS webhook transformation",
+            )
+        })?;
+
+    // Build gRPC headers
+    let grpc_headers = external_services::grpc_client::GrpcHeaders {
+        tenant_id: state.tenant.tenant_id.get_string_repr().to_string(),
+        request_id: Some(utils::generate_id(consts::ID_LENGTH, "webhook_req")),
+    };
+
+    // Make UCS call - client availability already verified
+    match ucs_client
+        .transform_incoming_webhook(transform_request, connector_auth_metadata, grpc_headers)
+        .await
+    {
+        Ok(response) => {
+            let transform_response = response.into_inner();
+            let transform_data = transformers::transform_ucs_webhook_response(transform_response)?;
+
+            // UCS handles everything internally - event type, source verification, decoding
+            Ok((
+                transform_data.event_type,
+                transform_data.source_verified,
+                transform_data,
+            ))
+        }
+        Err(err) => {
+            // When UCS is configured, we don't fall back to direct connector processing
+            Err(ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable(format!("UCS webhook processing failed: {err}"))
+        }
+    }
+}
+
+/// Extract webhook content from UCS response for further processing
+/// This provides a helper function to extract specific data from UCS responses
+pub fn extract_webhook_content_from_ucs_response(
+    transform_data: &WebhookTransformData,
+) -> Option<&unified_connector_service_client::payments::WebhookResponseContent> {
+    transform_data.webhook_content.as_ref()
+}
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index 9f8ad6c128e..a6559abc2d4 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -17,11 +17,14 @@ use hyperswitch_domain_models::{
 };
 use masking::{ExposeInterface, PeekInterface};
 use router_env::tracing;
-use unified_connector_service_client::payments::{self as payments_grpc, Identifier};
+use unified_connector_service_client::payments::{
+    self as payments_grpc, Identifier, PaymentServiceTransformRequest,
+    PaymentServiceTransformResponse,
+};
 use url::Url;
 
 use crate::{
-    core::unified_connector_service::build_unified_connector_service_payment_method,
+    core::{errors, unified_connector_service::build_unified_connector_service_payment_method},
     types::transformers::ForeignTryFrom,
 };
 impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>
@@ -39,6 +42,13 @@ impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>
             .map(|id| Identifier {
                 id_type: Some(payments_grpc::identifier::IdType::Id(id)),
             })
+            .map_err(|e| {
+                tracing::debug!(
+                    transaction_id_error=?e,
+                    "Failed to extract connector transaction ID for UCS payment sync request"
+                );
+                e
+            })
             .ok();
 
         let connector_ref_id = router_data
@@ -670,6 +680,7 @@ impl ForeignTryFrom<common_enums::CardNetwork> for payments_grpc::CardNetwork {
             common_enums::CardNetwork::UnionPay => Ok(Self::Unionpay),
             common_enums::CardNetwork::RuPay => Ok(Self::Rupay),
             common_enums::CardNetwork::Maestro => Ok(Self::Maestro),
+            common_enums::CardNetwork::AmericanExpress => Ok(Self::Amex),
             _ => Err(
                 UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
                     "Card Network not supported".to_string(),
@@ -1003,6 +1014,113 @@ impl ForeignTryFrom<common_types::payments::CustomerAcceptance>
     }
 }
 
+impl ForeignTryFrom<&hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>>
+    for payments_grpc::RequestDetails
+{
+    type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+    fn foreign_try_from(
+        request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+    ) -> Result<Self, Self::Error> {
+        let headers_map = request_details
+            .headers
+            .iter()
+            .map(|(key, value)| {
+                let value_string = value.to_str().unwrap_or_default().to_string();
+                (key.as_str().to_string(), value_string)
+            })
+            .collect();
+
+        Ok(Self {
+            method: 1, // POST method for webhooks
+            uri: Some({
+                let uri_result = request_details
+                    .headers
+                    .get("x-forwarded-path")
+                    .and_then(|h| h.to_str().map_err(|e| {
+                        tracing::warn!(
+                            header_conversion_error=?e,
+                            header_value=?h,
+                            "Failed to convert x-forwarded-path header to string for webhook processing"
+                        );
+                        e
+                    }).ok());
+
+                uri_result.unwrap_or_else(|| {
+                    tracing::debug!("x-forwarded-path header not found or invalid, using default '/Unknown'");
+                    "/Unknown"
+                }).to_string()
+            }),
+            body: request_details.body.to_vec(),
+            headers: headers_map,
+            query_params: Some(request_details.query_params.clone()),
+        })
+    }
+}
+
+/// Webhook transform data structure containing UCS response information
+pub struct WebhookTransformData {
+    pub event_type: api_models::webhooks::IncomingWebhookEvent,
+    pub source_verified: bool,
+    pub webhook_content: Option<payments_grpc::WebhookResponseContent>,
+    pub response_ref_id: Option<String>,
+}
+
+/// Transform UCS webhook response into webhook event data
+pub fn transform_ucs_webhook_response(
+    response: PaymentServiceTransformResponse,
+) -> Result<WebhookTransformData, error_stack::Report<errors::ApiErrorResponse>> {
+    let event_type = match response.event_type {
+        0 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess,
+        1 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentFailure,
+        2 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentProcessing,
+        3 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentCancelled,
+        4 => api_models::webhooks::IncomingWebhookEvent::RefundSuccess,
+        5 => api_models::webhooks::IncomingWebhookEvent::RefundFailure,
+        6 => api_models::webhooks::IncomingWebhookEvent::MandateRevoked,
+        _ => api_models::webhooks::IncomingWebhookEvent::EventNotSupported,
+    };
+
+    Ok(WebhookTransformData {
+        event_type,
+        source_verified: response.source_verified,
+        webhook_content: response.content,
+        response_ref_id: response.response_ref_id.and_then(|identifier| {
+            identifier.id_type.and_then(|id_type| match id_type {
+                payments_grpc::identifier::IdType::Id(id) => Some(id),
+                payments_grpc::identifier::IdType::EncodedData(encoded_data) => Some(encoded_data),
+                payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
+            })
+        }),
+    })
+}
+
+/// Build UCS webhook transform request from webhook components
+pub fn build_webhook_transform_request(
+    _webhook_body: &[u8],
+    request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+    webhook_secrets: Option<payments_grpc::WebhookSecrets>,
+    merchant_id: &str,
+    connector_id: &str,
+) -> Result<PaymentServiceTransformRequest, error_stack::Report<errors::ApiErrorResponse>> {
+    let request_details_grpc = payments_grpc::RequestDetails::foreign_try_from(request_details)
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed to transform webhook request details to gRPC format")?;
+
+    Ok(PaymentServiceTransformRequest {
+        request_ref_id: Some(Identifier {
+            id_type: Some(payments_grpc::identifier::IdType::Id(format!(
+                "{}_{}_{}",
+                merchant_id,
+                connector_id,
+                time::OffsetDateTime::now_utc().unix_timestamp()
+            ))),
+        }),
+        request_details: Some(request_details_grpc),
+        webhook_secrets,
+    })
+}
+
 pub fn convert_connector_service_status_code(
     status_code: u32,
 ) -> Result<u16, error_stack::Report<UnifiedConnectorServiceError>> {
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index fae94ceb11a..29a6c6c8e26 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -30,7 +30,7 @@ use crate::{
         errors::{self, ConnectorErrorExt, CustomResult, RouterResponse, StorageErrorExt},
         metrics, payment_methods,
         payments::{self, tokenization},
-        refunds, relay, utils as core_utils,
+        refunds, relay, unified_connector_service, utils as core_utils,
         webhooks::{network_tokenization_incoming, utils::construct_webhook_router_data},
     },
     db::StorageInterface,
@@ -202,8 +202,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
     WebhookResponseTracker,
     serde_json::Value,
 )> {
-    let key_manager_state = &(&state).into();
-
+    // Initial setup and metrics
     metrics::WEBHOOK_INCOMING_COUNT.add(
         1,
         router_env::metric_attributes!((
@@ -211,7 +210,8 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
             merchant_context.get_merchant_account().get_id().clone()
         )),
     );
-    let mut request_details = IncomingWebhookRequestDetails {
+
+    let request_details = IncomingWebhookRequestDetails {
         method: req.method().clone(),
         uri: req.uri().clone(),
         headers: req.headers(),
@@ -220,31 +220,211 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
     };
 
     // Fetch the merchant connector account to get the webhooks source secret
-    // `webhooks source secret` is a secret shared between the merchant and connector
-    // This is used for source verification and webhooks integrity
     let (merchant_connector_account, connector, connector_name) =
         fetch_optional_mca_and_connector(&state, &merchant_context, connector_name_or_mca_id)
             .await?;
 
-    let decoded_body = connector
-        .decode_webhook_body(
-            &request_details,
-            merchant_context.get_merchant_account().get_id(),
-            merchant_connector_account
-                .clone()
-                .and_then(|merchant_connector_account| {
-                    merchant_connector_account.connector_webhook_details
-                }),
-            connector_name.as_str(),
+    // Determine webhook processing path (UCS vs non-UCS) and handle event type extraction
+    let webhook_processing_result =
+        if unified_connector_service::should_call_unified_connector_service_for_webhooks(
+            &state,
+            &merchant_context,
+            &connector_name,
         )
-        .await
+        .await?
+        {
+            logger::info!(
+                connector = connector_name,
+                "Using Unified Connector Service for webhook processing",
+            );
+            process_ucs_webhook_transform(
+                &state,
+                &merchant_context,
+                &connector_name,
+                &body,
+                &request_details,
+                merchant_connector_account.as_ref(),
+            )
+            .await?
+        } else {
+            // NON-UCS PATH: Need to decode body first
+            let decoded_body = connector
+                .decode_webhook_body(
+                    &request_details,
+                    merchant_context.get_merchant_account().get_id(),
+                    merchant_connector_account
+                        .and_then(|mca| mca.connector_webhook_details.clone()),
+                    &connector_name,
+                )
+                .await
+                .switch()
+                .attach_printable("There was an error in incoming webhook body decoding")?;
+
+            process_non_ucs_webhook(
+                &state,
+                &merchant_context,
+                &connector,
+                &connector_name,
+                decoded_body.into(),
+                &request_details,
+            )
+            .await?
+        };
+
+    // Update request_details with the appropriate body (decoded for non-UCS, raw for UCS)
+    let final_request_details = match &webhook_processing_result.decoded_body {
+        Some(decoded_body) => IncomingWebhookRequestDetails {
+            method: request_details.method.clone(),
+            uri: request_details.uri.clone(),
+            headers: request_details.headers,
+            query_params: request_details.query_params.clone(),
+            body: decoded_body,
+        },
+        None => request_details, // Use original request details for UCS
+    };
+
+    logger::info!(event_type=?webhook_processing_result.event_type);
+
+    // Check if webhook should be processed further
+    let is_webhook_event_supported = !matches!(
+        webhook_processing_result.event_type,
+        webhooks::IncomingWebhookEvent::EventNotSupported
+    );
+    let is_webhook_event_enabled = !utils::is_webhook_event_disabled(
+        &*state.clone().store,
+        connector_name.as_str(),
+        merchant_context.get_merchant_account().get_id(),
+        &webhook_processing_result.event_type,
+    )
+    .await;
+    let flow_type: api::WebhookFlow = webhook_processing_result.event_type.into();
+    let process_webhook_further = is_webhook_event_enabled
+        && is_webhook_event_supported
+        && !matches!(flow_type, api::WebhookFlow::ReturnResponse);
+    logger::info!(process_webhook=?process_webhook_further);
+    let mut event_object: Box<dyn masking::ErasedMaskSerialize> = Box::new(serde_json::Value::Null);
+
+    let webhook_effect = match process_webhook_further {
+        true => {
+            let business_logic_result = process_webhook_business_logic(
+                &state,
+                req_state,
+                &merchant_context,
+                &connector,
+                &connector_name,
+                webhook_processing_result.event_type,
+                webhook_processing_result.source_verified,
+                &webhook_processing_result.transform_data,
+                &final_request_details,
+                is_relay_webhook,
+            )
+            .await;
+
+            match business_logic_result {
+                Ok(response) => {
+                    // Extract event object for serialization
+                    event_object = extract_webhook_event_object(
+                        &webhook_processing_result.transform_data,
+                        &connector,
+                        &final_request_details,
+                    )?;
+                    response
+                }
+                Err(error) => {
+                    let error_result = handle_incoming_webhook_error(
+                        error,
+                        &connector,
+                        connector_name.as_str(),
+                        &final_request_details,
+                    );
+                    match error_result {
+                        Ok((_, webhook_tracker, _)) => webhook_tracker,
+                        Err(e) => return Err(e),
+                    }
+                }
+            }
+        }
+        false => {
+            metrics::WEBHOOK_INCOMING_FILTERED_COUNT.add(
+                1,
+                router_env::metric_attributes!((
+                    MERCHANT_ID,
+                    merchant_context.get_merchant_account().get_id().clone()
+                )),
+            );
+            WebhookResponseTracker::NoEffect
+        }
+    };
+
+    // Generate response
+    let response = connector
+        .get_webhook_api_response(&final_request_details, None)
         .switch()
-        .attach_printable("There was an error in incoming webhook body decoding")?;
+        .attach_printable("Could not get incoming webhook api response from connector")?;
+
+    let serialized_request = event_object
+        .masked_serialize()
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Could not convert webhook effect to string")?;
+
+    Ok((response, webhook_effect, serialized_request))
+}
+
+/// Process UCS webhook transformation using the high-level UCS abstraction
+async fn process_ucs_webhook_transform(
+    state: &SessionState,
+    merchant_context: &domain::MerchantContext,
+    connector_name: &str,
+    body: &actix_web::web::Bytes,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+    merchant_connector_account: Option<&domain::MerchantConnectorAccount>,
+) -> errors::RouterResult<WebhookProcessingResult> {
+    // Use the new UCS abstraction which provides clean separation
+    let (event_type, source_verified, transform_data) =
+        unified_connector_service::call_unified_connector_service_for_webhook(
+            state,
+            merchant_context,
+            connector_name,
+            body,
+            request_details,
+            merchant_connector_account,
+        )
+        .await?;
+    Ok(WebhookProcessingResult {
+        event_type,
+        source_verified,
+        transform_data: Some(Box::new(transform_data)),
+        decoded_body: None, // UCS path uses raw body
+    })
+}
+/// Result type for webhook processing path determination
+pub struct WebhookProcessingResult {
+    event_type: webhooks::IncomingWebhookEvent,
+    source_verified: bool,
+    transform_data: Option<Box<unified_connector_service::WebhookTransformData>>,
+    decoded_body: Option<actix_web::web::Bytes>,
+}
 
-    request_details.body = &decoded_body;
+/// Process non-UCS webhook using traditional connector processing
+async fn process_non_ucs_webhook(
+    state: &SessionState,
+    merchant_context: &domain::MerchantContext,
+    connector: &ConnectorEnum,
+    connector_name: &str,
+    decoded_body: actix_web::web::Bytes,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+) -> errors::RouterResult<WebhookProcessingResult> {
+    // Create request_details with decoded body for connector processing
+    let updated_request_details = IncomingWebhookRequestDetails {
+        method: request_details.method.clone(),
+        uri: request_details.uri.clone(),
+        headers: request_details.headers,
+        query_params: request_details.query_params.clone(),
+        body: &decoded_body,
+    };
 
-    let event_type = match connector
-        .get_webhook_event_type(&request_details)
+    match connector
+        .get_webhook_event_type(&updated_request_details)
         .allow_webhook_event_type_not_found(
             state
                 .clone()
@@ -257,14 +437,13 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
         .switch()
         .attach_printable("Could not find event type in incoming webhook body")?
     {
-        Some(event_type) => event_type,
-        // Early return allows us to acknowledge the webhooks that we do not support
+        Some(event_type) => Ok(WebhookProcessingResult {
+            event_type,
+            source_verified: false,
+            transform_data: None,
+            decoded_body: Some(decoded_body),
+        }),
         None => {
-            logger::error!(
-                webhook_payload =? request_details.body,
-                "Failed while identifying the event type",
-            );
-
             metrics::WEBHOOK_EVENT_TYPE_IDENTIFICATION_FAILURE_COUNT.add(
                 1,
                 router_env::metric_attributes!(
@@ -272,94 +451,101 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
                         MERCHANT_ID,
                         merchant_context.get_merchant_account().get_id().clone()
                     ),
-                    ("connector", connector_name)
+                    ("connector", connector_name.to_string())
                 ),
             );
-
-            let response = connector
-                .get_webhook_api_response(&request_details, None)
-                .switch()
-                .attach_printable("Failed while early return in case of event type parsing")?;
-
-            return Ok((
-                response,
-                WebhookResponseTracker::NoEffect,
-                serde_json::Value::Null,
-            ));
+            Err(errors::ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable("Failed to identify event type in incoming webhook body")
         }
-    };
-    logger::info!(event_type=?event_type);
-
-    let is_webhook_event_supported = !matches!(
-        event_type,
-        webhooks::IncomingWebhookEvent::EventNotSupported
-    );
-    let is_webhook_event_enabled = !utils::is_webhook_event_disabled(
-        &*state.clone().store,
-        connector_name.as_str(),
-        merchant_context.get_merchant_account().get_id(),
-        &event_type,
-    )
-    .await;
+    }
+}
 
-    //process webhook further only if webhook event is enabled and is not event_not_supported
-    let process_webhook_further = is_webhook_event_enabled && is_webhook_event_supported;
+/// Extract webhook event object based on transform data availability
+fn extract_webhook_event_object(
+    transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
+    connector: &ConnectorEnum,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+) -> errors::RouterResult<Box<dyn masking::ErasedMaskSerialize>> {
+    match transform_data {
+        Some(transform_data) => match &transform_data.webhook_content {
+            Some(webhook_content) => {
+                let serialized_value = serde_json::to_value(webhook_content)
+                    .change_context(errors::ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to serialize UCS webhook content")?;
+                Ok(Box::new(serialized_value))
+            }
+            None => connector
+                .get_webhook_resource_object(request_details)
+                .switch()
+                .attach_printable("Could not find resource object in incoming webhook body"),
+        },
+        None => connector
+            .get_webhook_resource_object(request_details)
+            .switch()
+            .attach_printable("Could not find resource object in incoming webhook body"),
+    }
+}
 
-    logger::info!(process_webhook=?process_webhook_further);
+/// Process the main webhook business logic after event type determination
+#[allow(clippy::too_many_arguments)]
+async fn process_webhook_business_logic(
+    state: &SessionState,
+    req_state: ReqState,
+    merchant_context: &domain::MerchantContext,
+    connector: &ConnectorEnum,
+    connector_name: &str,
+    event_type: webhooks::IncomingWebhookEvent,
+    source_verified_via_ucs: bool,
+    webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+    is_relay_webhook: bool,
+) -> errors::RouterResult<WebhookResponseTracker> {
+    let object_ref_id = connector
+        .get_webhook_object_reference_id(request_details)
+        .switch()
+        .attach_printable("Could not find object reference id in incoming webhook body")?;
+    let connector_enum = api_models::enums::Connector::from_str(connector_name)
+        .change_context(errors::ApiErrorResponse::InvalidDataValue {
+            field_name: "connector",
+        })
+        .attach_printable_lazy(|| format!("unable to parse connector name {connector_name:?}"))?;
+    let connectors_with_source_verification_call = &state.conf.webhook_source_verification_call;
 
-    let flow_type: api::WebhookFlow = event_type.into();
-    let mut event_object: Box<dyn masking::ErasedMaskSerialize> = Box::new(serde_json::Value::Null);
-    let webhook_effect = if process_webhook_further
-        && !matches!(flow_type, api::WebhookFlow::ReturnResponse)
+    let merchant_connector_account = match Box::pin(helper_utils::get_mca_from_object_reference_id(
+        state,
+        object_ref_id.clone(),
+        merchant_context,
+        connector_name,
+    ))
+    .await
     {
-        let object_ref_id = connector
-            .get_webhook_object_reference_id(&request_details)
-            .switch()
-            .attach_printable("Could not find object reference id in incoming webhook body")?;
-        let connector_enum = api_models::enums::Connector::from_str(&connector_name)
-            .change_context(errors::ApiErrorResponse::InvalidDataValue {
-                field_name: "connector",
-            })
-            .attach_printable_lazy(|| {
-                format!("unable to parse connector name {connector_name:?}")
-            })?;
-        let connectors_with_source_verification_call = &state.conf.webhook_source_verification_call;
-
-        let merchant_connector_account = match merchant_connector_account {
-            Some(merchant_connector_account) => merchant_connector_account,
-            None => {
-                match Box::pin(helper_utils::get_mca_from_object_reference_id(
-                    &state,
-                    object_ref_id.clone(),
-                    &merchant_context,
-                    &connector_name,
-                ))
-                .await
-                {
-                    Ok(mca) => mca,
-                    Err(error) => {
-                        return handle_incoming_webhook_error(
-                            error,
-                            &connector,
-                            connector_name.as_str(),
-                            &request_details,
-                        );
-                    }
-                }
+        Ok(mca) => mca,
+        Err(error) => {
+            let result =
+                handle_incoming_webhook_error(error, connector, connector_name, request_details);
+            match result {
+                Ok((_, webhook_tracker, _)) => return Ok(webhook_tracker),
+                Err(e) => return Err(e),
             }
-        };
+        }
+    };
 
-        let source_verified = if connectors_with_source_verification_call
+    let source_verified = if source_verified_via_ucs {
+        // If UCS handled verification, use that result
+        source_verified_via_ucs
+    } else {
+        // Fall back to traditional source verification
+        if connectors_with_source_verification_call
             .connectors_with_webhook_source_verification_call
             .contains(&connector_enum)
         {
             verify_webhook_source_verification_call(
                 connector.clone(),
-                &state,
-                &merchant_context,
+                state,
+                merchant_context,
                 merchant_connector_account.clone(),
-                &connector_name,
-                &request_details,
+                connector_name,
+                request_details,
             )
             .await
             .or_else(|error| match error.current_context() {
@@ -375,11 +561,11 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
             connector
                 .clone()
                 .verify_webhook_source(
-                    &request_details,
+                    request_details,
                     merchant_context.get_merchant_account().get_id(),
                     merchant_connector_account.connector_webhook_details.clone(),
                     merchant_connector_account.connector_account_details.clone(),
-                    connector_name.as_str(),
+                    connector_name,
                 )
                 .await
                 .or_else(|error| match error.current_context() {
@@ -391,235 +577,233 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
                 })
                 .switch()
                 .attach_printable("There was an issue in incoming webhook source verification")?
-        };
-
-        if source_verified {
-            metrics::WEBHOOK_SOURCE_VERIFIED_COUNT.add(
-                1,
-                router_env::metric_attributes!((
-                    MERCHANT_ID,
-                    merchant_context.get_merchant_account().get_id().clone()
-                )),
-            );
-        } else if connector.is_webhook_source_verification_mandatory() {
-            // if webhook consumption is mandatory for connector, fail webhook
-            // so that merchant can retrigger it after updating merchant_secret
-            return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into());
         }
+    };
 
-        logger::info!(source_verified=?source_verified);
+    if source_verified {
+        metrics::WEBHOOK_SOURCE_VERIFIED_COUNT.add(
+            1,
+            router_env::metric_attributes!((
+                MERCHANT_ID,
+                merchant_context.get_merchant_account().get_id().clone()
+            )),
+        );
+    } else if connector.is_webhook_source_verification_mandatory() {
+        // if webhook consumption is mandatory for connector, fail webhook
+        // so that merchant can retrigger it after updating merchant_secret
+        return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into());
+    }
 
-        event_object = connector
-            .get_webhook_resource_object(&request_details)
-            .switch()
-            .attach_printable("Could not find resource object in incoming webhook body")?;
+    logger::info!(source_verified=?source_verified);
 
-        let webhook_details = api::IncomingWebhookDetails {
-            object_reference_id: object_ref_id.clone(),
-            resource_object: serde_json::to_vec(&event_object)
-                .change_context(errors::ParsingError::EncodeError("byte-vec"))
-                .attach_printable("Unable to convert webhook payload to a value")
-                .change_context(errors::ApiErrorResponse::InternalServerError)
-                .attach_printable(
-                    "There was an issue when encoding the incoming webhook body to bytes",
-                )?,
+    let event_object: Box<dyn masking::ErasedMaskSerialize> =
+        if let Some(transform_data) = webhook_transform_data {
+            // Use UCS transform data if available
+            if let Some(webhook_content) = &transform_data.webhook_content {
+                // Convert UCS webhook content to appropriate format
+                Box::new(
+                    serde_json::to_value(webhook_content)
+                        .change_context(errors::ApiErrorResponse::InternalServerError)
+                        .attach_printable("Failed to serialize UCS webhook content")?,
+                )
+            } else {
+                // Fall back to connector extraction
+                connector
+                    .get_webhook_resource_object(request_details)
+                    .switch()
+                    .attach_printable("Could not find resource object in incoming webhook body")?
+            }
+        } else {
+            // Use traditional connector extraction
+            connector
+                .get_webhook_resource_object(request_details)
+                .switch()
+                .attach_printable("Could not find resource object in incoming webhook body")?
         };
 
-        let profile_id = &merchant_connector_account.profile_id;
+    let webhook_details = api::IncomingWebhookDetails {
+        object_reference_id: object_ref_id.clone(),
+        resource_object: serde_json::to_vec(&event_object)
+            .change_context(errors::ParsingError::EncodeError("byte-vec"))
+            .attach_printable("Unable to convert webhook payload to a value")
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable(
+                "There was an issue when encoding the incoming webhook body to bytes",
+            )?,
+    };
 
-        let business_profile = state
-            .store
-            .find_business_profile_by_profile_id(
-                key_manager_state,
-                merchant_context.get_merchant_key_store(),
-                profile_id,
-            )
-            .await
-            .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound {
-                id: profile_id.get_string_repr().to_owned(),
-            })?;
+    let profile_id = &merchant_connector_account.profile_id;
+    let key_manager_state = &(state).into();
+
+    let business_profile = state
+        .store
+        .find_business_profile_by_profile_id(
+            key_manager_state,
+            merchant_context.get_merchant_key_store(),
+            profile_id,
+        )
+        .await
+        .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound {
+            id: profile_id.get_string_repr().to_owned(),
+        })?;
+
+    // If the incoming webhook is a relay webhook, then we need to trigger the relay webhook flow
+    let result_response = if is_relay_webhook {
+        let relay_webhook_response = Box::pin(relay_incoming_webhook_flow(
+            state.clone(),
+            merchant_context.clone(),
+            business_profile,
+            webhook_details,
+            event_type,
+            source_verified,
+        ))
+        .await
+        .attach_printable("Incoming webhook flow for relay failed");
+
+        // Using early return ensures unsupported webhooks are acknowledged to the connector
+        if let Some(errors::ApiErrorResponse::NotSupported { .. }) = relay_webhook_response
+            .as_ref()
+            .err()
+            .map(|a| a.current_context())
+        {
+            logger::error!(
+                webhook_payload =? request_details.body,
+                "Failed while identifying the event type",
+            );
+
+            let _response = connector
+                    .get_webhook_api_response(request_details, None)
+                    .switch()
+                    .attach_printable(
+                        "Failed while early return in case of not supported event type in relay webhooks",
+                    )?;
 
-        // If the incoming webhook is a relay webhook, then we need to trigger the relay webhook flow
-        let result_response = if is_relay_webhook {
-            let relay_webhook_response = Box::pin(relay_incoming_webhook_flow(
+            return Ok(WebhookResponseTracker::NoEffect);
+        };
+
+        relay_webhook_response
+    } else {
+        let flow_type: api::WebhookFlow = event_type.into();
+        match flow_type {
+            api::WebhookFlow::Payment => Box::pin(payments_incoming_webhook_flow(
                 state.clone(),
-                merchant_context,
+                req_state,
+                merchant_context.clone(),
                 business_profile,
                 webhook_details,
-                event_type,
                 source_verified,
+                connector,
+                request_details,
+                event_type,
             ))
             .await
-            .attach_printable("Incoming webhook flow for relay failed");
-
-            // Using early return ensures unsupported webhooks are acknowledged to the connector
-            if let Some(errors::ApiErrorResponse::NotSupported { .. }) = relay_webhook_response
-                .as_ref()
-                .err()
-                .map(|a| a.current_context())
-            {
-                logger::error!(
-                    webhook_payload =? request_details.body,
-                    "Failed while identifying the event type",
-                );
-
-                let response = connector
-                        .get_webhook_api_response(&request_details, None)
-                        .switch()
-                        .attach_printable(
-                            "Failed while early return in case of not supported event type in relay webhooks",
-                        )?;
-
-                return Ok((
-                    response,
-                    WebhookResponseTracker::NoEffect,
-                    serde_json::Value::Null,
-                ));
-            };
+            .attach_printable("Incoming webhook flow for payments failed"),
 
-            relay_webhook_response
-        } else {
-            match flow_type {
-                api::WebhookFlow::Payment => Box::pin(payments_incoming_webhook_flow(
-                    state.clone(),
-                    req_state,
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                    &connector,
-                    &request_details,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for payments failed"),
-
-                api::WebhookFlow::Refund => Box::pin(refunds_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    connector_name.as_str(),
-                    source_verified,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for refunds failed"),
+            api::WebhookFlow::Refund => Box::pin(refunds_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                connector_name,
+                source_verified,
+                event_type,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for refunds failed"),
 
-                api::WebhookFlow::Dispute => Box::pin(disputes_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                    &connector,
-                    &request_details,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for disputes failed"),
+            api::WebhookFlow::Dispute => Box::pin(disputes_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+                connector,
+                request_details,
+                event_type,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for disputes failed"),
 
-                api::WebhookFlow::BankTransfer => Box::pin(bank_transfer_webhook_flow(
-                    state.clone(),
-                    req_state,
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                ))
-                .await
-                .attach_printable("Incoming bank-transfer webhook flow failed"),
+            api::WebhookFlow::BankTransfer => Box::pin(bank_transfer_webhook_flow(
+                state.clone(),
+                req_state,
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+            ))
+            .await
+            .attach_printable("Incoming bank-transfer webhook flow failed"),
 
-                api::WebhookFlow::ReturnResponse => Ok(WebhookResponseTracker::NoEffect),
+            api::WebhookFlow::ReturnResponse => Ok(WebhookResponseTracker::NoEffect),
 
-                api::WebhookFlow::Mandate => Box::pin(mandates_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for mandates failed"),
+            api::WebhookFlow::Mandate => Box::pin(mandates_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+                event_type,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for mandates failed"),
 
-                api::WebhookFlow::ExternalAuthentication => {
-                    Box::pin(external_authentication_incoming_webhook_flow(
-                        state.clone(),
-                        req_state,
-                        merchant_context,
-                        source_verified,
-                        event_type,
-                        &request_details,
-                        &connector,
-                        object_ref_id,
-                        business_profile,
-                        merchant_connector_account,
-                    ))
-                    .await
-                    .attach_printable("Incoming webhook flow for external authentication failed")
-                }
-                api::WebhookFlow::FraudCheck => Box::pin(frm_incoming_webhook_flow(
+            api::WebhookFlow::ExternalAuthentication => {
+                Box::pin(external_authentication_incoming_webhook_flow(
                     state.clone(),
                     req_state,
-                    merchant_context,
+                    merchant_context.clone(),
                     source_verified,
                     event_type,
+                    request_details,
+                    connector,
                     object_ref_id,
                     business_profile,
+                    merchant_connector_account,
                 ))
                 .await
-                .attach_printable("Incoming webhook flow for fraud check failed"),
-
-                #[cfg(feature = "payouts")]
-                api::WebhookFlow::Payout => Box::pin(payouts_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    event_type,
-                    source_verified,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for payouts failed"),
-
-                _ => Err(errors::ApiErrorResponse::InternalServerError)
-                    .attach_printable("Unsupported Flow Type received in incoming webhooks"),
+                .attach_printable("Incoming webhook flow for external authentication failed")
             }
-        };
+            api::WebhookFlow::FraudCheck => Box::pin(frm_incoming_webhook_flow(
+                state.clone(),
+                req_state,
+                merchant_context.clone(),
+                source_verified,
+                event_type,
+                object_ref_id,
+                business_profile,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for fraud check failed"),
 
-        match result_response {
-            Ok(response) => response,
-            Err(error) => {
-                return handle_incoming_webhook_error(
-                    error,
-                    &connector,
-                    connector_name.as_str(),
-                    &request_details,
-                );
-            }
+            #[cfg(feature = "payouts")]
+            api::WebhookFlow::Payout => Box::pin(payouts_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                event_type,
+                source_verified,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for payouts failed"),
+
+            _ => Err(errors::ApiErrorResponse::InternalServerError)
+                .attach_printable("Unsupported Flow Type received in incoming webhooks"),
         }
-    } else {
-        metrics::WEBHOOK_INCOMING_FILTERED_COUNT.add(
-            1,
-            router_env::metric_attributes!((
-                MERCHANT_ID,
-                merchant_context.get_merchant_account().get_id().clone()
-            )),
-        );
-        WebhookResponseTracker::NoEffect
     };
 
-    let response = connector
-        .get_webhook_api_response(&request_details, None)
-        .switch()
-        .attach_printable("Could not get incoming webhook api response from connector")?;
-
-    let serialized_request = event_object
-        .masked_serialize()
-        .change_context(errors::ApiErrorResponse::InternalServerError)
-        .attach_printable("Could not convert webhook effect to string")?;
-    Ok((response, webhook_effect, serialized_request))
+    match result_response {
+        Ok(response) => Ok(response),
+        Err(error) => {
+            let result =
+                handle_incoming_webhook_error(error, connector, connector_name, request_details);
+            match result {
+                Ok((_, webhook_tracker, _)) => Ok(webhook_tracker),
+                Err(e) => Err(e),
+            }
+        }
+    }
 }
 
 fn handle_incoming_webhook_error(
@@ -1346,7 +1530,7 @@ pub async fn get_or_update_dispute_object(
         Some(dispute) => {
             logger::info!("Dispute Already exists, Updating the dispute details");
             metrics::INCOMING_DISPUTE_WEBHOOK_UPDATE_RECORD_METRIC.add(1, &[]);
-            crate::core::utils::validate_dispute_stage_and_dispute_status(
+            core_utils::validate_dispute_stage_and_dispute_status(
                 dispute.dispute_stage,
                 dispute.dispute_status,
                 dispute_details.dispute_stage,
@@ -1354,7 +1538,6 @@ pub async fn get_or_update_dispute_object(
             )
             .change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
             .attach_printable("dispute stage and status validation failed")?;
-
             let update_dispute = diesel_models::dispute::DisputeUpdate::Update {
                 dispute_stage: dispute_details.dispute_stage,
                 dispute_status,
 | 
	2025-08-13T13:36:00Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Fixes #8944 
Backport of juspay/hyperswitch/pull/8814
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c9c0559e81cfcc2616148efb317a8582fe02314a | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8908 | 
	Bug: [BUG] (connector): [Netcetera] Fix struct fields for Netcetera Authentication Response
### Bug Description
current structure
NetceteraAuthenticationSuccessResponse{
    ....
    pub challenge_cancel: Option<String>,
    pub trans_status_reason: Option<String>,
    pub message_extension: Option<Vec<MessageExtensionAttribute>>,
}
Correct structure
NetceteraAuthenticationSuccessResponse{
    ....
    authentication_response: {
    pub trans_status_reason: Option<String>,
    },
   authentication_request: {
    pub message_extension: Option<String>,
    }
}
### Expected Behavior
When the struct is fixed in code, the expected behavior is to:
Receive message_extension and trans_status_reason fields in Netcetera’s authentication response and store them in the authentication table.
Receive the challenge_cancel field from the Netcetera notification payload and store it in the authentication table.
### Actual Behavior
Currently expected behaviour is not happening and mentioned fields are not getting stored in authentication table.
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index 2025d29d10d..f080a76b051 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -1439,29 +1439,23 @@ impl
                 )
                 .ok();
                 let effective_authentication_type = authn_data.authentication_type.map(Into::into);
-                let network_score: Option<u32> =
-                    if ccard.card_network == Some(common_enums::CardNetwork::CartesBancaires) {
-                        match authn_data.message_extension.as_ref() {
-                            Some(secret) => {
-                                let exposed_value = secret.clone().expose();
-                                match serde_json::from_value::<Vec<MessageExtensionAttribute>>(
-                                    exposed_value,
-                                ) {
-                                    Ok(exts) => extract_score_id(&exts),
-                                    Err(err) => {
-                                        router_env::logger::error!(
-                                            "Failed to deserialize message_extension: {:?}",
-                                            err
-                                        );
-                                        None
-                                    }
-                                }
-                            }
-                            None => None,
-                        }
-                    } else {
-                        None
-                    };
+                let network_score = (ccard.card_network
+                    == Some(common_enums::CardNetwork::CartesBancaires))
+                .then_some(authn_data.message_extension.as_ref())
+                .flatten()
+                .map(|secret| secret.clone().expose())
+                .and_then(|exposed| {
+                    serde_json::from_value::<Vec<MessageExtensionAttribute>>(exposed)
+                        .map_err(|err| {
+                            router_env::logger::error!(
+                                "Failed to deserialize message_extension: {:?}",
+                                err
+                            );
+                        })
+                        .ok()
+                        .and_then(|exts| extract_score_id(&exts))
+                });
+
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1566,29 +1560,23 @@ impl
                     date_time::DateFormat::YYYYMMDDHHmmss,
                 )
                 .ok();
-                let network_score: Option<u32> =
-                    if ccard.card_network == Some(common_enums::CardNetwork::CartesBancaires) {
-                        match authn_data.message_extension.as_ref() {
-                            Some(secret) => {
-                                let exposed_value = secret.clone().expose();
-                                match serde_json::from_value::<Vec<MessageExtensionAttribute>>(
-                                    exposed_value,
-                                ) {
-                                    Ok(exts) => extract_score_id(&exts),
-                                    Err(err) => {
-                                        router_env::logger::error!(
-                                            "Failed to deserialize message_extension: {:?}",
-                                            err
-                                        );
-                                        None
-                                    }
-                                }
-                            }
-                            None => None,
-                        }
-                    } else {
-                        None
-                    };
+                let network_score = (ccard.card_network
+                    == Some(common_enums::CardNetwork::CartesBancaires))
+                .then_some(authn_data.message_extension.as_ref())
+                .flatten()
+                .map(|secret| secret.clone().expose())
+                .and_then(|exposed| {
+                    serde_json::from_value::<Vec<MessageExtensionAttribute>>(exposed)
+                        .map_err(|err| {
+                            router_env::logger::error!(
+                                "Failed to deserialize message_extension: {:?}",
+                                err
+                            );
+                        })
+                        .ok()
+                        .and_then(|exts| extract_score_id(&exts))
+                });
+
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1697,30 +1685,23 @@ impl
                     date_time::DateFormat::YYYYMMDDHHmmss,
                 )
                 .ok();
-                let network_score: Option<u32> = if token_data.card_network
-                    == Some(common_enums::CardNetwork::CartesBancaires)
-                {
-                    match authn_data.message_extension.as_ref() {
-                        Some(secret) => {
-                            let exposed_value = secret.clone().expose();
-                            match serde_json::from_value::<Vec<MessageExtensionAttribute>>(
-                                exposed_value,
-                            ) {
-                                Ok(exts) => extract_score_id(&exts),
-                                Err(err) => {
-                                    router_env::logger::error!(
-                                        "Failed to deserialize message_extension: {:?}",
-                                        err
-                                    );
-                                    None
-                                }
-                            }
-                        }
-                        None => None,
-                    }
-                } else {
-                    None
-                };
+                let network_score = (token_data.card_network
+                    == Some(common_enums::CardNetwork::CartesBancaires))
+                .then_some(authn_data.message_extension.as_ref())
+                .flatten()
+                .map(|secret| secret.clone().expose())
+                .and_then(|exposed| {
+                    serde_json::from_value::<Vec<MessageExtensionAttribute>>(exposed)
+                        .map_err(|err| {
+                            router_env::logger::error!(
+                                "Failed to deserialize message_extension: {:?}",
+                                err
+                            );
+                        })
+                        .ok()
+                        .and_then(|exts| extract_score_id(&exts))
+                });
+
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera.rs b/crates/hyperswitch_connectors/src/connectors/netcetera.rs
index a2745dc4b08..60977d9b69b 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera.rs
@@ -214,14 +214,27 @@ impl IncomingWebhook for Netcetera {
             .body
             .parse_struct("netcetera ResultsResponseData")
             .change_context(ConnectorError::WebhookBodyDecodingFailed)?;
+
+        let challenge_cancel = webhook_body
+            .results_request
+            .as_ref()
+            .and_then(|v| v.get("challengeCancel").and_then(|v| v.as_str()))
+            .map(|s| s.to_string());
+
+        let challenge_code_reason = webhook_body
+            .results_request
+            .as_ref()
+            .and_then(|v| v.get("transStatusReason").and_then(|v| v.as_str()))
+            .map(|s| s.to_string());
+
         Ok(ExternalAuthenticationPayload {
             trans_status: webhook_body
                 .trans_status
                 .unwrap_or(common_enums::TransactionStatus::InformationOnly),
             authentication_value: webhook_body.authentication_value,
             eci: webhook_body.eci,
-            challenge_cancel: webhook_body.challenge_cancel,
-            challenge_code_reason: webhook_body.trans_status_reason,
+            challenge_cancel,
+            challenge_code_reason,
         })
     }
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
index 01189f6b926..1b8e2a65057 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
@@ -165,6 +165,21 @@ impl
                     .and_then(|req| req.three_ds_requestor_challenge_ind.as_ref())
                     .and_then(|v| v.first().cloned());
 
+                let message_extension = response
+                    .authentication_request
+                    .as_ref()
+                    .and_then(|req| req.message_extension.as_ref())
+                    .and_then(|v| match serde_json::to_value(v) {
+                        Ok(val) => Some(Secret::new(val)),
+                        Err(e) => {
+                            router_env::logger::error!(
+                                "Failed to serialize message_extension: {:?}",
+                                e
+                            );
+                            None
+                        }
+                    });
+
                 Ok(AuthenticationResponseData::AuthNResponse {
                     authn_flow_type,
                     authentication_value: response.authentication_value,
@@ -173,20 +188,9 @@ impl
                     ds_trans_id: response.authentication_response.ds_trans_id,
                     eci: response.eci,
                     challenge_code,
-                    challenge_cancel: response.challenge_cancel,
-                    challenge_code_reason: response.trans_status_reason,
-                    message_extension: response.message_extension.and_then(|v| {
-                        match serde_json::to_value(&v) {
-                            Ok(val) => Some(Secret::new(val)),
-                            Err(e) => {
-                                router_env::logger::error!(
-                                    "Failed to serialize message_extension: {:?}",
-                                    e
-                                );
-                                None
-                            }
-                        }
-                    }),
+                    challenge_cancel: None, // Note - challenge_cancel field is recieved in the RReq and updated in DB during external_authentication_incoming_webhook_flow
+                    challenge_code_reason: response.authentication_response.trans_status_reason,
+                    message_extension,
                 })
             }
             NetceteraAuthenticationResponse::Error(error_response) => Err(ErrorResponse {
@@ -664,9 +668,6 @@ pub struct NetceteraAuthenticationSuccessResponse {
     pub authentication_response: AuthenticationResponse,
     #[serde(rename = "base64EncodedChallengeRequest")]
     pub encoded_challenge_request: Option<String>,
-    pub challenge_cancel: Option<String>,
-    pub trans_status_reason: Option<String>,
-    pub message_extension: Option<Vec<MessageExtensionAttribute>>,
 }
 
 #[derive(Debug, Deserialize, Serialize)]
@@ -680,6 +681,7 @@ pub struct NetceteraAuthenticationFailureResponse {
 pub struct AuthenticationRequest {
     #[serde(rename = "threeDSRequestorChallengeInd")]
     pub three_ds_requestor_challenge_ind: Option<Vec<String>>,
+    pub message_extension: Option<serde_json::Value>,
 }
 
 #[derive(Debug, Deserialize, Serialize)]
@@ -693,6 +695,7 @@ pub struct AuthenticationResponse {
     #[serde(rename = "dsTransID")]
     pub ds_trans_id: Option<String>,
     pub acs_signed_content: Option<String>,
+    pub trans_status_reason: Option<String>,
 }
 
 #[derive(Debug, Deserialize, Serialize, Clone)]
@@ -742,6 +745,4 @@ pub struct ResultsResponseData {
 
     /// Optional object containing error details if any errors occurred during the process.
     pub error_details: Option<NetceteraErrorDetails>,
-    pub challenge_cancel: Option<String>,
-    pub trans_status_reason: Option<String>,
 }
 | 
	2025-08-11T11:40:14Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [X] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Current structure
```
NetceteraAuthenticationSuccessResponse{
    ....
    pub challenge_cancel: Option<String>,
    pub trans_status_reason: Option<String>,
    pub message_extension: Option<Vec<MessageExtensionAttribute>>,
}
```
Correct structure
```
NetceteraAuthenticationSuccessResponse{
    ....
    authentication_response: {
    pub trans_status_reason: Option<String>,
    },
   authentication_request: {
    pub message_extension: Option<String>,
    }
}
```
This PR introduces the above fix in the struct.
Fixes summary:
1. Remove **challenge_cancel** field from NetceteraAuthenticationSuccessResponse
2. Move **trans_status_reason** inside AuthenticationResponse struct
3. Move **message_extension** inside AuthenticationRequest struct
4. Remove fields **challenge_cancel** and **challenge_code_reason** from ResultsResponseData, and consume **challenge_cancel** and **challenge_code_reason** from webhook's results_request field (RReq)."
For your reference, please check the official specification of these attribute in 3DSecureio docs —it's clearer than what Netcetera currently provides
https://docs.3dsecure.io/3dsv2/specification_220.html#attr-RReq-challengeCancel
https://docs.3dsecure.io/3dsv2/specification_220.html#attr-ARes-transStatusReason
https://docs.3dsecure.io/3dsv2/specification_220.html#attr-ARes-messageExtension
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
4. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
With the code changes, the expected behaviour is to,
1. Receive message_extension and trans_status_reason fields in Netcetera’s authentication response and store them in the authentication table.
2. Receive the challenge_cancel field from the Netcetera notification payload and store it in the authentication table.
### Steps to verify field **trans_status_reason**:
1. Test Netcetera 3ds challenge flow via SDK.
2. Check in Authentication Table if **challenge_code_reason** is present. (trans_status_reason is mapped to challenge_code_reason in authentication table)
**Query**
`select challenge_code_reason from authentication where connector_authentication_id='82e5df02-d83f-4adf-b00b-d5c10c52d4cd';`
<img width="1074" height="516" alt="Screenshot 2025-08-11 at 5 38 31 PM" src="https://github.com/user-attachments/assets/ffe93636-1630-4d75-b310-e28e9cdcab8a" />
### Steps to verify field **challenge_cancel**:
1. Test Netcetera 3ds challenge flow via SDK.
2. Cancel the challenge from challenge iframe.
3. Check in Authentication Table if **challenge_cancel** is present. 
<img width="1319" height="585" alt="Screenshot 2025-08-11 at 5 40 31 PM" src="https://github.com/user-attachments/assets/612f21a1-2da1-472d-a844-d205024bc01f" />
**Query**
`select challenge_cancel from authentication where connector_authentication_id='b51b6977-059d-4a59-92c9-1f3d37b43563';`
<img width="1319" height="585" alt="Screenshot 2025-08-11 at 5 43 11 PM" src="https://github.com/user-attachments/assets/a441d352-4e7b-4c0a-ac82-09849dbcbc2f" />
Please note we cannot verify field **message_extension** in integ/sandbox, can only be tested in prod.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [X] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	0e957854372f1e6a81ce72234b8a4fda16cb4b8d | 
	
With the code changes, the expected behaviour is to,
1. Receive message_extension and trans_status_reason fields in Netcetera’s authentication response and store them in the authentication table.
2. Receive the challenge_cancel field from the Netcetera notification payload and store it in the authentication table.
### Steps to verify field **trans_status_reason**:
1. Test Netcetera 3ds challenge flow via SDK.
2. Check in Authentication Table if **challenge_code_reason** is present. (trans_status_reason is mapped to challenge_code_reason in authentication table)
**Query**
`select challenge_code_reason from authentication where connector_authentication_id='82e5df02-d83f-4adf-b00b-d5c10c52d4cd';`
<img width="1074" height="516" alt="Screenshot 2025-08-11 at 5 38 31 PM" src="https://github.com/user-attachments/assets/ffe93636-1630-4d75-b310-e28e9cdcab8a" />
### Steps to verify field **challenge_cancel**:
1. Test Netcetera 3ds challenge flow via SDK.
2. Cancel the challenge from challenge iframe.
3. Check in Authentication Table if **challenge_cancel** is present. 
<img width="1319" height="585" alt="Screenshot 2025-08-11 at 5 40 31 PM" src="https://github.com/user-attachments/assets/612f21a1-2da1-472d-a844-d205024bc01f" />
**Query**
`select challenge_cancel from authentication where connector_authentication_id='b51b6977-059d-4a59-92c9-1f3d37b43563';`
<img width="1319" height="585" alt="Screenshot 2025-08-11 at 5 43 11 PM" src="https://github.com/user-attachments/assets/a441d352-4e7b-4c0a-ac82-09849dbcbc2f" />
Please note we cannot verify field **message_extension** in integ/sandbox, can only be tested in prod.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8906 | 
	Bug: Improve UCS connector configuration format for better type safety and usability
## Problem Statement
The current unified connector service (UCS) configuration uses an array format for specifying connectors that should use UCS only. This approach has several limitations:
### Current Issues
1. **Type Safety**: The current `Vec<String>` approach allows invalid connector names to be specified without compile-time validation
2. **Configuration Verbosity**: Array format in TOML files is more verbose and harder to read/maintain
3. **Runtime Validation**: Invalid connector names are only caught at runtime when the configuration is parsed
4. **Inconsistent Format**: Different from other comma-separated configuration patterns used elsewhere in the codebase
### Current Configuration Format
```toml
[grpc_client.unified_connector_service]
ucs_only_connectors = [
  "razorpay",
  "phonepe", 
  "paytm",
  "cashfree",
]
```
## Proposed Solution
Refactor the configuration to use a comma-separated string format with type-safe parsing:
### Benefits
- **Type Safety**: Use `HashSet<Connector>` with enum validation to prevent invalid connector names
- **Cleaner Configuration**: More concise and readable comma-separated format
- **Better Error Handling**: Custom deserializer with detailed error messages for invalid configurations
- **Consistency**: Aligns with other comma-separated configuration patterns in the codebase
- **Performance**: HashSet provides O(1) lookup time for connector validation
### Proposed Configuration Format
```toml
[grpc_client.unified_connector_service]
ucs_only_connectors = "paytm, phonepe, razorpay, cashfree"
```
## Implementation Requirements
1. **Custom Deserializer**: Implement a generic deserializer for comma-separated strings to typed HashSets
2. **Type Safety**: Use `Connector` enum instead of raw strings
3. **Backward Compatibility**: Ensure existing connector validation logic continues to work
4. **Configuration Updates**: Update all config files to use the new format
5. **Comprehensive Testing**: Add unit tests for the deserializer and configuration parsing
## Acceptance Criteria
- [x] Configuration uses comma-separated string format
- [x] Type-safe parsing with `Connector` enum validation
- [x] Custom deserializer handles edge cases (whitespace, duplicates, empty strings)
- [x] All configuration files updated consistently
- [x] Comprehensive unit tests for the deserializer
- [x] Existing connector validation logic works with new format
- [x] Detailed error messages for invalid configurations
## Labels
- Enhancement
- Configuration
- Type Safety
- Refactoring | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index d4ce454edfc..5783a70c370 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1159,6 +1159,7 @@ url = "http://localhost:8080"           # Open Router URL
 [grpc_client.unified_connector_service]
 base_url = "http://localhost:8000"      # Unified Connector Service Base URL
 connection_timeout = 10                 # Connection Timeout Duration in Seconds
+ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
 
 [grpc_client.recovery_decider_client] # Revenue recovery client base url
 base_url = "http://127.0.0.1:8080" #Base URL
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 6acf697ac4d..64db7079f40 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -384,6 +384,7 @@ connector_names = "connector_names"     # Comma-separated list of allowed connec
 [grpc_client.unified_connector_service]
 base_url = "http://localhost:8000"      # Unified Connector Service Base URL
 connection_timeout = 10                 # Connection Timeout Duration in Seconds
+ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
 
 [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
 initial_timestamp_in_hours = 1        # number of hours added to start time for Decider service of Revenue Recovery
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 47c2bc39bc1..a387cd0c164 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -837,3 +837,6 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 
 [list_dispute_supported_connectors]
 connector_list = "worldpayvantiv"
+
+[grpc_client.unified_connector_service]
+ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 3550b1ec929..a95d88dc632 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -847,3 +847,6 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 [revenue_recovery]
 monitoring_threshold_in_seconds = 60
 retry_algorithm_type = "cascading"
+
+[grpc_client.unified_connector_service]
+ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 47a64b91b4b..296888abcdd 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -856,3 +856,6 @@ retry_algorithm_type = "cascading"
 
 [list_dispute_supported_connectors]
 connector_list = "worldpayvantiv"
+
+[grpc_client.unified_connector_service]
+ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
diff --git a/config/development.toml b/config/development.toml
index 7bc0dcc397d..95b2f289621 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1268,12 +1268,7 @@ enabled = "true"
 [grpc_client.unified_connector_service]
 base_url = "http://localhost:8000"
 connection_timeout = 10
-ucs_only_connectors = [
-  "razorpay",
-  "phonepe",
-  "paytm",
-  "cashfree",
-]
+ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
 
 [revenue_recovery]
 monitoring_threshold_in_seconds = 60
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 62f681a985c..81bb2dc8988 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -1,5 +1,6 @@
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
 
+use common_enums::connector_enums::Connector;
 use common_utils::{consts as common_utils_consts, errors::CustomResult, types::Url};
 use error_stack::ResultExt;
 use masking::{PeekInterface, Secret};
@@ -18,6 +19,7 @@ use unified_connector_service_client::payments::{
 use crate::{
     consts,
     grpc_client::{GrpcClientSettings, GrpcHeaders},
+    utils::deserialize_hashset,
 };
 
 /// Unified Connector Service error variants
@@ -123,9 +125,9 @@ pub struct UnifiedConnectorServiceClientConfig {
     /// Contains the connection timeout duration in seconds
     pub connection_timeout: u64,
 
-    /// List of connectors to use with the unified connector service
-    #[serde(default)]
-    pub ucs_only_connectors: Vec<String>,
+    /// Set of external services/connectors available for the unified connector service
+    #[serde(default, deserialize_with = "deserialize_hashset")]
+    pub ucs_only_connectors: HashSet<Connector>,
 }
 
 /// Contains the Connector Auth Type and related authentication data.
diff --git a/crates/external_services/src/lib.rs b/crates/external_services/src/lib.rs
index 7d97b5e99c0..aee7d232bb3 100644
--- a/crates/external_services/src/lib.rs
+++ b/crates/external_services/src/lib.rs
@@ -28,6 +28,9 @@ pub mod managers;
 /// crm module
 pub mod crm;
 
+/// deserializers module_path
+pub mod utils;
+
 #[cfg(feature = "revenue_recovery")]
 /// date_time module
 pub mod date_time {
diff --git a/crates/external_services/src/utils.rs b/crates/external_services/src/utils.rs
new file mode 100644
index 00000000000..16cfc8ea008
--- /dev/null
+++ b/crates/external_services/src/utils.rs
@@ -0,0 +1,178 @@
+//! Custom deserializers for external services configuration
+
+use std::collections::HashSet;
+
+use serde::Deserialize;
+
+/// Parses a comma-separated string into a HashSet of typed values.
+///
+/// # Arguments
+///
+/// * `value` - String or string reference containing comma-separated values
+///
+/// # Returns
+///
+/// * `Ok(HashSet<T>)` - Successfully parsed HashSet
+/// * `Err(String)` - Error message if any value parsing fails
+///
+/// # Type Parameters
+///
+/// * `T` - Target type that implements `FromStr`, `Eq`, and `Hash`
+///
+/// # Examples
+///
+/// ```
+/// use std::collections::HashSet;
+///
+/// let result: Result<HashSet<i32>, String> =
+///     deserialize_hashset_inner("1,2,3");
+/// assert!(result.is_ok());
+///
+/// if let Ok(hashset) = result {
+///     assert!(hashset.contains(&1));
+///     assert!(hashset.contains(&2));
+///     assert!(hashset.contains(&3));
+/// }
+/// ```
+fn deserialize_hashset_inner<T>(value: impl AsRef<str>) -> Result<HashSet<T>, String>
+where
+    T: Eq + std::str::FromStr + std::hash::Hash,
+    <T as std::str::FromStr>::Err: std::fmt::Display,
+{
+    let (values, errors) = value
+        .as_ref()
+        .trim()
+        .split(',')
+        .map(|s| {
+            T::from_str(s.trim()).map_err(|error| {
+                format!(
+                    "Unable to deserialize `{}` as `{}`: {error}",
+                    s.trim(),
+                    std::any::type_name::<T>()
+                )
+            })
+        })
+        .fold(
+            (HashSet::new(), Vec::new()),
+            |(mut values, mut errors), result| match result {
+                Ok(t) => {
+                    values.insert(t);
+                    (values, errors)
+                }
+                Err(error) => {
+                    errors.push(error);
+                    (values, errors)
+                }
+            },
+        );
+    if !errors.is_empty() {
+        Err(format!("Some errors occurred:\n{}", errors.join("\n")))
+    } else {
+        Ok(values)
+    }
+}
+
+/// Serde deserializer function for converting comma-separated strings into typed HashSets.
+///
+/// This function is designed to be used with serde's `#[serde(deserialize_with = "deserialize_hashset")]`
+/// attribute to customize deserialization of HashSet fields.
+///
+/// # Arguments
+///
+/// * `deserializer` - Serde deserializer instance
+///
+/// # Returns
+///
+/// * `Ok(HashSet<T>)` - Successfully deserialized HashSet
+/// * `Err(D::Error)` - Serde deserialization error
+///
+/// # Type Parameters
+///
+/// * `D` - Serde deserializer type
+/// * `T` - Target type that implements `FromStr`, `Eq`, and `Hash`
+pub(crate) fn deserialize_hashset<'a, D, T>(deserializer: D) -> Result<HashSet<T>, D::Error>
+where
+    D: serde::Deserializer<'a>,
+    T: Eq + std::str::FromStr + std::hash::Hash,
+    <T as std::str::FromStr>::Err: std::fmt::Display,
+{
+    use serde::de::Error;
+
+    deserialize_hashset_inner(<String>::deserialize(deserializer)?).map_err(D::Error::custom)
+}
+
+#[cfg(test)]
+mod tests {
+    use std::collections::HashSet;
+
+    use super::*;
+
+    #[test]
+    fn test_deserialize_hashset_inner_success() {
+        let result: Result<HashSet<i32>, String> = deserialize_hashset_inner("1,2,3");
+        assert!(result.is_ok());
+
+        if let Ok(hashset) = result {
+            assert_eq!(hashset.len(), 3);
+            assert!(hashset.contains(&1));
+            assert!(hashset.contains(&2));
+            assert!(hashset.contains(&3));
+        }
+    }
+
+    #[test]
+    fn test_deserialize_hashset_inner_with_whitespace() {
+        let result: Result<HashSet<String>, String> = deserialize_hashset_inner(" a , b , c ");
+        assert!(result.is_ok());
+
+        if let Ok(hashset) = result {
+            assert_eq!(hashset.len(), 3);
+            assert!(hashset.contains("a"));
+            assert!(hashset.contains("b"));
+            assert!(hashset.contains("c"));
+        }
+    }
+
+    #[test]
+    fn test_deserialize_hashset_inner_empty_string() {
+        let result: Result<HashSet<String>, String> = deserialize_hashset_inner("");
+        assert!(result.is_ok());
+        if let Ok(hashset) = result {
+            assert_eq!(hashset.len(), 0);
+        }
+    }
+
+    #[test]
+    fn test_deserialize_hashset_inner_single_value() {
+        let result: Result<HashSet<String>, String> = deserialize_hashset_inner("single");
+        assert!(result.is_ok());
+
+        if let Ok(hashset) = result {
+            assert_eq!(hashset.len(), 1);
+            assert!(hashset.contains("single"));
+        }
+    }
+
+    #[test]
+    fn test_deserialize_hashset_inner_invalid_int() {
+        let result: Result<HashSet<i32>, String> = deserialize_hashset_inner("1,invalid,3");
+        assert!(result.is_err());
+
+        if let Err(error) = result {
+            assert!(error.contains("Unable to deserialize `invalid` as `i32`"));
+        }
+    }
+
+    #[test]
+    fn test_deserialize_hashset_inner_duplicates() {
+        let result: Result<HashSet<String>, String> = deserialize_hashset_inner("a,b,a,c,b");
+        assert!(result.is_ok());
+
+        if let Ok(hashset) = result {
+            assert_eq!(hashset.len(), 3); // Duplicates should be removed
+            assert!(hashset.contains("a"));
+            assert!(hashset.contains("b"));
+            assert!(hashset.contains("c"));
+        }
+    }
+}
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index b14811ea735..2ef6e81eedc 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1,5 +1,7 @@
+use std::str::FromStr;
+
 use api_models::admin;
-use common_enums::{AttemptStatus, GatewaySystem, PaymentMethodType};
+use common_enums::{connector_enums::Connector, AttemptStatus, GatewaySystem, PaymentMethodType};
 use common_utils::{errors::CustomResult, ext_traits::ValueExt};
 use diesel_models::types::FeatureMetadata;
 use error_stack::ResultExt;
@@ -105,6 +107,9 @@ where
         .get_string_repr();
 
     let connector_name = router_data.connector.clone();
+    let connector_enum = Connector::from_str(&connector_name)
+        .change_context(errors::ApiErrorResponse::IncorrectConnectorNameGiven)?;
+
     let payment_method = router_data.payment_method.to_string();
     let flow_name = get_flow_name::<F>()?;
 
@@ -113,7 +118,7 @@ where
         .grpc_client
         .unified_connector_service
         .as_ref()
-        .is_some_and(|config| config.ucs_only_connectors.contains(&connector_name));
+        .is_some_and(|config| config.ucs_only_connectors.contains(&connector_enum));
 
     if is_ucs_only_connector {
         router_env::logger::info!(
 | 
	2025-08-11T10:41:24Z | 
	# Refactor: Change UCS connector configuration from array to comma-separated string
## Summary
This PR refactors the unified connector service (UCS) configuration to use a comma-separated string format instead of an array for specifying connectors that should use UCS only. This change improves configuration management and parsing efficiency while maintaining type safety through a custom deserializer.
## Changes
- **Configuration Format Change**: Modified `ucs_only_connectors` from `Vec<String>` to `HashSet<Connector>` with comma-separated string input
- **Custom Deserializer Implementation**: Added a new `utils.rs` module in `external_services` with `deserialize_hashset` function for parsing comma-separated values into typed HashSets
- **Type Safety Enhancement**: Updated connector validation to use `Connector` enum instead of raw strings, preventing invalid connector names
- **Configuration Updates**: Updated all config files (`development.toml`, `config.example.toml`, `deployments/env_specific.toml`) to use the new comma-separated format
- **Dependencies**: Added `common_enums` dependency to `external_services` crate for proper connector enum handling
## Related Issues
Closes #8906 - Improve UCS connector configuration format for better type safety and usability
## Type of Change
- [x] Refactoring
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- **Configuration Parsing**: Tested comma-separated string parsing with various inputs including whitespace handling
- **Type Validation**: Verified that invalid connector names are properly rejected during deserialization
- **Backward Compatibility**: Ensured existing connector validation logic works with the new enum-based approach
- **Unit Tests**: Added comprehensive test suite for the new deserializer functionality covering:
  - Valid comma-separated inputs
  - Whitespace handling
  - Error handling for invalid values
  - Empty string and single value scenarios
  - Duplicate value handling
## Implementation Details
### Key Files Modified
- `crates/external_services/src/grpc_client/unified_connector_service.rs:119` - Configuration struct update
- `crates/external_services/src/utils.rs` - New deserializer implementation
- `crates/router/src/core/unified_connector_service.rs:57` - Connector validation logic update
- Configuration files in `config/` directory
### New Functionality
The custom deserializer provides:
- Type-safe parsing of comma-separated strings into HashSets
- Comprehensive error handling with detailed error messages
- Generic implementation supporting any type that implements `FromStr + Eq + Hash`
- Proper handling of edge cases (empty strings, whitespace, duplicates)
## Checklist
- [x] Code follows project style guidelines
- [x] Self-review completed
- [x] Configuration changes tested locally
- [x] Unit tests added for new deserializer functionality
- [x] Type safety improvements verified
- [x] All config files updated consistently | 
	07a6271b76f6986f30064d51113838d486f0f2c6 | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8884 | 
	Bug: [FEATURE] Add Apple Pay Payment Method In Barclaycard
### Feature Description
Add Apple Pay Payment Method In Barclaycard
### Possible Implementation
Add Apple Pay Payment Method In Barclaycard
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index 00f7ba33a59..fdb5c2a0e5e 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -702,6 +702,7 @@ paze = { currency = "USD,SEK" }
 credit = { currency = "USD,GBP,EUR,PLN,SEK" }
 debit = { currency = "USD,GBP,EUR,PLN,SEK" }
 google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" }
+apple_pay = { currency = "ARS, CAD, CLP, COP, CNY, EUR, HKD, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, GBP, AED, USD, PLN, SEK" }
 
 [pm_filters.globepay]
 ali_pay = { country = "GB",currency = "GBP" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 40a0bdb137e..02b5a084f11 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -526,6 +526,7 @@ paze = { currency = "USD,SEK" }
 credit = { currency = "USD,GBP,EUR,PLN,SEK" }
 debit = { currency = "USD,GBP,EUR,PLN,SEK" }
 google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" }
+apple_pay = { currency = "ARS, CAD, CLP, COP, CNY, EUR, HKD, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, GBP, AED, USD, PLN, SEK" }
 
 [pm_filters.itaubank]
 pix = { country = "BR", currency = "BRL" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index c4c37289fa1..9bebc017d1a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -443,6 +443,7 @@ paze = { currency = "USD,SEK" }
 credit = { currency = "USD,GBP,EUR,PLN,SEK" }
 debit = { currency = "USD,GBP,EUR,PLN,SEK" }
 google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" }
+apple_pay = { currency = "ARS, CAD, CLP, COP, CNY, EUR, HKD, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, GBP, AED, USD, PLN, SEK" }
 
 [pm_filters.itaubank]
 pix = { country = "BR", currency = "BRL" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 171b4bf0987..b01733d1ae4 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -455,6 +455,7 @@ paze = { currency = "USD,SEK" }
 credit = { currency = "USD,GBP,EUR,PLN,SEK" }
 debit = { currency = "USD,GBP,EUR,PLN,SEK" }
 google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" }
+apple_pay = { currency = "ARS, CAD, CLP, COP, CNY, EUR, HKD, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, GBP, AED, USD, PLN, SEK" }
 
 [pm_filters.nexixpay]
 credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU,AU,BR,US", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
diff --git a/config/development.toml b/config/development.toml
index a2d06e7d28e..6ed294918b6 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -621,6 +621,7 @@ paze = { currency = "USD,SEK" }
 credit = { currency = "USD,GBP,EUR,PLN,SEK" }
 debit = { currency = "USD,GBP,EUR,PLN,SEK" }
 google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" }
+apple_pay = { currency = "ARS, CAD, CLP, COP, CNY, EUR, HKD, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, GBP, AED, USD, PLN, SEK" }
 
 
 [pm_filters.globepay]
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 544caf4c9f2..5ab5b481905 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -669,6 +669,7 @@ paze = { currency = "USD,SEK" }
 credit = { currency = "USD,GBP,EUR,PLN,SEK" }
 debit = { currency = "USD,GBP,EUR,PLN,SEK" }
 google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" }
+apple_pay = { currency = "ARS, CAD, CLP, COP, CNY, EUR, HKD, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, GBP, AED, USD, PLN, SEK" }
 
 [pm_filters.globepay]
 ali_pay = { country = "GB",currency = "GBP,CNY" }
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index bdedcf9d1f7..daf0119b9fe 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1028,11 +1028,65 @@ options=["visa","masterCard","amex","discover"]
   payment_method_type = "UnionPay"
 [[barclaycard.wallet]]
   payment_method_type = "google_pay"
+[[barclaycard.wallet]]
+  payment_method_type = "apple_pay"
 [barclaycard.connector_auth.SignatureKey]
 api_key="Key"
 key1="Merchant ID"
 api_secret="Shared Secret"
 
+[[barclaycard.metadata.apple_pay]]
+name="certificate"
+label="Merchant Certificate (Base64 Encoded)"
+placeholder="Enter Merchant Certificate (Base64 Encoded)"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="certificate_keys"
+label="Merchant PrivateKey (Base64 Encoded)"
+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="merchant_identifier"
+label="Apple Merchant Identifier"
+placeholder="Enter Apple Merchant Identifier"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="display_name"
+label="Display Name"
+placeholder="Enter Display Name"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="initiative"
+label="Domain"
+placeholder="Enter Domain"
+required=true
+type="Select"
+options=["web","ios"]
+[[barclaycard.metadata.apple_pay]]
+name="initiative_context"
+label="Domain Name"
+placeholder="Enter Domain Name"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="merchant_business_country"
+label="Merchant Business Country"
+placeholder="Enter Merchant Business Country"
+required=true
+type="Select"
+options=[]
+[[barclaycard.metadata.apple_pay]]
+name="payment_processing_details_at"
+label="Payment Processing Details At"
+placeholder="Enter Payment Processing Details At"
+required=true
+type="Radio"
+options=["Connector","Hyperswitch"]
+
 [[barclaycard.metadata.google_pay]]
 name = "merchant_name"
 label = "Google Pay Merchant Name"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 21c9f20fedc..61e58a1cc32 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1032,11 +1032,65 @@ payment_method_type = "CartesBancaires"
 payment_method_type = "UnionPay"
 [[barclaycard.wallet]]
   payment_method_type = "google_pay"
+[[barclaycard.wallet]]
+  payment_method_type = "apple_pay"
 [barclaycard.connector_auth.SignatureKey]
 api_key = "Key"
 key1 = "Merchant ID"
 api_secret = "Shared Secret"
 
+[[barclaycard.metadata.apple_pay]]
+name="certificate"
+label="Merchant Certificate (Base64 Encoded)"
+placeholder="Enter Merchant Certificate (Base64 Encoded)"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="certificate_keys"
+label="Merchant PrivateKey (Base64 Encoded)"
+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="merchant_identifier"
+label="Apple Merchant Identifier"
+placeholder="Enter Apple Merchant Identifier"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="display_name"
+label="Display Name"
+placeholder="Enter Display Name"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="initiative"
+label="Domain"
+placeholder="Enter Domain"
+required=true
+type="Select"
+options=["web","ios"]
+[[barclaycard.metadata.apple_pay]]
+name="initiative_context"
+label="Domain Name"
+placeholder="Enter Domain Name"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="merchant_business_country"
+label="Merchant Business Country"
+placeholder="Enter Merchant Business Country"
+required=true
+type="Select"
+options=[]
+[[barclaycard.metadata.apple_pay]]
+name="payment_processing_details_at"
+label="Payment Processing Details At"
+placeholder="Enter Payment Processing Details At"
+required=true
+type="Radio"
+options=["Connector","Hyperswitch"]
+
 [[barclaycard.metadata.google_pay]]
 name = "merchant_name"
 label = "Google Pay Merchant Name"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 597c3fb7276..217203879d4 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1028,11 +1028,65 @@ payment_method_type = "CartesBancaires"
 payment_method_type = "UnionPay"
 [[barclaycard.wallet]]
   payment_method_type = "google_pay"
+[[barclaycard.wallet]]
+  payment_method_type = "apple_pay"
 [barclaycard.connector_auth.SignatureKey]
 api_key = "Key"
 key1 = "Merchant ID"
 api_secret = "Shared Secret"
 
+[[barclaycard.metadata.apple_pay]]
+name="certificate"
+label="Merchant Certificate (Base64 Encoded)"
+placeholder="Enter Merchant Certificate (Base64 Encoded)"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="certificate_keys"
+label="Merchant PrivateKey (Base64 Encoded)"
+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="merchant_identifier"
+label="Apple Merchant Identifier"
+placeholder="Enter Apple Merchant Identifier"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="display_name"
+label="Display Name"
+placeholder="Enter Display Name"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="initiative"
+label="Domain"
+placeholder="Enter Domain"
+required=true
+type="Select"
+options=["web","ios"]
+[[barclaycard.metadata.apple_pay]]
+name="initiative_context"
+label="Domain Name"
+placeholder="Enter Domain Name"
+required=true
+type="Text"
+[[barclaycard.metadata.apple_pay]]
+name="merchant_business_country"
+label="Merchant Business Country"
+placeholder="Enter Merchant Business Country"
+required=true
+type="Select"
+options=[]
+[[barclaycard.metadata.apple_pay]]
+name="payment_processing_details_at"
+label="Payment Processing Details At"
+placeholder="Enter Payment Processing Details At"
+required=true
+type="Radio"
+options=["Connector","Hyperswitch"]
+
 [[barclaycard.metadata.google_pay]]
 name = "merchant_name"
 label = "Google Pay Merchant Name"
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
index 98843a068f4..7a1e09a24f2 100644
--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
@@ -1315,6 +1315,17 @@ static BARCLAYCARD_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods>
         barclaycard_supported_payment_methods.add(
             enums::PaymentMethod::Wallet,
             enums::PaymentMethodType::GooglePay,
+            PaymentMethodDetails {
+                mandates: enums::FeatureStatus::NotSupported,
+                refunds: enums::FeatureStatus::Supported,
+                supported_capture_methods: supported_capture_methods.clone(),
+                specific_features: None,
+            },
+        );
+
+        barclaycard_supported_payment_methods.add(
+            enums::PaymentMethod::Wallet,
+            enums::PaymentMethodType::ApplePay,
             PaymentMethodDetails {
                 mandates: enums::FeatureStatus::NotSupported,
                 refunds: enums::FeatureStatus::Supported,
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
index 9d78d9de9a4..6be869fa217 100644
--- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
@@ -1,5 +1,6 @@
 use base64::Engine;
 use common_enums::enums;
+use common_types::payments::ApplePayPredecryptData;
 use common_utils::{
     consts, date_time,
     ext_traits::ValueExt,
@@ -8,10 +9,10 @@ use common_utils::{
 };
 use error_stack::ResultExt;
 use hyperswitch_domain_models::{
-    payment_method_data::{GooglePayWalletData, PaymentMethodData, WalletData},
+    payment_method_data::{ApplePayWalletData, GooglePayWalletData, PaymentMethodData, WalletData},
     router_data::{
         AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData,
-        ErrorResponse, RouterData,
+        ErrorResponse, PaymentMethodToken, RouterData,
     },
     router_flow_types::refunds::{Execute, RSync},
     router_request_types::{
@@ -33,6 +34,7 @@ use serde_json::Value;
 use crate::{
     constants,
     types::{RefundsResponseRouterData, ResponseRouterData},
+    unimplemented_payment_method,
     utils::{
         self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData,
         PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData,
@@ -179,11 +181,44 @@ pub struct GooglePayPaymentInformation {
     fluid_data: FluidData,
 }
 
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TokenizedCard {
+    number: cards::CardNumber,
+    expiration_month: Secret<String>,
+    expiration_year: Secret<String>,
+    cryptogram: Option<Secret<String>>,
+    transaction_type: TransactionType,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplePayTokenizedCard {
+    transaction_type: TransactionType,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplePayTokenPaymentInformation {
+    fluid_data: FluidData,
+    tokenized_card: ApplePayTokenizedCard,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplePayPaymentInformation {
+    tokenized_card: TokenizedCard,
+}
+
+pub const FLUID_DATA_DESCRIPTOR: &str = "RklEPUNPTU1PTi5BUFBMRS5JTkFQUC5QQVlNRU5U";
+
 #[derive(Debug, Serialize)]
 #[serde(untagged)]
 pub enum PaymentInformation {
     Cards(Box<CardPaymentInformation>),
     GooglePay(Box<GooglePayPaymentInformation>),
+    ApplePay(Box<ApplePayPaymentInformation>),
+    ApplePayToken(Box<ApplePayTokenPaymentInformation>),
 }
 
 #[derive(Debug, Serialize)]
@@ -202,6 +237,8 @@ pub struct Card {
 #[serde(rename_all = "camelCase")]
 pub struct FluidData {
     value: Secret<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    descriptor: Option<String>,
 }
 
 #[derive(Debug, Serialize)]
@@ -289,12 +326,20 @@ fn get_barclaycard_card_type(card_network: common_enums::CardNetwork) -> Option<
 #[derive(Debug, Serialize)]
 pub enum PaymentSolution {
     GooglePay,
+    ApplePay,
+}
+
+#[derive(Debug, Serialize)]
+pub enum TransactionType {
+    #[serde(rename = "1")]
+    InApp,
 }
 
 impl From<PaymentSolution> for String {
     fn from(solution: PaymentSolution) -> Self {
         let payment_solution = match solution {
             PaymentSolution::GooglePay => "012",
+            PaymentSolution::ApplePay => "001",
         };
         payment_solution.to_string()
     }
@@ -338,7 +383,23 @@ impl
             Option<String>,
         ),
     ) -> Result<Self, Self::Error> {
-        let commerce_indicator = get_commerce_indicator(network);
+        let commerce_indicator = solution
+            .as_ref()
+            .map(|pm_solution| match pm_solution {
+                PaymentSolution::ApplePay => network
+                    .as_ref()
+                    .map(|card_network| match card_network.to_lowercase().as_str() {
+                        "amex" => "internet",
+                        "discover" => "internet",
+                        "mastercard" => "spa",
+                        "visa" => "internet",
+                        _ => "internet",
+                    })
+                    .unwrap_or("internet"),
+                PaymentSolution::GooglePay => "internet",
+            })
+            .unwrap_or("internet")
+            .to_string();
         let cavv_algorithm = Some("2".to_string());
         Ok(Self {
             capture: Some(matches!(
@@ -1278,6 +1339,90 @@ impl
     }
 }
 
+impl
+    TryFrom<(
+        &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+        Box<ApplePayPredecryptData>,
+        ApplePayWalletData,
+    )> for BarclaycardPaymentsRequest
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        (item, apple_pay_data, apple_pay_wallet_data): (
+            &BarclaycardRouterData<&PaymentsAuthorizeRouterData>,
+            Box<ApplePayPredecryptData>,
+            ApplePayWalletData,
+        ),
+    ) -> Result<Self, Self::Error> {
+        let email = item
+            .router_data
+            .get_billing_email()
+            .or(item.router_data.request.get_email())?;
+        let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?;
+        let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
+        let processing_information =
+            ProcessingInformation::try_from((item, Some(PaymentSolution::ApplePay), None))?;
+        let client_reference_information = ClientReferenceInformation::from(item);
+        let expiration_month = apple_pay_data.get_expiry_month().change_context(
+            errors::ConnectorError::InvalidDataFormat {
+                field_name: "expiration_month",
+            },
+        )?;
+        let expiration_year = apple_pay_data.get_four_digit_expiry_year();
+        let payment_information =
+            PaymentInformation::ApplePay(Box::new(ApplePayPaymentInformation {
+                tokenized_card: TokenizedCard {
+                    number: apple_pay_data.application_primary_account_number,
+                    cryptogram: Some(apple_pay_data.payment_data.online_payment_cryptogram),
+                    transaction_type: TransactionType::InApp,
+                    expiration_year,
+                    expiration_month,
+                },
+            }));
+        let merchant_defined_information = item
+            .router_data
+            .request
+            .metadata
+            .clone()
+            .map(convert_metadata_to_merchant_defined_info);
+        let ucaf_collection_indicator = match apple_pay_wallet_data
+            .payment_method
+            .network
+            .to_lowercase()
+            .as_str()
+        {
+            "mastercard" => Some("2".to_string()),
+            _ => None,
+        };
+        Ok(Self {
+            processing_information,
+            payment_information,
+            order_information,
+            client_reference_information,
+            consumer_authentication_information: Some(BarclaycardConsumerAuthInformation {
+                ucaf_collection_indicator,
+                cavv: None,
+                ucaf_authentication_data: None,
+                xid: None,
+                directory_server_transaction_id: None,
+                specification_version: None,
+                pa_specification_version: None,
+                veres_enrolled: None,
+                eci_raw: None,
+                pares_status: None,
+                authentication_date: None,
+                effective_authentication_type: None,
+                challenge_code: None,
+                pares_status_reason: None,
+                challenge_cancel_code: None,
+                network_score: None,
+                acs_transaction_id: None,
+            }),
+            merchant_defined_information,
+        })
+    }
+}
+
 impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for BarclaycardPaymentsRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
@@ -1287,11 +1432,105 @@ impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for Barclayca
             PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
             PaymentMethodData::Wallet(wallet_data) => match wallet_data {
                 WalletData::GooglePay(google_pay_data) => Self::try_from((item, google_pay_data)),
+                WalletData::ApplePay(apple_pay_data) => {
+                    match item.router_data.payment_method_token.clone() {
+                        Some(payment_method_token) => match payment_method_token {
+                            PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
+                                Self::try_from((item, decrypt_data, apple_pay_data))
+                            }
+                            PaymentMethodToken::Token(_) => Err(unimplemented_payment_method!(
+                                "Apple Pay",
+                                "Manual",
+                                "Cybersource"
+                            ))?,
+                            PaymentMethodToken::PazeDecrypt(_) => {
+                                Err(unimplemented_payment_method!("Paze", "Cybersource"))?
+                            }
+                            PaymentMethodToken::GooglePayDecrypt(_) => {
+                                Err(unimplemented_payment_method!("Google Pay", "Cybersource"))?
+                            }
+                        },
+                        None => {
+                            let transaction_type = TransactionType::InApp;
+                            let email = item
+                                .router_data
+                                .get_billing_email()
+                                .or(item.router_data.request.get_email())?;
+                            let bill_to =
+                                build_bill_to(item.router_data.get_billing_address()?, email)?;
+                            let order_information =
+                                OrderInformationWithBill::from((item, Some(bill_to)));
+                            let processing_information = ProcessingInformation::try_from((
+                                item,
+                                Some(PaymentSolution::ApplePay),
+                                Some(apple_pay_data.payment_method.network.clone()),
+                            ))?;
+                            let client_reference_information =
+                                ClientReferenceInformation::from(item);
+
+                            let apple_pay_encrypted_data = apple_pay_data
+                                .payment_data
+                                .get_encrypted_apple_pay_payment_data_mandatory()
+                                .change_context(errors::ConnectorError::MissingRequiredField {
+                                    field_name: "Apple pay encrypted data",
+                                })?;
+                            let payment_information = PaymentInformation::ApplePayToken(Box::new(
+                                ApplePayTokenPaymentInformation {
+                                    fluid_data: FluidData {
+                                        value: Secret::from(apple_pay_encrypted_data.clone()),
+                                        descriptor: Some(FLUID_DATA_DESCRIPTOR.to_string()),
+                                    },
+                                    tokenized_card: ApplePayTokenizedCard { transaction_type },
+                                },
+                            ));
+                            let merchant_defined_information =
+                                item.router_data.request.metadata.clone().map(|metadata| {
+                                    convert_metadata_to_merchant_defined_info(metadata)
+                                });
+                            let ucaf_collection_indicator = match apple_pay_data
+                                .payment_method
+                                .network
+                                .to_lowercase()
+                                .as_str()
+                            {
+                                "mastercard" => Some("2".to_string()),
+                                _ => None,
+                            };
+                            Ok(Self {
+                                processing_information,
+                                payment_information,
+                                order_information,
+                                client_reference_information,
+                                merchant_defined_information,
+                                consumer_authentication_information: Some(
+                                    BarclaycardConsumerAuthInformation {
+                                        ucaf_collection_indicator,
+                                        cavv: None,
+                                        ucaf_authentication_data: None,
+                                        xid: None,
+                                        directory_server_transaction_id: None,
+                                        specification_version: None,
+                                        pa_specification_version: None,
+                                        veres_enrolled: None,
+                                        eci_raw: None,
+                                        pares_status: None,
+                                        authentication_date: None,
+                                        effective_authentication_type: None,
+                                        challenge_code: None,
+                                        pares_status_reason: None,
+                                        challenge_cancel_code: None,
+                                        network_score: None,
+                                        acs_transaction_id: None,
+                                    },
+                                ),
+                            })
+                        }
+                    }
+                }
                 WalletData::AliPayQr(_)
                 | WalletData::AliPayRedirect(_)
                 | WalletData::AliPayHkRedirect(_)
                 | WalletData::AmazonPayRedirect(_)
-                | WalletData::ApplePay(_)
                 | WalletData::MomoRedirect(_)
                 | WalletData::KakaoPayRedirect(_)
                 | WalletData::GoPayRedirect(_)
@@ -2671,6 +2910,7 @@ impl TryFrom<&GooglePayWalletData> for PaymentInformation {
                             .clone(),
                     ),
                 ),
+                descriptor: None,
             },
         })))
     }
 | 
	2025-08-08T20:13:37Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/8884)
## Description
<!-- Describe your changes in detail -->
Added Apple Pay Flow for Barclaycard
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
<details>
<summary>Hyperswitch Decryption Flow </summary>
1. Payment Connector - Create
Request:
```
curl --location 'http://localhost:8080/account/merchant_1755085109/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_taZoWveMbydxSkllyD5IB1sPHXNYOLLR2iveHgisLDodWCnHUkaXOF5k8RS8jMFC' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_account_details": {
        "auth_type":"SignatureKey",
        "api_secret": API_SECRET
        "api_key": API_KEY,
        "key1": KEY1
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
     "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": CERTIFICATE,
                    "display_name": "Applepay",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "initiative_context": INITIATIVE_CONTEXT,
                    "merchant_identifier": MERCHANT_IDENTIFIER
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": PAYMENT_PROCESSING_CERTIFICATE,
                    "payment_processing_certificate_key": PAYMENT_PROCESSING_CERTIFICATE_KEY,
                },
                "payment_request_data": {
                    "label": "Applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "business_country": "US",
    "business_label": "default"
}'
```
Response:
```
{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_label": "barclaycard_US_default",
    "merchant_connector_id": "mca_eS9yhJMxUdKy4eZJ1Ea1",
    "profile_id": "pro_v4sNqtQqIhqC7zNvjBna",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": API_KEY,
        "key1": KEY1,
        "api_secret": API_SECRET
    },
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": CERTIFICATE,
                    "display_name": "Applepay",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "initiative_context": INITIATIVE_CONTEXT,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": PAYMENT_PROCESSING_CERTIFICATE,
                    "payment_processing_certificate_key": PAYMENT_PROCESSING_CERTIFICATE_KEY
                },
                "payment_request_data": {
                    "label": "Applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": {
        "apple_pay_combined": {
            "manual": {
                "payment_request_data": {
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ],
                    "label": "Applepay"
                },
                "session_token_data": {
                    "certificate": CERTIFICATE,
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "display_name": "Applepay",
                    "initiative": "web",
                    "initiative_context": INITIATIVE_CONTEXT,
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": PAYMENT_PROCESSING_CERTIFICATE,
                    "payment_processing_certificate_key": PAYMENT_PROCESSING_CERTIFICATE_KEY
                }
            }
        }
    }
}
```
2. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_taZoWveMbydxSkllyD5IB1sPHXNYOLLR2iveHgisLDodWCnHUkaXOF5k8RS8jMFC' \
--data-raw '{
    "amount": 650,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 650,
    "customer_id": "cu_1752502119",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "setup_future_usage": "off_session",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "billing": {
        "address": {
            "line1": "1467",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": NUMBER
            "country_code": "+91"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": PAYMENT_DATA,
                    "display_name": "MasterCard 0049",
                    "network": "MasterCard",
                    "type": "credit"
                },
                "transaction_identifier": TRANSACTION_IDENTIFIER
            }
        }
    },
    "shipping": {
        "phone": {
            "number": "4081234567"
        },
        "email": EMAIL
    }
}'
```
Response:
```
{
    "payment_id": "pay_ytnuQR2VsUo0pTAPUlvy",
    "merchant_id": "merchant_1755085109",
    "status": "succeeded",
    "amount": 650,
    "net_amount": 650,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 650,
    "connector": "barclaycard",
    "client_secret": "pay_ytnuQR2VsUo0pTAPUlvy_secret_pdWZPEULnUSv9XOzVUaF",
    "created": "2025-08-13T11:38:39.949Z",
    "currency": "USD",
    "customer_id": "cu_1752502119",
    "customer": {
        "id": "cu_1752502119",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "0049",
                "card_network": "MasterCard",
                "type": "credit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": null,
        "phone": {
            "number": "4081234567",
            "country_code": null
        },
        "email": EMAIL
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": NUMBER,
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": "barclaycard_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1752502119",
        "created_at": 1755085119,
        "expires": 1755088719,
        "secret": "SECRET
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7550851222606001203813",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_ytnuQR2VsUo0pTAPUlvy_1",
    "payment_link": null,
    "profile_id": "pro_v4sNqtQqIhqC7zNvjBna",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_eS9yhJMxUdKy4eZJ1Ea1",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-13T11:53:39.949Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-13T11:38:43.164Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
<summary>Connector Decryption Flow </summary>
1. Payment Connector - Create
Request:
```
curl --location 'http://localhost:8080/account/merchant_1757312693/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_tO4QhL39rQMDHYzzbfwpngxQRd7PfKBjb3H9h0ngxbMUeLjNovXFBbIRDfRhBkKk' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_secret": API_SECRET,
        "api_key": API_KEY,
        "key1": KEY1
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "ios",
                    "certificate": CERTIFICATE,
                    "display_name": "Barclaycard via Hyperswitch",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "merchant_business_country": MERCHANT_BUSINESS_COUNTRY,
                    "payment_processing_details_at": "Connector"
                },
                "payment_request_data": {
                    "label": "Cybersource via Hyperswitch",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    },
    "business_country": "US",
    "business_label": "default"
}'
```
Response:
```
{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_label": "barclaycard_US_default",
    "merchant_connector_id": "mca_dQAvxu5nKalC1YM9Nh4c",
    "profile_id": "pro_PbbZjjifqFiYwIXrlBjq",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": API_KEY,
        "key1": KEY1,
        "api_secret": API_SECRET
    },
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret",
        "additional_secret": null
    },
    "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "ios",
                    "certificate": CERTIFICATE,
                    "display_name": "Barclaycard via Hyperswitch",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "merchant_business_country": MERCHANT_BUSINESS_COUNTRY,
                    "payment_processing_details_at": "Connector"
                },
                "payment_request_data": {
                    "label": "Barclaycard via Hyperswitch",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": {
        "apple_pay_combined": {
            "manual": {
                "payment_request_data": {
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ],
                    "label": "Barclaycard via Hyperswitch"
                },
                "session_token_data": {
                    "certificate": CERTIFICATE,
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "display_name": MERCHANT_BUSINESS_COUNTRY,
                    "initiative": "ios",
                    "initiative_context": null,
                    "merchant_business_country": MERCHANT_BUSINESS_COUNTRY,
                    "payment_processing_details_at": "Connector"
                }
            }
        }
    }
}
```
2. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_tO4QhL39rQMDHYzzbfwpngxQRd7PfKBjb3H9h0ngxbMUeLjNovXFBbIRDfRhBkKk' \
--data-raw '{
    "amount": 2229,
    "currency": "USD",
    "confirm": true,
    "customer_id": "gmail",
    "email": "email@email.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": PAYMENT_DATA,
                "payment_method": {
                    "display_name": "MasterCard 0049",
                    "network": "MasterCard",
                    "type": "credit"
                },
                "transaction_identifier": TRANSACTION_IDENTIFIER
            }
        }
    },
    "payment_method": "wallet",
    "payment_method_type": "apple_pay"
}'
```
Response:
```
{
    "payment_id": "pay_PGO6Zpfp4QqUUVrcV69m",
    "merchant_id": "merchant_1757312693",
    "status": "succeeded",
    "amount": 2229,
    "net_amount": 2229,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 2229,
    "connector": "barclaycard",
    "client_secret": "pay_PGO6Zpfp4QqUUVrcV69m_secret_4NqlDHVTMiECtyKhMRgN",
    "created": "2025-09-08T06:25:44.739Z",
    "currency": "USD",
    "customer_id": "gmail",
    "customer": {
        "id": "gmail",
        "name": null,
        "email": "email@email.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "0049",
                "card_network": "MasterCard",
                "type": "credit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": null,
    "email": "email@email.com",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "gmail",
        "created_at": 1757312744,
        "expires": 1757316344,
        "secret": "epk_972bbb09245349088a4f2eb20ffb472e"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7573127477466909504807",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_PGO6Zpfp4QqUUVrcV69m_1",
    "payment_link": null,
    "profile_id": "pro_PbbZjjifqFiYwIXrlBjq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_dQAvxu5nKalC1YM9Nh4c",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-08T06:40:44.739Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-08T06:25:48.784Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f5db00352b90e99e78b631fa8b9cde5800093a9d | 
	
Postman Test
<details>
<summary>Hyperswitch Decryption Flow </summary>
1. Payment Connector - Create
Request:
```
curl --location 'http://localhost:8080/account/merchant_1755085109/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_taZoWveMbydxSkllyD5IB1sPHXNYOLLR2iveHgisLDodWCnHUkaXOF5k8RS8jMFC' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_account_details": {
        "auth_type":"SignatureKey",
        "api_secret": API_SECRET
        "api_key": API_KEY,
        "key1": KEY1
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
     "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": CERTIFICATE,
                    "display_name": "Applepay",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "initiative_context": INITIATIVE_CONTEXT,
                    "merchant_identifier": MERCHANT_IDENTIFIER
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": PAYMENT_PROCESSING_CERTIFICATE,
                    "payment_processing_certificate_key": PAYMENT_PROCESSING_CERTIFICATE_KEY,
                },
                "payment_request_data": {
                    "label": "Applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "business_country": "US",
    "business_label": "default"
}'
```
Response:
```
{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_label": "barclaycard_US_default",
    "merchant_connector_id": "mca_eS9yhJMxUdKy4eZJ1Ea1",
    "profile_id": "pro_v4sNqtQqIhqC7zNvjBna",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": API_KEY,
        "key1": KEY1,
        "api_secret": API_SECRET
    },
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": CERTIFICATE,
                    "display_name": "Applepay",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "initiative_context": INITIATIVE_CONTEXT,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": PAYMENT_PROCESSING_CERTIFICATE,
                    "payment_processing_certificate_key": PAYMENT_PROCESSING_CERTIFICATE_KEY
                },
                "payment_request_data": {
                    "label": "Applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": {
        "apple_pay_combined": {
            "manual": {
                "payment_request_data": {
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ],
                    "label": "Applepay"
                },
                "session_token_data": {
                    "certificate": CERTIFICATE,
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "display_name": "Applepay",
                    "initiative": "web",
                    "initiative_context": INITIATIVE_CONTEXT,
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": PAYMENT_PROCESSING_CERTIFICATE,
                    "payment_processing_certificate_key": PAYMENT_PROCESSING_CERTIFICATE_KEY
                }
            }
        }
    }
}
```
2. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_taZoWveMbydxSkllyD5IB1sPHXNYOLLR2iveHgisLDodWCnHUkaXOF5k8RS8jMFC' \
--data-raw '{
    "amount": 650,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 650,
    "customer_id": "cu_1752502119",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "setup_future_usage": "off_session",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "billing": {
        "address": {
            "line1": "1467",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": NUMBER
            "country_code": "+91"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": PAYMENT_DATA,
                    "display_name": "MasterCard 0049",
                    "network": "MasterCard",
                    "type": "credit"
                },
                "transaction_identifier": TRANSACTION_IDENTIFIER
            }
        }
    },
    "shipping": {
        "phone": {
            "number": "4081234567"
        },
        "email": EMAIL
    }
}'
```
Response:
```
{
    "payment_id": "pay_ytnuQR2VsUo0pTAPUlvy",
    "merchant_id": "merchant_1755085109",
    "status": "succeeded",
    "amount": 650,
    "net_amount": 650,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 650,
    "connector": "barclaycard",
    "client_secret": "pay_ytnuQR2VsUo0pTAPUlvy_secret_pdWZPEULnUSv9XOzVUaF",
    "created": "2025-08-13T11:38:39.949Z",
    "currency": "USD",
    "customer_id": "cu_1752502119",
    "customer": {
        "id": "cu_1752502119",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "0049",
                "card_network": "MasterCard",
                "type": "credit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": null,
        "phone": {
            "number": "4081234567",
            "country_code": null
        },
        "email": EMAIL
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": NUMBER,
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": "barclaycard_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1752502119",
        "created_at": 1755085119,
        "expires": 1755088719,
        "secret": "SECRET
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7550851222606001203813",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_ytnuQR2VsUo0pTAPUlvy_1",
    "payment_link": null,
    "profile_id": "pro_v4sNqtQqIhqC7zNvjBna",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_eS9yhJMxUdKy4eZJ1Ea1",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-13T11:53:39.949Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-13T11:38:43.164Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
<summary>Connector Decryption Flow </summary>
1. Payment Connector - Create
Request:
```
curl --location 'http://localhost:8080/account/merchant_1757312693/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_tO4QhL39rQMDHYzzbfwpngxQRd7PfKBjb3H9h0ngxbMUeLjNovXFBbIRDfRhBkKk' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_secret": API_SECRET,
        "api_key": API_KEY,
        "key1": KEY1
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "ios",
                    "certificate": CERTIFICATE,
                    "display_name": "Barclaycard via Hyperswitch",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "merchant_business_country": MERCHANT_BUSINESS_COUNTRY,
                    "payment_processing_details_at": "Connector"
                },
                "payment_request_data": {
                    "label": "Cybersource via Hyperswitch",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    },
    "business_country": "US",
    "business_label": "default"
}'
```
Response:
```
{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_label": "barclaycard_US_default",
    "merchant_connector_id": "mca_dQAvxu5nKalC1YM9Nh4c",
    "profile_id": "pro_PbbZjjifqFiYwIXrlBjq",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": API_KEY,
        "key1": KEY1,
        "api_secret": API_SECRET
    },
    "payment_methods_enabled": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret",
        "additional_secret": null
    },
    "metadata": {
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "ios",
                    "certificate": CERTIFICATE,
                    "display_name": "Barclaycard via Hyperswitch",
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "merchant_business_country": MERCHANT_BUSINESS_COUNTRY,
                    "payment_processing_details_at": "Connector"
                },
                "payment_request_data": {
                    "label": "Barclaycard via Hyperswitch",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": {
        "apple_pay_combined": {
            "manual": {
                "payment_request_data": {
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ],
                    "label": "Barclaycard via Hyperswitch"
                },
                "session_token_data": {
                    "certificate": CERTIFICATE,
                    "certificate_keys": CERTIFICATE_KEYS,
                    "merchant_identifier": MERCHANT_IDENTIFIER,
                    "display_name": MERCHANT_BUSINESS_COUNTRY,
                    "initiative": "ios",
                    "initiative_context": null,
                    "merchant_business_country": MERCHANT_BUSINESS_COUNTRY,
                    "payment_processing_details_at": "Connector"
                }
            }
        }
    }
}
```
2. Payments - Create
Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_tO4QhL39rQMDHYzzbfwpngxQRd7PfKBjb3H9h0ngxbMUeLjNovXFBbIRDfRhBkKk' \
--data-raw '{
    "amount": 2229,
    "currency": "USD",
    "confirm": true,
    "customer_id": "gmail",
    "email": "email@email.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": PAYMENT_DATA,
                "payment_method": {
                    "display_name": "MasterCard 0049",
                    "network": "MasterCard",
                    "type": "credit"
                },
                "transaction_identifier": TRANSACTION_IDENTIFIER
            }
        }
    },
    "payment_method": "wallet",
    "payment_method_type": "apple_pay"
}'
```
Response:
```
{
    "payment_id": "pay_PGO6Zpfp4QqUUVrcV69m",
    "merchant_id": "merchant_1757312693",
    "status": "succeeded",
    "amount": 2229,
    "net_amount": 2229,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 2229,
    "connector": "barclaycard",
    "client_secret": "pay_PGO6Zpfp4QqUUVrcV69m_secret_4NqlDHVTMiECtyKhMRgN",
    "created": "2025-09-08T06:25:44.739Z",
    "currency": "USD",
    "customer_id": "gmail",
    "customer": {
        "id": "gmail",
        "name": null,
        "email": "email@email.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "0049",
                "card_network": "MasterCard",
                "type": "credit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": null,
    "email": "email@email.com",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "gmail",
        "created_at": 1757312744,
        "expires": 1757316344,
        "secret": "epk_972bbb09245349088a4f2eb20ffb472e"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7573127477466909504807",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_PGO6Zpfp4QqUUVrcV69m_1",
    "payment_link": null,
    "profile_id": "pro_PbbZjjifqFiYwIXrlBjq",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_dQAvxu5nKalC1YM9Nh4c",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-08T06:40:44.739Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-08T06:25:48.784Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8892 | 
	Bug: add support to store signature_network and is_regulated in payment attempts
Extended the AdditionalCardInfo struct to include new fields: is_regulated (indicates if the issuer is regulated under interchange fee caps) and signature_network (the card's primary global brand). | 
	diff --git a/crates/analytics/docs/clickhouse/scripts/payment_attempts.sql b/crates/analytics/docs/clickhouse/scripts/payment_attempts.sql
index 16815e9a33d..ffe706cab08 100644
--- a/crates/analytics/docs/clickhouse/scripts/payment_attempts.sql
+++ b/crates/analytics/docs/clickhouse/scripts/payment_attempts.sql
@@ -45,6 +45,8 @@ CREATE TABLE payment_attempt_queue (
     `card_network` Nullable(String),
     `routing_approach` LowCardinality(Nullable(String)),
     `debit_routing_savings` Nullable(UInt32),
+    `signature_network` Nullable(String),
+    `is_issuer_regulated` Nullable(Bool),
     `sign_flag` Int8
 ) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
 kafka_topic_list = 'hyperswitch-payment-attempt-events',
@@ -100,6 +102,8 @@ CREATE TABLE payment_attempts (
     `card_network` Nullable(String),
     `routing_approach` LowCardinality(Nullable(String)),
     `debit_routing_savings` Nullable(UInt32),
+    `signature_network` Nullable(String),
+    `is_issuer_regulated` Nullable(Bool),
     `sign_flag` Int8,
     INDEX connectorIndex connector TYPE bloom_filter GRANULARITY 1,
     INDEX paymentMethodIndex payment_method TYPE bloom_filter GRANULARITY 1,
@@ -158,6 +162,8 @@ CREATE MATERIALIZED VIEW payment_attempt_mv TO payment_attempts (
     `card_network` Nullable(String),
     `routing_approach` LowCardinality(Nullable(String)),
     `debit_routing_savings` Nullable(UInt32),
+    `signature_network` Nullable(String),
+    `is_issuer_regulated` Nullable(Bool),
     `sign_flag` Int8
 ) AS
 SELECT
@@ -208,6 +214,8 @@ SELECT
     card_network,
     routing_approach,
     debit_routing_savings,
+    signature_network,
+    is_issuer_regulated,
     sign_flag
 FROM
     payment_attempt_queue
diff --git a/crates/analytics/src/payments/accumulator.rs b/crates/analytics/src/payments/accumulator.rs
index 6d7dca22a30..a266e1366af 100644
--- a/crates/analytics/src/payments/accumulator.rs
+++ b/crates/analytics/src/payments/accumulator.rs
@@ -63,6 +63,8 @@ pub struct ProcessedAmountAccumulator {
 pub struct DebitRoutingAccumulator {
     pub transaction_count: u64,
     pub savings_amount: u64,
+    pub signature_network: Option<String>,
+    pub is_issuer_regulated: Option<bool>,
 }
 
 #[derive(Debug, Default)]
@@ -191,7 +193,13 @@ impl PaymentMetricAccumulator for SuccessRateAccumulator {
 }
 
 impl PaymentMetricAccumulator for DebitRoutingAccumulator {
-    type MetricOutput = (Option<u64>, Option<u64>, Option<u64>);
+    type MetricOutput = (
+        Option<u64>,
+        Option<u64>,
+        Option<u64>,
+        Option<String>,
+        Option<bool>,
+    );
 
     fn add_metrics_bucket(&mut self, metrics: &PaymentMetricRow) {
         if let Some(count) = metrics.count {
@@ -200,6 +208,12 @@ impl PaymentMetricAccumulator for DebitRoutingAccumulator {
         if let Some(total) = metrics.total.as_ref().and_then(ToPrimitive::to_u64) {
             self.savings_amount += total;
         }
+        if let Some(signature_network) = &metrics.signature_network {
+            self.signature_network = Some(signature_network.clone());
+        }
+        if let Some(is_issuer_regulated) = metrics.is_issuer_regulated {
+            self.is_issuer_regulated = Some(is_issuer_regulated);
+        }
     }
 
     fn collect(self) -> Self::MetricOutput {
@@ -207,6 +221,8 @@ impl PaymentMetricAccumulator for DebitRoutingAccumulator {
             Some(self.transaction_count),
             Some(self.savings_amount),
             Some(0),
+            self.signature_network,
+            self.is_issuer_regulated,
         )
     }
 }
@@ -468,8 +484,13 @@ impl PaymentMetricsAccumulator {
         ) = self.payments_distribution.collect();
         let (failure_reason_count, failure_reason_count_without_smart_retries) =
             self.failure_reasons_distribution.collect();
-        let (debit_routed_transaction_count, debit_routing_savings, debit_routing_savings_in_usd) =
-            self.debit_routing.collect();
+        let (
+            debit_routed_transaction_count,
+            debit_routing_savings,
+            debit_routing_savings_in_usd,
+            signature_network,
+            is_issuer_regulated,
+        ) = self.debit_routing.collect();
 
         PaymentMetricsBucketValue {
             payment_success_rate: self.payment_success_rate.collect(),
@@ -497,6 +518,8 @@ impl PaymentMetricsAccumulator {
             debit_routed_transaction_count,
             debit_routing_savings,
             debit_routing_savings_in_usd,
+            signature_network,
+            is_issuer_regulated,
         }
     }
 }
diff --git a/crates/analytics/src/payments/metrics.rs b/crates/analytics/src/payments/metrics.rs
index b19c661322d..914eac7116b 100644
--- a/crates/analytics/src/payments/metrics.rs
+++ b/crates/analytics/src/payments/metrics.rs
@@ -53,6 +53,8 @@ pub struct PaymentMetricRow {
     pub total: Option<bigdecimal::BigDecimal>,
     pub count: Option<i64>,
     pub routing_approach: Option<DBEnumWrapper<storage_enums::RoutingApproach>>,
+    pub signature_network: Option<String>,
+    pub is_issuer_regulated: Option<bool>,
     #[serde(with = "common_utils::custom_serde::iso8601::option")]
     pub start_bucket: Option<PrimitiveDateTime>,
     #[serde(with = "common_utils::custom_serde::iso8601::option")]
diff --git a/crates/analytics/src/payments/metrics/debit_routing.rs b/crates/analytics/src/payments/metrics/debit_routing.rs
index 2caec813ec8..309b2131c63 100644
--- a/crates/analytics/src/payments/metrics/debit_routing.rs
+++ b/crates/analytics/src/payments/metrics/debit_routing.rs
@@ -56,6 +56,14 @@ where
             })
             .switch()?;
         query_builder.add_select_column("currency").switch()?;
+
+        query_builder
+            .add_select_column("signature_network")
+            .switch()?;
+        query_builder
+            .add_select_column("is_issuer_regulated")
+            .switch()?;
+
         query_builder
             .add_select_column(Aggregate::Min {
                 field: "created_at",
@@ -85,6 +93,16 @@ where
                 .switch()?;
         }
 
+        query_builder
+            .add_group_by_clause("signature_network")
+            .attach_printable("Error grouping by signature_network")
+            .switch()?;
+
+        query_builder
+            .add_group_by_clause("is_issuer_regulated")
+            .attach_printable("Error grouping by is_issuer_regulated")
+            .switch()?;
+
         query_builder
             .add_group_by_clause("currency")
             .attach_printable("Error grouping by currency")
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index 10f039fcc72..38746ce5951 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -736,6 +736,16 @@ impl<'a> FromRow<'a, PgRow> for super::payments::metrics::PaymentMetricRow {
                 ColumnNotFound(_) => Ok(Default::default()),
                 e => Err(e),
             })?;
+        let signature_network: Option<String> =
+            row.try_get("signature_network").or_else(|e| match e {
+                ColumnNotFound(_) => Ok(Default::default()),
+                e => Err(e),
+            })?;
+        let is_issuer_regulated: Option<bool> =
+            row.try_get("is_issuer_regulated").or_else(|e| match e {
+                ColumnNotFound(_) => Ok(Default::default()),
+                e => Err(e),
+            })?;
         let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e {
             ColumnNotFound(_) => Ok(Default::default()),
             e => Err(e),
@@ -768,6 +778,8 @@ impl<'a> FromRow<'a, PgRow> for super::payments::metrics::PaymentMetricRow {
             error_reason,
             first_attempt,
             routing_approach,
+            signature_network,
+            is_issuer_regulated,
             total,
             count,
             start_bucket,
diff --git a/crates/api_models/src/analytics/payments.rs b/crates/api_models/src/analytics/payments.rs
index 193fdf26cc7..70583079930 100644
--- a/crates/api_models/src/analytics/payments.rs
+++ b/crates/api_models/src/analytics/payments.rs
@@ -319,6 +319,8 @@ pub struct PaymentMetricsBucketValue {
     pub debit_routed_transaction_count: Option<u64>,
     pub debit_routing_savings: Option<u64>,
     pub debit_routing_savings_in_usd: Option<u64>,
+    pub signature_network: Option<String>,
+    pub is_issuer_regulated: Option<bool>,
 }
 
 #[derive(Debug, serde::Serialize)]
diff --git a/crates/api_models/src/open_router.rs b/crates/api_models/src/open_router.rs
index 0365d4b6d50..c2e6bc76c06 100644
--- a/crates/api_models/src/open_router.rs
+++ b/crates/api_models/src/open_router.rs
@@ -124,6 +124,13 @@ impl CoBadgedCardNetworks {
     pub fn get_card_networks(&self) -> Vec<common_enums::CardNetwork> {
         self.0.iter().map(|info| info.network.clone()).collect()
     }
+
+    pub fn get_signature_network(&self) -> Option<common_enums::CardNetwork> {
+        self.0
+            .iter()
+            .find(|info| info.network.is_signature_network())
+            .map(|info| info.network.clone())
+    }
 }
 
 impl From<&DebitRoutingOutput> for payment_methods::CoBadgedCardData {
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index d3a502c877b..2e9478dc250 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -1229,6 +1229,8 @@ impl From<CardDetailFromLocker> for payments::AdditionalCardInfo {
             card_holder_name: item.card_holder_name,
             payment_checks: None,
             authentication_data: None,
+            is_regulated: None,
+            signature_network: None,
         }
     }
 }
@@ -1252,6 +1254,8 @@ impl From<CardDetailFromLocker> for payments::AdditionalCardInfo {
             card_holder_name: item.card_holder_name,
             payment_checks: None,
             authentication_data: None,
+            is_regulated: None,
+            signature_network: None,
         }
     }
 }
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 714ad7cb50a..d757c6cfb6f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2970,6 +2970,15 @@ pub struct AdditionalCardInfo {
     /// Details about the threeds environment.
     /// This is a free form field and the structure varies from processor to processor
     pub authentication_data: Option<serde_json::Value>,
+
+    /// Indicates if the card issuer is regulated under government-imposed interchange fee caps.
+    /// In the United States, this includes debit cards that fall under the Durbin Amendment,
+    /// which imposes capped interchange fees.
+    pub is_regulated: Option<bool>,
+
+    /// The global signature network under which the card is issued.
+    /// This represents the primary global card brand, even if the transaction uses a local network
+    pub signature_network: Option<api_enums::CardNetwork>,
 }
 
 #[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index a895f0710c4..ec8d55ed000 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2599,7 +2599,7 @@ pub enum DecisionEngineMerchantCategoryCode {
 }
 
 impl CardNetwork {
-    pub fn is_global_network(&self) -> bool {
+    pub fn is_signature_network(&self) -> bool {
         match self {
             Self::Interac
             | Self::Star
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index ceff3d161d6..a9d44566069 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -37,6 +37,8 @@ use error_stack::ResultExt;
 #[cfg(feature = "v2")]
 use masking::PeekInterface;
 use masking::Secret;
+#[cfg(feature = "v1")]
+use router_env::logger;
 #[cfg(feature = "v2")]
 use rustc_hash::FxHashMap;
 #[cfg(feature = "v1")]
@@ -1109,6 +1111,19 @@ impl PaymentAttempt {
             .and_then(|data| data.get_additional_card_info())
             .and_then(|card_info| card_info.card_network)
     }
+
+    pub fn get_payment_method_data(&self) -> Option<api_models::payments::AdditionalPaymentData> {
+        self.payment_method_data
+            .clone()
+            .and_then(|data| match data {
+                serde_json::Value::Null => None,
+                _ => Some(data.parse_value("AdditionalPaymentData")),
+            })
+            .transpose()
+            .map_err(|err| logger::error!("Failed to parse AdditionalPaymentData {err:?}"))
+            .ok()
+            .flatten()
+    }
 }
 
 #[derive(Clone, Debug, Eq, PartialEq)]
diff --git a/crates/router/src/core/debit_routing.rs b/crates/router/src/core/debit_routing.rs
index 0aeb2b9777b..34eaed42908 100644
--- a/crates/router/src/core/debit_routing.rs
+++ b/crates/router/src/core/debit_routing.rs
@@ -726,7 +726,7 @@ fn find_matching_networks(
     fee_sorted_debit_networks
         .iter()
         .filter(|network| merchant_debit_networks.contains(network))
-        .filter(|network| is_routing_enabled || network.is_global_network())
+        .filter(|network| is_routing_enabled || network.is_signature_network())
         .map(|network| {
             if network.is_us_local_network() {
                 *has_us_local_network = true;
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 8dd79f95d97..c8320bcc631 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -866,7 +866,7 @@ fn get_card_network_with_us_local_debit_network_override(
                 data.co_badged_card_networks_info
                     .0
                     .iter()
-                    .find(|info| info.network.is_global_network())
+                    .find(|info| info.network.is_signature_network())
                     .cloned()
             });
         info.map(|data| data.network)
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 87f47a9b2bb..1523a4b3c2b 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4867,19 +4867,30 @@ pub async fn get_additional_payment_data(
                     "Card cobadge check failed due to an invalid card network regex",
                 )?;
 
-            let card_network = match (
-                is_cobadged_based_on_regex,
-                card_data.co_badged_card_data.is_some(),
-            ) {
-                (false, false) => {
+            let (card_network, signature_network, is_regulated) = card_data
+                .co_badged_card_data
+                .as_ref()
+                .map(|co_badged_data| {
+                    logger::debug!("Co-badged card data found");
+
+                    (
+                        card_data.card_network.clone(),
+                        co_badged_data
+                            .co_badged_card_networks_info
+                            .get_signature_network(),
+                        Some(co_badged_data.is_regulated),
+                    )
+                })
+                .or_else(|| {
+                    is_cobadged_based_on_regex.then(|| {
+                        logger::debug!("Card network is cobadged (regex-based detection)");
+                        (card_data.card_network.clone(), None, None)
+                    })
+                })
+                .unwrap_or_else(|| {
                     logger::debug!("Card network is not cobadged");
-                    None
-                }
-                _ => {
-                    logger::debug!("Card network is cobadged");
-                    card_data.card_network.clone()
-                }
-            };
+                    (None, None, None)
+                });
 
             let last4 = Some(card_data.card_number.get_last4());
             if card_data.card_issuer.is_some()
@@ -4904,6 +4915,8 @@ pub async fn get_additional_payment_data(
                         // These are filled after calling the processor / connector
                         payment_checks: None,
                         authentication_data: None,
+                        is_regulated,
+                        signature_network: signature_network.clone(),
                     }),
                 )))
             } else {
@@ -4934,6 +4947,8 @@ pub async fn get_additional_payment_data(
                                 // These are filled after calling the processor / connector
                                 payment_checks: None,
                                 authentication_data: None,
+                                is_regulated,
+                                signature_network: signature_network.clone(),
                             },
                         ))
                     });
@@ -4954,6 +4969,8 @@ pub async fn get_additional_payment_data(
                             // These are filled after calling the processor / connector
                             payment_checks: None,
                             authentication_data: None,
+                            is_regulated,
+                            signature_network: signature_network.clone(),
                         },
                     ))
                 })))
@@ -5199,6 +5216,8 @@ pub async fn get_additional_payment_data(
                         // These are filled after calling the processor / connector
                         payment_checks: None,
                         authentication_data: None,
+                        is_regulated: None,
+                        signature_network: None,
                     }),
                 )))
             } else {
@@ -5229,6 +5248,8 @@ pub async fn get_additional_payment_data(
                                 // These are filled after calling the processor / connector
                                 payment_checks: None,
                                 authentication_data: None,
+                                is_regulated: None,
+                                signature_network: None,
                             },
                         ))
                     });
@@ -5249,6 +5270,8 @@ pub async fn get_additional_payment_data(
                             // These are filled after calling the processor / connector
                             payment_checks: None,
                             authentication_data: None,
+                            is_regulated: None,
+                            signature_network: None,
                         },
                     ))
                 })))
diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rs
index 8a900019b7c..0d8dfd8704a 100644
--- a/crates/router/src/services/kafka/payment_attempt.rs
+++ b/crates/router/src/services/kafka/payment_attempt.rs
@@ -71,11 +71,16 @@ pub struct KafkaPaymentAttempt<'a> {
     pub card_discovery: Option<String>,
     pub routing_approach: Option<storage_enums::RoutingApproach>,
     pub debit_routing_savings: Option<MinorUnit>,
+    pub signature_network: Option<common_enums::CardNetwork>,
+    pub is_issuer_regulated: Option<bool>,
 }
 
 #[cfg(feature = "v1")]
 impl<'a> KafkaPaymentAttempt<'a> {
     pub fn from_storage(attempt: &'a PaymentAttempt) -> Self {
+        let card_payment_method_data = attempt
+            .get_payment_method_data()
+            .and_then(|data| data.get_additional_card_info());
         Self {
             payment_id: &attempt.payment_id,
             merchant_id: &attempt.merchant_id,
@@ -134,6 +139,10 @@ impl<'a> KafkaPaymentAttempt<'a> {
                 .map(|discovery| discovery.to_string()),
             routing_approach: attempt.routing_approach.clone(),
             debit_routing_savings: attempt.debit_routing_savings,
+            signature_network: card_payment_method_data
+                .as_ref()
+                .and_then(|data| data.signature_network.clone()),
+            is_issuer_regulated: card_payment_method_data.and_then(|data| data.is_regulated),
         }
     }
 }
diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rs
index eea3916f803..5f87e017f85 100644
--- a/crates/router/src/services/kafka/payment_attempt_event.rs
+++ b/crates/router/src/services/kafka/payment_attempt_event.rs
@@ -72,11 +72,16 @@ pub struct KafkaPaymentAttemptEvent<'a> {
     pub card_discovery: Option<String>,
     pub routing_approach: Option<storage_enums::RoutingApproach>,
     pub debit_routing_savings: Option<MinorUnit>,
+    pub signature_network: Option<common_enums::CardNetwork>,
+    pub is_issuer_regulated: Option<bool>,
 }
 
 #[cfg(feature = "v1")]
 impl<'a> KafkaPaymentAttemptEvent<'a> {
     pub fn from_storage(attempt: &'a PaymentAttempt) -> Self {
+        let card_payment_method_data = attempt
+            .get_payment_method_data()
+            .and_then(|data| data.get_additional_card_info());
         Self {
             payment_id: &attempt.payment_id,
             merchant_id: &attempt.merchant_id,
@@ -135,6 +140,10 @@ impl<'a> KafkaPaymentAttemptEvent<'a> {
                 .map(|discovery| discovery.to_string()),
             routing_approach: attempt.routing_approach.clone(),
             debit_routing_savings: attempt.debit_routing_savings,
+            signature_network: card_payment_method_data
+                .as_ref()
+                .and_then(|data| data.signature_network.clone()),
+            is_issuer_regulated: card_payment_method_data.and_then(|data| data.is_regulated),
         }
     }
 }
 | 
	2025-08-11T07:13:40Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pull request enhances how co-badged card information is handled, especially around identifying and propagating the card's "signature network" and whether the card issuer is regulated. 
* Extended the `AdditionalCardInfo` struct to include new fields: `is_regulated` (indicates if the issuer is regulated under interchange fee caps) and `signature_network` (the card's primary global brand).
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Enable debit routing for a profile
-> Create adyen connector and enable local debit networks
-> Make a card payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-feature: router-custom' \
--header 'x-tenant-id: hyperswitch' \
--header 'api-key: dev_5sRc7V4OXL2Qk52mr4qp5JLcgLPu3TlNOZ8M31eALWZcuOFaXhZX4FAZVT8VKgbX' \
--data-raw '{
    "amount": 1000000,
    "amount_to_capture": 1000000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "setup_future_usage": "on_session",
    "capture_on": "2022-09-10T10:11:12Z",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "customer_id": "cu_1754896317",
    "return_url": "http://127.0.0.1:4040",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4400 0020 0000 0004",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "email": "raj@gmail.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```
{
    "payment_id": "pay_C6Da6MjduSo3GYZD5Rv4",
    "merchant_id": "merchant_1754887772",
    "status": "processing",
    "amount": 1000000,
    "net_amount": 1000000,
    "shipping_cost": null,
    "amount_capturable": 1000000,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_C6Da6MjduSo3GYZD5Rv4_secret_OnariiuxjA1PeO2GOpKW",
    "created": "2025-08-11T04:51:47.628Z",
    "currency": "USD",
    "customer_id": "cu_1754887908",
    "customer": {
        "id": "cu_1754887908",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0004",
            "card_type": null,
            "card_network": "Accel",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "440000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss",
            "origin_zip": null
        },
        "phone": null,
        "email": "raj@gmail.com"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": "905_1",
    "error_message": "Could not find an acquirer account for the provided txvariant (accel), currency (USD), and action (AUTH).",
    "unified_code": "UE_9000",
    "unified_message": "Something went wrong",
    "payment_experience": null,
    "payment_method_type": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1754887908",
        "created_at": 1754887907,
        "expires": 1754891507,
        "secret": "epk_779c3dcfdc894107918575b408446962"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "SCTLC5JVNSRZ5TT5",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_UsCIuOTX3On1bJUP7Dw3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HWuMPavh4o8pMXXypjKT",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-11T05:06:47.628Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-11T04:51:48.673Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payment attempt db storage
<img width="2206" height="891" alt="image" src="https://github.com/user-attachments/assets/d6cbb348-2f49-4603-b10a-a684df003232" />
-> Payment metric
```
curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWQxMGYxOGUtZjMzNy00NDU5LWFhNTEtOTE3YWRiYTlmYWJiIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1MDA1MTY4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NTE3Nzk4Miwib3JnX2lkIjoib3JnX2NmYTlEaTJwdEN2YjFHU05jOXN1IiwicHJvZmlsZV9pZCI6InByb19NYTRrVzJjOFpobDJEeUFBQVZrTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lP65o0BdE7w9La48HPn2MasV9MZaAaBp_WWI7A7iUdU' \
--data '[
    {
        "timeRange": {
            "startTime": "2025-08-01T18:30:00Z",
            "endTime": "2025-09-30T09:22:00Z"
        },
        "groupByNames": [
            "card_network"
        ],
        
        
        "filters": {
          "routing_approach": [
            "debit_routing"
          ]
        },
        "source": "BATCH",
        "metrics": [
            "debit_routing"
        ],
        
        
        
        "delta": true
    }
]'
```
```
{
    "queryData": [
        {
            "payment_success_rate": null,
            "payment_count": null,
            "payment_success_count": null,
            "payment_processed_amount": 0,
            "payment_processed_amount_in_usd": null,
            "payment_processed_count": null,
            "payment_processed_amount_without_smart_retries": 0,
            "payment_processed_amount_without_smart_retries_usd": null,
            "payment_processed_count_without_smart_retries": null,
            "avg_ticket_size": null,
            "payment_error_message": null,
            "retries_count": null,
            "retries_amount_processed": 0,
            "connector_success_rate": null,
            "payments_success_rate_distribution": null,
            "payments_success_rate_distribution_without_smart_retries": null,
            "payments_success_rate_distribution_with_only_retries": null,
            "payments_failure_rate_distribution": null,
            "payments_failure_rate_distribution_without_smart_retries": null,
            "payments_failure_rate_distribution_with_only_retries": null,
            "failure_reason_count": 0,
            "failure_reason_count_without_smart_retries": 0,
            "debit_routed_transaction_count": 1,
            "debit_routing_savings": 0,
            "debit_routing_savings_in_usd": null,
            "signature_network": "Visa",
            "is_issuer_regulated": true,
            "currency": "USD",
            "status": null,
            "connector": null,
            "authentication_type": null,
            "payment_method": null,
            "payment_method_type": null,
            "client_source": null,
            "client_version": null,
            "profile_id": null,
            "card_network": "Accel",
            "merchant_id": null,
            "card_last_4": null,
            "card_issuer": null,
            "error_reason": null,
            "routing_approach": null,
            "time_range": {
                "start_time": "2025-08-01T18:30:00.000Z",
                "end_time": "2025-09-30T09:22:00.000Z"
            },
            "time_bucket": "2025-08-01 18:30:00"
        },
        {
            "payment_success_rate": null,
            "payment_count": null,
            "payment_success_count": null,
            "payment_processed_amount": 0,
            "payment_processed_amount_in_usd": null,
            "payment_processed_count": null,
            "payment_processed_amount_without_smart_retries": 0,
            "payment_processed_amount_without_smart_retries_usd": null,
            "payment_processed_count_without_smart_retries": null,
            "avg_ticket_size": null,
            "payment_error_message": null,
            "retries_count": null,
            "retries_amount_processed": 0,
            "connector_success_rate": null,
            "payments_success_rate_distribution": null,
            "payments_success_rate_distribution_without_smart_retries": null,
            "payments_success_rate_distribution_with_only_retries": null,
            "payments_failure_rate_distribution": null,
            "payments_failure_rate_distribution_without_smart_retries": null,
            "payments_failure_rate_distribution_with_only_retries": null,
            "failure_reason_count": 0,
            "failure_reason_count_without_smart_retries": 0,
            "debit_routed_transaction_count": 4,
            "debit_routing_savings": 0,
            "debit_routing_savings_in_usd": null,
            "signature_network": "Visa",
            "is_issuer_regulated": true,
            "currency": "USD",
            "status": null,
            "connector": null,
            "authentication_type": null,
            "payment_method": null,
            "payment_method_type": null,
            "client_source": null,
            "client_version": null,
            "profile_id": null,
            "card_network": "Star",
            "merchant_id": null,
            "card_last_4": null,
            "card_issuer": null,
            "error_reason": null,
            "routing_approach": null,
            "time_range": {
                "start_time": "2025-08-01T18:30:00.000Z",
                "end_time": "2025-09-30T09:22:00.000Z"
            },
            "time_bucket": "2025-08-01 18:30:00"
        }
    ],
    "metaData": [
        {
            "total_payment_processed_amount": 0,
            "total_payment_processed_amount_in_usd": null,
            "total_payment_processed_amount_without_smart_retries": 0,
            "total_payment_processed_amount_without_smart_retries_usd": null,
            "total_payment_processed_count": 0,
            "total_payment_processed_count_without_smart_retries": 0,
            "total_failure_reasons_count": 0,
            "total_failure_reasons_count_without_smart_retries": 0
        }
    ]
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	5a09d7ec2ab66d901e29492521e63cc6a01281de | 
	
-> Enable debit routing for a profile
-> Create adyen connector and enable local debit networks
-> Make a card payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-feature: router-custom' \
--header 'x-tenant-id: hyperswitch' \
--header 'api-key: dev_5sRc7V4OXL2Qk52mr4qp5JLcgLPu3TlNOZ8M31eALWZcuOFaXhZX4FAZVT8VKgbX' \
--data-raw '{
    "amount": 1000000,
    "amount_to_capture": 1000000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "setup_future_usage": "on_session",
    "capture_on": "2022-09-10T10:11:12Z",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "customer_id": "cu_1754896317",
    "return_url": "http://127.0.0.1:4040",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4400 0020 0000 0004",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "email": "raj@gmail.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```
{
    "payment_id": "pay_C6Da6MjduSo3GYZD5Rv4",
    "merchant_id": "merchant_1754887772",
    "status": "processing",
    "amount": 1000000,
    "net_amount": 1000000,
    "shipping_cost": null,
    "amount_capturable": 1000000,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_C6Da6MjduSo3GYZD5Rv4_secret_OnariiuxjA1PeO2GOpKW",
    "created": "2025-08-11T04:51:47.628Z",
    "currency": "USD",
    "customer_id": "cu_1754887908",
    "customer": {
        "id": "cu_1754887908",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0004",
            "card_type": null,
            "card_network": "Accel",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "440000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss",
            "origin_zip": null
        },
        "phone": null,
        "email": "raj@gmail.com"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": "905_1",
    "error_message": "Could not find an acquirer account for the provided txvariant (accel), currency (USD), and action (AUTH).",
    "unified_code": "UE_9000",
    "unified_message": "Something went wrong",
    "payment_experience": null,
    "payment_method_type": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1754887908",
        "created_at": 1754887907,
        "expires": 1754891507,
        "secret": "epk_779c3dcfdc894107918575b408446962"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "SCTLC5JVNSRZ5TT5",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_UsCIuOTX3On1bJUP7Dw3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HWuMPavh4o8pMXXypjKT",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-11T05:06:47.628Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-11T04:51:48.673Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
Payment attempt db storage
<img width="2206" height="891" alt="image" src="https://github.com/user-attachments/assets/d6cbb348-2f49-4603-b10a-a684df003232" />
-> Payment metric
```
curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMWQxMGYxOGUtZjMzNy00NDU5LWFhNTEtOTE3YWRiYTlmYWJiIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1MDA1MTY4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NTE3Nzk4Miwib3JnX2lkIjoib3JnX2NmYTlEaTJwdEN2YjFHU05jOXN1IiwicHJvZmlsZV9pZCI6InByb19NYTRrVzJjOFpobDJEeUFBQVZrTyIsInRlbmFudF9pZCI6InB1YmxpYyJ9.lP65o0BdE7w9La48HPn2MasV9MZaAaBp_WWI7A7iUdU' \
--data '[
    {
        "timeRange": {
            "startTime": "2025-08-01T18:30:00Z",
            "endTime": "2025-09-30T09:22:00Z"
        },
        "groupByNames": [
            "card_network"
        ],
        
        
        "filters": {
          "routing_approach": [
            "debit_routing"
          ]
        },
        "source": "BATCH",
        "metrics": [
            "debit_routing"
        ],
        
        
        
        "delta": true
    }
]'
```
```
{
    "queryData": [
        {
            "payment_success_rate": null,
            "payment_count": null,
            "payment_success_count": null,
            "payment_processed_amount": 0,
            "payment_processed_amount_in_usd": null,
            "payment_processed_count": null,
            "payment_processed_amount_without_smart_retries": 0,
            "payment_processed_amount_without_smart_retries_usd": null,
            "payment_processed_count_without_smart_retries": null,
            "avg_ticket_size": null,
            "payment_error_message": null,
            "retries_count": null,
            "retries_amount_processed": 0,
            "connector_success_rate": null,
            "payments_success_rate_distribution": null,
            "payments_success_rate_distribution_without_smart_retries": null,
            "payments_success_rate_distribution_with_only_retries": null,
            "payments_failure_rate_distribution": null,
            "payments_failure_rate_distribution_without_smart_retries": null,
            "payments_failure_rate_distribution_with_only_retries": null,
            "failure_reason_count": 0,
            "failure_reason_count_without_smart_retries": 0,
            "debit_routed_transaction_count": 1,
            "debit_routing_savings": 0,
            "debit_routing_savings_in_usd": null,
            "signature_network": "Visa",
            "is_issuer_regulated": true,
            "currency": "USD",
            "status": null,
            "connector": null,
            "authentication_type": null,
            "payment_method": null,
            "payment_method_type": null,
            "client_source": null,
            "client_version": null,
            "profile_id": null,
            "card_network": "Accel",
            "merchant_id": null,
            "card_last_4": null,
            "card_issuer": null,
            "error_reason": null,
            "routing_approach": null,
            "time_range": {
                "start_time": "2025-08-01T18:30:00.000Z",
                "end_time": "2025-09-30T09:22:00.000Z"
            },
            "time_bucket": "2025-08-01 18:30:00"
        },
        {
            "payment_success_rate": null,
            "payment_count": null,
            "payment_success_count": null,
            "payment_processed_amount": 0,
            "payment_processed_amount_in_usd": null,
            "payment_processed_count": null,
            "payment_processed_amount_without_smart_retries": 0,
            "payment_processed_amount_without_smart_retries_usd": null,
            "payment_processed_count_without_smart_retries": null,
            "avg_ticket_size": null,
            "payment_error_message": null,
            "retries_count": null,
            "retries_amount_processed": 0,
            "connector_success_rate": null,
            "payments_success_rate_distribution": null,
            "payments_success_rate_distribution_without_smart_retries": null,
            "payments_success_rate_distribution_with_only_retries": null,
            "payments_failure_rate_distribution": null,
            "payments_failure_rate_distribution_without_smart_retries": null,
            "payments_failure_rate_distribution_with_only_retries": null,
            "failure_reason_count": 0,
            "failure_reason_count_without_smart_retries": 0,
            "debit_routed_transaction_count": 4,
            "debit_routing_savings": 0,
            "debit_routing_savings_in_usd": null,
            "signature_network": "Visa",
            "is_issuer_regulated": true,
            "currency": "USD",
            "status": null,
            "connector": null,
            "authentication_type": null,
            "payment_method": null,
            "payment_method_type": null,
            "client_source": null,
            "client_version": null,
            "profile_id": null,
            "card_network": "Star",
            "merchant_id": null,
            "card_last_4": null,
            "card_issuer": null,
            "error_reason": null,
            "routing_approach": null,
            "time_range": {
                "start_time": "2025-08-01T18:30:00.000Z",
                "end_time": "2025-09-30T09:22:00.000Z"
            },
            "time_bucket": "2025-08-01 18:30:00"
        }
    ],
    "metaData": [
        {
            "total_payment_processed_amount": 0,
            "total_payment_processed_amount_in_usd": null,
            "total_payment_processed_amount_without_smart_retries": 0,
            "total_payment_processed_amount_without_smart_retries_usd": null,
            "total_payment_processed_count": 0,
            "total_payment_processed_count_without_smart_retries": 0,
            "total_failure_reasons_count": 0,
            "total_failure_reasons_count_without_smart_retries": 0
        }
    ]
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8880 | 
	Bug: [FEATURE]: Add support for Webhooks through UCS
### Feature Description
the Webhooks should go to Unified connector service and should be handled there
### Possible Implementation
add webhook integration in hyperswitch
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 8db71c930f3..4f6313ea31a 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -9,7 +9,8 @@ use tonic::{
 };
 use unified_connector_service_client::payments::{
     self as payments_grpc, payment_service_client::PaymentServiceClient,
-    PaymentServiceAuthorizeResponse,
+    PaymentServiceAuthorizeResponse, PaymentServiceTransformRequest,
+    PaymentServiceTransformResponse,
 };
 
 use crate::{
@@ -96,6 +97,10 @@ pub enum UnifiedConnectorServiceError {
     /// Failed to perform Payment Repeat Payment from gRPC Server
     #[error("Failed to perform Repeat Payment from gRPC Server")]
     PaymentRepeatEverythingFailure,
+
+    /// Failed to transform incoming webhook from gRPC Server
+    #[error("Failed to transform incoming webhook from gRPC Server")]
+    WebhookTransformFailure,
 }
 
 /// Result type for Dynamic Routing
@@ -194,6 +199,7 @@ impl UnifiedConnectorServiceClient {
     ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceAuthorizeResponse>> {
         let mut request = tonic::Request::new(payment_authorize_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -203,7 +209,14 @@ impl UnifiedConnectorServiceClient {
             .authorize(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentAuthorizeFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_authorize",
+                    connector_name=?connector_name,
+                    "UCS payment authorize gRPC call failed"
+                )
+            })
     }
 
     /// Performs Payment Sync/Get
@@ -216,6 +229,7 @@ impl UnifiedConnectorServiceClient {
     {
         let mut request = tonic::Request::new(payment_get_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -225,7 +239,14 @@ impl UnifiedConnectorServiceClient {
             .get(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentGetFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_get",
+                    connector_name=?connector_name,
+                    "UCS payment get/sync gRPC call failed"
+                )
+            })
     }
 
     /// Performs Payment Setup Mandate
@@ -238,6 +259,7 @@ impl UnifiedConnectorServiceClient {
     {
         let mut request = tonic::Request::new(payment_register_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -247,7 +269,14 @@ impl UnifiedConnectorServiceClient {
             .register(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentRegisterFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_setup_mandate",
+                    connector_name=?connector_name,
+                    "UCS payment setup mandate gRPC call failed"
+                )
+            })
     }
 
     /// Performs Payment repeat (MIT - Merchant Initiated Transaction).
@@ -261,6 +290,7 @@ impl UnifiedConnectorServiceClient {
     > {
         let mut request = tonic::Request::new(payment_repeat_request);
 
+        let connector_name = connector_auth_metadata.connector_name.clone();
         let metadata =
             build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
         *request.metadata_mut() = metadata;
@@ -270,7 +300,43 @@ impl UnifiedConnectorServiceClient {
             .repeat_everything(request)
             .await
             .change_context(UnifiedConnectorServiceError::PaymentRepeatEverythingFailure)
-            .inspect_err(|error| logger::error!(?error))
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="payment_repeat",
+                    connector_name=?connector_name,
+                    "UCS payment repeat gRPC call failed"
+                )
+            })
+    }
+
+    /// Transforms incoming webhook through UCS
+    pub async fn transform_incoming_webhook(
+        &self,
+        webhook_transform_request: PaymentServiceTransformRequest,
+        connector_auth_metadata: ConnectorAuthMetadata,
+        grpc_headers: GrpcHeaders,
+    ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceTransformResponse>> {
+        let mut request = tonic::Request::new(webhook_transform_request);
+
+        let connector_name = connector_auth_metadata.connector_name.clone();
+        let metadata =
+            build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
+        *request.metadata_mut() = metadata;
+
+        self.client
+            .clone()
+            .transform(request)
+            .await
+            .change_context(UnifiedConnectorServiceError::WebhookTransformFailure)
+            .inspect_err(|error| {
+                logger::error!(
+                    grpc_error=?error,
+                    method="transform_incoming_webhook",
+                    connector_name=?connector_name,
+                    "UCS webhook transform gRPC call failed"
+                )
+            })
     }
 }
 
@@ -318,17 +384,18 @@ pub fn build_unified_connector_service_grpc_headers(
         parse(common_utils_consts::X_MERCHANT_ID, meta.merchant_id.peek())?,
     );
 
-    grpc_headers.tenant_id
-            .parse()
-            .map(|tenant_id| {
-                metadata.append(
-                    common_utils_consts::TENANT_HEADER,
-                    tenant_id)
-            })
-            .inspect_err(
-                |err| logger::warn!(header_parse_error=?err,"invalid {} received",common_utils_consts::TENANT_HEADER),
-            )
-            .ok();
+    if let Err(err) = grpc_headers
+        .tenant_id
+        .parse()
+        .map(|tenant_id| metadata.append(common_utils_consts::TENANT_HEADER, tenant_id))
+    {
+        logger::error!(
+            header_parse_error=?err,
+            tenant_id=?grpc_headers.tenant_id,
+            "Failed to parse tenant_id header for UCS gRPC request: {}",
+            common_utils_consts::TENANT_HEADER
+        );
+    }
 
     Ok(metadata)
 }
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index a6be59c8114..87f47a9b2bb 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4188,6 +4188,15 @@ impl MerchantConnectorAccountType {
             Self::CacheVal(_) => None,
         }
     }
+
+    pub fn get_webhook_details(
+        &self,
+    ) -> CustomResult<Option<&masking::Secret<serde_json::Value>>, errors::ApiErrorResponse> {
+        match self {
+            Self::DbVal(db_val) => Ok(db_val.connector_webhook_details.as_ref()),
+            Self::CacheVal(_) => Ok(None),
+        }
+    }
 }
 
 /// Query for merchant connector account either by business label or profile id
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 107b6e7e7a2..4e32095dea7 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1,3 +1,4 @@
+use api_models::admin;
 use common_enums::{AttemptStatus, PaymentMethodType};
 use common_utils::{errors::CustomResult, ext_traits::ValueExt};
 use error_stack::ResultExt;
@@ -13,6 +14,7 @@ use hyperswitch_domain_models::{
     router_response_types::PaymentsResponseData,
 };
 use masking::{ExposeInterface, PeekInterface, Secret};
+use router_env::logger;
 use unified_connector_service_client::payments::{
     self as payments_grpc, payment_method::PaymentMethod, CardDetails, CardPaymentMethodType,
     PaymentServiceAuthorizeResponse,
@@ -21,7 +23,7 @@ use unified_connector_service_client::payments::{
 use crate::{
     consts,
     core::{
-        errors::RouterResult,
+        errors::{ApiErrorResponse, RouterResult},
         payments::helpers::{
             is_ucs_enabled, should_execute_based_on_rollout, MerchantConnectorAccountType,
         },
@@ -29,9 +31,13 @@ use crate::{
     },
     routes::SessionState,
     types::transformers::ForeignTryFrom,
+    utils,
 };
 
-mod transformers;
+pub mod transformers;
+
+// Re-export webhook transformer types for easier access
+pub use transformers::WebhookTransformData;
 
 pub async fn should_call_unified_connector_service<F: Clone, T>(
     state: &SessionState,
@@ -80,6 +86,42 @@ pub async fn should_call_unified_connector_service<F: Clone, T>(
     Ok(should_execute)
 }
 
+pub async fn should_call_unified_connector_service_for_webhooks(
+    state: &SessionState,
+    merchant_context: &MerchantContext,
+    connector_name: &str,
+) -> RouterResult<bool> {
+    if state.grpc_client.unified_connector_service_client.is_none() {
+        logger::debug!(
+            connector = connector_name.to_string(),
+            "Unified Connector Service client is not available for webhooks"
+        );
+        return Ok(false);
+    }
+
+    let ucs_config_key = consts::UCS_ENABLED;
+
+    if !is_ucs_enabled(state, ucs_config_key).await {
+        return Ok(false);
+    }
+
+    let merchant_id = merchant_context
+        .get_merchant_account()
+        .get_id()
+        .get_string_repr();
+
+    let config_key = format!(
+        "{}_{}_{}_Webhooks",
+        consts::UCS_ROLLOUT_PERCENT_CONFIG_PREFIX,
+        merchant_id,
+        connector_name
+    );
+
+    let should_execute = should_execute_based_on_rollout(state, &config_key).await?;
+
+    Ok(should_execute)
+}
+
 pub fn build_unified_connector_service_payment_method(
     payment_method_data: hyperswitch_domain_models::payment_method_data::PaymentMethodData,
     payment_method_type: PaymentMethodType,
@@ -317,3 +359,161 @@ pub fn handle_unified_connector_service_response_for_payment_repeat(
 
     Ok((status, router_data_response, status_code))
 }
+
+pub fn build_webhook_secrets_from_merchant_connector_account(
+    #[cfg(feature = "v1")] merchant_connector_account: &MerchantConnectorAccountType,
+    #[cfg(feature = "v2")] merchant_connector_account: &MerchantConnectorAccountTypeDetails,
+) -> CustomResult<Option<payments_grpc::WebhookSecrets>, UnifiedConnectorServiceError> {
+    // Extract webhook credentials from merchant connector account
+    // This depends on how webhook secrets are stored in the merchant connector account
+
+    #[cfg(feature = "v1")]
+    let webhook_details = merchant_connector_account
+        .get_webhook_details()
+        .map_err(|_| UnifiedConnectorServiceError::FailedToObtainAuthType)?;
+
+    #[cfg(feature = "v2")]
+    let webhook_details = match merchant_connector_account {
+        MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(mca) => {
+            mca.connector_webhook_details.as_ref()
+        }
+        MerchantConnectorAccountTypeDetails::MerchantConnectorDetails(_) => None,
+    };
+
+    match webhook_details {
+        Some(details) => {
+            // Parse the webhook details JSON to extract secrets
+            let webhook_details: admin::MerchantConnectorWebhookDetails = details
+                .clone()
+                .parse_value("MerchantConnectorWebhookDetails")
+                .change_context(UnifiedConnectorServiceError::FailedToObtainAuthType)
+                .attach_printable("Failed to parse MerchantConnectorWebhookDetails")?;
+
+            // Build gRPC WebhookSecrets from parsed details
+            Ok(Some(payments_grpc::WebhookSecrets {
+                secret: webhook_details.merchant_secret.expose().to_string(),
+                additional_secret: webhook_details
+                    .additional_secret
+                    .map(|secret| secret.expose().to_string()),
+            }))
+        }
+        None => Ok(None),
+    }
+}
+
+/// High-level abstraction for calling UCS webhook transformation
+/// This provides a clean interface similar to payment flow UCS calls
+pub async fn call_unified_connector_service_for_webhook(
+    state: &SessionState,
+    merchant_context: &MerchantContext,
+    connector_name: &str,
+    body: &actix_web::web::Bytes,
+    request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+    merchant_connector_account: Option<
+        &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
+    >,
+) -> RouterResult<(
+    api_models::webhooks::IncomingWebhookEvent,
+    bool,
+    WebhookTransformData,
+)> {
+    let ucs_client = state
+        .grpc_client
+        .unified_connector_service_client
+        .as_ref()
+        .ok_or_else(|| {
+            error_stack::report!(ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable("UCS client is not available for webhook processing")
+        })?;
+
+    // Build webhook secrets from merchant connector account
+    let webhook_secrets = merchant_connector_account.and_then(|mca| {
+        #[cfg(feature = "v1")]
+        let mca_type = MerchantConnectorAccountType::DbVal(Box::new(mca.clone()));
+        #[cfg(feature = "v2")]
+        let mca_type =
+            MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(mca.clone()));
+
+        build_webhook_secrets_from_merchant_connector_account(&mca_type)
+            .map_err(|e| {
+                logger::warn!(
+                    build_error=?e,
+                    connector_name=connector_name,
+                    "Failed to build webhook secrets from merchant connector account in call_unified_connector_service_for_webhook"
+                );
+                e
+            })
+            .ok()
+            .flatten()
+    });
+
+    // Build UCS transform request using new webhook transformers
+    let transform_request = transformers::build_webhook_transform_request(
+        body,
+        request_details,
+        webhook_secrets,
+        merchant_context
+            .get_merchant_account()
+            .get_id()
+            .get_string_repr(),
+        connector_name,
+    )?;
+
+    // Build connector auth metadata
+    let connector_auth_metadata = merchant_connector_account
+        .map(|mca| {
+            #[cfg(feature = "v1")]
+            let mca_type = MerchantConnectorAccountType::DbVal(Box::new(mca.clone()));
+            #[cfg(feature = "v2")]
+            let mca_type = MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
+                mca.clone(),
+            ));
+
+            build_unified_connector_service_auth_metadata(mca_type, merchant_context)
+        })
+        .transpose()
+        .change_context(ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed to build UCS auth metadata")?
+        .ok_or_else(|| {
+            error_stack::report!(ApiErrorResponse::InternalServerError).attach_printable(
+                "Missing merchant connector account for UCS webhook transformation",
+            )
+        })?;
+
+    // Build gRPC headers
+    let grpc_headers = external_services::grpc_client::GrpcHeaders {
+        tenant_id: state.tenant.tenant_id.get_string_repr().to_string(),
+        request_id: Some(utils::generate_id(consts::ID_LENGTH, "webhook_req")),
+    };
+
+    // Make UCS call - client availability already verified
+    match ucs_client
+        .transform_incoming_webhook(transform_request, connector_auth_metadata, grpc_headers)
+        .await
+    {
+        Ok(response) => {
+            let transform_response = response.into_inner();
+            let transform_data = transformers::transform_ucs_webhook_response(transform_response)?;
+
+            // UCS handles everything internally - event type, source verification, decoding
+            Ok((
+                transform_data.event_type,
+                transform_data.source_verified,
+                transform_data,
+            ))
+        }
+        Err(err) => {
+            // When UCS is configured, we don't fall back to direct connector processing
+            Err(ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable(format!("UCS webhook processing failed: {err}"))
+        }
+    }
+}
+
+/// Extract webhook content from UCS response for further processing
+/// This provides a helper function to extract specific data from UCS responses
+pub fn extract_webhook_content_from_ucs_response(
+    transform_data: &WebhookTransformData,
+) -> Option<&unified_connector_service_client::payments::WebhookResponseContent> {
+    transform_data.webhook_content.as_ref()
+}
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index 9f8ad6c128e..a6559abc2d4 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -17,11 +17,14 @@ use hyperswitch_domain_models::{
 };
 use masking::{ExposeInterface, PeekInterface};
 use router_env::tracing;
-use unified_connector_service_client::payments::{self as payments_grpc, Identifier};
+use unified_connector_service_client::payments::{
+    self as payments_grpc, Identifier, PaymentServiceTransformRequest,
+    PaymentServiceTransformResponse,
+};
 use url::Url;
 
 use crate::{
-    core::unified_connector_service::build_unified_connector_service_payment_method,
+    core::{errors, unified_connector_service::build_unified_connector_service_payment_method},
     types::transformers::ForeignTryFrom,
 };
 impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>
@@ -39,6 +42,13 @@ impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>
             .map(|id| Identifier {
                 id_type: Some(payments_grpc::identifier::IdType::Id(id)),
             })
+            .map_err(|e| {
+                tracing::debug!(
+                    transaction_id_error=?e,
+                    "Failed to extract connector transaction ID for UCS payment sync request"
+                );
+                e
+            })
             .ok();
 
         let connector_ref_id = router_data
@@ -670,6 +680,7 @@ impl ForeignTryFrom<common_enums::CardNetwork> for payments_grpc::CardNetwork {
             common_enums::CardNetwork::UnionPay => Ok(Self::Unionpay),
             common_enums::CardNetwork::RuPay => Ok(Self::Rupay),
             common_enums::CardNetwork::Maestro => Ok(Self::Maestro),
+            common_enums::CardNetwork::AmericanExpress => Ok(Self::Amex),
             _ => Err(
                 UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
                     "Card Network not supported".to_string(),
@@ -1003,6 +1014,113 @@ impl ForeignTryFrom<common_types::payments::CustomerAcceptance>
     }
 }
 
+impl ForeignTryFrom<&hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>>
+    for payments_grpc::RequestDetails
+{
+    type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+    fn foreign_try_from(
+        request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+    ) -> Result<Self, Self::Error> {
+        let headers_map = request_details
+            .headers
+            .iter()
+            .map(|(key, value)| {
+                let value_string = value.to_str().unwrap_or_default().to_string();
+                (key.as_str().to_string(), value_string)
+            })
+            .collect();
+
+        Ok(Self {
+            method: 1, // POST method for webhooks
+            uri: Some({
+                let uri_result = request_details
+                    .headers
+                    .get("x-forwarded-path")
+                    .and_then(|h| h.to_str().map_err(|e| {
+                        tracing::warn!(
+                            header_conversion_error=?e,
+                            header_value=?h,
+                            "Failed to convert x-forwarded-path header to string for webhook processing"
+                        );
+                        e
+                    }).ok());
+
+                uri_result.unwrap_or_else(|| {
+                    tracing::debug!("x-forwarded-path header not found or invalid, using default '/Unknown'");
+                    "/Unknown"
+                }).to_string()
+            }),
+            body: request_details.body.to_vec(),
+            headers: headers_map,
+            query_params: Some(request_details.query_params.clone()),
+        })
+    }
+}
+
+/// Webhook transform data structure containing UCS response information
+pub struct WebhookTransformData {
+    pub event_type: api_models::webhooks::IncomingWebhookEvent,
+    pub source_verified: bool,
+    pub webhook_content: Option<payments_grpc::WebhookResponseContent>,
+    pub response_ref_id: Option<String>,
+}
+
+/// Transform UCS webhook response into webhook event data
+pub fn transform_ucs_webhook_response(
+    response: PaymentServiceTransformResponse,
+) -> Result<WebhookTransformData, error_stack::Report<errors::ApiErrorResponse>> {
+    let event_type = match response.event_type {
+        0 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess,
+        1 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentFailure,
+        2 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentProcessing,
+        3 => api_models::webhooks::IncomingWebhookEvent::PaymentIntentCancelled,
+        4 => api_models::webhooks::IncomingWebhookEvent::RefundSuccess,
+        5 => api_models::webhooks::IncomingWebhookEvent::RefundFailure,
+        6 => api_models::webhooks::IncomingWebhookEvent::MandateRevoked,
+        _ => api_models::webhooks::IncomingWebhookEvent::EventNotSupported,
+    };
+
+    Ok(WebhookTransformData {
+        event_type,
+        source_verified: response.source_verified,
+        webhook_content: response.content,
+        response_ref_id: response.response_ref_id.and_then(|identifier| {
+            identifier.id_type.and_then(|id_type| match id_type {
+                payments_grpc::identifier::IdType::Id(id) => Some(id),
+                payments_grpc::identifier::IdType::EncodedData(encoded_data) => Some(encoded_data),
+                payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
+            })
+        }),
+    })
+}
+
+/// Build UCS webhook transform request from webhook components
+pub fn build_webhook_transform_request(
+    _webhook_body: &[u8],
+    request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+    webhook_secrets: Option<payments_grpc::WebhookSecrets>,
+    merchant_id: &str,
+    connector_id: &str,
+) -> Result<PaymentServiceTransformRequest, error_stack::Report<errors::ApiErrorResponse>> {
+    let request_details_grpc = payments_grpc::RequestDetails::foreign_try_from(request_details)
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed to transform webhook request details to gRPC format")?;
+
+    Ok(PaymentServiceTransformRequest {
+        request_ref_id: Some(Identifier {
+            id_type: Some(payments_grpc::identifier::IdType::Id(format!(
+                "{}_{}_{}",
+                merchant_id,
+                connector_id,
+                time::OffsetDateTime::now_utc().unix_timestamp()
+            ))),
+        }),
+        request_details: Some(request_details_grpc),
+        webhook_secrets,
+    })
+}
+
 pub fn convert_connector_service_status_code(
     status_code: u32,
 ) -> Result<u16, error_stack::Report<UnifiedConnectorServiceError>> {
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index fae94ceb11a..29a6c6c8e26 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -30,7 +30,7 @@ use crate::{
         errors::{self, ConnectorErrorExt, CustomResult, RouterResponse, StorageErrorExt},
         metrics, payment_methods,
         payments::{self, tokenization},
-        refunds, relay, utils as core_utils,
+        refunds, relay, unified_connector_service, utils as core_utils,
         webhooks::{network_tokenization_incoming, utils::construct_webhook_router_data},
     },
     db::StorageInterface,
@@ -202,8 +202,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
     WebhookResponseTracker,
     serde_json::Value,
 )> {
-    let key_manager_state = &(&state).into();
-
+    // Initial setup and metrics
     metrics::WEBHOOK_INCOMING_COUNT.add(
         1,
         router_env::metric_attributes!((
@@ -211,7 +210,8 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
             merchant_context.get_merchant_account().get_id().clone()
         )),
     );
-    let mut request_details = IncomingWebhookRequestDetails {
+
+    let request_details = IncomingWebhookRequestDetails {
         method: req.method().clone(),
         uri: req.uri().clone(),
         headers: req.headers(),
@@ -220,31 +220,211 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
     };
 
     // Fetch the merchant connector account to get the webhooks source secret
-    // `webhooks source secret` is a secret shared between the merchant and connector
-    // This is used for source verification and webhooks integrity
     let (merchant_connector_account, connector, connector_name) =
         fetch_optional_mca_and_connector(&state, &merchant_context, connector_name_or_mca_id)
             .await?;
 
-    let decoded_body = connector
-        .decode_webhook_body(
-            &request_details,
-            merchant_context.get_merchant_account().get_id(),
-            merchant_connector_account
-                .clone()
-                .and_then(|merchant_connector_account| {
-                    merchant_connector_account.connector_webhook_details
-                }),
-            connector_name.as_str(),
+    // Determine webhook processing path (UCS vs non-UCS) and handle event type extraction
+    let webhook_processing_result =
+        if unified_connector_service::should_call_unified_connector_service_for_webhooks(
+            &state,
+            &merchant_context,
+            &connector_name,
         )
-        .await
+        .await?
+        {
+            logger::info!(
+                connector = connector_name,
+                "Using Unified Connector Service for webhook processing",
+            );
+            process_ucs_webhook_transform(
+                &state,
+                &merchant_context,
+                &connector_name,
+                &body,
+                &request_details,
+                merchant_connector_account.as_ref(),
+            )
+            .await?
+        } else {
+            // NON-UCS PATH: Need to decode body first
+            let decoded_body = connector
+                .decode_webhook_body(
+                    &request_details,
+                    merchant_context.get_merchant_account().get_id(),
+                    merchant_connector_account
+                        .and_then(|mca| mca.connector_webhook_details.clone()),
+                    &connector_name,
+                )
+                .await
+                .switch()
+                .attach_printable("There was an error in incoming webhook body decoding")?;
+
+            process_non_ucs_webhook(
+                &state,
+                &merchant_context,
+                &connector,
+                &connector_name,
+                decoded_body.into(),
+                &request_details,
+            )
+            .await?
+        };
+
+    // Update request_details with the appropriate body (decoded for non-UCS, raw for UCS)
+    let final_request_details = match &webhook_processing_result.decoded_body {
+        Some(decoded_body) => IncomingWebhookRequestDetails {
+            method: request_details.method.clone(),
+            uri: request_details.uri.clone(),
+            headers: request_details.headers,
+            query_params: request_details.query_params.clone(),
+            body: decoded_body,
+        },
+        None => request_details, // Use original request details for UCS
+    };
+
+    logger::info!(event_type=?webhook_processing_result.event_type);
+
+    // Check if webhook should be processed further
+    let is_webhook_event_supported = !matches!(
+        webhook_processing_result.event_type,
+        webhooks::IncomingWebhookEvent::EventNotSupported
+    );
+    let is_webhook_event_enabled = !utils::is_webhook_event_disabled(
+        &*state.clone().store,
+        connector_name.as_str(),
+        merchant_context.get_merchant_account().get_id(),
+        &webhook_processing_result.event_type,
+    )
+    .await;
+    let flow_type: api::WebhookFlow = webhook_processing_result.event_type.into();
+    let process_webhook_further = is_webhook_event_enabled
+        && is_webhook_event_supported
+        && !matches!(flow_type, api::WebhookFlow::ReturnResponse);
+    logger::info!(process_webhook=?process_webhook_further);
+    let mut event_object: Box<dyn masking::ErasedMaskSerialize> = Box::new(serde_json::Value::Null);
+
+    let webhook_effect = match process_webhook_further {
+        true => {
+            let business_logic_result = process_webhook_business_logic(
+                &state,
+                req_state,
+                &merchant_context,
+                &connector,
+                &connector_name,
+                webhook_processing_result.event_type,
+                webhook_processing_result.source_verified,
+                &webhook_processing_result.transform_data,
+                &final_request_details,
+                is_relay_webhook,
+            )
+            .await;
+
+            match business_logic_result {
+                Ok(response) => {
+                    // Extract event object for serialization
+                    event_object = extract_webhook_event_object(
+                        &webhook_processing_result.transform_data,
+                        &connector,
+                        &final_request_details,
+                    )?;
+                    response
+                }
+                Err(error) => {
+                    let error_result = handle_incoming_webhook_error(
+                        error,
+                        &connector,
+                        connector_name.as_str(),
+                        &final_request_details,
+                    );
+                    match error_result {
+                        Ok((_, webhook_tracker, _)) => webhook_tracker,
+                        Err(e) => return Err(e),
+                    }
+                }
+            }
+        }
+        false => {
+            metrics::WEBHOOK_INCOMING_FILTERED_COUNT.add(
+                1,
+                router_env::metric_attributes!((
+                    MERCHANT_ID,
+                    merchant_context.get_merchant_account().get_id().clone()
+                )),
+            );
+            WebhookResponseTracker::NoEffect
+        }
+    };
+
+    // Generate response
+    let response = connector
+        .get_webhook_api_response(&final_request_details, None)
         .switch()
-        .attach_printable("There was an error in incoming webhook body decoding")?;
+        .attach_printable("Could not get incoming webhook api response from connector")?;
+
+    let serialized_request = event_object
+        .masked_serialize()
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Could not convert webhook effect to string")?;
+
+    Ok((response, webhook_effect, serialized_request))
+}
+
+/// Process UCS webhook transformation using the high-level UCS abstraction
+async fn process_ucs_webhook_transform(
+    state: &SessionState,
+    merchant_context: &domain::MerchantContext,
+    connector_name: &str,
+    body: &actix_web::web::Bytes,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+    merchant_connector_account: Option<&domain::MerchantConnectorAccount>,
+) -> errors::RouterResult<WebhookProcessingResult> {
+    // Use the new UCS abstraction which provides clean separation
+    let (event_type, source_verified, transform_data) =
+        unified_connector_service::call_unified_connector_service_for_webhook(
+            state,
+            merchant_context,
+            connector_name,
+            body,
+            request_details,
+            merchant_connector_account,
+        )
+        .await?;
+    Ok(WebhookProcessingResult {
+        event_type,
+        source_verified,
+        transform_data: Some(Box::new(transform_data)),
+        decoded_body: None, // UCS path uses raw body
+    })
+}
+/// Result type for webhook processing path determination
+pub struct WebhookProcessingResult {
+    event_type: webhooks::IncomingWebhookEvent,
+    source_verified: bool,
+    transform_data: Option<Box<unified_connector_service::WebhookTransformData>>,
+    decoded_body: Option<actix_web::web::Bytes>,
+}
 
-    request_details.body = &decoded_body;
+/// Process non-UCS webhook using traditional connector processing
+async fn process_non_ucs_webhook(
+    state: &SessionState,
+    merchant_context: &domain::MerchantContext,
+    connector: &ConnectorEnum,
+    connector_name: &str,
+    decoded_body: actix_web::web::Bytes,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+) -> errors::RouterResult<WebhookProcessingResult> {
+    // Create request_details with decoded body for connector processing
+    let updated_request_details = IncomingWebhookRequestDetails {
+        method: request_details.method.clone(),
+        uri: request_details.uri.clone(),
+        headers: request_details.headers,
+        query_params: request_details.query_params.clone(),
+        body: &decoded_body,
+    };
 
-    let event_type = match connector
-        .get_webhook_event_type(&request_details)
+    match connector
+        .get_webhook_event_type(&updated_request_details)
         .allow_webhook_event_type_not_found(
             state
                 .clone()
@@ -257,14 +437,13 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
         .switch()
         .attach_printable("Could not find event type in incoming webhook body")?
     {
-        Some(event_type) => event_type,
-        // Early return allows us to acknowledge the webhooks that we do not support
+        Some(event_type) => Ok(WebhookProcessingResult {
+            event_type,
+            source_verified: false,
+            transform_data: None,
+            decoded_body: Some(decoded_body),
+        }),
         None => {
-            logger::error!(
-                webhook_payload =? request_details.body,
-                "Failed while identifying the event type",
-            );
-
             metrics::WEBHOOK_EVENT_TYPE_IDENTIFICATION_FAILURE_COUNT.add(
                 1,
                 router_env::metric_attributes!(
@@ -272,94 +451,101 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
                         MERCHANT_ID,
                         merchant_context.get_merchant_account().get_id().clone()
                     ),
-                    ("connector", connector_name)
+                    ("connector", connector_name.to_string())
                 ),
             );
-
-            let response = connector
-                .get_webhook_api_response(&request_details, None)
-                .switch()
-                .attach_printable("Failed while early return in case of event type parsing")?;
-
-            return Ok((
-                response,
-                WebhookResponseTracker::NoEffect,
-                serde_json::Value::Null,
-            ));
+            Err(errors::ApiErrorResponse::WebhookProcessingFailure)
+                .attach_printable("Failed to identify event type in incoming webhook body")
         }
-    };
-    logger::info!(event_type=?event_type);
-
-    let is_webhook_event_supported = !matches!(
-        event_type,
-        webhooks::IncomingWebhookEvent::EventNotSupported
-    );
-    let is_webhook_event_enabled = !utils::is_webhook_event_disabled(
-        &*state.clone().store,
-        connector_name.as_str(),
-        merchant_context.get_merchant_account().get_id(),
-        &event_type,
-    )
-    .await;
+    }
+}
 
-    //process webhook further only if webhook event is enabled and is not event_not_supported
-    let process_webhook_further = is_webhook_event_enabled && is_webhook_event_supported;
+/// Extract webhook event object based on transform data availability
+fn extract_webhook_event_object(
+    transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
+    connector: &ConnectorEnum,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+) -> errors::RouterResult<Box<dyn masking::ErasedMaskSerialize>> {
+    match transform_data {
+        Some(transform_data) => match &transform_data.webhook_content {
+            Some(webhook_content) => {
+                let serialized_value = serde_json::to_value(webhook_content)
+                    .change_context(errors::ApiErrorResponse::InternalServerError)
+                    .attach_printable("Failed to serialize UCS webhook content")?;
+                Ok(Box::new(serialized_value))
+            }
+            None => connector
+                .get_webhook_resource_object(request_details)
+                .switch()
+                .attach_printable("Could not find resource object in incoming webhook body"),
+        },
+        None => connector
+            .get_webhook_resource_object(request_details)
+            .switch()
+            .attach_printable("Could not find resource object in incoming webhook body"),
+    }
+}
 
-    logger::info!(process_webhook=?process_webhook_further);
+/// Process the main webhook business logic after event type determination
+#[allow(clippy::too_many_arguments)]
+async fn process_webhook_business_logic(
+    state: &SessionState,
+    req_state: ReqState,
+    merchant_context: &domain::MerchantContext,
+    connector: &ConnectorEnum,
+    connector_name: &str,
+    event_type: webhooks::IncomingWebhookEvent,
+    source_verified_via_ucs: bool,
+    webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
+    request_details: &IncomingWebhookRequestDetails<'_>,
+    is_relay_webhook: bool,
+) -> errors::RouterResult<WebhookResponseTracker> {
+    let object_ref_id = connector
+        .get_webhook_object_reference_id(request_details)
+        .switch()
+        .attach_printable("Could not find object reference id in incoming webhook body")?;
+    let connector_enum = api_models::enums::Connector::from_str(connector_name)
+        .change_context(errors::ApiErrorResponse::InvalidDataValue {
+            field_name: "connector",
+        })
+        .attach_printable_lazy(|| format!("unable to parse connector name {connector_name:?}"))?;
+    let connectors_with_source_verification_call = &state.conf.webhook_source_verification_call;
 
-    let flow_type: api::WebhookFlow = event_type.into();
-    let mut event_object: Box<dyn masking::ErasedMaskSerialize> = Box::new(serde_json::Value::Null);
-    let webhook_effect = if process_webhook_further
-        && !matches!(flow_type, api::WebhookFlow::ReturnResponse)
+    let merchant_connector_account = match Box::pin(helper_utils::get_mca_from_object_reference_id(
+        state,
+        object_ref_id.clone(),
+        merchant_context,
+        connector_name,
+    ))
+    .await
     {
-        let object_ref_id = connector
-            .get_webhook_object_reference_id(&request_details)
-            .switch()
-            .attach_printable("Could not find object reference id in incoming webhook body")?;
-        let connector_enum = api_models::enums::Connector::from_str(&connector_name)
-            .change_context(errors::ApiErrorResponse::InvalidDataValue {
-                field_name: "connector",
-            })
-            .attach_printable_lazy(|| {
-                format!("unable to parse connector name {connector_name:?}")
-            })?;
-        let connectors_with_source_verification_call = &state.conf.webhook_source_verification_call;
-
-        let merchant_connector_account = match merchant_connector_account {
-            Some(merchant_connector_account) => merchant_connector_account,
-            None => {
-                match Box::pin(helper_utils::get_mca_from_object_reference_id(
-                    &state,
-                    object_ref_id.clone(),
-                    &merchant_context,
-                    &connector_name,
-                ))
-                .await
-                {
-                    Ok(mca) => mca,
-                    Err(error) => {
-                        return handle_incoming_webhook_error(
-                            error,
-                            &connector,
-                            connector_name.as_str(),
-                            &request_details,
-                        );
-                    }
-                }
+        Ok(mca) => mca,
+        Err(error) => {
+            let result =
+                handle_incoming_webhook_error(error, connector, connector_name, request_details);
+            match result {
+                Ok((_, webhook_tracker, _)) => return Ok(webhook_tracker),
+                Err(e) => return Err(e),
             }
-        };
+        }
+    };
 
-        let source_verified = if connectors_with_source_verification_call
+    let source_verified = if source_verified_via_ucs {
+        // If UCS handled verification, use that result
+        source_verified_via_ucs
+    } else {
+        // Fall back to traditional source verification
+        if connectors_with_source_verification_call
             .connectors_with_webhook_source_verification_call
             .contains(&connector_enum)
         {
             verify_webhook_source_verification_call(
                 connector.clone(),
-                &state,
-                &merchant_context,
+                state,
+                merchant_context,
                 merchant_connector_account.clone(),
-                &connector_name,
-                &request_details,
+                connector_name,
+                request_details,
             )
             .await
             .or_else(|error| match error.current_context() {
@@ -375,11 +561,11 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
             connector
                 .clone()
                 .verify_webhook_source(
-                    &request_details,
+                    request_details,
                     merchant_context.get_merchant_account().get_id(),
                     merchant_connector_account.connector_webhook_details.clone(),
                     merchant_connector_account.connector_account_details.clone(),
-                    connector_name.as_str(),
+                    connector_name,
                 )
                 .await
                 .or_else(|error| match error.current_context() {
@@ -391,235 +577,233 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
                 })
                 .switch()
                 .attach_printable("There was an issue in incoming webhook source verification")?
-        };
-
-        if source_verified {
-            metrics::WEBHOOK_SOURCE_VERIFIED_COUNT.add(
-                1,
-                router_env::metric_attributes!((
-                    MERCHANT_ID,
-                    merchant_context.get_merchant_account().get_id().clone()
-                )),
-            );
-        } else if connector.is_webhook_source_verification_mandatory() {
-            // if webhook consumption is mandatory for connector, fail webhook
-            // so that merchant can retrigger it after updating merchant_secret
-            return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into());
         }
+    };
 
-        logger::info!(source_verified=?source_verified);
+    if source_verified {
+        metrics::WEBHOOK_SOURCE_VERIFIED_COUNT.add(
+            1,
+            router_env::metric_attributes!((
+                MERCHANT_ID,
+                merchant_context.get_merchant_account().get_id().clone()
+            )),
+        );
+    } else if connector.is_webhook_source_verification_mandatory() {
+        // if webhook consumption is mandatory for connector, fail webhook
+        // so that merchant can retrigger it after updating merchant_secret
+        return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into());
+    }
 
-        event_object = connector
-            .get_webhook_resource_object(&request_details)
-            .switch()
-            .attach_printable("Could not find resource object in incoming webhook body")?;
+    logger::info!(source_verified=?source_verified);
 
-        let webhook_details = api::IncomingWebhookDetails {
-            object_reference_id: object_ref_id.clone(),
-            resource_object: serde_json::to_vec(&event_object)
-                .change_context(errors::ParsingError::EncodeError("byte-vec"))
-                .attach_printable("Unable to convert webhook payload to a value")
-                .change_context(errors::ApiErrorResponse::InternalServerError)
-                .attach_printable(
-                    "There was an issue when encoding the incoming webhook body to bytes",
-                )?,
+    let event_object: Box<dyn masking::ErasedMaskSerialize> =
+        if let Some(transform_data) = webhook_transform_data {
+            // Use UCS transform data if available
+            if let Some(webhook_content) = &transform_data.webhook_content {
+                // Convert UCS webhook content to appropriate format
+                Box::new(
+                    serde_json::to_value(webhook_content)
+                        .change_context(errors::ApiErrorResponse::InternalServerError)
+                        .attach_printable("Failed to serialize UCS webhook content")?,
+                )
+            } else {
+                // Fall back to connector extraction
+                connector
+                    .get_webhook_resource_object(request_details)
+                    .switch()
+                    .attach_printable("Could not find resource object in incoming webhook body")?
+            }
+        } else {
+            // Use traditional connector extraction
+            connector
+                .get_webhook_resource_object(request_details)
+                .switch()
+                .attach_printable("Could not find resource object in incoming webhook body")?
         };
 
-        let profile_id = &merchant_connector_account.profile_id;
+    let webhook_details = api::IncomingWebhookDetails {
+        object_reference_id: object_ref_id.clone(),
+        resource_object: serde_json::to_vec(&event_object)
+            .change_context(errors::ParsingError::EncodeError("byte-vec"))
+            .attach_printable("Unable to convert webhook payload to a value")
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable(
+                "There was an issue when encoding the incoming webhook body to bytes",
+            )?,
+    };
 
-        let business_profile = state
-            .store
-            .find_business_profile_by_profile_id(
-                key_manager_state,
-                merchant_context.get_merchant_key_store(),
-                profile_id,
-            )
-            .await
-            .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound {
-                id: profile_id.get_string_repr().to_owned(),
-            })?;
+    let profile_id = &merchant_connector_account.profile_id;
+    let key_manager_state = &(state).into();
+
+    let business_profile = state
+        .store
+        .find_business_profile_by_profile_id(
+            key_manager_state,
+            merchant_context.get_merchant_key_store(),
+            profile_id,
+        )
+        .await
+        .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound {
+            id: profile_id.get_string_repr().to_owned(),
+        })?;
+
+    // If the incoming webhook is a relay webhook, then we need to trigger the relay webhook flow
+    let result_response = if is_relay_webhook {
+        let relay_webhook_response = Box::pin(relay_incoming_webhook_flow(
+            state.clone(),
+            merchant_context.clone(),
+            business_profile,
+            webhook_details,
+            event_type,
+            source_verified,
+        ))
+        .await
+        .attach_printable("Incoming webhook flow for relay failed");
+
+        // Using early return ensures unsupported webhooks are acknowledged to the connector
+        if let Some(errors::ApiErrorResponse::NotSupported { .. }) = relay_webhook_response
+            .as_ref()
+            .err()
+            .map(|a| a.current_context())
+        {
+            logger::error!(
+                webhook_payload =? request_details.body,
+                "Failed while identifying the event type",
+            );
+
+            let _response = connector
+                    .get_webhook_api_response(request_details, None)
+                    .switch()
+                    .attach_printable(
+                        "Failed while early return in case of not supported event type in relay webhooks",
+                    )?;
 
-        // If the incoming webhook is a relay webhook, then we need to trigger the relay webhook flow
-        let result_response = if is_relay_webhook {
-            let relay_webhook_response = Box::pin(relay_incoming_webhook_flow(
+            return Ok(WebhookResponseTracker::NoEffect);
+        };
+
+        relay_webhook_response
+    } else {
+        let flow_type: api::WebhookFlow = event_type.into();
+        match flow_type {
+            api::WebhookFlow::Payment => Box::pin(payments_incoming_webhook_flow(
                 state.clone(),
-                merchant_context,
+                req_state,
+                merchant_context.clone(),
                 business_profile,
                 webhook_details,
-                event_type,
                 source_verified,
+                connector,
+                request_details,
+                event_type,
             ))
             .await
-            .attach_printable("Incoming webhook flow for relay failed");
-
-            // Using early return ensures unsupported webhooks are acknowledged to the connector
-            if let Some(errors::ApiErrorResponse::NotSupported { .. }) = relay_webhook_response
-                .as_ref()
-                .err()
-                .map(|a| a.current_context())
-            {
-                logger::error!(
-                    webhook_payload =? request_details.body,
-                    "Failed while identifying the event type",
-                );
-
-                let response = connector
-                        .get_webhook_api_response(&request_details, None)
-                        .switch()
-                        .attach_printable(
-                            "Failed while early return in case of not supported event type in relay webhooks",
-                        )?;
-
-                return Ok((
-                    response,
-                    WebhookResponseTracker::NoEffect,
-                    serde_json::Value::Null,
-                ));
-            };
+            .attach_printable("Incoming webhook flow for payments failed"),
 
-            relay_webhook_response
-        } else {
-            match flow_type {
-                api::WebhookFlow::Payment => Box::pin(payments_incoming_webhook_flow(
-                    state.clone(),
-                    req_state,
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                    &connector,
-                    &request_details,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for payments failed"),
-
-                api::WebhookFlow::Refund => Box::pin(refunds_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    connector_name.as_str(),
-                    source_verified,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for refunds failed"),
+            api::WebhookFlow::Refund => Box::pin(refunds_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                connector_name,
+                source_verified,
+                event_type,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for refunds failed"),
 
-                api::WebhookFlow::Dispute => Box::pin(disputes_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                    &connector,
-                    &request_details,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for disputes failed"),
+            api::WebhookFlow::Dispute => Box::pin(disputes_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+                connector,
+                request_details,
+                event_type,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for disputes failed"),
 
-                api::WebhookFlow::BankTransfer => Box::pin(bank_transfer_webhook_flow(
-                    state.clone(),
-                    req_state,
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                ))
-                .await
-                .attach_printable("Incoming bank-transfer webhook flow failed"),
+            api::WebhookFlow::BankTransfer => Box::pin(bank_transfer_webhook_flow(
+                state.clone(),
+                req_state,
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+            ))
+            .await
+            .attach_printable("Incoming bank-transfer webhook flow failed"),
 
-                api::WebhookFlow::ReturnResponse => Ok(WebhookResponseTracker::NoEffect),
+            api::WebhookFlow::ReturnResponse => Ok(WebhookResponseTracker::NoEffect),
 
-                api::WebhookFlow::Mandate => Box::pin(mandates_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    source_verified,
-                    event_type,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for mandates failed"),
+            api::WebhookFlow::Mandate => Box::pin(mandates_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                source_verified,
+                event_type,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for mandates failed"),
 
-                api::WebhookFlow::ExternalAuthentication => {
-                    Box::pin(external_authentication_incoming_webhook_flow(
-                        state.clone(),
-                        req_state,
-                        merchant_context,
-                        source_verified,
-                        event_type,
-                        &request_details,
-                        &connector,
-                        object_ref_id,
-                        business_profile,
-                        merchant_connector_account,
-                    ))
-                    .await
-                    .attach_printable("Incoming webhook flow for external authentication failed")
-                }
-                api::WebhookFlow::FraudCheck => Box::pin(frm_incoming_webhook_flow(
+            api::WebhookFlow::ExternalAuthentication => {
+                Box::pin(external_authentication_incoming_webhook_flow(
                     state.clone(),
                     req_state,
-                    merchant_context,
+                    merchant_context.clone(),
                     source_verified,
                     event_type,
+                    request_details,
+                    connector,
                     object_ref_id,
                     business_profile,
+                    merchant_connector_account,
                 ))
                 .await
-                .attach_printable("Incoming webhook flow for fraud check failed"),
-
-                #[cfg(feature = "payouts")]
-                api::WebhookFlow::Payout => Box::pin(payouts_incoming_webhook_flow(
-                    state.clone(),
-                    merchant_context,
-                    business_profile,
-                    webhook_details,
-                    event_type,
-                    source_verified,
-                ))
-                .await
-                .attach_printable("Incoming webhook flow for payouts failed"),
-
-                _ => Err(errors::ApiErrorResponse::InternalServerError)
-                    .attach_printable("Unsupported Flow Type received in incoming webhooks"),
+                .attach_printable("Incoming webhook flow for external authentication failed")
             }
-        };
+            api::WebhookFlow::FraudCheck => Box::pin(frm_incoming_webhook_flow(
+                state.clone(),
+                req_state,
+                merchant_context.clone(),
+                source_verified,
+                event_type,
+                object_ref_id,
+                business_profile,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for fraud check failed"),
 
-        match result_response {
-            Ok(response) => response,
-            Err(error) => {
-                return handle_incoming_webhook_error(
-                    error,
-                    &connector,
-                    connector_name.as_str(),
-                    &request_details,
-                );
-            }
+            #[cfg(feature = "payouts")]
+            api::WebhookFlow::Payout => Box::pin(payouts_incoming_webhook_flow(
+                state.clone(),
+                merchant_context.clone(),
+                business_profile,
+                webhook_details,
+                event_type,
+                source_verified,
+            ))
+            .await
+            .attach_printable("Incoming webhook flow for payouts failed"),
+
+            _ => Err(errors::ApiErrorResponse::InternalServerError)
+                .attach_printable("Unsupported Flow Type received in incoming webhooks"),
         }
-    } else {
-        metrics::WEBHOOK_INCOMING_FILTERED_COUNT.add(
-            1,
-            router_env::metric_attributes!((
-                MERCHANT_ID,
-                merchant_context.get_merchant_account().get_id().clone()
-            )),
-        );
-        WebhookResponseTracker::NoEffect
     };
 
-    let response = connector
-        .get_webhook_api_response(&request_details, None)
-        .switch()
-        .attach_printable("Could not get incoming webhook api response from connector")?;
-
-    let serialized_request = event_object
-        .masked_serialize()
-        .change_context(errors::ApiErrorResponse::InternalServerError)
-        .attach_printable("Could not convert webhook effect to string")?;
-    Ok((response, webhook_effect, serialized_request))
+    match result_response {
+        Ok(response) => Ok(response),
+        Err(error) => {
+            let result =
+                handle_incoming_webhook_error(error, connector, connector_name, request_details);
+            match result {
+                Ok((_, webhook_tracker, _)) => Ok(webhook_tracker),
+                Err(e) => Err(e),
+            }
+        }
+    }
 }
 
 fn handle_incoming_webhook_error(
@@ -1346,7 +1530,7 @@ pub async fn get_or_update_dispute_object(
         Some(dispute) => {
             logger::info!("Dispute Already exists, Updating the dispute details");
             metrics::INCOMING_DISPUTE_WEBHOOK_UPDATE_RECORD_METRIC.add(1, &[]);
-            crate::core::utils::validate_dispute_stage_and_dispute_status(
+            core_utils::validate_dispute_stage_and_dispute_status(
                 dispute.dispute_stage,
                 dispute.dispute_status,
                 dispute_details.dispute_stage,
@@ -1354,7 +1538,6 @@ pub async fn get_or_update_dispute_object(
             )
             .change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
             .attach_printable("dispute stage and status validation failed")?;
-
             let update_dispute = diesel_models::dispute::DisputeUpdate::Update {
                 dispute_stage: dispute_details.dispute_stage,
                 dispute_status,
 | 
	2025-08-01T07:07:02Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Added webhooks integration support in hyperswitch so that for webhooks hyperswitch can call UCS and get the response.
Closes #8880  
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
```
curl --location 'http://localhost:8080/webhooks/merchant_1753974582/mca_lwqSM0js79MQm1DGwYRj' \
--header 'Content-Type: application/json' \
--header 'X-ANET-Signature: sha512=38b0bc1ea66b14793e39cd58e93d37b799a507442d0dd8d37443fa95dec58e57da6db4742636fea31201c48e57a66e73a308a2e5a5c6bb831e4e39fe2227c00f' \
--header 'api-key: dev_gkgtNkEyXov857WXSuWWiduf9a2PnTLd78j7ZVUheZ86M7nroCye8G3BEgqcL5SH' \
--data '{
    "notificationId": "550e8400-e29b-41d4-a716-446655440000",
    "eventType": "net.authorize.payment.authorization.created",
    "eventDate": "2023-12-01T12:00:00Z",
    "webhookId": "webhook_123",
    "payload": {
      "responseCode": 1,
      "entityName": "transaction",
      "id": "120068558980",
      "authAmount": 6540,
      "merchantReferenceId": "REF123",
      "authCode": "ABC123",
      "messageText": "This transaction has been approved.",
      "avsResponse": "Y",
      "cvvResponse": "M"
    }
  }'
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
img of hyperswitch
<img width="1727" height="1045" alt="Screenshot 2025-08-07 at 9 32 55 AM" src="https://github.com/user-attachments/assets/b22707ae-027c-4f5f-8552-1a82372d8bed" />
img of UCS
<img width="1728" height="1044" alt="Screenshot 2025-08-07 at 9 30 58 AM" src="https://github.com/user-attachments/assets/e5324ec7-0228-4963-ba24-dac2238c4068" />
Steps to test webhooks
✅ 1. Create a Sandbox Account on Authorize.Net
Go to: https://developer.authorize.net/hello_world/sandbox/
Sign up for a sandbox account.
After registration, note your:
API Login ID
Transaction Key
(Optional: Public Client Key if needed)
✅ 2. Generate the Signature Key
Log in to the Authorize.Net Sandbox
Navigate to:
Account → Settings → API Credentials & Keys
Under Signature Key, click New Signature Key → click Submit
Copy and save the Signature Key safely — you’ll use it to verify webhooks.
✅ 3. Enable Webhooks in Authorize.Net
In your sandbox account, go to:
Account → Settings → Webhooks
Click Add Endpoint
Endpoint URL:
https://f9475498739857e.ngrok-free.app/webhooks/merchant_id/mca_of_merchant
Event Types: Select the events you want (e.g., net.authorize.payment.authcapture.created)
Save the webhook.
✅ 4. Configure Hyperswitch Merchant with Signature & Credentials
While creating a merchant in Hyperswitch, add the following:
authentication creds
BodyKey
api_key = API Login ID (from step 1)
key1 = Transaction Key
and below you file find a field named merchant secret where you will put the signature
Signature Key (from step 2)
This allows Hyperswitch to authenticate with Authorize.Net and validate incoming webhooks.
✅ 5. Trigger a Payment to Receive Webhooks
Use Hyperswitch to make a test payment through the merchant you configured.
If everything is set up:
Authorize.Net will send a webhook to your endpoint (ngrok URL).
Your backend should receive and verify the webhook using the signature key.
✅ Optional: Use ngrok to Test Webhooks Locally
If running locally:
`ngrok http 8080`
Use the https://xxxx.ngrok-free.app URL as the webhook URL in step 3.
 | 
	8bbb76840bb5b560b0e4d0f98c5fd5530dc11cef | 
	```
curl --location 'http://localhost:8080/webhooks/merchant_1753974582/mca_lwqSM0js79MQm1DGwYRj' \
--header 'Content-Type: application/json' \
--header 'X-ANET-Signature: sha512=38b0bc1ea66b14793e39cd58e93d37b799a507442d0dd8d37443fa95dec58e57da6db4742636fea31201c48e57a66e73a308a2e5a5c6bb831e4e39fe2227c00f' \
--header 'api-key: dev_gkgtNkEyXov857WXSuWWiduf9a2PnTLd78j7ZVUheZ86M7nroCye8G3BEgqcL5SH' \
--data '{
    "notificationId": "550e8400-e29b-41d4-a716-446655440000",
    "eventType": "net.authorize.payment.authorization.created",
    "eventDate": "2023-12-01T12:00:00Z",
    "webhookId": "webhook_123",
    "payload": {
      "responseCode": 1,
      "entityName": "transaction",
      "id": "120068558980",
      "authAmount": 6540,
      "merchantReferenceId": "REF123",
      "authCode": "ABC123",
      "messageText": "This transaction has been approved.",
      "avsResponse": "Y",
      "cvvResponse": "M"
    }
  }'
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8874 | 
	Bug: chore: address Rust 1.89.0 clippy lints
Address the clippy lints occurring due to new rust version 1.89.0
See https://github.com/juspay/hyperswitch/issues/3391 for more information. | 
	diff --git a/crates/euclid_macros/src/inner/knowledge.rs b/crates/euclid_macros/src/inner/knowledge.rs
index 49d645be72a..837a511f02d 100644
--- a/crates/euclid_macros/src/inner/knowledge.rs
+++ b/crates/euclid_macros/src/inner/knowledge.rs
@@ -301,35 +301,6 @@ impl Parse for Rule {
     }
 }
 
-#[derive(Clone)]
-enum Scope {
-    Crate,
-    Extern,
-}
-
-impl Parse for Scope {
-    fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
-        let lookahead = input.lookahead1();
-        if lookahead.peek(Token![crate]) {
-            input.parse::<Token![crate]>()?;
-            Ok(Self::Crate)
-        } else if lookahead.peek(Token![extern]) {
-            input.parse::<Token![extern]>()?;
-            Ok(Self::Extern)
-        } else {
-            Err(lookahead.error())
-        }
-    }
-}
-
-impl Display for Scope {
-    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::Crate => write!(f, "crate"),
-            Self::Extern => write!(f, "euclid"),
-        }
-    }
-}
 #[derive(Clone)]
 struct Program {
     rules: Vec<Rc<Rule>>,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index d70dc7933b4..50d703ba6a5 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -782,10 +782,11 @@ where
             payment_data = match connector_details {
                 ConnectorCallType::PreDetermined(ref connector) => {
                     #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
-                    let routable_connectors =
-                        convert_connector_data_to_routable_connectors(&[connector.clone()])
-                            .map_err(|e| logger::error!(routable_connector_error=?e))
-                            .unwrap_or_default();
+                    let routable_connectors = convert_connector_data_to_routable_connectors(
+                        std::slice::from_ref(connector),
+                    )
+                    .map_err(|e| logger::error!(routable_connector_error=?e))
+                    .unwrap_or_default();
                     let schedule_time = if should_add_task_to_process_tracker {
                         payment_sync::get_sync_process_schedule_time(
                             &*state.store,
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 6554ec1b016..837b0bcf9fc 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -400,12 +400,12 @@ pub async fn connect_account(
             logger::info!(?welcome_email_result);
         }
 
-        return Ok(ApplicationResponse::Json(
+        Ok(ApplicationResponse::Json(
             user_api::ConnectAccountResponse {
                 is_email_sent: magic_link_result.is_ok(),
                 user_id: user_from_db.get_user_id().to_string(),
             },
-        ));
+        ))
     } else {
         Err(find_user
             .err()
 | 
	2025-08-08T07:57:33Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR addresses the clippy lints occurring due to new rust version 1.89.0
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. just clippy
<img width="552" height="237" alt="image" src="https://github.com/user-attachments/assets/11c34b90-2697-48c2-ad08-7436e83f6799" />
2. just clippy_v2
<img width="548" height="223" alt="image" src="https://github.com/user-attachments/assets/42da0048-5e03-4302-8f1c-fd0885ce882d" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	838de443d1ed8d0d509e86d75e3220bedc9121e8 | 
	
1. just clippy
<img width="552" height="237" alt="image" src="https://github.com/user-attachments/assets/11c34b90-2697-48c2-ad08-7436e83f6799" />
2. just clippy_v2
<img width="548" height="223" alt="image" src="https://github.com/user-attachments/assets/42da0048-5e03-4302-8f1c-fd0885ce882d" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8872 | 
	Bug: [FEATURE]: add support of passing metadata in adyen payment request
add support of passing metadata in adyen payment request | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 53ecbf882e6..df98be4c684 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -292,6 +292,7 @@ pub struct AdyenPaymentRequest<'a> {
     device_fingerprint: Option<Secret<String>>,
     #[serde(with = "common_utils::custom_serde::iso8601::option")]
     session_validity: Option<PrimitiveDateTime>,
+    metadata: Option<serde_json::Value>,
 }
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -2936,6 +2937,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
@@ -3020,6 +3022,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &Card)> for AdyenP
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
@@ -3108,6 +3111,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         };
         Ok(request)
     }
@@ -3184,6 +3188,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &VoucherData)>
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         };
         Ok(request)
     }
@@ -3302,6 +3307,7 @@ impl
             splits,
             device_fingerprint,
             session_validity,
+            metadata: item.router_data.request.metadata.clone(),
         };
         Ok(request)
     }
@@ -3379,6 +3385,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         };
         Ok(request)
     }
@@ -3460,6 +3467,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
@@ -3591,6 +3599,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &WalletData)>
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
@@ -3681,6 +3690,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
@@ -3763,6 +3773,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
@@ -6018,6 +6029,7 @@ impl
             splits,
             device_fingerprint,
             session_validity: None,
+            metadata: item.router_data.request.metadata.clone(),
         })
     }
 }
 | 
	2025-08-08T07:20:47Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
Make a adyen payment request by passing metadata
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gfSvA66FtTOYRAET2roFlwpZII7Im5qV58tVCQ8nmgfvCGW34H7KOatZrmImGpJi' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4917610000000000",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "merchant_order_reference_id" : "order_narvar12",
     "browser_info": {
    "os_type": "macOS",
    "language": "en-GB",
    "time_zone": -330,
    "ip_address": "103.159.11.202",
    "os_version": "10.15.7",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
    "color_depth": 24,
    "device_model": "Macintosh",
    "java_enabled": true,
    "screen_width": 1920,
    "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "screen_height": 1080,
    "accept_language": "en",
    "java_script_enabled": true
  },
    "profile_id": "pro_16j8JOCurimvr2XXG9EE"
}'
```
Response
```
{
    "payment_id": "pay_hzlcxXX8nyJI66W4kWqV",
    "merchant_id": "merchant_1754636642",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_hzlcxXX8nyJI66W4kWqV_secret_nCpTSGcFPShUZCI00wx1",
    "created": "2025-08-08T07:04:25.612Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "491761",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_hzlcxXX8nyJI66W4kWqV/merchant_1754636642/pay_hzlcxXX8nyJI66W4kWqV_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1754636665,
        "expires": 1754640265,
        "secret": "epk_4fc117f853654c8289fb1024aa8dbeed"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "SPD59ZTRRZ9TPM75",
    "frm_message": null,
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "SPD59ZTRRZ9TPM75",
    "payment_link": null,
    "profile_id": "pro_BkMsi4kLNDDn7Occ4u2v",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_hwPRKWHa1C2kQQ9Y86sr",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-08T07:19:25.612Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": "macOS",
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "103.159.11.202",
        "os_version": "10.15.7",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
        "color_depth": 24,
        "device_model": "Macintosh",
        "java_enabled": true,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1080,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-08T07:04:26.048Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "order_narvar12",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
In adyen dashboard it should show up like this:
<img width="696" height="210" alt="Screenshot 2025-08-08 at 12 50 13 PM" src="https://github.com/user-attachments/assets/5cee3d27-a810-49fe-a1d3-42fe43caac83" />
Cypress test
<img width="1912" height="1880" alt="Screenshot 2025-08-08 at 8 36 49 PM" src="https://github.com/user-attachments/assets/b012d628-f74d-4e3a-bd3c-3893bae9115a" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	838de443d1ed8d0d509e86d75e3220bedc9121e8 | 
	Make a adyen payment request by passing metadata
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gfSvA66FtTOYRAET2roFlwpZII7Im5qV58tVCQ8nmgfvCGW34H7KOatZrmImGpJi' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4917610000000000",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "merchant_order_reference_id" : "order_narvar12",
     "browser_info": {
    "os_type": "macOS",
    "language": "en-GB",
    "time_zone": -330,
    "ip_address": "103.159.11.202",
    "os_version": "10.15.7",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
    "color_depth": 24,
    "device_model": "Macintosh",
    "java_enabled": true,
    "screen_width": 1920,
    "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "screen_height": 1080,
    "accept_language": "en",
    "java_script_enabled": true
  },
    "profile_id": "pro_16j8JOCurimvr2XXG9EE"
}'
```
Response
```
{
    "payment_id": "pay_hzlcxXX8nyJI66W4kWqV",
    "merchant_id": "merchant_1754636642",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_hzlcxXX8nyJI66W4kWqV_secret_nCpTSGcFPShUZCI00wx1",
    "created": "2025-08-08T07:04:25.612Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "491761",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_hzlcxXX8nyJI66W4kWqV/merchant_1754636642/pay_hzlcxXX8nyJI66W4kWqV_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1754636665,
        "expires": 1754640265,
        "secret": "epk_4fc117f853654c8289fb1024aa8dbeed"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "SPD59ZTRRZ9TPM75",
    "frm_message": null,
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "SPD59ZTRRZ9TPM75",
    "payment_link": null,
    "profile_id": "pro_BkMsi4kLNDDn7Occ4u2v",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_hwPRKWHa1C2kQQ9Y86sr",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-08T07:19:25.612Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": "macOS",
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "103.159.11.202",
        "os_version": "10.15.7",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
        "color_depth": 24,
        "device_model": "Macintosh",
        "java_enabled": true,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1080,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-08T07:04:26.048Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "order_narvar12",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
In adyen dashboard it should show up like this:
<img width="696" height="210" alt="Screenshot 2025-08-08 at 12 50 13 PM" src="https://github.com/user-attachments/assets/5cee3d27-a810-49fe-a1d3-42fe43caac83" />
Cypress test
<img width="1912" height="1880" alt="Screenshot 2025-08-08 at 8 36 49 PM" src="https://github.com/user-attachments/assets/b012d628-f74d-4e3a-bd3c-3893bae9115a" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8893 | 
	Bug: [FEATURE] nuvie : Avs,cvv check, postConfirmVoid,0$ txn
### Feature Description
Add / fix nuvie related features
### Possible Implementation
- Avs,cvv check, 
- postConfirmVoid
- 0$ txn
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 853b9fd968a..e02168e1f41 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -18,13 +18,13 @@ use hyperswitch_domain_models::{
         access_token_auth::AccessTokenAuth,
         payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
         refunds::{Execute, RSync},
-        AuthorizeSessionToken, CompleteAuthorize, PreProcessing,
+        AuthorizeSessionToken, CompleteAuthorize, PostCaptureVoid, PreProcessing,
     },
     router_request_types::{
         AccessTokenRequestData, AuthorizeSessionTokenData, CompleteAuthorizeData,
         PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,
-        RefundsData, SetupMandateRequestData,
+        PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPreProcessingData,
+        PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData,
     },
     router_response_types::{
         ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
@@ -32,8 +32,9 @@ use hyperswitch_domain_models::{
     },
     types::{
         PaymentsAuthorizeRouterData, PaymentsAuthorizeSessionTokenRouterData,
-        PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData,
-        PaymentsPreProcessingRouterData, PaymentsSyncRouterData, RefundsRouterData,
+        PaymentsCancelPostCaptureRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+        PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData,
+        PaymentsSyncRouterData, RefundsRouterData,
     },
 };
 use hyperswitch_interfaces::{
@@ -131,7 +132,7 @@ impl api::RefundSync for Nuvei {}
 impl api::PaymentsCompleteAuthorize for Nuvei {}
 impl api::ConnectorAccessToken for Nuvei {}
 impl api::PaymentsPreProcessing for Nuvei {}
-
+impl api::PaymentPostCaptureVoid for Nuvei {}
 impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Nuvei {
     fn build_request(
         &self,
@@ -175,7 +176,6 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let meta: nuvei::NuveiMeta = utils::to_connector_meta(req.request.connector_meta.clone())?;
         let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, meta.session_token))?;
-
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
     fn build_request(
@@ -209,7 +209,6 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
-
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
@@ -309,6 +308,90 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Nu
     }
 }
 
+impl ConnectorIntegration<PostCaptureVoid, PaymentsCancelPostCaptureData, PaymentsResponseData>
+    for Nuvei
+{
+    fn get_headers(
+        &self,
+        req: &PaymentsCancelPostCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+        self.build_headers(req, connectors)
+    }
+
+    fn get_content_type(&self) -> &'static str {
+        self.common_get_content_type()
+    }
+
+    fn get_url(
+        &self,
+        _req: &PaymentsCancelPostCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<String, errors::ConnectorError> {
+        Ok(format!(
+            "{}ppp/api/v1/voidTransaction.do",
+            ConnectorCommon::base_url(self, connectors)
+        ))
+    }
+
+    fn get_request_body(
+        &self,
+        req: &PaymentsCancelPostCaptureRouterData,
+        _connectors: &Connectors,
+    ) -> CustomResult<RequestContent, errors::ConnectorError> {
+        let connector_req = nuvei::NuveiVoidRequest::try_from(req)?;
+        Ok(RequestContent::Json(Box::new(connector_req)))
+    }
+
+    fn build_request(
+        &self,
+        req: &PaymentsCancelPostCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        let request = RequestBuilder::new()
+            .method(Method::Post)
+            .url(&types::PaymentsPostCaptureVoidType::get_url(
+                self, req, connectors,
+            )?)
+            .attach_default_headers()
+            .headers(types::PaymentsPostCaptureVoidType::get_headers(
+                self, req, connectors,
+            )?)
+            .set_body(types::PaymentsPostCaptureVoidType::get_request_body(
+                self, req, connectors,
+            )?)
+            .build();
+        Ok(Some(request))
+    }
+
+    fn handle_response(
+        &self,
+        data: &PaymentsCancelPostCaptureRouterData,
+        event_builder: Option<&mut ConnectorEvent>,
+        res: Response,
+    ) -> CustomResult<PaymentsCancelPostCaptureRouterData, errors::ConnectorError> {
+        let response: nuvei::NuveiPaymentsResponse = res
+            .response
+            .parse_struct("NuveiPaymentsResponse")
+            .switch()?;
+        event_builder.map(|i| i.set_response_body(&response));
+        router_env::logger::info!(connector_response=?response);
+        RouterData::try_from(ResponseRouterData {
+            response,
+            data: data.clone(),
+            http_code: res.status_code,
+        })
+        .change_context(errors::ConnectorError::ResponseHandlingFailed)
+    }
+
+    fn get_error_response(
+        &self,
+        res: Response,
+        event_builder: Option<&mut ConnectorEvent>,
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+        self.build_error_response(res, event_builder)
+    }
+}
 impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Nuvei {}
 
 impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Nuvei {
@@ -509,7 +592,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, req.get_session_token()?))?;
-
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
@@ -545,7 +627,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
-
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
@@ -683,7 +764,6 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, req.get_session_token()?))?;
-
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
@@ -719,7 +799,6 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
-
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
@@ -802,7 +881,6 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Nuvei {
             .response
             .parse_struct("NuveiPaymentsResponse")
             .switch()?;
-
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
@@ -849,33 +927,75 @@ impl IncomingWebhook for Nuvei {
         _merchant_id: &id_type::MerchantId,
         connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
     ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
-        let body = serde_urlencoded::from_str::<nuvei::NuveiWebhookDetails>(&request.query_params)
+        // Parse the webhook payload
+        let webhook = serde_urlencoded::from_str::<nuvei::NuveiWebhook>(&request.query_params)
             .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
         let secret_str = std::str::from_utf8(&connector_webhook_secrets.secret)
             .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
-        let status = format!("{:?}", body.status).to_uppercase();
-        let to_sign = format!(
-            "{}{}{}{}{}{}{}",
-            secret_str,
-            body.total_amount,
-            body.currency,
-            body.response_time_stamp,
-            body.ppp_transaction_id,
-            status,
-            body.product_id
-        );
-        Ok(to_sign.into_bytes())
+
+        // Generate signature based on webhook type
+        match webhook {
+            nuvei::NuveiWebhook::PaymentDmn(notification) => {
+                // For payment DMNs, use the same format as before
+                let status = notification
+                    .transaction_status
+                    .as_ref()
+                    .map(|s| format!("{s:?}").to_uppercase())
+                    .unwrap_or_else(|| "UNKNOWN".to_string());
+
+                let to_sign = transformers::concat_strings(&[
+                    secret_str.to_string(),
+                    notification.total_amount.unwrap_or_default(),
+                    notification.currency.unwrap_or_default(),
+                    notification.response_time_stamp.unwrap_or_default(),
+                    notification.ppp_transaction_id.unwrap_or_default(),
+                    status,
+                    notification.product_id.unwrap_or_default(),
+                ]);
+                Ok(to_sign.into_bytes())
+            }
+            nuvei::NuveiWebhook::Chargeback(notification) => {
+                // For chargeback notifications, use a different format based on Nuvei's documentation
+                // Note: This is a placeholder - you'll need to adjust based on Nuvei's actual chargeback signature format
+                let status = notification
+                    .status
+                    .as_ref()
+                    .map(|s| format!("{s:?}").to_uppercase())
+                    .unwrap_or_else(|| "UNKNOWN".to_string());
+
+                let to_sign = transformers::concat_strings(&[
+                    secret_str.to_string(),
+                    notification.chargeback_amount.unwrap_or_default(),
+                    notification.chargeback_currency.unwrap_or_default(),
+                    notification.ppp_transaction_id.unwrap_or_default(),
+                    status,
+                ]);
+                Ok(to_sign.into_bytes())
+            }
+        }
     }
 
     fn get_webhook_object_reference_id(
         &self,
         request: &IncomingWebhookRequestDetails<'_>,
     ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
-        let body =
-            serde_urlencoded::from_str::<nuvei::NuveiWebhookTransactionId>(&request.query_params)
-                .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+        // Parse the webhook payload
+        let webhook = serde_urlencoded::from_str::<nuvei::NuveiWebhook>(&request.query_params)
+            .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
+        // Extract transaction ID from the webhook
+        let transaction_id = match &webhook {
+            nuvei::NuveiWebhook::PaymentDmn(notification) => {
+                notification.ppp_transaction_id.clone().unwrap_or_default()
+            }
+            nuvei::NuveiWebhook::Chargeback(notification) => {
+                notification.ppp_transaction_id.clone().unwrap_or_default()
+            }
+        };
+
         Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
-            PaymentIdType::ConnectorTransactionId(body.ppp_transaction_id),
+            PaymentIdType::ConnectorTransactionId(transaction_id),
         ))
     }
 
@@ -883,15 +1003,29 @@ impl IncomingWebhook for Nuvei {
         &self,
         request: &IncomingWebhookRequestDetails<'_>,
     ) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
-        let body =
-            serde_urlencoded::from_str::<nuvei::NuveiWebhookDataStatus>(&request.query_params)
-                .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
-        match body.status {
-            nuvei::NuveiWebhookStatus::Approved => Ok(IncomingWebhookEvent::PaymentIntentSuccess),
-            nuvei::NuveiWebhookStatus::Declined => Ok(IncomingWebhookEvent::PaymentIntentFailure),
-            nuvei::NuveiWebhookStatus::Unknown
-            | nuvei::NuveiWebhookStatus::Pending
-            | nuvei::NuveiWebhookStatus::Update => Ok(IncomingWebhookEvent::EventNotSupported),
+        // Parse the webhook payload
+        let webhook = serde_urlencoded::from_str::<nuvei::NuveiWebhook>(&request.query_params)
+            .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
+        // Map webhook type to event type
+        match webhook {
+            nuvei::NuveiWebhook::PaymentDmn(notification) => {
+                match notification.transaction_status {
+                    Some(nuvei::TransactionStatus::Approved)
+                    | Some(nuvei::TransactionStatus::Settled) => {
+                        Ok(IncomingWebhookEvent::PaymentIntentSuccess)
+                    }
+                    Some(nuvei::TransactionStatus::Declined)
+                    | Some(nuvei::TransactionStatus::Error) => {
+                        Ok(IncomingWebhookEvent::PaymentIntentFailure)
+                    }
+                    _ => Ok(IncomingWebhookEvent::EventNotSupported),
+                }
+            }
+            nuvei::NuveiWebhook::Chargeback(_) => {
+                // Chargeback notifications always map to dispute opened
+                Ok(IncomingWebhookEvent::DisputeOpened)
+            }
         }
     }
 
@@ -899,9 +1033,12 @@ impl IncomingWebhook for Nuvei {
         &self,
         request: &IncomingWebhookRequestDetails<'_>,
     ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
-        let body = serde_urlencoded::from_str::<nuvei::NuveiWebhookDetails>(&request.query_params)
+        // Parse the webhook payload
+        let webhook = serde_urlencoded::from_str::<nuvei::NuveiWebhook>(&request.query_params)
             .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
-        let payment_response = nuvei::NuveiPaymentsResponse::from(body);
+
+        // Convert webhook to payments response
+        let payment_response = nuvei::NuveiPaymentsResponse::from(webhook);
 
         Ok(Box::new(payment_response))
     }
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 9cc8476a4f4..6a2e26bc056 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1,9 +1,10 @@
-use common_enums::enums;
+use common_enums::{enums, CaptureMethod, PaymentChannel};
 use common_utils::{
     crypto::{self, GenerateDigest},
     date_time,
     ext_traits::{Encode, OptionExt},
     fp_utils,
+    id_type::CustomerId,
     pii::{Email, IpAddress},
     request::Method,
 };
@@ -14,10 +15,13 @@ use hyperswitch_domain_models::{
         self, ApplePayWalletData, BankRedirectData, GooglePayWalletData, PayLaterData,
         PaymentMethodData, WalletData,
     },
-    router_data::{ConnectorAuthType, ErrorResponse, RouterData},
+    router_data::{
+        AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData,
+        ErrorResponse, RouterData,
+    },
     router_flow_types::{
         refunds::{Execute, RSync},
-        Authorize, Capture, CompleteAuthorize, PSync, Void,
+        Authorize, Capture, CompleteAuthorize, PSync, PostCaptureVoid, Void,
     },
     router_request_types::{
         authentication::MessageExtensionAttribute, BrowserInformation, PaymentsAuthorizeData,
@@ -41,7 +45,7 @@ use crate::{
         PaymentsPreprocessingResponseRouterData, RefundsResponseRouterData, ResponseRouterData,
     },
     utils::{
-        self, AddressDetailsData, BrowserInformationData, ForeignTryFrom,
+        self, missing_field_err, AddressDetailsData, BrowserInformationData, ForeignTryFrom,
         PaymentsAuthorizeRequestData, PaymentsCancelRequestData, PaymentsPreProcessingRequestData,
         RouterData as _,
     },
@@ -61,21 +65,26 @@ fn to_boolean(string: String) -> bool {
 trait NuveiAuthorizePreprocessingCommon {
     fn get_browser_info(&self) -> Option<BrowserInformation>;
     fn get_related_transaction_id(&self) -> Option<String>;
-    fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>>;
     fn get_setup_mandate_details(&self) -> Option<MandateData>;
     fn get_complete_authorize_url(&self) -> Option<String>;
+    fn get_is_moto(&self) -> Option<bool>;
     fn get_connector_mandate_id(&self) -> Option<String>;
     fn get_return_url_required(
         &self,
     ) -> Result<String, error_stack::Report<errors::ConnectorError>>;
-    fn get_capture_method(&self) -> Option<enums::CaptureMethod>;
+    fn get_capture_method(&self) -> Option<CaptureMethod>;
     fn get_amount_required(&self) -> Result<i64, error_stack::Report<errors::ConnectorError>>;
+    fn get_customer_id_required(&self) -> Option<CustomerId>;
+    fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>>;
     fn get_currency_required(
         &self,
     ) -> Result<enums::Currency, error_stack::Report<errors::ConnectorError>>;
     fn get_payment_method_data_required(
         &self,
     ) -> Result<PaymentMethodData, error_stack::Report<errors::ConnectorError>>;
+    fn get_order_tax_amount(
+        &self,
+    ) -> Result<Option<i64>, error_stack::Report<errors::ConnectorError>>;
 }
 
 impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
@@ -86,9 +95,15 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
     fn get_related_transaction_id(&self) -> Option<String> {
         self.related_transaction_id.clone()
     }
+    fn get_is_moto(&self) -> Option<bool> {
+        match self.payment_channel {
+            Some(PaymentChannel::MailOrder) | Some(PaymentChannel::TelephoneOrder) => Some(true),
+            _ => None,
+        }
+    }
 
-    fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>> {
-        self.get_email()
+    fn get_customer_id_required(&self) -> Option<CustomerId> {
+        self.customer_id.clone()
     }
 
     fn get_setup_mandate_details(&self) -> Option<MandateData> {
@@ -109,7 +124,7 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
         self.get_router_return_url()
     }
 
-    fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
+    fn get_capture_method(&self) -> Option<CaptureMethod> {
         self.capture_method
     }
 
@@ -127,6 +142,15 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
     ) -> Result<PaymentMethodData, error_stack::Report<errors::ConnectorError>> {
         Ok(self.payment_method_data.clone())
     }
+    fn get_order_tax_amount(
+        &self,
+    ) -> Result<Option<i64>, error_stack::Report<errors::ConnectorError>> {
+        Ok(self.order_tax_amount.map(|tax| tax.get_amount_as_i64()))
+    }
+
+    fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>> {
+        self.get_email()
+    }
 }
 
 impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
@@ -138,10 +162,16 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
         self.related_transaction_id.clone()
     }
 
+    fn get_is_moto(&self) -> Option<bool> {
+        None
+    }
+
+    fn get_customer_id_required(&self) -> Option<CustomerId> {
+        None
+    }
     fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>> {
         self.get_email()
     }
-
     fn get_setup_mandate_details(&self) -> Option<MandateData> {
         self.setup_mandate_details.clone()
     }
@@ -160,7 +190,7 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
         self.get_router_return_url()
     }
 
-    fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
+    fn get_capture_method(&self) -> Option<CaptureMethod> {
         self.capture_method
     }
 
@@ -183,6 +213,11 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
             .into(),
         )
     }
+    fn get_order_tax_amount(
+        &self,
+    ) -> Result<Option<i64>, error_stack::Report<errors::ConnectorError>> {
+        Ok(None)
+    }
 }
 
 #[derive(Debug, Serialize, Default, Deserialize)]
@@ -219,6 +254,11 @@ pub struct NuveiSessionResponse {
     pub client_request_id: String,
 }
 
+#[derive(Debug, Serialize, Default)]
+#[serde(rename_all = "camelCase")]
+pub struct NuvieAmountDetails {
+    total_tax: Option<String>,
+}
 #[serde_with::skip_serializing_none]
 #[derive(Debug, Serialize, Default)]
 #[serde(rename_all = "camelCase")]
@@ -231,16 +271,19 @@ pub struct NuveiPaymentsRequest {
     pub amount: String,
     pub currency: enums::Currency,
     /// This ID uniquely identifies your consumer/user in your system.
-    pub user_token_id: Option<Email>,
+    pub user_token_id: Option<CustomerId>,
+    //unique transaction id
     pub client_unique_id: String,
     pub transaction_type: TransactionType,
     pub is_rebilling: Option<String>,
     pub payment_option: PaymentOption,
-    pub device_details: Option<DeviceDetails>,
+    pub is_moto: Option<bool>,
+    pub device_details: DeviceDetails,
     pub checksum: Secret<String>,
     pub billing_address: Option<BillingAddress>,
     pub related_transaction_id: Option<String>,
     pub url_details: Option<UrlDetails>,
+    pub amount_details: Option<NuvieAmountDetails>,
 }
 
 #[derive(Debug, Serialize, Default)]
@@ -421,11 +464,24 @@ pub struct ThreeD {
     #[serde(rename = "merchantURL")]
     pub merchant_url: Option<String>,
     pub acs_url: Option<String>,
+    pub acs_challenge_mandate: Option<String>,
     pub c_req: Option<Secret<String>>,
+    pub three_d_flow: Option<String>,
+    pub external_transaction_id: Option<String>,
+    pub transaction_id: Option<String>,
+    pub three_d_reason_id: Option<String>,
+    pub three_d_reason: Option<String>,
+    pub challenge_preference_reason: Option<String>,
+    pub challenge_cancel_reason_id: Option<String>,
+    pub challenge_cancel_reason: Option<String>,
+    pub is_liability_on_issuer: Option<String>,
+    pub is_exemption_request_in_authentication: Option<String>,
+    pub flow: Option<String>,
+    pub acquirer_decision: Option<String>,
+    pub decision_reason: Option<String>,
     pub platform_type: Option<PlatformType>,
     pub v2supported: Option<String>,
     pub v2_additional_params: Option<V2AdditionalParams>,
-    pub is_liability_on_issuer: Option<LiabilityShift>,
 }
 
 #[derive(Debug, Clone, Default, Serialize, Deserialize)]
@@ -479,11 +535,16 @@ pub struct DeviceDetails {
     pub ip_address: Secret<String, IpAddress>,
 }
 
-impl From<enums::CaptureMethod> for TransactionType {
-    fn from(value: enums::CaptureMethod) -> Self {
-        match value {
-            enums::CaptureMethod::Manual => Self::Auth,
-            _ => Self::Sale,
+impl TransactionType {
+    fn get_from_capture_method_and_amount_string(
+        capture_method: CaptureMethod,
+        amount: &str,
+    ) -> Self {
+        let amount_value = amount.parse::<f64>();
+        if capture_method == CaptureMethod::Manual || amount_value == Ok(0.0) {
+            Self::Auth
+        } else {
+            Self::Sale
         }
     }
 }
@@ -514,12 +575,14 @@ pub enum LiabilityShift {
     Failed,
 }
 
-fn encode_payload(payload: &[&str]) -> Result<String, error_stack::Report<errors::ConnectorError>> {
+pub fn encode_payload(
+    payload: &[&str],
+) -> Result<String, error_stack::Report<errors::ConnectorError>> {
     let data = payload.join("");
     let digest = crypto::Sha256
         .generate_digest(data.as_bytes())
         .change_context(errors::ConnectorError::RequestEncodingFailed)
-        .attach_printable("error encoding the payload")?;
+        .attach_printable("error encoding nuvie payload")?;
     Ok(hex::encode(digest))
 }
 
@@ -874,7 +937,7 @@ where
         .get_billing()?
         .address
         .as_ref()
-        .ok_or_else(utils::missing_field_err("billing.address"))?;
+        .ok_or_else(missing_field_err("billing.address"))?;
     let first_name = address.get_first_name()?;
     let payment_method = payment_method_type;
     Ok(NuveiPaymentsRequest {
@@ -1041,9 +1104,16 @@ where
             ..Default::default()
         })?;
         let return_url = item.request.get_return_url_required()?;
+
+        let amount_details = match item.request.get_order_tax_amount()? {
+            Some(tax) => Some(NuvieAmountDetails {
+                total_tax: Some(utils::to_currency_base_unit(tax, currency)?),
+            }),
+            None => None,
+        };
         Ok(Self {
             is_rebilling: request_data.is_rebilling,
-            user_token_id: request_data.user_token_id,
+            user_token_id: item.customer_id.clone(),
             related_transaction_id: request_data.related_transaction_id,
             payment_option: request_data.payment_option,
             billing_address: request_data.billing_address,
@@ -1051,8 +1121,10 @@ where
             url_details: Some(UrlDetails {
                 success_url: return_url.clone(),
                 failure_url: return_url.clone(),
-                pending_url: return_url,
+                pending_url: return_url.clone(),
             }),
+            amount_details,
+
             ..request
         })
     }
@@ -1105,7 +1177,7 @@ where
                     }
                 };
                 let mandate_meta: NuveiMandateMeta = utils::to_connector_meta_from_secret(Some(
-                    details.get_metadata().ok_or_else(utils::missing_field_err(
+                    details.get_metadata().ok_or_else(missing_field_err(
                         "mandate_data.mandate_type.{multi_use|single_use}.metadata",
                     ))?,
                 ))?;
@@ -1116,14 +1188,14 @@ where
                             details
                                 .get_end_date(date_time::DateFormat::YYYYMMDD)
                                 .change_context(errors::ConnectorError::DateFormattingFailed)?
-                                .ok_or_else(utils::missing_field_err(
+                                .ok_or_else(missing_field_err(
                                     "mandate_data.mandate_type.{multi_use|single_use}.end_date",
                                 ))?,
                         ),
                         rebill_frequency: Some(mandate_meta.frequency),
                         challenge_window_size: None,
                     }),
-                    Some(item.request.get_email_required()?),
+                    item.request.get_customer_id_required(),
                 )
             }
             _ => (None, None, None),
@@ -1159,20 +1231,19 @@ where
     } else {
         None
     };
-
+    let is_moto = item.request.get_is_moto();
     Ok(NuveiPaymentsRequest {
         related_transaction_id,
         is_rebilling,
         user_token_id,
-        device_details: Option::<DeviceDetails>::foreign_try_from(
-            &item.request.get_browser_info().clone(),
-        )?,
+        device_details: DeviceDetails::foreign_try_from(&item.request.get_browser_info().clone())?,
         payment_option: PaymentOption::from(NuveiCardDetails {
             card: card_details.clone(),
             three_d,
             card_holder_name: item.get_optional_billing_full_name(),
         }),
         billing_address,
+        is_moto,
         ..Default::default()
     })
 }
@@ -1265,16 +1336,17 @@ impl TryFrom<NuveiPaymentRequestData> for NuveiPaymentsRequest {
             date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss)
                 .change_context(errors::ConnectorError::RequestEncodingFailed)?;
         let merchant_secret = connector_meta.merchant_secret;
+        let transaction_type = TransactionType::get_from_capture_method_and_amount_string(
+            request.capture_method.unwrap_or_default(),
+            &request.amount,
+        );
         Ok(Self {
             merchant_id: merchant_id.clone(),
             merchant_site_id: merchant_site_id.clone(),
             client_request_id: Secret::new(client_request_id.clone()),
             time_stamp: time_stamp.clone(),
             session_token,
-            transaction_type: request
-                .capture_method
-                .map(TransactionType::from)
-                .unwrap_or_default(),
+            transaction_type,
             checksum: Secret::new(encode_payload(&[
                 merchant_id.peek(),
                 merchant_site_id.peek(),
@@ -1285,6 +1357,7 @@ impl TryFrom<NuveiPaymentRequestData> for NuveiPaymentsRequest {
                 merchant_secret.peek(),
             ])?),
             amount: request.amount,
+            user_token_id: None,
             currency: request.currency,
             ..Default::default()
         })
@@ -1332,7 +1405,7 @@ pub struct NuveiPaymentRequestData {
     pub client_request_id: String,
     pub connector_auth_type: ConnectorAuthType,
     pub session_token: Secret<String>,
-    pub capture_method: Option<enums::CaptureMethod>,
+    pub capture_method: Option<CaptureMethod>,
 }
 
 impl TryFrom<&types::PaymentsCaptureRouterData> for NuveiPaymentFlowRequest {
@@ -1378,6 +1451,57 @@ impl TryFrom<&types::PaymentsSyncRouterData> for NuveiPaymentSyncRequest {
     }
 }
 
+#[derive(Debug, Serialize, Default)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiVoidRequest {
+    pub merchant_id: Secret<String>,
+    pub merchant_site_id: Secret<String>,
+    pub client_unique_id: String,
+    pub related_transaction_id: String,
+    pub time_stamp: String,
+    pub checksum: Secret<String>,
+    pub client_request_id: String,
+}
+
+impl TryFrom<&types::PaymentsCancelPostCaptureRouterData> for NuveiVoidRequest {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(item: &types::PaymentsCancelPostCaptureRouterData) -> Result<Self, Self::Error> {
+        let connector_meta: NuveiAuthType = NuveiAuthType::try_from(&item.connector_auth_type)?;
+        let merchant_id = connector_meta.merchant_id.clone();
+        let merchant_site_id = connector_meta.merchant_site_id.clone();
+        let merchant_secret = connector_meta.merchant_secret.clone();
+        let client_unique_id = item.connector_request_reference_id.clone();
+        let related_transaction_id = item.request.connector_transaction_id.clone();
+        let client_request_id = item.connector_request_reference_id.clone();
+        let time_stamp =
+            date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss)
+                .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+        let checksum = Secret::new(encode_payload(&[
+            merchant_id.peek(),
+            merchant_site_id.peek(),
+            &client_request_id,
+            &client_unique_id,
+            "", // amount (empty for void)
+            "", // currency (empty for void)
+            &related_transaction_id,
+            "", // authCode (empty)
+            "", // comment (empty)
+            &time_stamp,
+            merchant_secret.peek(),
+        ])?);
+
+        Ok(Self {
+            merchant_id,
+            merchant_site_id,
+            client_unique_id,
+            related_transaction_id,
+            time_stamp,
+            checksum,
+            client_request_id,
+        })
+    }
+}
+
 impl TryFrom<&types::PaymentsCancelRouterData> for NuveiPaymentFlowRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
@@ -1484,9 +1608,10 @@ pub struct NuveiPaymentsResponse {
     pub merchant_site_id: Option<Secret<String>>,
     pub version: Option<String>,
     pub client_request_id: Option<String>,
+    pub merchant_advice_code: Option<String>,
 }
 
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
 pub enum NuveiTransactionType {
     Auth,
     Sale,
@@ -1503,7 +1628,29 @@ pub struct FraudDetails {
     pub final_decision: String,
 }
 
-fn get_payment_status(response: &NuveiPaymentsResponse) -> enums::AttemptStatus {
+fn get_payment_status(
+    response: &NuveiPaymentsResponse,
+    amount: Option<i64>,
+) -> enums::AttemptStatus {
+    // ZERO dollar authorization
+    if amount == Some(0) && response.transaction_type.clone() == Some(NuveiTransactionType::Auth) {
+        return match response.transaction_status.clone() {
+            Some(NuveiTransactionStatus::Approved) => enums::AttemptStatus::Charged,
+            Some(NuveiTransactionStatus::Declined) | Some(NuveiTransactionStatus::Error) => {
+                enums::AttemptStatus::AuthorizationFailed
+            }
+            Some(NuveiTransactionStatus::Pending) | Some(NuveiTransactionStatus::Processing) => {
+                enums::AttemptStatus::Pending
+            }
+            Some(NuveiTransactionStatus::Redirect) => enums::AttemptStatus::AuthenticationPending,
+            None => match response.status {
+                NuveiPaymentStatus::Failed | NuveiPaymentStatus::Error => {
+                    enums::AttemptStatus::Failure
+                }
+                _ => enums::AttemptStatus::Pending,
+            },
+        };
+    }
     match response.transaction_status.clone() {
         Some(status) => match status {
             NuveiTransactionStatus::Approved => match response.transaction_type {
@@ -1539,15 +1686,32 @@ fn get_payment_status(response: &NuveiPaymentsResponse) -> enums::AttemptStatus
 fn build_error_response<T>(
     response: &NuveiPaymentsResponse,
     http_code: u16,
-) -> Option<Result<T, ErrorResponse>> {
+) -> Option<Result<T, error_stack::Report<errors::ConnectorError>>> {
     match response.status {
         NuveiPaymentStatus::Error => Some(
-            get_error_response(response.err_code, &response.reason, http_code).map_err(|err| *err),
+            get_error_response(
+                response.err_code,
+                &response.reason,
+                http_code,
+                &response.merchant_advice_code,
+                &response.gw_error_code.map(|e| e.to_string()),
+                &response.gw_error_reason,
+            )
+            .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)),
         ),
         _ => {
             let err = Some(
-                get_error_response(response.gw_error_code, &response.gw_error_reason, http_code)
-                    .map_err(|err| *err),
+                get_error_response(
+                    response.gw_error_code,
+                    &response.gw_error_reason,
+                    http_code,
+                    &response.merchant_advice_code,
+                    &response.gw_error_code.map(|e| e.to_string()),
+                    &response.gw_error_reason,
+                )
+                .map_err(|_err| {
+                    error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)
+                }),
             );
             match response.transaction_status {
                 Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err,
@@ -1566,86 +1730,174 @@ fn build_error_response<T>(
 
 pub trait NuveiPaymentsGenericResponse {}
 
-impl NuveiPaymentsGenericResponse for Authorize {}
 impl NuveiPaymentsGenericResponse for CompleteAuthorize {}
 impl NuveiPaymentsGenericResponse for Void {}
 impl NuveiPaymentsGenericResponse for PSync {}
 impl NuveiPaymentsGenericResponse for Capture {}
+impl NuveiPaymentsGenericResponse for PostCaptureVoid {}
+
+// Helper function to process Nuvei payment response
+
+fn process_nuvei_payment_response<F, T>(
+    item: &ResponseRouterData<F, NuveiPaymentsResponse, T, PaymentsResponseData>,
+    amount: Option<i64>,
+) -> Result<
+    (
+        enums::AttemptStatus,
+        Option<RedirectForm>,
+        Option<ConnectorResponseData>,
+    ),
+    error_stack::Report<errors::ConnectorError>,
+>
+where
+    F: std::fmt::Debug,
+    T: std::fmt::Debug,
+{
+    let redirection_data = match item.data.payment_method {
+        enums::PaymentMethod::Wallet | enums::PaymentMethod::BankRedirect => item
+            .response
+            .payment_option
+            .as_ref()
+            .and_then(|po| po.redirect_url.clone())
+            .map(|base_url| RedirectForm::from((base_url, Method::Get))),
+        _ => item
+            .response
+            .payment_option
+            .as_ref()
+            .and_then(|o| o.card.clone())
+            .and_then(|card| card.three_d)
+            .and_then(|three_ds| three_ds.acs_url.zip(three_ds.c_req))
+            .map(|(base_url, creq)| RedirectForm::Form {
+                endpoint: base_url,
+                method: Method::Post,
+                form_fields: std::collections::HashMap::from([("creq".to_string(), creq.expose())]),
+            }),
+    };
+
+    let connector_response_data =
+        convert_to_additional_payment_method_connector_response(&item.response)
+            .map(ConnectorResponseData::with_additional_payment_method_data);
+
+    let status = get_payment_status(&item.response, amount);
+
+    Ok((status, redirection_data, connector_response_data))
+}
+
+// Helper function to create transaction response
+fn create_transaction_response(
+    response: &NuveiPaymentsResponse,
+    redirection_data: Option<RedirectForm>,
+    http_code: u16,
+) -> Result<PaymentsResponseData, error_stack::Report<errors::ConnectorError>> {
+    if let Some(err) = build_error_response(response, http_code) {
+        return err;
+    }
+
+    Ok(PaymentsResponseData::TransactionResponse {
+        resource_id: response
+            .transaction_id
+            .clone()
+            .map_or(response.order_id.clone(), Some) // For paypal there will be no transaction_id, only order_id will be present
+            .map(ResponseId::ConnectorTransactionId)
+            .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
+        redirection_data: Box::new(redirection_data),
+        mandate_reference: Box::new(
+            response
+                .payment_option
+                .as_ref()
+                .and_then(|po| po.user_payment_option_id.clone())
+                .map(|id| MandateReference {
+                    connector_mandate_id: Some(id),
+                    payment_method_id: None,
+                    mandate_metadata: None,
+                    connector_mandate_request_reference_id: None,
+                }),
+        ),
+        // we don't need to save session token for capture, void flow so ignoring if it is not present
+        connector_metadata: if let Some(token) = response.session_token.clone() {
+            Some(
+                serde_json::to_value(NuveiMeta {
+                    session_token: token,
+                })
+                .change_context(errors::ConnectorError::ResponseHandlingFailed)?,
+            )
+        } else {
+            None
+        },
+        network_txn_id: None,
+        connector_response_reference_id: response.order_id.clone(),
+        incremental_authorization_allowed: None,
+        charges: None,
+    })
+}
 
+// Specialized implementation for Authorize
+impl
+    TryFrom<
+        ResponseRouterData<
+            Authorize,
+            NuveiPaymentsResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    > for RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn try_from(
+        item: ResponseRouterData<
+            Authorize,
+            NuveiPaymentsResponse,
+            PaymentsAuthorizeData,
+            PaymentsResponseData,
+        >,
+    ) -> Result<Self, Self::Error> {
+        // Get amount directly from the authorize data
+        let amount = Some(item.data.request.amount);
+
+        let (status, redirection_data, connector_response_data) =
+            process_nuvei_payment_response(&item, amount)?;
+
+        Ok(Self {
+            status,
+            response: Ok(create_transaction_response(
+                &item.response,
+                redirection_data,
+                item.http_code,
+            )?),
+            connector_response: connector_response_data,
+            ..item.data
+        })
+    }
+}
+
+// Generic implementation for other flow types
 impl<F, T> TryFrom<ResponseRouterData<F, NuveiPaymentsResponse, T, PaymentsResponseData>>
     for RouterData<F, T, PaymentsResponseData>
 where
-    F: NuveiPaymentsGenericResponse,
+    F: NuveiPaymentsGenericResponse + std::fmt::Debug,
+    T: std::fmt::Debug,
+    F: std::any::Any,
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
         item: ResponseRouterData<F, NuveiPaymentsResponse, T, PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
-        let redirection_data = match item.data.payment_method {
-            enums::PaymentMethod::Wallet | enums::PaymentMethod::BankRedirect => item
-                .response
-                .payment_option
-                .as_ref()
-                .and_then(|po| po.redirect_url.clone())
-                .map(|base_url| RedirectForm::from((base_url, Method::Get))),
-            _ => item
-                .response
-                .payment_option
-                .as_ref()
-                .and_then(|o| o.card.clone())
-                .and_then(|card| card.three_d)
-                .and_then(|three_ds| three_ds.acs_url.zip(three_ds.c_req))
-                .map(|(base_url, creq)| RedirectForm::Form {
-                    endpoint: base_url,
-                    method: Method::Post,
-                    form_fields: std::collections::HashMap::from([(
-                        "creq".to_string(),
-                        creq.expose(),
-                    )]),
-                }),
-        };
+        let amount = item
+            .data
+            .minor_amount_capturable
+            .map(|amount| amount.get_amount_as_i64());
+
+        let (status, redirection_data, connector_response_data) =
+            process_nuvei_payment_response(&item, amount)?;
 
-        let response = item.response;
         Ok(Self {
-            status: get_payment_status(&response),
-            response: if let Some(err) = build_error_response(&response, item.http_code) {
-                err
-            } else {
-                Ok(PaymentsResponseData::TransactionResponse {
-                    resource_id: response
-                        .transaction_id
-                        .map_or(response.order_id.clone(), Some) // For paypal there will be no transaction_id, only order_id will be present
-                        .map(ResponseId::ConnectorTransactionId)
-                        .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
-                    redirection_data: Box::new(redirection_data),
-                    mandate_reference: Box::new(
-                        response
-                            .payment_option
-                            .and_then(|po| po.user_payment_option_id)
-                            .map(|id| MandateReference {
-                                connector_mandate_id: Some(id),
-                                payment_method_id: None,
-                                mandate_metadata: None,
-                                connector_mandate_request_reference_id: None,
-                            }),
-                    ),
-                    // we don't need to save session token for capture, void flow so ignoring if it is not present
-                    connector_metadata: if let Some(token) = response.session_token {
-                        Some(
-                            serde_json::to_value(NuveiMeta {
-                                session_token: token,
-                            })
-                            .change_context(errors::ConnectorError::ResponseHandlingFailed)?,
-                        )
-                    } else {
-                        None
-                    },
-                    network_txn_id: None,
-                    connector_response_reference_id: response.order_id,
-                    incremental_authorization_allowed: None,
-                    charges: None,
-                })
-            },
+            status,
+            response: Ok(create_transaction_response(
+                &item.response,
+                redirection_data,
+                item.http_code,
+            )?),
+            connector_response: connector_response_data,
             ..item.data
         })
     }
@@ -1668,11 +1920,12 @@ impl TryFrom<PaymentsPreprocessingResponseRouterData<NuveiPaymentsResponse>>
             .map(to_boolean)
             .unwrap_or_default();
         Ok(Self {
-            status: get_payment_status(&response),
+            status: get_payment_status(&response, item.data.request.amount),
             response: Ok(PaymentsResponseData::ThreeDSEnrollmentResponse {
                 enrolled_v2: is_enrolled_for_3ds,
                 related_transaction_id: response.transaction_id,
             }),
+
             ..item.data
         })
     }
@@ -1697,15 +1950,17 @@ impl TryFrom<RefundsResponseRouterData<Execute, NuveiPaymentsResponse>>
     fn try_from(
         item: RefundsResponseRouterData<Execute, NuveiPaymentsResponse>,
     ) -> Result<Self, Self::Error> {
+        let transaction_id = item
+            .response
+            .transaction_id
+            .clone()
+            .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;
+
+        let refund_response =
+            get_refund_response(item.response.clone(), item.http_code, transaction_id)?;
+
         Ok(Self {
-            response: get_refund_response(
-                item.response.clone(),
-                item.http_code,
-                item.response
-                    .transaction_id
-                    .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
-            )
-            .map_err(|err| *err),
+            response: Ok(refund_response),
             ..item.data
         })
     }
@@ -1718,15 +1973,17 @@ impl TryFrom<RefundsResponseRouterData<RSync, NuveiPaymentsResponse>>
     fn try_from(
         item: RefundsResponseRouterData<RSync, NuveiPaymentsResponse>,
     ) -> Result<Self, Self::Error> {
+        let transaction_id = item
+            .response
+            .transaction_id
+            .clone()
+            .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;
+
+        let refund_response =
+            get_refund_response(item.response.clone(), item.http_code, transaction_id)?;
+
         Ok(Self {
-            response: get_refund_response(
-                item.response.clone(),
-                item.http_code,
-                item.response
-                    .transaction_id
-                    .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
-            )
-            .map_err(|err| *err),
+            response: Ok(refund_response),
             ..item.data
         })
     }
@@ -1741,6 +1998,10 @@ where
         {
             let item = data;
             let connector_mandate_id = &item.request.get_connector_mandate_id();
+            let customer_id = item
+                .request
+                .get_customer_id_required()
+                .ok_or(missing_field_err("customer_id")())?;
             let related_transaction_id = if item.is_three_ds() {
                 item.request.get_related_transaction_id().clone()
             } else {
@@ -1748,11 +2009,11 @@ where
             };
             Ok(Self {
                 related_transaction_id,
-                device_details: Option::<DeviceDetails>::foreign_try_from(
+                device_details: DeviceDetails::foreign_try_from(
                     &item.request.get_browser_info().clone(),
                 )?,
                 is_rebilling: Some("1".to_string()), // In case of second installment, rebilling should be 1
-                user_token_id: Some(item.request.get_email_required()?),
+                user_token_id: Some(customer_id),
                 payment_option: PaymentOption {
                     user_payment_option_id: connector_mandate_id.clone(),
                     ..Default::default()
@@ -1763,16 +2024,15 @@ where
     }
 }
 
-impl ForeignTryFrom<&Option<BrowserInformation>> for Option<DeviceDetails> {
+impl ForeignTryFrom<&Option<BrowserInformation>> for DeviceDetails {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn foreign_try_from(browser_info: &Option<BrowserInformation>) -> Result<Self, Self::Error> {
-        let device_details = match browser_info {
-            Some(browser_info) => Some(DeviceDetails {
-                ip_address: browser_info.get_ip_address()?,
-            }),
-            None => None,
-        };
-        Ok(device_details)
+        let browser_info = browser_info
+            .as_ref()
+            .ok_or_else(missing_field_err("browser_info"))?;
+        Ok(Self {
+            ip_address: browser_info.get_ip_address()?,
+        })
     }
 }
 
@@ -1780,20 +2040,32 @@ fn get_refund_response(
     response: NuveiPaymentsResponse,
     http_code: u16,
     txn_id: String,
-) -> Result<RefundsResponseData, Box<ErrorResponse>> {
+) -> Result<RefundsResponseData, error_stack::Report<errors::ConnectorError>> {
     let refund_status = response
         .transaction_status
         .clone()
         .map(enums::RefundStatus::from)
         .unwrap_or(enums::RefundStatus::Failure);
     match response.status {
-        NuveiPaymentStatus::Error => {
-            get_error_response(response.err_code, &response.reason, http_code)
-        }
+        NuveiPaymentStatus::Error => get_error_response(
+            response.err_code,
+            &response.reason,
+            http_code,
+            &response.merchant_advice_code,
+            &response.gw_error_code.map(|e| e.to_string()),
+            &response.gw_error_reason,
+        )
+        .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)),
         _ => match response.transaction_status {
-            Some(NuveiTransactionStatus::Error) => {
-                get_error_response(response.gw_error_code, &response.gw_error_reason, http_code)
-            }
+            Some(NuveiTransactionStatus::Error) => get_error_response(
+                response.err_code,
+                &response.reason,
+                http_code,
+                &response.merchant_advice_code,
+                &response.gw_error_code.map(|e| e.to_string()),
+                &response.gw_error_reason,
+            )
+            .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)),
             _ => Ok(RefundsResponseData {
                 connector_refund_id: txn_id,
                 refund_status,
@@ -1806,6 +2078,9 @@ fn get_error_response<T>(
     error_code: Option<i64>,
     error_msg: &Option<String>,
     http_code: u16,
+    network_advice_code: &Option<String>,
+    network_decline_code: &Option<String>,
+    network_error_message: &Option<String>,
 ) -> Result<T, Box<ErrorResponse>> {
     Err(Box::new(ErrorResponse {
         code: error_code
@@ -1818,80 +2093,299 @@ fn get_error_response<T>(
         status_code: http_code,
         attempt_status: None,
         connector_transaction_id: None,
-        network_advice_code: None,
-        network_decline_code: None,
-        network_error_message: None,
+        network_advice_code: network_advice_code.clone(),
+        network_decline_code: network_decline_code.clone(),
+        network_error_message: network_error_message.clone(),
     }))
 }
 
-#[derive(Debug, Default, Serialize, Deserialize)]
-pub struct NuveiWebhookDetails {
-    pub ppp_status: Option<String>,
+/// Represents any possible webhook notification from Nuvei.
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum NuveiWebhook {
+    PaymentDmn(PaymentDmnNotification),
+    Chargeback(ChargebackNotification),
+}
+
+/// Represents the status of a chargeback event.
+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
+pub enum ChargebackStatus {
+    RetrievalRequest,
+    Chargeback,
+    Representment,
+    SecondChargeback,
+    Arbitration,
+    #[serde(other)]
+    Unknown,
+}
+
+/// Represents a Chargeback webhook notification from the Nuvei Control Panel.
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChargebackNotification {
     #[serde(rename = "ppp_TransactionID")]
-    pub ppp_transaction_id: String,
-    #[serde(rename = "TransactionId")]
+    pub ppp_transaction_id: Option<String>,
+    pub merchant_unique_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub merchant_site_id: Option<String>,
+    pub request_version: Option<String>,
+    pub message: Option<String>,
+    pub status: Option<ChargebackStatus>,
+    pub reason: Option<String>,
+    pub case_id: Option<String>,
+    pub processor_case_id: Option<String>,
+    pub arn: Option<String>,
+    pub retrieval_request_date: Option<String>,
+    pub chargeback_date: Option<String>,
+    pub chargeback_amount: Option<String>,
+    pub chargeback_currency: Option<String>,
+    pub original_amount: Option<String>,
+    pub original_currency: Option<String>,
+    #[serde(rename = "transactionID")]
+    pub transaction_id: Option<String>,
+    pub user_token_id: Option<String>,
+}
+
+/// Represents the overall status of the DMN.
+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum DmnStatus {
+    Success,
+    Error,
+    Pending,
+}
+
+/// Represents the status of the transaction itself.
+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum TransactionStatus {
+    Approved,
+    Declined,
+    Error,
+    Cancelled,
+    Pending,
+    #[serde(rename = "Settle")]
+    Settled,
+}
+
+/// Represents the type of transaction.
+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "PascalCase")]
+pub enum PaymentTransactionType {
+    Auth,
+    Sale,
+    Settle,
+    Credit,
+    Void,
+    Auth3D,
+    Sale3D,
+    Verif,
+}
+
+/// Represents a Payment Direct Merchant Notification (DMN) webhook.
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentDmnNotification {
+    #[serde(rename = "PPP_TransactionID")]
+    pub ppp_transaction_id: Option<String>,
+    #[serde(rename = "TransactionID")]
     pub transaction_id: Option<String>,
-    pub userid: Option<String>,
+    pub status: Option<DmnStatus>,
+    #[serde(rename = "ErrCode")]
+    pub err_code: Option<String>,
+    #[serde(rename = "ExErrCode")]
+    pub ex_err_code: Option<String>,
+    pub desc: Option<String>,
     pub merchant_unique_id: Option<String>,
-    #[serde(rename = "customData")]
     pub custom_data: Option<String>,
-    #[serde(rename = "productId")]
-    pub product_id: String,
+    pub product_id: Option<String>,
     pub first_name: Option<String>,
     pub last_name: Option<String>,
     pub email: Option<String>,
-    #[serde(rename = "totalAmount")]
-    pub total_amount: String,
-    pub currency: String,
+    pub total_amount: Option<String>,
+    pub currency: Option<String>,
+    pub fee: Option<String>,
+    #[serde(rename = "AuthCode")]
+    pub auth_code: Option<String>,
+    pub transaction_status: Option<TransactionStatus>,
+    pub transaction_type: Option<PaymentTransactionType>,
+    #[serde(rename = "user_token_id")]
+    pub user_token_id: Option<String>,
+    #[serde(rename = "payment_method")]
+    pub payment_method: Option<String>,
     #[serde(rename = "responseTimeStamp")]
-    pub response_time_stamp: String,
-    #[serde(rename = "Status")]
-    pub status: NuveiWebhookStatus,
-    #[serde(rename = "transactionType")]
-    pub transaction_type: Option<NuveiTransactionType>,
-}
-
+    pub response_time_stamp: Option<String>,
+    #[serde(rename = "invoice_id")]
+    pub invoice_id: Option<String>,
+    #[serde(rename = "merchant_id")]
+    pub merchant_id: Option<String>,
+    #[serde(rename = "merchant_site_id")]
+    pub merchant_site_id: Option<String>,
+    #[serde(rename = "responsechecksum")]
+    pub response_checksum: Option<String>,
+    #[serde(rename = "advanceResponseChecksum")]
+    pub advance_response_checksum: Option<String>,
+}
+
+// For backward compatibility with existing code
 #[derive(Debug, Default, Serialize, Deserialize)]
 pub struct NuveiWebhookTransactionId {
     #[serde(rename = "ppp_TransactionID")]
     pub ppp_transaction_id: String,
 }
 
-#[derive(Debug, Default, Serialize, Deserialize)]
-pub struct NuveiWebhookDataStatus {
-    #[serde(rename = "Status")]
-    pub status: NuveiWebhookStatus,
+// Helper struct to extract transaction ID from either webhook type
+impl From<&NuveiWebhook> for NuveiWebhookTransactionId {
+    fn from(webhook: &NuveiWebhook) -> Self {
+        match webhook {
+            NuveiWebhook::Chargeback(notification) => Self {
+                ppp_transaction_id: notification.ppp_transaction_id.clone().unwrap_or_default(),
+            },
+            NuveiWebhook::PaymentDmn(notification) => Self {
+                ppp_transaction_id: notification.ppp_transaction_id.clone().unwrap_or_default(),
+            },
+        }
+    }
 }
 
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "UPPERCASE")]
-pub enum NuveiWebhookStatus {
-    Approved,
-    Declined,
-    #[default]
-    Pending,
-    Update,
-    #[serde(other)]
-    Unknown,
+// Convert webhook to payments response for further processing
+impl From<NuveiWebhook> for NuveiPaymentsResponse {
+    fn from(webhook: NuveiWebhook) -> Self {
+        match webhook {
+            NuveiWebhook::Chargeback(notification) => Self {
+                transaction_status: Some(NuveiTransactionStatus::Processing),
+                transaction_id: notification.transaction_id,
+                transaction_type: Some(NuveiTransactionType::Credit), // Using Credit as placeholder for chargeback
+                ..Default::default()
+            },
+            NuveiWebhook::PaymentDmn(notification) => {
+                let transaction_type = notification.transaction_type.map(|tt| match tt {
+                    PaymentTransactionType::Auth => NuveiTransactionType::Auth,
+                    PaymentTransactionType::Sale => NuveiTransactionType::Sale,
+                    PaymentTransactionType::Settle => NuveiTransactionType::Settle,
+                    PaymentTransactionType::Credit => NuveiTransactionType::Credit,
+                    PaymentTransactionType::Void => NuveiTransactionType::Void,
+                    PaymentTransactionType::Auth3D => NuveiTransactionType::Auth3D,
+                    PaymentTransactionType::Sale3D => NuveiTransactionType::Auth3D, // Map to closest equivalent
+                    PaymentTransactionType::Verif => NuveiTransactionType::Auth, // Map to closest equivalent
+                });
+
+                Self {
+                    transaction_status: notification.transaction_status.map(|ts| match ts {
+                        TransactionStatus::Approved => NuveiTransactionStatus::Approved,
+                        TransactionStatus::Declined => NuveiTransactionStatus::Declined,
+                        TransactionStatus::Error => NuveiTransactionStatus::Error,
+                        TransactionStatus::Settled => NuveiTransactionStatus::Approved,
+                        _ => NuveiTransactionStatus::Processing,
+                    }),
+                    transaction_id: notification.transaction_id,
+                    transaction_type,
+                    ..Default::default()
+                }
+            }
+        }
+    }
 }
 
-impl From<NuveiWebhookStatus> for NuveiTransactionStatus {
-    fn from(status: NuveiWebhookStatus) -> Self {
-        match status {
-            NuveiWebhookStatus::Approved => Self::Approved,
-            NuveiWebhookStatus::Declined => Self::Declined,
-            _ => Self::Processing,
-        }
+fn get_cvv2_response_description(code: &str) -> Option<&str> {
+    match code {
+        "M" => Some("CVV2 Match"),
+        "N" => Some("CVV2 No Match"),
+        "P" => Some("Not Processed. For EU card-on-file (COF) and ecommerce (ECOM) network token transactions, Visa removes any CVV and sends P. If you have fraud or security concerns, Visa recommends using 3DS."),
+        "U" => Some("Issuer is not certified and/or has not provided Visa the encryption keys"),
+        "S" => Some("CVV2 processor is unavailable."),
+        _=> None,
     }
 }
 
-impl From<NuveiWebhookDetails> for NuveiPaymentsResponse {
-    fn from(item: NuveiWebhookDetails) -> Self {
-        Self {
-            transaction_status: Some(NuveiTransactionStatus::from(item.status)),
-            transaction_id: item.transaction_id,
-            transaction_type: item.transaction_type,
-            ..Default::default()
-        }
+fn get_avs_response_description(code: &str) -> Option<&str> {
+    match code {
+        "A" => Some("The street address matches, the ZIP code does not."),
+        "W" => Some("Postal code matches, the street address does not."),
+        "Y" => Some("Postal code and the street address match."),
+        "X" => Some("An exact match of both the 9-digit ZIP code and the street address."),
+        "Z" => Some("Postal code matches, the street code does not."),
+        "U" => Some("Issuer is unavailable."),
+        "S" => Some("AVS not supported by issuer."),
+        "R" => Some("Retry."),
+        "B" => Some("Not authorized (declined)."),
+        "N" => Some("Both the street address and postal code do not match."),
+        _ => None,
+    }
+}
+
+fn get_merchant_advice_code_description(code: &str) -> Option<&str> {
+    match code {
+        "01" => Some("New Account Information Available"),
+        "02" => Some("Cannot approve at this time, try again later"),
+        "03" => Some("Do Not Try Again"),
+        "04" => Some("Token requirements not fulfilled for this token type"),
+        "21" => Some("Payment Cancellation, do not try again"),
+        "24" => Some("Retry after 1 hour"),
+        "25" => Some("Retry after 24 hours"),
+        "26" => Some("Retry after 2 days"),
+        "27" => Some("Retry after 4 days"),
+        "28" => Some("Retry after 6 days"),
+        "29" => Some("Retry after 8 days"),
+        "30" => Some("Retry after 10 days"),
+        "40" => Some("Card is a consumer non-reloadable prepaid card"),
+        "41" => Some("Card is a consumer single-use virtual card number"),
+        "42" => Some("Transaction type exceeds issuer's risk threshold. Please retry with another payment account."),
+        "43" => Some("Card is a consumer multi-use virtual card number"),
+        _ => None,
+    }
+}
+
+/// Concatenates a vector of strings without any separator
+/// This is useful for creating verification messages for webhooks
+pub fn concat_strings(strings: &[String]) -> String {
+    strings.join("")
+}
+
+fn convert_to_additional_payment_method_connector_response(
+    transaction_response: &NuveiPaymentsResponse,
+) -> Option<AdditionalPaymentMethodConnectorResponse> {
+    let card = transaction_response
+        .payment_option
+        .as_ref()?
+        .card
+        .as_ref()?;
+    let avs_code = card.avs_code.as_ref();
+    let cvv2_code = card.cvv2_reply.as_ref();
+    let merchant_advice_code = transaction_response.merchant_advice_code.as_ref();
+
+    let avs_description = avs_code.and_then(|code| get_avs_response_description(code));
+    let cvv_description = cvv2_code.and_then(|code| get_cvv2_response_description(code));
+    let merchant_advice_description =
+        merchant_advice_code.and_then(|code| get_merchant_advice_code_description(code));
+
+    let payment_checks = serde_json::json!({
+        "avs_result_code": avs_code,
+        "avs_description": avs_description,
+        "cvv_2_reply_code": cvv2_code,
+        "cvv_2_description": cvv_description,
+        "merchant_advice_code": merchant_advice_code,
+        "merchant_advice_code_description": merchant_advice_description
+    });
+
+    let card_network = card.card_brand.clone();
+    let three_ds_data = card
+        .three_d
+        .clone()
+        .map(|three_d| {
+            serde_json::to_value(three_d)
+                .map_err(|_| errors::ConnectorError::ResponseHandlingFailed)
+                .attach_printable("threeDs encoding failed Nuvei")
+        })
+        .transpose();
+
+    match three_ds_data {
+        Ok(authentication_data) => Some(AdditionalPaymentMethodConnectorResponse::Card {
+            authentication_data,
+            payment_checks: Some(payment_checks),
+            card_network,
+            domestic_network: None,
+        }),
+        Err(_) => None,
     }
 }
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 22c87d08323..2ecdf1f4de1 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -1058,7 +1058,6 @@ default_imp_for_cancel_post_capture!(
     connectors::Nexixpay,
     connectors::Opayo,
     connectors::Opennode,
-    connectors::Nuvei,
     connectors::Nmi,
     connectors::Paybox,
     connectors::Payeezy,
 | 
	2025-07-28T08:38:26Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Added few Nuvie features
- AVC,CVV : pass the response of AVC , CVV checks from Nuvie to Hypserswitch payment resonse (check in any below responses)
```json
    "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
```
- Post Capture Void : After capture of successful amount we should be able to make void (typically before 24 hours)
- 0$ transaction : Allow 0$ transaction // We are going to change this to setup mandate flow in upcomming pr rightnow its routing through AUTHORIZE flow itself . We can skip the test for this as of now.
<!-- Describe your changes in detail -->
## zero dollar transaction
<details>
 <summary>
Get connector mandate id with 0 transaction initization `/payments`
</summary>
## Request
```json
{
    "amount": 0,
    "currency": "EUR",
    "confirm": true,
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    // "order_tax_amount": 100,
    "setup_future_usage": "off_session",
    // "payment_type":"setup_mandate",
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_type": "credit",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000009995",
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "card_cvc": "100"
        }
    }
}
```
## response
```json
{
    "payment_id": "pay_bnO3yXpju09Ws8oBUR9w",
    "merchant_id": "merchant_1754498214",
    "status": "requires_capture",
    "amount": 0,
    "net_amount": 0,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_bnO3yXpju09Ws8oBUR9w_secret_Y6WO2DC3Uidzbeb7WyWa",
    "created": "2025-08-06T17:23:41.192Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "9995",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_rO5qEPT5099xgR6E600V",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1754501021,
        "expires": 1754504621,
        "secret": "epk_6fb49f9cdabd42dd9d33789fb584df66"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016293888",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7657741111",
    "payment_link": null,
    "profile_id": "pro_Lm9uDS83De6QX5EHQNMy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BgWz2Uy3MgHlzzgy7W7H",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-06T17:38:41.192Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_Ku0TdAhmkKDiX9TqhomL",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-06T17:23:46.105Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2073997111", // connector mandate id 
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
 <summary> Mandates triggered using 0 transcation payment method id </summary>
## Request
```json
curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gvwtxVj8XLUh0di5xt8yUkxS187Wlr733tSxZh7Aof45gYnrteTvmP2aJvFD8vdj' \
--data '{
    "amount": 333,
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_Ku0TdAhmkKDiX9TqhomL" 
    },
       "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    }
}'
```
##response
```json
{
    "payment_id": "pay_eW2XRbgGai3X3RpAVVGD",
    "merchant_id": "merchant_1754498214",
    "status": "succeeded",
    "amount": 333,
    "net_amount": 333,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 333,
    "connector": "nuvei",
    "client_secret": "pay_eW2XRbgGai3X3RpAVVGD_secret_H6pCfoxWHonNwkXzyHD2",
    "created": "2025-08-06T17:34:58.537Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "9995",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1754501698,
        "expires": 1754505298,
        "secret": "epk_7e35c394cdc94bc59e5184173d3fa385"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016294501",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7658013111",
    "payment_link": null,
    "profile_id": "pro_Lm9uDS83De6QX5EHQNMy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BgWz2Uy3MgHlzzgy7W7H",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-06T17:49:58.537Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_Ku0TdAhmkKDiX9TqhomL",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-06T17:35:01.823Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "2073997111",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
## Post capture cancel
- original txn:   7110000000016291163
- void:               7110000000016291191
<details>
    <summary>  
           /payments/:id/cancel_post_capture
  </summary>
```json
curl --location 'localhost:8080/payments/pay_MyZex1y0W8JtlkJ4E8sX/cancel_post_capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gvwtxVj8XLUh0di5xt8yUkxS187Wlr733tSxZh7Aof45gYnrteTvmP2aJvFD8vdj' \
--data '{
  "cancellation_reason": "requested_by_customer"
}'
```
### Response
```json
{
    "payment_id": "pay_MyZex1y0W8JtlkJ4E8sX",
    "merchant_id": "merchant_1754498214",
    "status": "partially_captured",
    "amount": 21,
    "net_amount": 21,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 21,
    "connector": "nuvei",
    "client_secret": "pay_MyZex1y0W8JtlkJ4E8sX_secret_Ih4q9iGVVaUNIM69pSHv",
    "created": "2025-08-06T16:45:05.230Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "9995",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_IpZOPBQT3Cr7UWNqtKFT",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016291191",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7656640111",
    "payment_link": null,
    "profile_id": "pro_Lm9uDS83De6QX5EHQNMy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BgWz2Uy3MgHlzzgy7W7H",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-06T17:00:05.230Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_IINXjPD3GBVwSFS5jrNS",
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-06T16:45:23.093Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
For AVS , cvv and MAC you can check in the above payment resopnses
```
json
           "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "", 
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
```
</details>
<img width="647" height="703" alt="Screenshot 2025-08-08 at 7 37 41 PM" src="https://github.com/user-attachments/assets/cb4aa3b0-4908-46c2-b4f7-f231d3d9f044" />
<img width="775" height="892" alt="Screenshot 2025-08-08 at 7 38 07 PM" src="https://github.com/user-attachments/assets/829f417f-859e-4712-936f-fa9d3165dc10" />
<img width="643" height="699" alt="Screenshot 2025-08-08 at 7 38 22 PM" src="https://github.com/user-attachments/assets/8bc337eb-b79b-4f62-8170-74bd5b3a3d6a" />
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	4a8eea9aa559a4fff6013a13c0defec4796e922c | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8895 | 
	Bug: [FEATURE] Googlepay , applepay and partial authorization integration for nuvei
### Feature Description
Add nuvie features
### Possible Implementation
Add and fix the following features in nuvie
    Google pay decrypt flow
    Apple pay decrypt flow
    Google pay direct
    Partial Authorization
    Send shipping address for nuvei (previously not sent)
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 3701a814103..7943479730d 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -1,5 +1,5 @@
 pub mod transformers;
-use std::{fmt::Debug, sync::LazyLock};
+use std::sync::LazyLock;
 
 use api_models::{payments::PaymentIdType, webhooks::IncomingWebhookEvent};
 use common_enums::{enums, CallConnectorAction, PaymentAction};
@@ -9,6 +9,7 @@ use common_utils::{
     ext_traits::{ByteSliceExt, BytesExt, ValueExt},
     id_type,
     request::{Method, Request, RequestBuilder, RequestContent},
+    types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},
 };
 use error_stack::ResultExt;
 use hyperswitch_domain_models::{
@@ -57,8 +58,17 @@ use crate::{
     utils::{self, is_mandate_supported, PaymentMethodDataType, RouterData as _},
 };
 
-#[derive(Debug, Clone)]
-pub struct Nuvei;
+#[derive(Clone)]
+pub struct Nuvei {
+    pub amount_convertor: &'static (dyn AmountConvertor<Output = StringMajorUnit> + Sync),
+}
+impl Nuvei {
+    pub fn new() -> &'static Self {
+        &Self {
+            amount_convertor: &StringMajorUnitForConnector,
+        }
+    }
+}
 
 impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Nuvei
 where
@@ -592,6 +602,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
         _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, req.get_session_token()?))?;
+
         Ok(RequestContent::Json(Box::new(connector_req)))
     }
 
@@ -629,7 +640,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
             .switch()?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-
         RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index c20b97d78a2..2280bbb707c 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1,4 +1,5 @@
 use common_enums::{enums, CaptureMethod, PaymentChannel};
+use common_types::payments::{ApplePayPaymentData, GpayTokenizationData};
 use common_utils::{
     crypto::{self, GenerateDigest},
     date_time,
@@ -7,9 +8,11 @@ use common_utils::{
     id_type::CustomerId,
     pii::{Email, IpAddress},
     request::Method,
+    types::{MinorUnit, StringMajorUnit, StringMajorUnitForConnector},
 };
 use error_stack::ResultExt;
 use hyperswitch_domain_models::{
+    address::Address,
     mandates::{MandateData, MandateDataType},
     payment_method_data::{
         self, ApplePayWalletData, BankRedirectData, GooglePayWalletData, PayLaterData,
@@ -34,7 +37,7 @@ use hyperswitch_domain_models::{
 };
 use hyperswitch_interfaces::{
     consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
-    errors,
+    errors::{self},
 };
 use masking::{ExposeInterface, PeekInterface, Secret};
 use serde::{Deserialize, Serialize};
@@ -45,12 +48,14 @@ use crate::{
         PaymentsPreprocessingResponseRouterData, RefundsResponseRouterData, ResponseRouterData,
     },
     utils::{
-        self, missing_field_err, AddressDetailsData, BrowserInformationData, ForeignTryFrom,
-        PaymentsAuthorizeRequestData, PaymentsCancelRequestData, PaymentsPreProcessingRequestData,
-        RouterData as _,
+        self, convert_amount, missing_field_err, AddressData, AddressDetailsData,
+        BrowserInformationData, ForeignTryFrom, PaymentsAuthorizeRequestData,
+        PaymentsCancelRequestData, PaymentsPreProcessingRequestData, RouterData as _,
     },
 };
 
+pub static NUVEI_AMOUNT_CONVERTOR: &StringMajorUnitForConnector = &StringMajorUnitForConnector;
+
 fn to_boolean(string: String) -> bool {
     let str = string.as_str();
     match str {
@@ -78,7 +83,9 @@ trait NuveiAuthorizePreprocessingCommon {
         &self,
     ) -> Result<String, error_stack::Report<errors::ConnectorError>>;
     fn get_capture_method(&self) -> Option<CaptureMethod>;
-    fn get_amount_required(&self) -> Result<i64, error_stack::Report<errors::ConnectorError>>;
+    fn get_minor_amount_required(
+        &self,
+    ) -> Result<MinorUnit, error_stack::Report<errors::ConnectorError>>;
     fn get_customer_id_required(&self) -> Option<CustomerId>;
     fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>>;
     fn get_currency_required(
@@ -87,9 +94,10 @@ trait NuveiAuthorizePreprocessingCommon {
     fn get_payment_method_data_required(
         &self,
     ) -> Result<PaymentMethodData, error_stack::Report<errors::ConnectorError>>;
+    fn get_is_partial_approval(&self) -> Option<PartialApprovalFlag>;
     fn get_order_tax_amount(
         &self,
-    ) -> Result<Option<i64>, error_stack::Report<errors::ConnectorError>>;
+    ) -> Result<Option<MinorUnit>, error_stack::Report<errors::ConnectorError>>;
 }
 
 impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
@@ -133,8 +141,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
         self.capture_method
     }
 
-    fn get_amount_required(&self) -> Result<i64, error_stack::Report<errors::ConnectorError>> {
-        Ok(self.amount)
+    fn get_minor_amount_required(
+        &self,
+    ) -> Result<MinorUnit, error_stack::Report<errors::ConnectorError>> {
+        Ok(self.minor_amount)
     }
 
     fn get_currency_required(
@@ -149,13 +159,18 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData {
     }
     fn get_order_tax_amount(
         &self,
-    ) -> Result<Option<i64>, error_stack::Report<errors::ConnectorError>> {
-        Ok(self.order_tax_amount.map(|tax| tax.get_amount_as_i64()))
+    ) -> Result<Option<MinorUnit>, error_stack::Report<errors::ConnectorError>> {
+        Ok(self.order_tax_amount)
     }
 
     fn get_email_required(&self) -> Result<Email, error_stack::Report<errors::ConnectorError>> {
         self.get_email()
     }
+
+    fn get_is_partial_approval(&self) -> Option<PartialApprovalFlag> {
+        self.enable_partial_authorization
+            .map(PartialApprovalFlag::from)
+    }
 }
 
 impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
@@ -199,8 +214,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
         self.capture_method
     }
 
-    fn get_amount_required(&self) -> Result<i64, error_stack::Report<errors::ConnectorError>> {
-        self.get_amount()
+    fn get_minor_amount_required(
+        &self,
+    ) -> Result<MinorUnit, error_stack::Report<errors::ConnectorError>> {
+        self.get_minor_amount()
     }
 
     fn get_currency_required(
@@ -220,9 +237,13 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData {
     }
     fn get_order_tax_amount(
         &self,
-    ) -> Result<Option<i64>, error_stack::Report<errors::ConnectorError>> {
+    ) -> Result<Option<MinorUnit>, error_stack::Report<errors::ConnectorError>> {
         Ok(None)
     }
+
+    fn get_is_partial_approval(&self) -> Option<PartialApprovalFlag> {
+        None
+    }
 }
 
 #[derive(Debug, Serialize, Default, Deserialize)]
@@ -262,7 +283,7 @@ pub struct NuveiSessionResponse {
 #[derive(Debug, Serialize, Default)]
 #[serde(rename_all = "camelCase")]
 pub struct NuvieAmountDetails {
-    total_tax: Option<String>,
+    total_tax: Option<StringMajorUnit>,
 }
 #[serde_with::skip_serializing_none]
 #[derive(Debug, Serialize, Default)]
@@ -273,7 +294,7 @@ pub struct NuveiPaymentsRequest {
     pub merchant_id: Secret<String>,
     pub merchant_site_id: Secret<String>,
     pub client_request_id: Secret<String>,
-    pub amount: String,
+    pub amount: StringMajorUnit,
     pub currency: enums::Currency,
     /// This ID uniquely identifies your consumer/user in your system.
     pub user_token_id: Option<CustomerId>,
@@ -286,9 +307,30 @@ pub struct NuveiPaymentsRequest {
     pub device_details: DeviceDetails,
     pub checksum: Secret<String>,
     pub billing_address: Option<BillingAddress>,
+    pub shipping_address: Option<ShippingAddress>,
     pub related_transaction_id: Option<String>,
     pub url_details: Option<UrlDetails>,
     pub amount_details: Option<NuvieAmountDetails>,
+    pub is_partial_approval: Option<PartialApprovalFlag>,
+}
+
+#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum PartialApprovalFlag {
+    #[serde(rename = "1")]
+    Enabled,
+    #[serde(rename = "0")]
+    Disabled,
+}
+
+impl From<bool> for PartialApprovalFlag {
+    fn from(value: bool) -> Self {
+        if value {
+            Self::Enabled
+        } else {
+            Self::Disabled
+        }
+    }
 }
 
 #[derive(Debug, Serialize, Default)]
@@ -305,7 +347,7 @@ pub struct NuveiInitPaymentRequest {
     pub merchant_id: Secret<String>,
     pub merchant_site_id: Secret<String>,
     pub client_request_id: String,
-    pub amount: String,
+    pub amount: StringMajorUnit,
     pub currency: String,
     pub payment_option: PaymentOption,
     pub checksum: Secret<String>,
@@ -319,7 +361,7 @@ pub struct NuveiPaymentFlowRequest {
     pub merchant_id: Secret<String>,
     pub merchant_site_id: Secret<String>,
     pub client_request_id: String,
-    pub amount: String,
+    pub amount: StringMajorUnit,
     pub currency: enums::Currency,
     pub related_transaction_id: Option<String>,
     pub checksum: Secret<String>,
@@ -347,6 +389,7 @@ pub struct PaymentOption {
     pub user_payment_option_id: Option<String>,
     pub alternative_payment_method: Option<AlternativePaymentMethod>,
     pub billing_address: Option<BillingAddress>,
+    pub shipping_address: Option<BillingAddress>,
 }
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -413,8 +456,104 @@ pub struct BillingAddress {
     pub first_name: Option<Secret<String>>,
     pub last_name: Option<Secret<String>>,
     pub country: api_models::enums::CountryAlpha2,
+    pub phone: Option<Secret<String>>,
+    pub city: Option<Secret<String>>,
+    pub address: Option<Secret<String>>,
+    pub street_number: Option<Secret<String>>,
+    pub zip: Option<Secret<String>>,
+    pub state: Option<Secret<String>>,
+    pub cell: Option<Secret<String>>,
+    pub address_match: Option<Secret<String>>,
+    pub address_line2: Option<Secret<String>>,
+    pub address_line3: Option<Secret<String>>,
+    pub home_phone: Option<Secret<String>>,
+    pub work_phone: Option<Secret<String>>,
+}
+
+#[serde_with::skip_serializing_none]
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ShippingAddress {
+    pub salutation: Option<Secret<String>>,
+    pub first_name: Option<Secret<String>>,
+    pub last_name: Option<Secret<String>>,
+    pub address: Option<Secret<String>>,
+    pub cell: Option<Secret<String>>,
+    pub phone: Option<Secret<String>>,
+    pub zip: Option<Secret<String>>,
+    pub city: Option<Secret<String>>,
+    pub country: api_models::enums::CountryAlpha2,
+    pub state: Option<Secret<String>>,
+    pub email: Email,
+    pub county: Option<Secret<String>>,
+    pub address_line2: Option<Secret<String>>,
+    pub address_line3: Option<Secret<String>>,
+    pub street_number: Option<Secret<String>>,
+    pub company_name: Option<Secret<String>>,
+    pub care_of: Option<Secret<String>>,
 }
 
+impl From<&Address> for BillingAddress {
+    fn from(address: &Address) -> Self {
+        let address_details = address.address.as_ref();
+        Self {
+            email: address.email.clone().unwrap_or_default(),
+            first_name: address.get_optional_first_name(),
+            last_name: address_details.and_then(|address| address.get_optional_last_name()),
+            country: address_details
+                .and_then(|address| address.get_optional_country())
+                .unwrap_or_default(),
+            phone: address
+                .phone
+                .as_ref()
+                .and_then(|phone| phone.number.clone()),
+            city: address_details
+                .and_then(|address| address.get_optional_city().map(|city| city.into())),
+            address: address_details.and_then(|address| address.get_optional_line1()),
+            street_number: None,
+            zip: address_details.and_then(|details| details.get_optional_zip()),
+            state: None,
+            cell: None,
+            address_match: None,
+            address_line2: address_details.and_then(|address| address.get_optional_line2()),
+            address_line3: address_details.and_then(|address| address.get_optional_line3()),
+            home_phone: None,
+            work_phone: None,
+        }
+    }
+}
+
+impl From<&Address> for ShippingAddress {
+    fn from(address: &Address) -> Self {
+        let address_details = address.address.as_ref();
+
+        Self {
+            email: address.email.clone().unwrap_or_default(),
+            first_name: address_details.and_then(|details| details.get_optional_first_name()),
+            last_name: address_details.and_then(|details| details.get_optional_last_name()),
+            country: address_details
+                .and_then(|details| details.get_optional_country())
+                .unwrap_or_default(),
+            phone: address
+                .phone
+                .as_ref()
+                .and_then(|phone| phone.number.clone()),
+            city: address_details
+                .and_then(|details| details.get_optional_city().map(|city| city.into())),
+            address: address_details.and_then(|details| details.get_optional_line1()),
+            street_number: None,
+            zip: address_details.and_then(|details| details.get_optional_zip()),
+            state: None,
+            cell: None,
+            address_line2: address_details.and_then(|details| details.get_optional_line2()),
+            address_line3: address_details.and_then(|details| details.get_optional_line3()),
+            county: None,
+            company_name: None,
+            care_of: None,
+            salutation: None,
+        }
+    }
+}
 #[serde_with::skip_serializing_none]
 #[derive(Debug, Clone, Default, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
@@ -435,7 +574,7 @@ pub struct Card {
     pub cvv2_reply: Option<String>,
     pub avs_code: Option<String>,
     pub card_type: Option<String>,
-    pub card_brand: Option<String>,
+    pub brand: Option<String>,
     pub issuer_bank_name: Option<String>,
     pub issuer_country: Option<String>,
     pub is_prepaid: Option<String>,
@@ -446,7 +585,9 @@ pub struct Card {
 #[serde(rename_all = "camelCase")]
 pub struct ExternalToken {
     pub external_token_provider: ExternalTokenProvider,
-    pub mobile_token: Secret<String>,
+    pub mobile_token: Option<Secret<String>>,
+    pub cryptogram: Option<Secret<String>>,
+    pub eci_provider: Option<String>,
 }
 
 #[derive(Debug, Clone, Default, Serialize, Deserialize)]
@@ -644,53 +785,226 @@ pub struct NuveiCardDetails {
     card_holder_name: Option<Secret<String>>,
 }
 
+// Define new structs with camelCase serialization
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct GooglePayCamelCase {
+    pm_type: Secret<String>,
+    description: Secret<String>,
+    info: GooglePayInfoCamelCase,
+    tokenization_data: GooglePayTokenizationDataCamelCase,
+}
+
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct GooglePayInfoCamelCase {
+    card_network: Secret<String>,
+    card_details: Secret<String>,
+    assurance_details: Option<GooglePayAssuranceDetailsCamelCase>,
+}
+
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct GooglePayAssuranceDetailsCamelCase {
+    card_holder_authenticated: bool,
+    account_verified: bool,
+}
+
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct GooglePayTokenizationDataCamelCase {
+    #[serde(rename = "type")]
+    token_type: Secret<String>,
+    token: Secret<String>,
+}
+
+// Define ApplePay structs with camelCase serialization
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct ApplePayCamelCase {
+    payment_data: Secret<String>,
+    payment_method: ApplePayPaymentMethodCamelCase,
+    transaction_identifier: Secret<String>,
+}
+
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct ApplePayPaymentMethodCamelCase {
+    display_name: Secret<String>,
+    network: Secret<String>,
+    #[serde(rename = "type")]
+    pm_type: Secret<String>,
+}
+
 impl TryFrom<GooglePayWalletData> for NuveiPaymentsRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(gpay_data: GooglePayWalletData) -> Result<Self, Self::Error> {
-        Ok(Self {
-            payment_option: PaymentOption {
-                card: Some(Card {
-                    external_token: Some(ExternalToken {
-                        external_token_provider: ExternalTokenProvider::GooglePay,
-                        mobile_token: Secret::new(
-                            utils::GooglePayWalletData::try_from(gpay_data)
-                                .change_context(errors::ConnectorError::InvalidDataFormat {
-                                    field_name: "google_pay_data",
-                                })?
-                                .encode_to_string_of_json()
-                                .change_context(errors::ConnectorError::RequestEncodingFailed)?,
+        match gpay_data.tokenization_data {
+            GpayTokenizationData::Decrypted(ref gpay_predecrypt_data) => Ok(Self {
+                payment_option: PaymentOption {
+                    card: Some(Card {
+                        brand: Some(gpay_data.info.card_network.clone()),
+                        card_number: Some(
+                            gpay_predecrypt_data
+                                .application_primary_account_number
+                                .clone(),
                         ),
+                        last4_digits: Some(Secret::new(
+                            gpay_predecrypt_data
+                                .application_primary_account_number
+                                .clone()
+                                .get_last4(),
+                        )),
+                        expiration_month: Some(gpay_predecrypt_data.card_exp_month.clone()),
+                        expiration_year: Some(gpay_predecrypt_data.card_exp_year.clone()),
+                        external_token: Some(ExternalToken {
+                            external_token_provider: ExternalTokenProvider::GooglePay,
+                            mobile_token: None,
+                            cryptogram: gpay_predecrypt_data.cryptogram.clone(),
+                            eci_provider: gpay_predecrypt_data.eci_indicator.clone(),
+                        }),
+                        ..Default::default()
                     }),
                     ..Default::default()
-                }),
+                },
                 ..Default::default()
-            },
-            ..Default::default()
-        })
+            }),
+            GpayTokenizationData::Encrypted(encrypted_data) => Ok(Self {
+                payment_option: PaymentOption {
+                    card: Some(Card {
+                        external_token: Some(ExternalToken {
+                            external_token_provider: ExternalTokenProvider::GooglePay,
+
+                            mobile_token: {
+                                let (token_type, token) = (
+                                    encrypted_data.token_type.clone(),
+                                    encrypted_data.token.clone(),
+                                );
+
+                                let google_pay: GooglePayCamelCase = GooglePayCamelCase {
+                                    pm_type: Secret::new(gpay_data.pm_type.clone()),
+                                    description: Secret::new(gpay_data.description.clone()),
+                                    info: GooglePayInfoCamelCase {
+                                        card_network: Secret::new(
+                                            gpay_data.info.card_network.clone(),
+                                        ),
+                                        card_details: Secret::new(
+                                            gpay_data.info.card_details.clone(),
+                                        ),
+                                        assurance_details: gpay_data
+                                            .info
+                                            .assurance_details
+                                            .as_ref()
+                                            .map(|details| GooglePayAssuranceDetailsCamelCase {
+                                                card_holder_authenticated: details
+                                                    .card_holder_authenticated,
+                                                account_verified: details.account_verified,
+                                            }),
+                                    },
+                                    tokenization_data: GooglePayTokenizationDataCamelCase {
+                                        token_type: token_type.into(),
+                                        token: token.into(),
+                                    },
+                                };
+                                Some(Secret::new(
+                                    google_pay.encode_to_string_of_json().change_context(
+                                        errors::ConnectorError::RequestEncodingFailed,
+                                    )?,
+                                ))
+                            },
+                            cryptogram: None,
+                            eci_provider: None,
+                        }),
+                        ..Default::default()
+                    }),
+                    ..Default::default()
+                },
+                ..Default::default()
+            }),
+        }
     }
 }
 impl TryFrom<ApplePayWalletData> for NuveiPaymentsRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(apple_pay_data: ApplePayWalletData) -> Result<Self, Self::Error> {
-        let apple_pay_encrypted_data = apple_pay_data
-            .payment_data
-            .get_encrypted_apple_pay_payment_data_mandatory()
-            .change_context(errors::ConnectorError::MissingRequiredField {
-                field_name: "Apple pay encrypted data",
-            })?;
-        Ok(Self {
-            payment_option: PaymentOption {
-                card: Some(Card {
-                    external_token: Some(ExternalToken {
-                        external_token_provider: ExternalTokenProvider::ApplePay,
-                        mobile_token: Secret::new(apple_pay_encrypted_data.clone()),
+        match apple_pay_data.payment_data {
+            ApplePayPaymentData::Decrypted(apple_pay_predecrypt_data) => Ok(Self {
+                payment_option: PaymentOption {
+                    card: Some(Card {
+                        brand:Some(apple_pay_data.payment_method.network.clone()),
+                        card_number: Some(
+                            apple_pay_predecrypt_data
+                                .application_primary_account_number
+                                .clone(),
+                        ),
+                        last4_digits: Some(Secret::new(
+                            apple_pay_predecrypt_data
+                                .application_primary_account_number
+                                .get_last4(),
+                        )),
+                        expiration_month: Some(
+                            apple_pay_predecrypt_data
+                                .application_expiration_month
+                                .clone(),
+                        ),
+                        expiration_year: Some(
+                            apple_pay_predecrypt_data
+                                .application_expiration_year
+                                .clone(),
+                        ),
+                        external_token: Some(ExternalToken {
+                            external_token_provider: ExternalTokenProvider::ApplePay,
+                            mobile_token: None,
+                            cryptogram: Some(
+                                apple_pay_predecrypt_data
+                                    .payment_data
+                                    .online_payment_cryptogram,
+                            ),
+                            eci_provider: Some(
+                                apple_pay_predecrypt_data
+                                    .payment_data
+                                    .eci_indicator
+                                    .ok_or_else(missing_field_err("payment_method_data.wallet.apple_pay.payment_data.eci_indicator"))?,
+                            ),
+                        }),
+                        ..Default::default()
                     }),
                     ..Default::default()
-                }),
+                },
                 ..Default::default()
-            },
-            ..Default::default()
-        })
+            }),
+            ApplePayPaymentData::Encrypted(encrypted_data) => Ok(Self {
+                payment_option: PaymentOption {
+                    card: Some(Card {
+                        external_token: Some(ExternalToken {
+                            external_token_provider: ExternalTokenProvider::ApplePay,
+                            mobile_token: {
+                                let apple_pay: ApplePayCamelCase = ApplePayCamelCase {
+                                     payment_data:encrypted_data.into(),
+                                     payment_method: ApplePayPaymentMethodCamelCase {
+                                         display_name: Secret::new(apple_pay_data.payment_method.display_name.clone()),
+                                         network: Secret::new(apple_pay_data.payment_method.network.clone()),
+                                         pm_type: Secret::new(apple_pay_data.payment_method.pm_type.clone()),
+                                     },
+                                     transaction_identifier: Secret::new(apple_pay_data.transaction_identifier.clone()),
+                                    };
+
+                                Some(Secret::new(
+                                    apple_pay.encode_to_string_of_json().change_context(
+                                        errors::ConnectorError::RequestEncodingFailed,
+                                    )?,
+                                ))
+                            },
+                            cryptogram: None,
+                            eci_provider: None,
+                        }),
+                        ..Default::default()
+                    }),
+                    ..Default::default()
+                },
+                ..Default::default()
+            }),
+        }
     }
 }
 
@@ -869,58 +1183,32 @@ where
         ),
     ) -> Result<Self, Self::Error> {
         let (payment_method, redirect, item) = data;
-        let (billing_address, bank_id) = match (&payment_method, redirect) {
-            (AlternativePaymentMethodType::Expresscheckout, _) => (
-                Some(BillingAddress {
-                    email: item.request.get_email_required()?,
-                    country: item.get_billing_country()?,
-                    ..Default::default()
-                }),
-                None,
-            ),
-            (AlternativePaymentMethodType::Giropay, _) => (
-                Some(BillingAddress {
-                    email: item.request.get_email_required()?,
-                    country: item.get_billing_country()?,
-                    ..Default::default()
-                }),
-                None,
-            ),
+        let bank_id = match (&payment_method, redirect) {
+            (AlternativePaymentMethodType::Expresscheckout, _) => None,
+            (AlternativePaymentMethodType::Giropay, _) => None,
             (AlternativePaymentMethodType::Sofort, _) | (AlternativePaymentMethodType::Eps, _) => {
                 let address = item.get_billing_address()?;
-                let first_name = address.get_first_name()?;
-                (
-                    Some(BillingAddress {
-                        first_name: Some(first_name.clone()),
-                        last_name: Some(address.get_last_name().unwrap_or(first_name).clone()),
-                        email: item.request.get_email_required()?,
-                        country: item.get_billing_country()?,
-                    }),
-                    None,
-                )
+                address.get_first_name()?;
+                item.request.get_email_required()?;
+                item.get_billing_country()?;
+                None
             }
             (
                 AlternativePaymentMethodType::Ideal,
                 Some(BankRedirectData::Ideal { bank_name, .. }),
             ) => {
                 let address = item.get_billing_address()?;
-                let first_name = address.get_first_name()?.clone();
-                (
-                    Some(BillingAddress {
-                        first_name: Some(first_name.clone()),
-                        last_name: Some(
-                            address.get_last_name().ok().unwrap_or(&first_name).clone(),
-                        ),
-                        email: item.request.get_email_required()?,
-                        country: item.get_billing_country()?,
-                    }),
-                    bank_name.map(NuveiBIC::try_from).transpose()?,
-                )
+                address.get_first_name()?;
+                item.request.get_email_required()?;
+                item.get_billing_country()?;
+                bank_name.map(NuveiBIC::try_from).transpose()?
             }
             _ => Err(errors::ConnectorError::NotImplemented(
                 utils::get_unimplemented_payment_method_error_message("Nuvei"),
             ))?,
         };
+        let billing_address: Option<BillingAddress> =
+            item.get_billing().ok().map(|billing| billing.into());
         Ok(Self {
             payment_option: PaymentOption {
                 alternative_payment_method: Some(AlternativePaymentMethod {
@@ -947,20 +1235,17 @@ where
         .address
         .as_ref()
         .ok_or_else(missing_field_err("billing.address"))?;
-    let first_name = address.get_first_name()?;
+    address.get_first_name()?;
     let payment_method = payment_method_type;
+    address.get_country()?; //country is necessary check
+    item.request.get_email_required()?;
     Ok(NuveiPaymentsRequest {
         payment_option: PaymentOption {
             alternative_payment_method: Some(AlternativePaymentMethod {
                 payment_method,
                 ..Default::default()
             }),
-            billing_address: Some(BillingAddress {
-                email: item.request.get_email_required()?,
-                first_name: Some(first_name.clone()),
-                last_name: Some(address.get_last_name().unwrap_or(first_name).clone()),
-                country: address.get_country()?.to_owned(),
-            }),
+            billing_address: item.get_billing().ok().map(|billing| billing.into()),
             ..Default::default()
         },
         ..Default::default()
@@ -1104,36 +1389,64 @@ where
         }?;
         let currency = item.request.get_currency_required()?;
         let request = Self::try_from(NuveiPaymentRequestData {
-            amount: utils::to_currency_base_unit(item.request.get_amount_required()?, currency)?,
+            amount: convert_amount(
+                NUVEI_AMOUNT_CONVERTOR,
+                item.request.get_minor_amount_required()?,
+                currency,
+            )?,
             currency,
             connector_auth_type: item.connector_auth_type.clone(),
             client_request_id: item.connector_request_reference_id.clone(),
             session_token: Secret::new(data.1),
             capture_method: item.request.get_capture_method(),
+
             ..Default::default()
         })?;
         let return_url = item.request.get_return_url_required()?;
 
         let amount_details = match item.request.get_order_tax_amount()? {
             Some(tax) => Some(NuvieAmountDetails {
-                total_tax: Some(utils::to_currency_base_unit(tax, currency)?),
+                total_tax: Some(convert_amount(NUVEI_AMOUNT_CONVERTOR, tax, currency)?),
             }),
             None => None,
         };
+        let address = {
+            if let Some(billing_address) = item.get_optional_billing() {
+                let mut billing_address = billing_address.clone();
+                item.get_billing_first_name()?;
+                billing_address.email = match item.get_billing_email() {
+                    Ok(email) => Some(email),
+                    Err(_) => Some(item.request.get_email_required()?),
+                };
+                item.get_billing_country()?;
+
+                Some(billing_address)
+            } else {
+                None
+            }
+        };
+
+        let shipping_address: Option<ShippingAddress> =
+            item.get_optional_shipping().map(|address| address.into());
+
+        let billing_address: Option<BillingAddress> = address.map(|ref address| address.into());
         Ok(Self {
             is_rebilling: request_data.is_rebilling,
             user_token_id: item.customer_id.clone(),
             related_transaction_id: request_data.related_transaction_id,
             payment_option: request_data.payment_option,
-            billing_address: request_data.billing_address,
-            device_details: request_data.device_details,
+            billing_address,
+            shipping_address,
+            device_details: DeviceDetails::foreign_try_from(
+                &item.request.get_browser_info().clone(),
+            )?,
             url_details: Some(UrlDetails {
                 success_url: return_url.clone(),
                 failure_url: return_url.clone(),
                 pending_url: return_url.clone(),
             }),
             amount_details,
-
+            is_partial_approval: item.request.get_is_partial_approval(),
             ..request
         })
     }
@@ -1157,18 +1470,13 @@ where
         .get_optional_billing()
         .and_then(|billing_details| billing_details.address.as_ref());
 
-    let billing_address = match address {
-        Some(address) => {
-            let first_name = address.get_first_name()?.clone();
-            Some(BillingAddress {
-                first_name: Some(first_name.clone()),
-                last_name: Some(address.get_last_name().ok().unwrap_or(&first_name).clone()),
-                email: item.request.get_email_required()?,
-                country: item.get_billing_country()?,
-            })
-        }
-        None => None,
-    };
+    if let Some(address) = address {
+        // mandatory feilds check
+        address.get_first_name()?;
+        item.request.get_email_required()?;
+        item.get_billing_country()?;
+    }
+
     let (is_rebilling, additional_params, user_token_id) =
         match item.request.get_setup_mandate_details().clone() {
             Some(mandate_data) => {
@@ -1262,7 +1570,7 @@ where
             three_d,
             card_holder_name: item.get_optional_billing_full_name(),
         }),
-        billing_address,
+
         is_moto,
         ..Default::default()
     })
@@ -1329,7 +1637,11 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret<String>)>
             )),
         }?;
         let request = Self::try_from(NuveiPaymentRequestData {
-            amount: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
+            amount: convert_amount(
+                NUVEI_AMOUNT_CONVERTOR,
+                item.request.minor_amount,
+                item.request.currency,
+            )?,
             currency: item.request.currency,
             connector_auth_type: item.connector_auth_type.clone(),
             client_request_id: item.connector_request_reference_id.clone(),
@@ -1363,7 +1675,7 @@ impl TryFrom<NuveiPaymentRequestData> for NuveiPaymentsRequest {
         let merchant_secret = connector_meta.merchant_secret;
         let transaction_type = TransactionType::get_from_capture_method_and_amount_string(
             request.capture_method.unwrap_or_default(),
-            &request.amount,
+            &request.amount.get_amount_as_string(),
         );
         Ok(Self {
             merchant_id: merchant_id.clone(),
@@ -1376,7 +1688,7 @@ impl TryFrom<NuveiPaymentRequestData> for NuveiPaymentsRequest {
                 merchant_id.peek(),
                 merchant_site_id.peek(),
                 &client_request_id,
-                &request.amount.clone(),
+                &request.amount.get_amount_as_string(),
                 &request.currency.to_string(),
                 &time_stamp,
                 merchant_secret.peek(),
@@ -1409,7 +1721,7 @@ impl TryFrom<NuveiPaymentRequestData> for NuveiPaymentFlowRequest {
                 merchant_id.peek(),
                 merchant_site_id.peek(),
                 &client_request_id,
-                &request.amount.clone(),
+                &request.amount.get_amount_as_string(),
                 &request.currency.to_string(),
                 &request.related_transaction_id.clone().unwrap_or_default(),
                 &time_stamp,
@@ -1424,7 +1736,7 @@ impl TryFrom<NuveiPaymentRequestData> for NuveiPaymentFlowRequest {
 
 #[derive(Debug, Clone, Default)]
 pub struct NuveiPaymentRequestData {
-    pub amount: String,
+    pub amount: StringMajorUnit,
     pub currency: enums::Currency,
     pub related_transaction_id: Option<String>,
     pub client_request_id: String,
@@ -1439,8 +1751,9 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for NuveiPaymentFlowRequest {
         Self::try_from(NuveiPaymentRequestData {
             client_request_id: item.connector_request_reference_id.clone(),
             connector_auth_type: item.connector_auth_type.clone(),
-            amount: utils::to_currency_base_unit(
-                item.request.amount_to_capture,
+            amount: convert_amount(
+                NUVEI_AMOUNT_CONVERTOR,
+                item.request.minor_amount_to_capture,
                 item.request.currency,
             )?,
             currency: item.request.currency,
@@ -1455,8 +1768,9 @@ impl TryFrom<&types::RefundExecuteRouterData> for NuveiPaymentFlowRequest {
         Self::try_from(NuveiPaymentRequestData {
             client_request_id: item.connector_request_reference_id.clone(),
             connector_auth_type: item.connector_auth_type.clone(),
-            amount: utils::to_currency_base_unit(
-                item.request.refund_amount,
+            amount: convert_amount(
+                NUVEI_AMOUNT_CONVERTOR,
+                item.request.minor_refund_amount,
                 item.request.currency,
             )?,
             currency: item.request.currency,
@@ -1533,8 +1847,11 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NuveiPaymentFlowRequest {
         Self::try_from(NuveiPaymentRequestData {
             client_request_id: item.connector_request_reference_id.clone(),
             connector_auth_type: item.connector_auth_type.clone(),
-            amount: utils::to_currency_base_unit(
-                item.request.get_amount()?,
+            amount: convert_amount(
+                NUVEI_AMOUNT_CONVERTOR,
+                item.request
+                    .minor_amount
+                    .ok_or_else(missing_field_err("amount"))?,
                 item.request.get_currency()?,
             )?,
             currency: item.request.get_currency()?,
@@ -1603,6 +1920,15 @@ impl From<NuveiTransactionStatus> for enums::AttemptStatus {
     }
 }
 
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiPartialApproval {
+    pub requested_amount: StringMajorUnit,
+    pub requested_currency: enums::Currency,
+    pub processed_amount: StringMajorUnit,
+    pub processed_currency: enums::Currency,
+}
+
 #[derive(Debug, Clone, Default, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct NuveiPaymentsResponse {
@@ -1623,6 +1949,7 @@ pub struct NuveiPaymentsResponse {
     pub fraud_details: Option<FraudDetails>,
     pub external_scheme_transaction_id: Option<Secret<String>>,
     pub session_token: Option<Secret<String>>,
+    pub partial_approval: Option<NuveiPartialApproval>,
     //The ID of the transaction in the merchant’s system.
     pub client_unique_id: Option<String>,
     pub internal_request_id: Option<i64>,
@@ -1635,6 +1962,37 @@ pub struct NuveiPaymentsResponse {
     pub client_request_id: Option<String>,
     pub merchant_advice_code: Option<String>,
 }
+impl NuveiPaymentsResponse {
+    /// returns amount_captured and minor_amount_capturable
+    pub fn get_amount_captured(
+        &self,
+    ) -> Result<(Option<i64>, Option<MinorUnit>), error_stack::Report<errors::ConnectorError>> {
+        match &self.partial_approval {
+            Some(partial_approval) => {
+                let amount = utils::convert_back_amount_to_minor_units(
+                    NUVEI_AMOUNT_CONVERTOR,
+                    partial_approval.processed_amount.clone(),
+                    partial_approval.processed_currency,
+                )?;
+                match self.transaction_type {
+                    None => Ok((None, None)),
+                    Some(NuveiTransactionType::Sale) => {
+                        Ok((Some(MinorUnit::get_amount_as_i64(amount)), None))
+                    }
+                    Some(NuveiTransactionType::Auth) => Ok((None, Some(amount))),
+                    Some(NuveiTransactionType::Auth3D) => {
+                        Ok((Some(MinorUnit::get_amount_as_i64(amount)), None))
+                    }
+                    Some(NuveiTransactionType::InitAuth3D) => Ok((None, Some(amount))),
+                    Some(NuveiTransactionType::Credit) => Ok((None, None)),
+                    Some(NuveiTransactionType::Void) => Ok((None, None)),
+                    Some(NuveiTransactionType::Settle) => Ok((None, None)),
+                }
+            }
+            None => Ok((None, None)),
+        }
+    }
+}
 
 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
 pub enum NuveiTransactionType {
@@ -1708,36 +2066,27 @@ fn get_payment_status(
     }
 }
 
-fn build_error_response<T>(
-    response: &NuveiPaymentsResponse,
-    http_code: u16,
-) -> Option<Result<T, error_stack::Report<errors::ConnectorError>>> {
+fn build_error_response(response: &NuveiPaymentsResponse, http_code: u16) -> Option<ErrorResponse> {
     match response.status {
-        NuveiPaymentStatus::Error => Some(
-            get_error_response(
-                response.err_code,
-                &response.reason,
+        NuveiPaymentStatus::Error => Some(get_error_response(
+            response.err_code,
+            &response.reason,
+            http_code,
+            &response.merchant_advice_code,
+            &response.gw_error_code.map(|e| e.to_string()),
+            &response.gw_error_reason,
+        )),
+
+        _ => {
+            let err = Some(get_error_response(
+                response.gw_error_code,
+                &response.gw_error_reason,
                 http_code,
                 &response.merchant_advice_code,
                 &response.gw_error_code.map(|e| e.to_string()),
                 &response.gw_error_reason,
-            )
-            .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)),
-        ),
-        _ => {
-            let err = Some(
-                get_error_response(
-                    response.gw_error_code,
-                    &response.gw_error_reason,
-                    http_code,
-                    &response.merchant_advice_code,
-                    &response.gw_error_code.map(|e| e.to_string()),
-                    &response.gw_error_reason,
-                )
-                .map_err(|_err| {
-                    error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)
-                }),
-            );
+            ));
+
             match response.transaction_status {
                 Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err,
                 _ => match response
@@ -1798,7 +2147,6 @@ where
                 form_fields: std::collections::HashMap::from([("creq".to_string(), creq.expose())]),
             }),
     };
-
     let connector_response_data =
         convert_to_additional_payment_method_connector_response(&item.response)
             .map(ConnectorResponseData::with_additional_payment_method_data);
@@ -1812,12 +2160,7 @@ where
 fn create_transaction_response(
     response: &NuveiPaymentsResponse,
     redirection_data: Option<RedirectForm>,
-    http_code: u16,
 ) -> Result<PaymentsResponseData, error_stack::Report<errors::ConnectorError>> {
-    if let Some(err) = build_error_response(response, http_code) {
-        return err;
-    }
-
     Ok(PaymentsResponseData::TransactionResponse {
         resource_id: response
             .transaction_id
@@ -1882,13 +2225,19 @@ impl
         let (status, redirection_data, connector_response_data) =
             process_nuvei_payment_response(&item, amount)?;
 
+        let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?;
         Ok(Self {
             status,
-            response: Ok(create_transaction_response(
-                &item.response,
-                redirection_data,
-                item.http_code,
-            )?),
+            response: if let Some(err) = build_error_response(&item.response, item.http_code) {
+                Err(err)
+            } else {
+                Ok(create_transaction_response(
+                    &item.response,
+                    redirection_data,
+                )?)
+            },
+            amount_captured,
+            minor_amount_capturable,
             connector_response: connector_response_data,
             ..item.data
         })
@@ -1915,13 +2264,19 @@ where
         let (status, redirection_data, connector_response_data) =
             process_nuvei_payment_response(&item, amount)?;
 
+        let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?;
         Ok(Self {
             status,
-            response: Ok(create_transaction_response(
-                &item.response,
-                redirection_data,
-                item.http_code,
-            )?),
+            response: if let Some(err) = build_error_response(&item.response, item.http_code) {
+                Err(err)
+            } else {
+                Ok(create_transaction_response(
+                    &item.response,
+                    redirection_data,
+                )?)
+            },
+            amount_captured,
+            minor_amount_capturable,
             connector_response: connector_response_data,
             ..item.data
         })
@@ -1982,10 +2337,10 @@ impl TryFrom<RefundsResponseRouterData<Execute, NuveiPaymentsResponse>>
             .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;
 
         let refund_response =
-            get_refund_response(item.response.clone(), item.http_code, transaction_id)?;
+            get_refund_response(item.response.clone(), item.http_code, transaction_id);
 
         Ok(Self {
-            response: Ok(refund_response),
+            response: refund_response.map_err(|err| *err),
             ..item.data
         })
     }
@@ -2005,10 +2360,10 @@ impl TryFrom<RefundsResponseRouterData<RSync, NuveiPaymentsResponse>>
             .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;
 
         let refund_response =
-            get_refund_response(item.response.clone(), item.http_code, transaction_id)?;
+            get_refund_response(item.response.clone(), item.http_code, transaction_id);
 
         Ok(Self {
-            response: Ok(refund_response),
+            response: refund_response.map_err(|err| *err),
             ..item.data
         })
     }
@@ -2032,6 +2387,7 @@ where
             } else {
                 None
             };
+
             Ok(Self {
                 related_transaction_id,
                 device_details: DeviceDetails::foreign_try_from(
@@ -2065,32 +2421,30 @@ fn get_refund_response(
     response: NuveiPaymentsResponse,
     http_code: u16,
     txn_id: String,
-) -> Result<RefundsResponseData, error_stack::Report<errors::ConnectorError>> {
+) -> Result<RefundsResponseData, Box<ErrorResponse>> {
     let refund_status = response
         .transaction_status
         .clone()
         .map(enums::RefundStatus::from)
         .unwrap_or(enums::RefundStatus::Failure);
     match response.status {
-        NuveiPaymentStatus::Error => get_error_response(
+        NuveiPaymentStatus::Error => Err(Box::new(get_error_response(
             response.err_code,
             &response.reason,
             http_code,
             &response.merchant_advice_code,
             &response.gw_error_code.map(|e| e.to_string()),
             &response.gw_error_reason,
-        )
-        .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)),
+        ))),
         _ => match response.transaction_status {
-            Some(NuveiTransactionStatus::Error) => get_error_response(
+            Some(NuveiTransactionStatus::Error) => Err(Box::new(get_error_response(
                 response.err_code,
                 &response.reason,
                 http_code,
                 &response.merchant_advice_code,
                 &response.gw_error_code.map(|e| e.to_string()),
                 &response.gw_error_reason,
-            )
-            .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)),
+            ))),
             _ => Ok(RefundsResponseData {
                 connector_refund_id: txn_id,
                 refund_status,
@@ -2099,15 +2453,15 @@ fn get_refund_response(
     }
 }
 
-fn get_error_response<T>(
+fn get_error_response(
     error_code: Option<i64>,
     error_msg: &Option<String>,
     http_code: u16,
     network_advice_code: &Option<String>,
     network_decline_code: &Option<String>,
     network_error_message: &Option<String>,
-) -> Result<T, Box<ErrorResponse>> {
-    Err(Box::new(ErrorResponse {
+) -> ErrorResponse {
+    ErrorResponse {
         code: error_code
             .map(|c| c.to_string())
             .unwrap_or_else(|| NO_ERROR_CODE.to_string()),
@@ -2122,7 +2476,7 @@ fn get_error_response<T>(
         network_decline_code: network_decline_code.clone(),
         network_error_message: network_error_message.clone(),
         connector_metadata: None,
-    }))
+    }
 }
 
 /// Represents any possible webhook notification from Nuvei.
@@ -2394,7 +2748,7 @@ fn convert_to_additional_payment_method_connector_response(
         "merchant_advice_code_description": merchant_advice_description
     });
 
-    let card_network = card.card_brand.clone();
+    let card_network = card.brand.clone();
     let three_ds_data = card
         .three_d
         .clone()
diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs
index c184c9db8dd..29f14f79432 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -322,7 +322,9 @@ impl ConnectorData {
                 enums::Connector::Novalnet => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new())))
                 }
-                enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))),
+                enums::Connector::Nuvei => {
+                    Ok(ConnectorEnum::Old(Box::new(connector::Nuvei::new())))
+                }
                 enums::Connector::Opennode => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Opennode::new())))
                 }
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index ac7754faa30..d7307e7ab68 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -239,7 +239,9 @@ impl FeatureMatrixConnectorData {
                 enums::Connector::Novalnet => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new())))
                 }
-                enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))),
+                enums::Connector::Nuvei => {
+                    Ok(ConnectorEnum::Old(Box::new(connector::Nuvei::new())))
+                }
                 enums::Connector::Opennode => {
                     Ok(ConnectorEnum::Old(Box::new(connector::Opennode::new())))
                 }
diff --git a/crates/router/tests/connectors/nuvei.rs b/crates/router/tests/connectors/nuvei.rs
index f2db3c94a4d..395ad1d1ea9 100644
--- a/crates/router/tests/connectors/nuvei.rs
+++ b/crates/router/tests/connectors/nuvei.rs
@@ -16,7 +16,7 @@ impl utils::Connector for NuveiTest {
     fn get_data(&self) -> types::api::ConnectorData {
         use router::connector::Nuvei;
         utils::construct_connector_data_old(
-            Box::new(&Nuvei),
+            Box::new(Nuvei::new()),
             types::Connector::Nuvei,
             types::api::GetToken::Connector,
             None,
 | 
	2025-08-19T07:19:30Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Add the following features in nuvie
1. Google pay decrypt flow S2S
2. Apple pay decrypt flow S2S
3. Google pay encrypt flow
4. Partial Authorization
5. Send shipping address for nuvei (previously not sent)
## Test attachment
<details>
<summary> <b>APPLE PAY DECRYPT FLOW </b> </summary>
# Request
```json
{
    "amount": 1,
    "currency": "EUR",
    "confirm": true,
    // "order_tax_amount": 100,
    "setup_future_usage": "off_session",
    // "payment_type":"setup_mandate",
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        },
        "email":"nithingowdan77@gmail.com"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": {
                    "application_primary_account_number": "4242424242424242",
                    "application_expiration_month": "09",
                    "application_expiration_year": "30",
                    "application_brand":"VISA",
                    "payment_data": {
                        "online_payment_cryptogram": "ArSx8**************************",
                        "eci_indicator": "7"
                    }
                },
                "payment_method": {
                    "display_name": "Discover 9319",
                    "network": "VISA",
                    "type": "debit"
                },
                "transaction_identifier": "c635c5b3af900d7bd81fecd7028f1262f9d030754ee65ec7afd988a678194751"
            }
        }
    }
}
```
# Response
```json
{
    "payment_id": "pay_MgXkheRylOHLMUllc1Mw",
    "merchant_id": "merchant_1755589543",
    "status": "succeeded",
    "amount": 1,
    "net_amount": 1,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1,
    "connector": "nuvei",
    "client_secret": "pay_MgXkheRylOHLMUllc1Mw_secret_swUebKaDNEsP4Qo5BMxe",
    "created": "2025-08-19T08:05:14.847Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "9319",
                "card_network": "VISA",
                "type": "debit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": "nithin*****@gmail.com"
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755590714,
        "expires": 1755594314,
        "secret": "epk_ad5c941cff3a4404ab38dee084e575d0"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012650848",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8027431111",
    "payment_link": null,
    "profile_id": "pro_o6xLMNfkFwAWH1U1zimF",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-19T08:20:14.847Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T08:05:17.249Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
<summary>
 Google pay Decrypt 
</summary>
## Request
```json
{
    "amount": 1,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "UA",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        },
        "email":"test@gmail.com"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "tokenization_data": {
                    "application_primary_account_number": "4761344136141390",
                    "card_exp_month": "12",
                    "card_exp_year": "25",
                    "cryptogram": "ejJR********************U=",
                    "eci_indicator": "5"
                },
                "info": {
                    "card_details": "Discover 9319",
                    "card_network": "VISA"
                },
                "description": "something"
            }
        }
    }
}
```
Response
```json
{
    "payment_id": "pay_0i5TBkizYCY8JIwAPB1H",
    "merchant_id": "merchant_1755589543",
    "status": "succeeded",
    "amount": 1,
    "net_amount": 1,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1,
    "connector": "nuvei",
    "client_secret": "pay_0i5TBkizYCY8JIwAPB1H_secret_7O5zdgMiNJxFdZolSjIJ",
    "created": "2025-08-19T08:07:18.648Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "Discover 9319",
                "card_network": "VISA",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "UA",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": "test@gmail.com"
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755590838,
        "expires": 1755594438,
        "secret": "epk_8d9994d7f5594c2a8fb10ebf6c3fdc27"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012650994",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8027476111",
    "payment_link": null,
    "profile_id": "pro_o6xLMNfkFwAWH1U1zimF",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-19T08:22:18.648Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T08:07:21.259Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
 <summary> GOOGLE PAY DIRECT </summary> 
```js
const tokenizationSpecification = {
  type: "PAYMENT_GATEWAY",
  parameters: {
    "gateway": "nuveidigital",
    "gatewayMerchantId": "googletest"
  }
};
```
## Request
```json
{
    "amount": 1,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "UA",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        },
        "email":"nithin@test.com"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
  "description": "SG Visa Success: Visa •••• 1390",
  "info": {
    "assuranceDetails": {
      "account_verified": true,
      "card_holder_authenticated": false
    },
    "card_details": "1390",
    "card_network": "VISA"
  },
  "tokenization_data": {
    "token": "{\"signature\":\"MEUCIG7saL2k07Szf8ezokemD5jAJTwpcWwpy+ajTJot7u+nAiEAzvcuwAoj47r8oMh3a6eUKeZB2lFyDLEzZt2R2lpezo0\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE9ByUUgcs6d9rtJA3svCKaGZQjfsbMQAAwWZ6YNIpJkg/NR9HAkMT1sdhkKMRxtcFp1k5y01dr/JpEU2Pj3XyYw\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1756245691797\\\"}\",\"signatures\":[\"MEQCIFAS8NBh7J4rz00iRDjScYizAfRV+pVnCfsmsFgrehMVAiBpxHFUu6wG3UVNhDMmudb6sZeZHXDJonLkkKOWgzN4TA\\u003d\\u003d\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"hJxayhOT/y4ekX9Ub14X6nl7Xm0h3b1nu8FKv7WDulloondBA+kk9sYnNomQx+ZPANrGES4CBGbmptqW5gR6TjdvENXbSUrTjzU8k++Klw/AwAJBcID+dL+EgyIvgmqIYesLyKzITkZr9zSxtd0zuB9ewcta8gHgBzlZmJSWmdvanv4xiBQgjriKolnw4IiOXXAzN+X0GGXkPqcQnlLIrUzjn/9oCgwhFDltl1EJjkUH8Ji2Rzx62FUexxY6RHHrkoq3pCoirc+KNRXPu3+gC06iloRTR48gmmayFKH5s3Kyw0j9Oypu7fx/AgSqrFKkFzVUmCV0yLwGQSI2vyVdKOFLgLay8dDbEHKvF5X+ZP7diunVh0QwZUTT7yRmgyQUaZAbQhd+uRHrev6SYXcmWdSu8E+8H6A7jtITaZN2eHI7u9ciW82/AcIx3gPkTocKGyXdYRB07+GaFIqyWwxT+9TwLW49oq7hbj978APK1vy4f8x6v2h1tCj6StH6md7xJpn+U47n8rKmJhQiXqRyzfKFcCekndvs0YpgEVbcoZEKKl0E\\\",\\\"ephemeralPublicKey\\\":\\\"BKvkUFUZmpa0BgifTbr2ZTNBK7D74Fg8RMsk2Txta+Vf+vX1/BZLUaITfjpgJ5Xqt3rz+AmrkFe+XRvT5E4R7nc\\\\u003d\\\",\\\"tag\\\":\\\"cGNVu61W/PvTC89JXVMUcsKaZIOpt92oexc+aztsKqw\\\\u003d\\\"}\"}",
    "type": "PAYMENT_GATEWAY"
  },
  "type": "CARD"
}
    }}
}
```
## response
```json
{
    "payment_id": "pay_UGldGh1QW8CTJJJ22CMJ",
    "merchant_id": "merchant_1755589543",
    "status": "succeeded",
    "amount": 1,
    "net_amount": 1,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1,
    "connector": "nuvei",
    "client_secret": "pay_UGldGh1QW8CTJJJ22CMJ_secret_nKqyqNJ02RgcaMsBBz51",
    "created": "2025-08-19T09:08:25.037Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "1390",
                "card_network": "VISA",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "UA",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": "nithin@test.com"
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755594505,
        "expires": 1755598105,
        "secret": "epk_d3dbd5a8b4c04958b6fb4c959cbc67a1"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012655452",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8029357111",
    "payment_link": null,
    "profile_id": "pro_o6xLMNfkFwAWH1U1zimF",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-19T09:23:25.037Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T09:08:29.510Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```
</details>
<details>
<summary>Partial auth </summary>
## Request
```json
{
    "amount": 300,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "enable_partial_authorization":true,
    "payment_method": "card",
    "payment_method_type": "credit",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        },
        "email":"nithin@gmail.com"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method_data": {
        "card": {
            "card_number": "4531739335817394",
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "card_cvc": "100"
        }
    }
}
```
## Response
```json
{
    "payment_id": "pay_hieZ9MkK4v1qbqiXKEor",
    "merchant_id": "merchant_1755589543",
    "status": "partially_captured",
    "amount": 300,
    "net_amount": 300,
    "shipping_cost": null,
    "amount_capturable": 300,
    "amount_received": 150,
    "connector": "nuvei",
    "client_secret": "pay_hieZ9MkK4v1qbqiXKEor_secret_KN9DE1LjGlbxEIDGpzFT",
    "created": "2025-08-19T09:21:17.091Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7394",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453173",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_7PrpuuSVcta1g2qFHYtC",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": "nithin@gmail.com"
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755595277,
        "expires": 1755598877,
        "secret": "epk_8003507abbdb427788e1fa089e75c59c"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012656330",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8029726111",
    "payment_link": null,
    "profile_id": "pro_o6xLMNfkFwAWH1U1zimF",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-19T09:36:17.091Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-19T09:21:19.648Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": true
}
```
## partial-auth manual payment response
```json
{
    "payment_id": "pay_t82V58k4cohYq87gBvGL",
    "merchant_id": "merchant_1755675958",
    "status": "partially_authorized_and_requires_capture",
    "amount": 300,
    "net_amount": 300,
    "shipping_cost": null,
    "amount_capturable": 150,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_t82V58k4cohYq87gBvGL_secret_CHN75ZbLuZWVBKYTITqg",
    "created": "2025-08-21T08:37:13.180Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7394",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453173",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_yUVtqVsfxyKqmAM4fl1H",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755765433,
        "expires": 1755769033,
        "secret": "epk_c7ea65af285e4db69a3bd6fbcb553bf4"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012833076",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8101170111",
    "payment_link": null,
    "profile_id": "pro_8OqPL5PekR8mRXU8WZZs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_48b4pLXImpTC9wJALk91",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-21T08:52:13.180Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-21T08:37:15.983Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": true
}
```
### capture partial 
```json
{
    "payment_id": "pay_t82V58k4cohYq87gBvGL",
    "merchant_id": "merchant_1755675958",
    "status": "partially_captured",
    "amount": 300,
    "net_amount": 300,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 150,
    "connector": "nuvei",
    "client_secret": "pay_t82V58k4cohYq87gBvGL_secret_CHN75ZbLuZWVBKYTITqg",
    "created": "2025-08-21T08:37:13.180Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7394",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "453173",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {
                "challengePreferenceReason": "12"
            }
        },
        "billing": null
    },
    "payment_token": "token_yUVtqVsfxyKqmAM4fl1H",
    "shipping": null,
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "8110000000012833218",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "8101170111",
    "payment_link": null,
    "profile_id": "pro_8OqPL5PekR8mRXU8WZZs",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_48b4pLXImpTC9wJALk91",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-21T08:52:13.180Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-21T08:37:57.428Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": true
}
```
</details>
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c90625a4ea163e03895276a04ec3a23d4117413d | ||
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8864 | 
	Bug: [FEATURE] Reward PaymentMethod & CurrencyAuthKey for Hyperswitch <> UCS Integration
### Feature Description
Add Reward payment method and CurrencyAuthKey auth type for HS <> UCS integration
### Possible Implementation
Add Reward payment method and CurrencyAuthKey auth type for HS <> UCS integration
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/Cargo.lock b/Cargo.lock
index 474d6d6f1d5..5ce7eff9c8c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3041,6 +3041,7 @@ dependencies = [
  "aws-sdk-sts",
  "aws-smithy-runtime",
  "base64 0.22.1",
+ "common_enums",
  "common_utils",
  "dyn-clone",
  "error-stack 0.4.1",
@@ -3061,6 +3062,7 @@ dependencies = [
  "router_env",
  "rust-grpc-client",
  "serde",
+ "serde_json",
  "thiserror 1.0.69",
  "time",
  "tokio 1.45.1",
@@ -3538,7 +3540,7 @@ dependencies = [
 [[package]]
 name = "grpc-api-types"
 version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=4387a6310dc9c2693b453b455a8032623f3d6a81#4387a6310dc9c2693b453b455a8032623f3d6a81"
+source = "git+https://github.com/juspay/connector-service?rev=2263c96a70f2606475ab30e6f716b2773e1fd093#2263c96a70f2606475ab30e6f716b2773e1fd093"
 dependencies = [
  "axum 0.8.4",
  "error-stack 0.5.0",
@@ -6914,7 +6916,7 @@ dependencies = [
 [[package]]
 name = "rust-grpc-client"
 version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=4387a6310dc9c2693b453b455a8032623f3d6a81#4387a6310dc9c2693b453b455a8032623f3d6a81"
+source = "git+https://github.com/juspay/connector-service?rev=2263c96a70f2606475ab30e6f716b2773e1fd093#2263c96a70f2606475ab30e6f716b2773e1fd093"
 dependencies = [
  "grpc-api-types",
 ]
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index b8933003065..062755496fe 100644
--- a/crates/external_services/Cargo.toml
+++ b/crates/external_services/Cargo.toml
@@ -51,6 +51,7 @@ lettre = "0.11.16"
 once_cell = "1.21.3"
 serde = { version = "1.0.219", features = ["derive"] }
 thiserror = "1.0.69"
+serde_json = "1.0.140"
 vaultrs = { version = "0.7.4", optional = true }
 prost = { version = "0.13", optional = true }
 prost-types = { version = "0.13", optional = true }
@@ -65,11 +66,12 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] }
 http = "0.2.12"
 url = { version = "2.5.4", features = ["serde"] }
 quick-xml = { version = "0.31.0", features = ["serialize"] }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "4387a6310dc9c2693b453b455a8032623f3d6a81", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "2263c96a70f2606475ab30e6f716b2773e1fd093", package = "rust-grpc-client" }
 
 
 # First party crates
 common_utils = { version = "0.1.0", path = "../common_utils" }
+common_enums = { version = "0.1.0", path = "../common_enums" }
 hyperswitch_interfaces = { version = "0.1.0", path = "../hyperswitch_interfaces", default-features = false }
 masking = { version = "0.1.0", path = "../masking" }
 router_env = { version = "0.1.0", path = "../router_env", features = [
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 699d8dad7ee..62f681a985c 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -1,3 +1,5 @@
+use std::collections::HashMap;
+
 use common_utils::{consts as common_utils_consts, errors::CustomResult, types::Url};
 use error_stack::ResultExt;
 use masking::{PeekInterface, Secret};
@@ -144,6 +146,10 @@ pub struct ConnectorAuthMetadata {
     /// Optional API secret used for signature or secure authentication.
     pub api_secret: Option<Secret<String>>,
 
+    /// Optional auth_key_map used for authentication.
+    pub auth_key_map:
+        Option<HashMap<common_enums::enums::Currency, common_utils::pii::SecretSerdeValue>>,
+
     /// Id of the merchant.
     pub merchant_id: Secret<String>,
 }
@@ -381,6 +387,16 @@ pub fn build_unified_connector_service_grpc_headers(
             parse("api_secret", api_secret.peek())?,
         );
     }
+    if let Some(auth_key_map) = meta.auth_key_map {
+        let auth_key_map_str = serde_json::to_string(&auth_key_map).map_err(|error| {
+            logger::error!(?error);
+            UnifiedConnectorServiceError::ParsingFailed
+        })?;
+        metadata.append(
+            consts::UCS_HEADER_AUTH_KEY_MAP,
+            parse("auth_key_map", &auth_key_map_str)?,
+        );
+    }
 
     metadata.append(
         common_utils_consts::X_MERCHANT_ID,
diff --git a/crates/external_services/src/lib.rs b/crates/external_services/src/lib.rs
index f63d2227053..7d97b5e99c0 100644
--- a/crates/external_services/src/lib.rs
+++ b/crates/external_services/src/lib.rs
@@ -85,6 +85,9 @@ pub mod consts {
 
     /// Header key for sending the API secret in signature-based authentication.
     pub(crate) const UCS_HEADER_API_SECRET: &str = "x-api-secret";
+
+    /// Header key for sending the AUTH KEY MAP in currency-based authentication.
+    pub(crate) const UCS_HEADER_AUTH_KEY_MAP: &str = "x-auth-key-map";
 }
 
 /// Metrics for interactions with external systems.
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 4c59c8e952b..83629e53d05 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -89,7 +89,7 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "mult
 ring = "0.17.14"
 rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] }
 rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "4387a6310dc9c2693b453b455a8032623f3d6a81", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "2263c96a70f2606475ab30e6f716b2773e1fd093", package = "rust-grpc-client" }
 rustc-hash = "1.1.0"
 rustls = "0.22"
 rustls-pemfile = "2"
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs
index 3907592d400..70b7fd3f75c 100644
--- a/crates/router/src/consts.rs
+++ b/crates/router/src/consts.rs
@@ -326,3 +326,6 @@ pub const UCS_AUTH_BODY_KEY: &str = "body-key";
 
 /// Header value indicating that header-key-based authentication is used.
 pub const UCS_AUTH_HEADER_KEY: &str = "header-key";
+
+/// Header value indicating that currency-auth-key-based authentication is used.
+pub const UCS_AUTH_CURRENCY_AUTH_KEY: &str = "currency-auth-key";
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index b00440e89f3..b14811ea735 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -18,7 +18,7 @@ use masking::{ExposeInterface, PeekInterface, Secret};
 use router_env::logger;
 use unified_connector_service_client::payments::{
     self as payments_grpc, payment_method::PaymentMethod, CardDetails, CardPaymentMethodType,
-    PaymentServiceAuthorizeResponse,
+    PaymentServiceAuthorizeResponse, RewardPaymentMethodType,
 };
 
 use crate::{
@@ -325,6 +325,24 @@ pub fn build_unified_connector_service_payment_method(
                 payment_method: Some(upi_type),
             })
         }
+        hyperswitch_domain_models::payment_method_data::PaymentMethodData::Reward => {
+            match payment_method_type {
+                PaymentMethodType::ClassicReward => Ok(payments_grpc::PaymentMethod {
+                    payment_method: Some(PaymentMethod::Reward(RewardPaymentMethodType {
+                        reward_type: 1,
+                    })),
+                }),
+                PaymentMethodType::Evoucher => Ok(payments_grpc::PaymentMethod {
+                    payment_method: Some(PaymentMethod::Reward(RewardPaymentMethodType {
+                        reward_type: 2,
+                    })),
+                }),
+                _ => Err(UnifiedConnectorServiceError::NotImplemented(format!(
+                    "Unimplemented payment method subtype: {payment_method_type:?}"
+                ))
+                .into()),
+            }
+        }
         _ => Err(UnifiedConnectorServiceError::NotImplemented(format!(
             "Unimplemented payment method: {payment_method_data:?}"
         ))
@@ -385,6 +403,7 @@ pub fn build_unified_connector_service_auth_metadata(
             api_key: Some(api_key.clone()),
             key1: Some(key1.clone()),
             api_secret: Some(api_secret.clone()),
+            auth_key_map: None,
             merchant_id: Secret::new(merchant_id.to_string()),
         }),
         ConnectorAuthType::BodyKey { api_key, key1 } => Ok(ConnectorAuthMetadata {
@@ -393,6 +412,7 @@ pub fn build_unified_connector_service_auth_metadata(
             api_key: Some(api_key.clone()),
             key1: Some(key1.clone()),
             api_secret: None,
+            auth_key_map: None,
             merchant_id: Secret::new(merchant_id.to_string()),
         }),
         ConnectorAuthType::HeaderKey { api_key } => Ok(ConnectorAuthMetadata {
@@ -401,6 +421,16 @@ pub fn build_unified_connector_service_auth_metadata(
             api_key: Some(api_key.clone()),
             key1: None,
             api_secret: None,
+            auth_key_map: None,
+            merchant_id: Secret::new(merchant_id.to_string()),
+        }),
+        ConnectorAuthType::CurrencyAuthKey { auth_key_map } => Ok(ConnectorAuthMetadata {
+            connector_name,
+            auth_type: consts::UCS_AUTH_CURRENCY_AUTH_KEY.to_string(),
+            api_key: None,
+            key1: None,
+            api_secret: None,
+            auth_key_map: Some(auth_key_map.clone()),
             merchant_id: Secret::new(merchant_id.to_string()),
         }),
         _ => Err(UnifiedConnectorServiceError::FailedToObtainAuthType)
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index a6559abc2d4..c63fd4a4a62 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -51,6 +51,16 @@ impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>
             })
             .ok();
 
+        let encoded_data = router_data
+            .request
+            .encoded_data
+            .as_ref()
+            .map(|data| Identifier {
+                id_type: Some(payments_grpc::identifier::IdType::EncodedData(
+                    data.to_string(),
+                )),
+            });
+
         let connector_ref_id = router_data
             .request
             .connector_reference_id
@@ -60,7 +70,7 @@ impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>
             });
 
         Ok(Self {
-            transaction_id: connector_transaction_id,
+            transaction_id: connector_transaction_id.or(encoded_data),
             request_ref_id: connector_ref_id,
         })
     }
@@ -319,6 +329,19 @@ impl ForeignTryFrom<&RouterData<Authorize, PaymentsAuthorizeData, PaymentsRespon
             }
         };
 
+        let capture_method = router_data
+            .request
+            .capture_method
+            .map(payments_grpc::CaptureMethod::foreign_try_from)
+            .transpose()?;
+
+        let browser_info = router_data
+            .request
+            .browser_info
+            .clone()
+            .map(payments_grpc::BrowserInformation::foreign_try_from)
+            .transpose()?;
+
         Ok(Self {
             request_ref_id: Some(Identifier {
                 id_type: Some(payments_grpc::identifier::IdType::Id(
@@ -342,6 +365,13 @@ impl ForeignTryFrom<&RouterData<Authorize, PaymentsAuthorizeData, PaymentsRespon
                 })
                 .unwrap_or_default(),
             webhook_url: router_data.request.webhook_url.clone(),
+            capture_method: capture_method.map(|capture_method| capture_method.into()),
+            email: router_data
+                .request
+                .email
+                .clone()
+                .map(|e| e.expose().expose()),
+            browser_info,
         })
     }
 }
@@ -370,13 +400,11 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponse>
                     })
             });
 
-        let transaction_id = response.transaction_id.as_ref().and_then(|id| {
-            id.id_type.clone().and_then(|id_type| match id_type {
-                payments_grpc::identifier::IdType::Id(id) => Some(id),
-                payments_grpc::identifier::IdType::EncodedData(encoded_data) => Some(encoded_data),
-                payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
-            })
-        });
+        let resource_id: hyperswitch_domain_models::router_request_types::ResponseId = match response.transaction_id.as_ref().and_then(|id| id.id_type.clone()) {
+            Some(payments_grpc::identifier::IdType::Id(id)) => hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(id),
+            Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => hyperswitch_domain_models::router_request_types::ResponseId::EncodedData(encoded_data),
+            Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => hyperswitch_domain_models::router_request_types::ResponseId::NoResponseId,
+        };
 
         let (connector_metadata, redirection_data) = match response.redirection_data.clone() {
             Some(redirection_data) => match redirection_data.form_type {
@@ -423,13 +451,8 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponse>
             })
         } else {
             Ok(PaymentsResponseData::TransactionResponse {
-                resource_id: match transaction_id.as_ref() {
-                    Some(transaction_id) => hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(transaction_id.clone()),
-                    None => hyperswitch_domain_models::router_request_types::ResponseId::NoResponseId,
-                },
-                redirection_data: Box::new(
-                    redirection_data
-                ),
+                resource_id,
+                redirection_data: Box::new(redirection_data),
                 mandate_reference: Box::new(None),
                 connector_metadata,
                 network_txn_id: response.network_txn_id.clone(),
@@ -469,6 +492,12 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceGetResponse>
 
         let status_code = convert_connector_service_status_code(response.status_code)?;
 
+        let resource_id: hyperswitch_domain_models::router_request_types::ResponseId = match response.transaction_id.as_ref().and_then(|id| id.id_type.clone()) {
+            Some(payments_grpc::identifier::IdType::Id(id)) => hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(id),
+            Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => hyperswitch_domain_models::router_request_types::ResponseId::EncodedData(encoded_data),
+            Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => hyperswitch_domain_models::router_request_types::ResponseId::NoResponseId,
+        };
+
         let response = if response.error_code.is_some() {
             Err(ErrorResponse {
                 code: response.error_code().to_owned(),
@@ -483,21 +512,22 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceGetResponse>
             })
         } else {
             Ok(PaymentsResponseData::TransactionResponse {
-                resource_id: match connector_response_reference_id.as_ref() {
-                    Some(connector_response_reference_id) => hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(connector_response_reference_id.clone()),
-                    None => hyperswitch_domain_models::router_request_types::ResponseId::NoResponseId,
-                },
-                redirection_data: Box::new(
-                    None
-                ),
-                mandate_reference: Box::new(None),
+                resource_id,
+                redirection_data: Box::new(None),
+                mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
+                    hyperswitch_domain_models::router_response_types::MandateReference {
+                        connector_mandate_id: grpc_mandate.mandate_id,
+                        payment_method_id: None,
+                        mandate_metadata: None,
+                        connector_mandate_request_reference_id: None,
+                    }
+                })),
                 connector_metadata: None,
                 network_txn_id: response.network_txn_id.clone(),
                 connector_response_reference_id,
                 incremental_authorization_allowed: None,
                 charges: None,
-                }
-            )
+            })
         };
 
         Ok(response)
 | 
	2025-07-28T09:27:29Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This PR implements the following
 - Added support for Reward payment methods for HS <> UCS integration
 - Added support for CurrencyAuthKey auth type for HS <> UCS integration
 - Send encoded_data as transaction_id when connector_transaction_id is None for PSync via UCS
 - Handle mandate_reference in PSync response from UCS
 - Updated unified-connector-service-client dependency
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<details>
<summary>Create Payment Evoucher</summary>
```json
{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "payment_method_data": "reward",
    "payment_method_type": "evoucher",
    "payment_method":"reward",  
    "capture_method": "automatic",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    }    
}
```
Response
```json
{
    "payment_id": "pay_Rg4QpaAPecdVQsRNBTmR",
    "merchant_id": "merchant_1753630639",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_Rg4QpaAPecdVQsRNBTmR_secret_OLIhHcWDaspkeHhC1LX8",
    "created": "2025-07-27T18:36:26.771Z",
    "currency": "USD",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_Rg4QpaAPecdVQsRNBTmR/merchant_1753630639/pay_Rg4QpaAPecdVQsRNBTmR_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "evoucher",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "created_at": 1753641386,
        "expires": 1753644986,
        "secret": "epk_e8ef8c9944cb44d0a04b9f480d56f8b1"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_Rg4QpaAPecdVQsRNBTmR_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_TTKe5DLbKRzmvW23NZ8W",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Cyziv5reSS6yqqJxi3NW",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-27T18:51:26.771Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-27T18:36:28.202Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Create Payment Classicreward</summary>
```json
{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "payment_method_data": "reward",
    "payment_method_type": "classic",
    "payment_method":"reward",  
    "capture_method": "automatic",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    }    
}
```
Response
```json
{
    "payment_id": "pay_u2oFZ7JZu9DKDMxmr4V8",
    "merchant_id": "merchant_1753630639",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_u2oFZ7JZu9DKDMxmr4V8_secret_zfm7dQ9weLttW8467iKF",
    "created": "2025-07-27T18:41:01.619Z",
    "currency": "EUR",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_u2oFZ7JZu9DKDMxmr4V8/merchant_1753630639/pay_u2oFZ7JZu9DKDMxmr4V8_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "classic",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "created_at": 1753641661,
        "expires": 1753645261,
        "secret": "epk_03beb90b91b249028e5f524c4366b16f"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_u2oFZ7JZu9DKDMxmr4V8_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_TTKe5DLbKRzmvW23NZ8W",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Cyziv5reSS6yqqJxi3NW",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-27T18:56:01.619Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-27T18:41:02.554Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
Enable payments in HS via UCS
<img width="576" height="148" alt="Screenshot 2025-07-28 at 7 15 10 PM" src="https://github.com/user-attachments/assets/fe0d8b17-a3f6-427c-931f-1cbe2eef252e" />
Tests via HS
<details>
<summary>Create Payment</summary>
```json
{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "payment_link": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "card_cvc": "123",
            "card_network": "VISA"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "12345",
            "country": "DE",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "email": "test@novalnet.de",
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,\/;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "ip_address": "103.77.139.95",
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
Response
```json
{
    "payment_id": "pay_SRFVMZTPcqcztdvz5Gqo",
    "merchant_id": "merchant_1753713393",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_SRFVMZTPcqcztdvz5Gqo_secret_8ozHMAIx9DBii0jJSOOH",
    "created": "2025-07-28T16:36:32.363Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SRFVMZTPcqcztdvz5Gqo/merchant_1753713393/pay_SRFVMZTPcqcztdvz5Gqo_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1753720592,
        "expires": 1753724192,
        "secret": "epk_aa8c7a02cd0449c58648567385e71406"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_khSwRJ3kHOBW2pETWhl3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_44BTpt1weQvLwraRCJBa",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-28T16:51:32.363Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-28T16:36:33.299Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Sync Payment</summary>
Response
```json
{
    "payment_id": "pay_SRFVMZTPcqcztdvz5Gqo",
    "merchant_id": "merchant_1753713393",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "novalnet",
    "client_secret": "pay_SRFVMZTPcqcztdvz5Gqo_secret_8ozHMAIx9DBii0jJSOOH",
    "created": "2025-07-28T16:36:32.363Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_SRFVMZTPcqcztdvz5Gqo_1",
            "status": "charged",
            "amount": 1000,
            "order_tax_amount": null,
            "currency": "EUR",
            "connector": "novalnet",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": null,
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-07-28T16:36:32.363Z",
            "modified_at": "2025-07-28T16:36:54.815Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": null,
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_khSwRJ3kHOBW2pETWhl3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_44BTpt1weQvLwraRCJBa",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-28T16:51:32.363Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-28T16:36:54.815Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Setup Mandate with 0 amount</summary>
```json
{
    "confirm": true,
    "customer_id": "Customer123",
    "payment_type": "setup_mandate",
    "setup_future_usage": "off_session",
    "amount": 0,
    "currency": "EUR",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "card_cvc": "123",
            "card_network": "VISA"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "12345",
            "country": "DE",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "email": "test@novalnet.de",
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,\/;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "ip_address": "103.77.139.95",
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
Response
```json
{
    "payment_id": "pay_SRFVMZTPcqcztdvz5Gqo",
    "merchant_id": "merchant_1753713393",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_SRFVMZTPcqcztdvz5Gqo_secret_8ozHMAIx9DBii0jJSOOH",
    "created": "2025-07-28T16:36:32.363Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SRFVMZTPcqcztdvz5Gqo/merchant_1753713393/pay_SRFVMZTPcqcztdvz5Gqo_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1753720592,
        "expires": 1753724192,
        "secret": "epk_aa8c7a02cd0449c58648567385e71406"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_khSwRJ3kHOBW2pETWhl3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_44BTpt1weQvLwraRCJBa",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-28T16:51:32.363Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-28T16:36:33.299Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Make a mandate payment manual capture</summary>
```json
{
    "amount": 100,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "manual",
    "customer_id": "Customer123",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_dPmHDOL7xWQi0IGMPlCF"
    }
}
```
Response
```json
{
    "payment_id": "pay_TyY8IWSWaxTEzpOLgsu1",
    "merchant_id": "merchant_1753878378",
    "status": "requires_capture",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_TyY8IWSWaxTEzpOLgsu1_secret_CjCYuDfP1JGo6caJ4g2C",
    "created": "2025-07-31T13:50:56.144Z",
    "currency": "EUR",
    "customer_id": "Customer123",
    "customer": {
        "id": "Customer123",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": "Visa",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Customer123",
        "created_at": 1753969856,
        "expires": 1753973456,
        "secret": "epk_382858505e58422b980776ffe49e26ed"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "15212700054805789",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "15212700054805789",
    "payment_link": null,
    "profile_id": "pro_McJmiAJzH046VnPS0CAN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_O7lUCBZh6h106Xmsxady",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-31T14:05:56.144Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_dPmHDOL7xWQi0IGMPlCF",
    "payment_method_status": "active",
    "updated": "2025-07-31T13:50:58.462Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "R2cB22w22w00a02c-R22w22w22wNJV-V14o10kNZ22wB18sB18s16q00aNP22wXV",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Make a mandate payment auto capture</summary>
```json
{
    "amount": 100,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "Customer123",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_dPmHDOL7xWQi0IGMPlCF"
    }
}
```
Response
```json
{
    "payment_id": "pay_Ep1buzxTanjWDHQIv3Sx",
    "merchant_id": "merchant_1753878378",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "novalnet",
    "client_secret": "pay_Ep1buzxTanjWDHQIv3Sx_secret_9faeER31esgb88tLjiqK",
    "created": "2025-07-31T13:52:14.410Z",
    "currency": "EUR",
    "customer_id": "Customer123",
    "customer": {
        "id": "Customer123",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": "Visa",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Customer123",
        "created_at": 1753969934,
        "expires": 1753973534,
        "secret": "epk_253da8acb7454f67a2fb6bcdc170f1aa"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "15212700054912058",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "15212700054912058",
    "payment_link": null,
    "profile_id": "pro_McJmiAJzH046VnPS0CAN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_O7lUCBZh6h106Xmsxady",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-31T14:07:14.410Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_dPmHDOL7xWQi0IGMPlCF",
    "payment_method_status": "active",
    "updated": "2025-07-31T13:52:17.146Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "R2cB22w22w00a02c-R22w22w22wNJV-V14o10kNZ22wB18sB18s16q00aNP22wXV",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	8bb8b2062e84e8d7116a9ca0e76c8ebd71b2b3ec | 
	<details>
<summary>Create Payment Evoucher</summary>
```json
{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "payment_method_data": "reward",
    "payment_method_type": "evoucher",
    "payment_method":"reward",  
    "capture_method": "automatic",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    }    
}
```
Response
```json
{
    "payment_id": "pay_Rg4QpaAPecdVQsRNBTmR",
    "merchant_id": "merchant_1753630639",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_Rg4QpaAPecdVQsRNBTmR_secret_OLIhHcWDaspkeHhC1LX8",
    "created": "2025-07-27T18:36:26.771Z",
    "currency": "USD",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_Rg4QpaAPecdVQsRNBTmR/merchant_1753630639/pay_Rg4QpaAPecdVQsRNBTmR_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "evoucher",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "created_at": 1753641386,
        "expires": 1753644986,
        "secret": "epk_e8ef8c9944cb44d0a04b9f480d56f8b1"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_Rg4QpaAPecdVQsRNBTmR_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_TTKe5DLbKRzmvW23NZ8W",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Cyziv5reSS6yqqJxi3NW",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-27T18:51:26.771Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-27T18:36:28.202Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Create Payment Classicreward</summary>
```json
{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "payment_method_data": "reward",
    "payment_method_type": "classic",
    "payment_method":"reward",  
    "capture_method": "automatic",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari"
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        }
    }    
}
```
Response
```json
{
    "payment_id": "pay_u2oFZ7JZu9DKDMxmr4V8",
    "merchant_id": "merchant_1753630639",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cashtocode",
    "client_secret": "pay_u2oFZ7JZu9DKDMxmr4V8_secret_zfm7dQ9weLttW8467iKF",
    "created": "2025-07-27T18:41:01.619Z",
    "currency": "EUR",
    "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
    "customer": {
        "id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "reward",
    "payment_method_data": "reward",
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": null
        },
        "phone": {
            "number": "1233456789",
            "country_code": "+1"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_u2oFZ7JZu9DKDMxmr4V8/merchant_1753630639/pay_u2oFZ7JZu9DKDMxmr4V8_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "classic",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_5ZiQdWmdv9efuLCPWeoN",
        "created_at": 1753641661,
        "expires": 1753645261,
        "secret": "epk_03beb90b91b249028e5f524c4366b16f"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_u2oFZ7JZu9DKDMxmr4V8_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_TTKe5DLbKRzmvW23NZ8W",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Cyziv5reSS6yqqJxi3NW",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-27T18:56:01.619Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1728,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1117,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-27T18:41:02.554Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
Enable payments in HS via UCS
<img width="576" height="148" alt="Screenshot 2025-07-28 at 7 15 10 PM" src="https://github.com/user-attachments/assets/fe0d8b17-a3f6-427c-931f-1cbe2eef252e" />
Tests via HS
<details>
<summary>Create Payment</summary>
```json
{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "payment_link": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "card_cvc": "123",
            "card_network": "VISA"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "12345",
            "country": "DE",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "email": "test@novalnet.de",
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,\/;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "ip_address": "103.77.139.95",
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
Response
```json
{
    "payment_id": "pay_SRFVMZTPcqcztdvz5Gqo",
    "merchant_id": "merchant_1753713393",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_SRFVMZTPcqcztdvz5Gqo_secret_8ozHMAIx9DBii0jJSOOH",
    "created": "2025-07-28T16:36:32.363Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SRFVMZTPcqcztdvz5Gqo/merchant_1753713393/pay_SRFVMZTPcqcztdvz5Gqo_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1753720592,
        "expires": 1753724192,
        "secret": "epk_aa8c7a02cd0449c58648567385e71406"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_khSwRJ3kHOBW2pETWhl3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_44BTpt1weQvLwraRCJBa",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-28T16:51:32.363Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-28T16:36:33.299Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Sync Payment</summary>
Response
```json
{
    "payment_id": "pay_SRFVMZTPcqcztdvz5Gqo",
    "merchant_id": "merchant_1753713393",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "novalnet",
    "client_secret": "pay_SRFVMZTPcqcztdvz5Gqo_secret_8ozHMAIx9DBii0jJSOOH",
    "created": "2025-07-28T16:36:32.363Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_SRFVMZTPcqcztdvz5Gqo_1",
            "status": "charged",
            "amount": 1000,
            "order_tax_amount": null,
            "currency": "EUR",
            "connector": "novalnet",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": null,
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-07-28T16:36:32.363Z",
            "modified_at": "2025-07-28T16:36:54.815Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": null,
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_khSwRJ3kHOBW2pETWhl3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_44BTpt1weQvLwraRCJBa",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-28T16:51:32.363Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-28T16:36:54.815Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Setup Mandate with 0 amount</summary>
```json
{
    "confirm": true,
    "customer_id": "Customer123",
    "payment_type": "setup_mandate",
    "setup_future_usage": "off_session",
    "amount": 0,
    "currency": "EUR",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "card_cvc": "123",
            "card_network": "VISA"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "12345",
            "country": "DE",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "email": "test@novalnet.de",
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,\/;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "ip_address": "103.77.139.95",
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
Response
```json
{
    "payment_id": "pay_SRFVMZTPcqcztdvz5Gqo",
    "merchant_id": "merchant_1753713393",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_SRFVMZTPcqcztdvz5Gqo_secret_8ozHMAIx9DBii0jJSOOH",
    "created": "2025-07-28T16:36:32.363Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "DE",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SRFVMZTPcqcztdvz5Gqo/merchant_1753713393/pay_SRFVMZTPcqcztdvz5Gqo_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1753720592,
        "expires": 1753724192,
        "secret": "epk_aa8c7a02cd0449c58648567385e71406"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_khSwRJ3kHOBW2pETWhl3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_44BTpt1weQvLwraRCJBa",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-28T16:51:32.363Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-28T16:36:33.299Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Make a mandate payment manual capture</summary>
```json
{
    "amount": 100,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "manual",
    "customer_id": "Customer123",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_dPmHDOL7xWQi0IGMPlCF"
    }
}
```
Response
```json
{
    "payment_id": "pay_TyY8IWSWaxTEzpOLgsu1",
    "merchant_id": "merchant_1753878378",
    "status": "requires_capture",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_TyY8IWSWaxTEzpOLgsu1_secret_CjCYuDfP1JGo6caJ4g2C",
    "created": "2025-07-31T13:50:56.144Z",
    "currency": "EUR",
    "customer_id": "Customer123",
    "customer": {
        "id": "Customer123",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": "Visa",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Customer123",
        "created_at": 1753969856,
        "expires": 1753973456,
        "secret": "epk_382858505e58422b980776ffe49e26ed"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "15212700054805789",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "15212700054805789",
    "payment_link": null,
    "profile_id": "pro_McJmiAJzH046VnPS0CAN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_O7lUCBZh6h106Xmsxady",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-31T14:05:56.144Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_dPmHDOL7xWQi0IGMPlCF",
    "payment_method_status": "active",
    "updated": "2025-07-31T13:50:58.462Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "R2cB22w22w00a02c-R22w22w22wNJV-V14o10kNZ22wB18sB18s16q00aNP22wXV",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
<details>
<summary>Make a mandate payment auto capture</summary>
```json
{
    "amount": 100,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "Customer123",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_dPmHDOL7xWQi0IGMPlCF"
    }
}
```
Response
```json
{
    "payment_id": "pay_Ep1buzxTanjWDHQIv3Sx",
    "merchant_id": "merchant_1753878378",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "novalnet",
    "client_secret": "pay_Ep1buzxTanjWDHQIv3Sx_secret_9faeER31esgb88tLjiqK",
    "created": "2025-07-31T13:52:14.410Z",
    "currency": "EUR",
    "customer_id": "Customer123",
    "customer": {
        "id": "Customer123",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": "Visa",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Customer123",
        "created_at": 1753969934,
        "expires": 1753973534,
        "secret": "epk_253da8acb7454f67a2fb6bcdc170f1aa"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "15212700054912058",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "15212700054912058",
    "payment_link": null,
    "profile_id": "pro_McJmiAJzH046VnPS0CAN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_O7lUCBZh6h106Xmsxady",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-31T14:07:14.410Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_dPmHDOL7xWQi0IGMPlCF",
    "payment_method_status": "active",
    "updated": "2025-07-31T13:52:17.146Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "R2cB22w22w00a02c-R22w22w22wNJV-V14o10kNZ22wB18sB18s16q00aNP22wXV",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8870 | 
	Bug: Retry Limit Tracking for Payment Processor Tokens in Revenue Recovery
## Background
In the current **revenue recovery flow**, there is **no mapping between a customer and their payment methods**.  
However, card networks enforce **retry limits** — both daily and rolling 30-day — for each merchant–customer card combination.  
Without a centralized retry counter:
- We risk exceeding network retry thresholds
- Decline rates can increase
- Merchant compliance issues may arise
---
## Problem Statement
We need a way to:
1. **Group multiple cards** belonging to the same customer under a shared `connector_customer_id`
2. **Track retries per token** for both daily and rolling 30-day windows
3. **Enforce retry limits** before selecting a token for retry | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index 00f7ba33a59..eb976ce8a39 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1179,6 +1179,24 @@ billing_connectors_which_requires_invoice_sync_call = "recurly" # List of billin
 [revenue_recovery]
 monitoring_threshold_in_seconds = 60  # 60 secs , threshold for monitoring the retry system
 retry_algorithm_type = "cascading"  # type of retry algorithm
+redis_ttl_in_seconds=3888000  # ttl for redis for storing payment processor token details
+
+# Card specific configuration for Revenue Recovery
+[revenue_recovery.card_config.amex]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.mastercard]
+max_retries_per_day = 10
+max_retry_count_for_thirty_day = 35
+
+[revenue_recovery.card_config.visa]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.discover]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
 
 [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
 initial_timestamp_in_hours = 1          # number of hours added to start time for Decider service of Revenue Recovery
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 64db7079f40..40868da8f3f 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -386,6 +386,29 @@ base_url = "http://localhost:8000"      # Unified Connector Service Base URL
 connection_timeout = 10                 # Connection Timeout Duration in Seconds
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
 
+[revenue_recovery]
+# monitoring threshold -  120 days
+monitoring_threshold_in_seconds = 10368000 
+retry_algorithm_type = "cascading"
+redis_ttl_in_seconds=3888000 
+
+# Card specific configuration for Revenue Recovery
+[revenue_recovery.card_config.amex]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.mastercard]
+max_retries_per_day = 10
+max_retry_count_for_thirty_day = 35
+
+[revenue_recovery.card_config.visa]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.discover]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
 [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
 initial_timestamp_in_hours = 1        # number of hours added to start time for Decider service of Revenue Recovery
 
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 40a0bdb137e..7ebb3e1079d 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -850,11 +850,6 @@ billing_connectors_which_require_payment_sync = "stripebilling, recurly"
 [billing_connectors_invoice_sync]
 billing_connectors_which_requires_invoice_sync_call = "recurly"
 
-
-[revenue_recovery]
-monitoring_threshold_in_seconds = 60
-retry_algorithm_type = "cascading"
-
 [authentication_providers]
 click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index c4c37289fa1..3cb914fdcdb 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -865,10 +865,6 @@ billing_connectors_which_requires_invoice_sync_call = "recurly"
 [authentication_providers]
 click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 
-
-[revenue_recovery]
-monitoring_threshold_in_seconds = 60
-retry_algorithm_type = "cascading"
-
 [grpc_client.unified_connector_service]
 ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors that use UCS only
+
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 171b4bf0987..b91df6cf2b4 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -872,10 +872,6 @@ billing_connectors_which_requires_invoice_sync_call = "recurly"
 [authentication_providers]
 click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 
-[revenue_recovery]
-monitoring_threshold_in_seconds = 60
-retry_algorithm_type = "cascading"
-
 [list_dispute_supported_connectors]
 connector_list = "worldpayvantiv"
 
diff --git a/config/development.toml b/config/development.toml
index a2d06e7d28e..02a5dce3be5 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1295,10 +1295,27 @@ ucs_only_connectors = "paytm, phonepe"    # Comma-separated list of connectors t
 [revenue_recovery]
 monitoring_threshold_in_seconds = 60
 retry_algorithm_type = "cascading"
+redis_ttl_in_seconds=3888000
 
 [revenue_recovery.recovery_timestamp]
 initial_timestamp_in_hours = 1
 
+[revenue_recovery.card_config.amex]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.mastercard]
+max_retries_per_day = 10
+max_retry_count_for_thirty_day = 35
+
+[revenue_recovery.card_config.visa]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.discover]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
 [clone_connector_allowlist]
 merchant_ids = "merchant_123, merchant_234"     # Comma-separated list of allowed merchant IDs
 connector_names = "stripe, adyen"               # Comma-separated list of allowed connector names
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 544caf4c9f2..c60a2b0374e 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1197,6 +1197,24 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
 [revenue_recovery]
 monitoring_threshold_in_seconds = 60 # threshold for monitoring the retry system
 retry_algorithm_type = "cascading" # type of retry algorithm
+redis_ttl_in_seconds=3888000 # ttl for redis for storing payment processor token details
+
+# Card specific configuration for Revenue Recovery
+[revenue_recovery.card_config.amex]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.mastercard]
+max_retries_per_day = 10
+max_retry_count_for_thirty_day = 35
+
+[revenue_recovery.card_config.visa]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.discover]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
 
 [clone_connector_allowlist]
 merchant_ids = "merchant_123, merchant_234"     # Comma-separated list of allowed merchant IDs
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index b8bf2db6c3c..95f105c67b9 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -515,10 +515,26 @@ impl TryFrom<ChargebeeWebhookBody> for revenue_recovery::RevenueRecoveryAttemptD
             retry_count,
             invoice_next_billing_time,
             invoice_billing_started_at_time,
-            card_network: Some(payment_method_details.card.brand),
-            card_isin: Some(payment_method_details.card.iin),
             // This field is none because it is specific to stripebilling.
             charge_id: None,
+            // Need to populate these card info field
+            card_info: api_models::payments::AdditionalCardInfo {
+                card_network: Some(payment_method_details.card.brand),
+                card_isin: Some(payment_method_details.card.iin),
+                card_issuer: None,
+                card_type: None,
+                card_issuing_country: None,
+                bank_code: None,
+                last4: None,
+                card_extended_bin: None,
+                card_exp_month: None,
+                card_exp_year: None,
+                card_holder_name: None,
+                payment_checks: None,
+                authentication_data: None,
+                is_regulated: None,
+                signature_network: None,
+            },
         })
     }
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
index 42dfc3f86d8..7338500db80 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
@@ -204,10 +204,26 @@ impl
                     payment_method_type: common_enums::PaymentMethod::from(
                         item.response.payment_method.object,
                     ),
-                    card_network: Some(item.response.payment_method.card_type),
-                    card_isin: Some(item.response.payment_method.first_six),
                     // This none because this field is specific to stripebilling.
                     charge_id: None,
+                    // Need to populate these card info field
+                    card_info: api_models::payments::AdditionalCardInfo {
+                        card_network: Some(item.response.payment_method.card_type),
+                        card_isin: Some(item.response.payment_method.first_six),
+                        card_issuer: None,
+                        card_type: None,
+                        card_issuing_country: None,
+                        bank_code: None,
+                        last4: None,
+                        card_extended_bin: None,
+                        card_exp_month: None,
+                        card_exp_year: None,
+                        card_holder_name: None,
+                        payment_checks: None,
+                        authentication_data: None,
+                        is_regulated: None,
+                        signature_network: None,
+                    },
                 },
             ),
             ..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
index ffabab2ae95..a5e4610ffdb 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
@@ -560,12 +560,28 @@ impl
                     payment_method_type: common_enums::PaymentMethod::from(
                         charge_details.payment_method_details.type_of_payment_method,
                     ),
-                    card_network: Some(common_enums::CardNetwork::from(
-                        charge_details.payment_method_details.card_details.network,
-                    )),
                     // Todo: Fetch Card issuer details. Generally in the other billing connector we are getting card_issuer using the card bin info. But stripe dosent provide any such details. We should find a way for stripe billing case
-                    card_isin: None,
                     charge_id: Some(charge_details.charge_id.clone()),
+                    // Need to populate these card info field
+                    card_info: api_models::payments::AdditionalCardInfo {
+                        card_network: Some(common_enums::CardNetwork::from(
+                            charge_details.payment_method_details.card_details.network,
+                        )),
+                        card_isin: None,
+                        card_issuer: None,
+                        card_type: None,
+                        card_issuing_country: None,
+                        bank_code: None,
+                        last4: None,
+                        card_extended_bin: None,
+                        card_exp_month: None,
+                        card_exp_year: None,
+                        card_holder_name: None,
+                        payment_checks: None,
+                        authentication_data: None,
+                        is_regulated: None,
+                        signature_network: None,
+                    },
                 },
             ),
             ..item.data
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 36eece964f9..0a63c036780 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -752,10 +752,25 @@ impl PaymentIntent {
             retry_count: None,
             invoice_next_billing_time: None,
             invoice_billing_started_at_time: None,
-            card_isin: None,
-            card_network: None,
             // No charge id is present here since it is an internal payment and we didn't call connector yet.
             charge_id: None,
+            card_info: api_models::payments::AdditionalCardInfo {
+                card_issuer: None,
+                card_network: None,
+                card_type: None,
+                card_issuing_country: None,
+                bank_code: None,
+                last4: None,
+                card_isin: None,
+                card_extended_bin: None,
+                card_exp_month: None,
+                card_exp_year: None,
+                card_holder_name: None,
+                payment_checks: None,
+                authentication_data: None,
+                is_regulated: None,
+                signature_network: None,
+            },
         })
     }
 
diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
index fd36c4420f1..094905b1baf 100644
--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
@@ -54,12 +54,10 @@ pub struct RevenueRecoveryAttemptData {
     pub invoice_next_billing_time: Option<PrimitiveDateTime>,
     /// Time at which the invoice created
     pub invoice_billing_started_at_time: Option<PrimitiveDateTime>,
-    /// card network type
-    pub card_network: Option<common_enums::CardNetwork>,
-    /// card isin
-    pub card_isin: Option<String>,
     /// stripe specific id used to validate duplicate attempts in revenue recovery flow
     pub charge_id: Option<String>,
+    /// Additional card details
+    pub card_info: api_payments::AdditionalCardInfo,
 }
 
 /// This is unified struct for Revenue Recovery Invoice Data and it is constructed from billing connectors
@@ -227,10 +225,9 @@ impl
             network_error_message: None,
             retry_count: invoice_details.retry_count,
             invoice_next_billing_time: invoice_details.next_billing_at,
-            card_network: billing_connector_payment_details.card_network.clone(),
-            card_isin: billing_connector_payment_details.card_isin.clone(),
             charge_id: billing_connector_payment_details.charge_id.clone(),
             invoice_billing_started_at_time: invoice_details.billing_started_at,
+            card_info: billing_connector_payment_details.card_info.clone(),
         }
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
index 3df81e6b66d..65a62f62125 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
@@ -28,12 +28,10 @@ pub struct BillingConnectorPaymentsSyncResponse {
     pub payment_method_type: common_enums::enums::PaymentMethod,
     /// payment method sub type of the payment attempt.
     pub payment_method_sub_type: common_enums::enums::PaymentMethodType,
-    /// card netword network
-    pub card_network: Option<common_enums::CardNetwork>,
-    /// card isin
-    pub card_isin: Option<String>,
     /// stripe specific id used to validate duplicate attempts.
     pub charge_id: Option<String>,
+    /// card information
+    pub card_info: api_models::payments::AdditionalCardInfo,
 }
 
 #[derive(Debug, Clone)]
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index c8e7cb4e6f4..bc8397b416b 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -496,4 +496,6 @@ pub enum RevenueRecoveryError {
     RetryAlgorithmUpdationFailed,
     #[error("Failed to create the revenue recovery attempt data")]
     RevenueRecoveryAttemptDataCreateFailed,
+    #[error("Failed to insert the revenue recovery payment method data in redis")]
+    RevenueRecoveryRedisInsertFailed,
 }
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 8a3594c310c..cdd552da14c 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -5508,7 +5508,10 @@ impl ForeignFrom<&hyperswitch_domain_models::payments::payment_attempt::PaymentA
             created_at: attempt.created_at,
             modified_at: attempt.modified_at,
             cancellation_reason: attempt.cancellation_reason.clone(),
-            payment_token: attempt.payment_token.clone(),
+            payment_token: attempt
+                .connector_token_details
+                .as_ref()
+                .and_then(|details| details.connector_mandate_id.clone()),
             connector_metadata: attempt.connector_metadata.clone(),
             payment_experience: attempt.payment_experience,
             payment_method_type: attempt.payment_method_type,
diff --git a/crates/router/src/core/revenue_recovery/api.rs b/crates/router/src/core/revenue_recovery/api.rs
index b8f912030c1..d942db48b4d 100644
--- a/crates/router/src/core/revenue_recovery/api.rs
+++ b/crates/router/src/core/revenue_recovery/api.rs
@@ -1,5 +1,5 @@
 use actix_web::{web, Responder};
-use api_models::payments as payments_api;
+use api_models::{payments as payments_api, payments as api_payments};
 use common_utils::id_type;
 use error_stack::{report, FutureExt, ResultExt};
 use hyperswitch_domain_models::{
diff --git a/crates/router/src/core/revenue_recovery/transformers.rs b/crates/router/src/core/revenue_recovery/transformers.rs
index b282ac1e94c..f78d496a6ba 100644
--- a/crates/router/src/core/revenue_recovery/transformers.rs
+++ b/crates/router/src/core/revenue_recovery/transformers.rs
@@ -107,10 +107,25 @@ impl ForeignFrom<&api_models::payments::RecoveryPaymentsCreate>
             retry_count: None,
             invoice_next_billing_time: None,
             invoice_billing_started_at_time: data.billing_started_at,
-            card_network: card_info
-                .as_ref()
-                .and_then(|info| info.card_network.clone()),
-            card_isin: card_info.as_ref().and_then(|info| info.card_isin.clone()),
+            card_info: card_info
+                .cloned()
+                .unwrap_or(api_models::payments::AdditionalCardInfo {
+                    card_issuer: None,
+                    card_network: None,
+                    card_type: None,
+                    card_issuing_country: None,
+                    bank_code: None,
+                    last4: None,
+                    card_isin: None,
+                    card_extended_bin: None,
+                    card_exp_month: None,
+                    card_exp_year: None,
+                    card_holder_name: None,
+                    payment_checks: None,
+                    authentication_data: None,
+                    is_regulated: None,
+                    signature_network: None,
+                }),
             charge_id: None,
         }
     }
diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs
index 32cb5552655..5f00dd0c5f2 100644
--- a/crates/router/src/core/webhooks/recovery_incoming.rs
+++ b/crates/router/src/core/webhooks/recovery_incoming.rs
@@ -1,4 +1,4 @@
-use std::{marker::PhantomData, str::FromStr};
+use std::{collections::HashMap, marker::PhantomData, str::FromStr};
 
 use api_models::{enums as api_enums, payments as api_payments, webhooks};
 use common_utils::{
@@ -30,11 +30,19 @@ use crate::{
         connector_integration_interface::{self, RouterDataConversion},
     },
     types::{
-        self, api, domain, storage::revenue_recovery as storage_churn_recovery,
+        self, api, domain,
+        storage::{
+            revenue_recovery as storage_revenue_recovery,
+            revenue_recovery_redis_operation::{
+                PaymentProcessorTokenDetails, PaymentProcessorTokenStatus, RedisTokenManager,
+            },
+        },
         transformers::ForeignFrom,
     },
     workflows::revenue_recovery as revenue_recovery_flow,
 };
+#[cfg(feature = "v2")]
+pub const REVENUE_RECOVERY: &str = "revenue_recovery";
 
 #[allow(clippy::too_many_arguments)]
 #[instrument(skip_all)]
@@ -617,14 +625,15 @@ impl RevenueRecoveryAttempt {
         errors::RevenueRecoveryError,
     > {
         let payment_connector_id =   payment_connector_account.as_ref().map(|account: &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount| account.id.clone());
+        let payment_connector_name = payment_connector_account
+            .as_ref()
+            .map(|account| account.connector_name);
         let request_payload: api_payments::PaymentsAttemptRecordRequest = self
             .create_payment_record_request(
                 state,
                 billing_connector_account_id,
                 payment_connector_id,
-                payment_connector_account
-                    .as_ref()
-                    .map(|account| account.connector_name),
+                payment_connector_name,
                 common_enums::TriggeredBy::External,
             )
             .await?;
@@ -685,6 +694,16 @@ impl RevenueRecoveryAttempt {
 
         let response = (recovery_attempt, updated_recovery_intent);
 
+        self.store_payment_processor_tokens_in_redis(state, &response.0, payment_connector_name)
+            .await
+            .map_err(|e| {
+                router_env::logger::error!(
+                    "Failed to store payment processor tokens in Redis: {:?}",
+                    e
+                );
+                errors::RevenueRecoveryError::RevenueRecoveryRedisInsertFailed
+            })?;
+
         Ok(response)
     }
 
@@ -709,6 +728,7 @@ impl RevenueRecoveryAttempt {
         };
 
         let card_info = revenue_recovery_attempt_data
+            .card_info
             .card_isin
             .clone()
             .async_and_then(|isin| async move {
@@ -755,7 +775,7 @@ impl RevenueRecoveryAttempt {
             invoice_billing_started_at_time: revenue_recovery_attempt_data
                 .invoice_billing_started_at_time,
             triggered_by,
-            card_network: revenue_recovery_attempt_data.card_network.clone(),
+            card_network: revenue_recovery_attempt_data.card_info.card_network.clone(),
             card_issuer,
         })
     }
@@ -899,7 +919,7 @@ impl RevenueRecoveryAttempt {
             .attach_printable("payment attempt id is required for pcr workflow tracking")?;
 
         let execute_workflow_tracking_data =
-            storage_churn_recovery::RevenueRecoveryWorkflowTrackingData {
+            storage_revenue_recovery::RevenueRecoveryWorkflowTrackingData {
                 billing_mca_id: billing_mca_id.clone(),
                 global_payment_id: payment_id.clone(),
                 merchant_id,
@@ -934,6 +954,77 @@ impl RevenueRecoveryAttempt {
             status: payment_intent.status,
         })
     }
+
+    /// Store payment processor tokens in Redis for retry management
+    async fn store_payment_processor_tokens_in_redis(
+        &self,
+        state: &SessionState,
+        recovery_attempt: &revenue_recovery::RecoveryPaymentAttempt,
+        payment_connector_name: Option<common_enums::connector_enums::Connector>,
+    ) -> CustomResult<(), errors::RevenueRecoveryError> {
+        let revenue_recovery_attempt_data = &self.0;
+        let error_code = revenue_recovery_attempt_data.error_code.clone();
+        let error_message = revenue_recovery_attempt_data.error_message.clone();
+        let connector_name = payment_connector_name
+            .ok_or(errors::RevenueRecoveryError::TransactionWebhookProcessingFailed)
+            .attach_printable("unable to derive payment connector")?
+            .to_string();
+
+        let gsm_record = helpers::get_gsm_record(
+            state,
+            error_code.clone(),
+            error_message,
+            connector_name,
+            REVENUE_RECOVERY.to_string(),
+        )
+        .await;
+
+        let is_hard_decline = gsm_record
+            .and_then(|record| record.error_category)
+            .map(|category| category == common_enums::ErrorCategory::HardDecline)
+            .unwrap_or(false);
+
+        // Extract required fields from the revenue recovery attempt data
+        let connector_customer_id = revenue_recovery_attempt_data.connector_customer_id.clone();
+
+        let attempt_id = recovery_attempt.attempt_id.clone();
+        let token_unit = PaymentProcessorTokenStatus {
+            error_code,
+            inserted_by_attempt_id: attempt_id.clone(),
+            daily_retry_history: HashMap::from([(recovery_attempt.created_at.date(), 1)]),
+            scheduled_at: None,
+            is_hard_decline: Some(is_hard_decline),
+            payment_processor_token_details: PaymentProcessorTokenDetails {
+                payment_processor_token: revenue_recovery_attempt_data
+                    .processor_payment_method_token
+                    .clone(),
+                expiry_month: revenue_recovery_attempt_data
+                    .card_info
+                    .card_exp_month
+                    .clone(),
+                expiry_year: revenue_recovery_attempt_data
+                    .card_info
+                    .card_exp_year
+                    .clone(),
+                card_issuer: revenue_recovery_attempt_data.card_info.card_issuer.clone(),
+                last_four_digits: revenue_recovery_attempt_data.card_info.last4.clone(),
+                card_network: revenue_recovery_attempt_data.card_info.card_network.clone(),
+                card_type: revenue_recovery_attempt_data.card_info.card_type.clone(),
+            },
+        };
+
+        // Make the Redis call to store tokens
+        RedisTokenManager::upsert_payment_processor_token(
+            state,
+            &connector_customer_id,
+            token_unit,
+        )
+        .await
+        .change_context(errors::RevenueRecoveryError::RevenueRecoveryRedisInsertFailed)
+        .attach_printable("Failed to store payment processor tokens in Redis")?;
+
+        Ok(())
+    }
 }
 
 pub struct BillingConnectorPaymentsSyncResponseData(
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 341f9327f75..70a0a344150 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -36,6 +36,8 @@ pub mod payouts;
 pub mod refund;
 #[cfg(feature = "v2")]
 pub mod revenue_recovery;
+#[cfg(feature = "v2")]
+pub mod revenue_recovery_redis_operation;
 pub mod reverse_lookup;
 pub mod role;
 pub mod routing_algorithm;
diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs
index 1c1a076fd01..81a012ba414 100644
--- a/crates/router/src/types/storage/revenue_recovery.rs
+++ b/crates/router/src/types/storage/revenue_recovery.rs
@@ -1,7 +1,8 @@
-use std::fmt::Debug;
+use std::{collections::HashMap, fmt::Debug};
 
-use common_enums::enums;
+use common_enums::enums::{self, CardNetwork};
 use common_utils::{date_time, ext_traits::ValueExt, id_type};
+use error_stack::ResultExt;
 use external_services::grpc_client::{self as external_grpc_client, GrpcHeaders};
 use hyperswitch_domain_models::{
     business_profile, merchant_account, merchant_connector_account, merchant_key_store,
@@ -10,6 +11,7 @@ use hyperswitch_domain_models::{
 };
 use masking::PeekInterface;
 use router_env::logger;
+use serde::{Deserialize, Serialize};
 
 use crate::{db::StorageInterface, routes::SessionState, workflows::revenue_recovery};
 #[derive(serde::Serialize, serde::Deserialize, Debug)]
@@ -53,20 +55,7 @@ impl RevenueRecoveryPaymentData {
                 )
                 .await
             }
-            enums::RevenueRecoveryAlgorithmType::Smart => {
-                if is_hard_decline {
-                    None
-                } else {
-                    // TODO: Integrate the smart retry call to return back a schedule time
-                    revenue_recovery::get_schedule_time_for_smart_retry(
-                        state,
-                        payment_attempt,
-                        payment_intent,
-                        retry_count,
-                    )
-                    .await
-                }
-            }
+            enums::RevenueRecoveryAlgorithmType::Smart => None,
         }
     }
 }
@@ -76,6 +65,8 @@ pub struct RevenueRecoverySettings {
     pub monitoring_threshold_in_seconds: i64,
     pub retry_algorithm_type: enums::RevenueRecoveryAlgorithmType,
     pub recovery_timestamp: RecoveryTimestamp,
+    pub card_config: RetryLimitsConfig,
+    pub redis_ttl_in_seconds: i64,
 }
 
 #[derive(Debug, serde::Deserialize, Clone)]
@@ -90,3 +81,28 @@ impl Default for RecoveryTimestamp {
         }
     }
 }
+
+#[derive(Debug, serde::Deserialize, Clone, Default)]
+pub struct RetryLimitsConfig(pub HashMap<CardNetwork, NetworkRetryConfig>);
+
+#[derive(Debug, serde::Deserialize, Clone, Default)]
+pub struct NetworkRetryConfig {
+    pub max_retries_per_day: i32,
+    pub max_retry_count_for_thirty_day: i32,
+}
+
+impl RetryLimitsConfig {
+    pub fn get_network_config(&self, network: Option<CardNetwork>) -> &NetworkRetryConfig {
+        // Hardcoded fallback default config
+        static DEFAULT_CONFIG: NetworkRetryConfig = NetworkRetryConfig {
+            max_retries_per_day: 20,
+            max_retry_count_for_thirty_day: 20,
+        };
+
+        if let Some(net) = network {
+            self.0.get(&net).unwrap_or(&DEFAULT_CONFIG)
+        } else {
+            self.0.get(&CardNetwork::Visa).unwrap_or(&DEFAULT_CONFIG)
+        }
+    }
+}
diff --git a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
new file mode 100644
index 00000000000..433de9c2b36
--- /dev/null
+++ b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
@@ -0,0 +1,655 @@
+use std::collections::HashMap;
+
+use common_enums::enums::CardNetwork;
+use common_utils::{date_time, errors::CustomResult, id_type};
+use error_stack::ResultExt;
+use masking::Secret;
+use redis_interface::{DelReply, SetnxReply};
+use router_env::{instrument, tracing};
+use serde::{Deserialize, Serialize};
+use time::{Date, Duration, OffsetDateTime, PrimitiveDateTime};
+
+use crate::{db::errors, SessionState};
+
+// Constants for retry window management
+const RETRY_WINDOW_DAYS: i32 = 30;
+const INITIAL_RETRY_COUNT: i32 = 0;
+
+/// Payment processor token details including card information
+#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
+pub struct PaymentProcessorTokenDetails {
+    pub payment_processor_token: String,
+    pub expiry_month: Option<Secret<String>>,
+    pub expiry_year: Option<Secret<String>>,
+    pub card_issuer: Option<String>,
+    pub last_four_digits: Option<String>,
+    pub card_network: Option<CardNetwork>,
+    pub card_type: Option<String>,
+}
+
+/// Represents the status and retry history of a payment processor token
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct PaymentProcessorTokenStatus {
+    /// Payment processor token details including card information and token ID
+    pub payment_processor_token_details: PaymentProcessorTokenDetails,
+    /// Payment intent ID that originally inserted this token
+    pub inserted_by_attempt_id: id_type::GlobalAttemptId,
+    /// Error code associated with the token failure
+    pub error_code: Option<String>,
+    /// Daily retry count history for the last 30 days (date -> retry_count)
+    pub daily_retry_history: HashMap<Date, i32>,
+    /// Scheduled time for the next retry attempt
+    pub scheduled_at: Option<PrimitiveDateTime>,
+    /// Indicates if the token is a hard decline (no retries allowed)
+    pub is_hard_decline: Option<bool>,
+}
+
+/// Token retry availability information with detailed wait times
+#[derive(Debug, Clone)]
+pub struct TokenRetryInfo {
+    pub monthly_wait_hours: i64,   // Hours to wait for 30-day limit reset
+    pub daily_wait_hours: i64,     // Hours to wait for daily limit reset
+    pub total_30_day_retries: i32, // Current total retry count in 30-day window
+}
+
+/// Complete token information with retry limits and wait times
+#[derive(Debug, Clone)]
+pub struct PaymentProcessorTokenWithRetryInfo {
+    /// The complete token status information
+    pub token_status: PaymentProcessorTokenStatus,
+    /// Hours to wait before next retry attempt (max of daily/monthly wait)
+    pub retry_wait_time_hours: i64,
+    /// Number of retries remaining in the 30-day rolling window
+    pub monthly_retry_remaining: i32,
+}
+
+/// Redis-based token management struct
+pub struct RedisTokenManager;
+
+impl RedisTokenManager {
+    /// Lock connector customer
+    #[instrument(skip_all)]
+    pub async fn lock_connector_customer_status(
+        state: &SessionState,
+        connector_customer_id: &str,
+        payment_id: &id_type::GlobalPaymentId,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let redis_conn =
+            state
+                .store
+                .get_redis_conn()
+                .change_context(errors::StorageError::RedisError(
+                    errors::RedisError::RedisConnectionError.into(),
+                ))?;
+
+        let lock_key = format!("customer:{connector_customer_id}:status");
+        let seconds = &state.conf.revenue_recovery.redis_ttl_in_seconds;
+
+        let result: bool = match redis_conn
+            .set_key_if_not_exists_with_expiry(
+                &lock_key.into(),
+                payment_id.get_string_repr(),
+                Some(*seconds),
+            )
+            .await
+        {
+            Ok(resp) => resp == SetnxReply::KeySet,
+            Err(error) => {
+                tracing::error!(operation = "lock_stream", err = ?error);
+                false
+            }
+        };
+
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            payment_id = payment_id.get_string_repr(),
+            lock_acquired = %result,
+            "Connector customer lock attempt"
+        );
+
+        Ok(result)
+    }
+
+    /// Unlock connector customer status
+    #[instrument(skip_all)]
+    pub async fn unlock_connector_customer_status(
+        state: &SessionState,
+        connector_customer_id: &str,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let redis_conn =
+            state
+                .store
+                .get_redis_conn()
+                .change_context(errors::StorageError::RedisError(
+                    errors::RedisError::RedisConnectionError.into(),
+                ))?;
+
+        let lock_key = format!("customer:{connector_customer_id}:status");
+
+        match redis_conn.delete_key(&lock_key.into()).await {
+            Ok(DelReply::KeyDeleted) => {
+                tracing::debug!(
+                    connector_customer_id = connector_customer_id,
+                    "Connector customer unlocked"
+                );
+                Ok(true)
+            }
+            Ok(DelReply::KeyNotDeleted) => {
+                tracing::debug!("Tried to unlock a stream which is already unlocked");
+                Ok(false)
+            }
+            Err(err) => {
+                tracing::error!(?err, "Failed to delete lock key");
+                Ok(false)
+            }
+        }
+    }
+
+    /// Get all payment processor tokens for a connector customer
+    #[instrument(skip_all)]
+    pub async fn get_connector_customer_payment_processor_tokens(
+        state: &SessionState,
+        connector_customer_id: &str,
+    ) -> CustomResult<HashMap<String, PaymentProcessorTokenStatus>, errors::StorageError> {
+        let redis_conn =
+            state
+                .store
+                .get_redis_conn()
+                .change_context(errors::StorageError::RedisError(
+                    errors::RedisError::RedisConnectionError.into(),
+                ))?;
+        let tokens_key = format!("customer:{connector_customer_id}:tokens");
+
+        let get_hash_err =
+            errors::StorageError::RedisError(errors::RedisError::GetHashFieldFailed.into());
+
+        let payment_processor_tokens: HashMap<String, String> = redis_conn
+            .get_hash_fields(&tokens_key.into())
+            .await
+            .change_context(get_hash_err)?;
+
+        // build the result map using iterator adapters (explicit match preserved for logging)
+        let payment_processor_token_info_map: HashMap<String, PaymentProcessorTokenStatus> =
+            payment_processor_tokens
+                .into_iter()
+                .filter_map(|(token_id, token_data)| {
+                    match serde_json::from_str::<PaymentProcessorTokenStatus>(&token_data) {
+                        Ok(token_status) => Some((token_id, token_status)),
+                        Err(err) => {
+                            tracing::warn!(
+                                connector_customer_id = %connector_customer_id,
+                                token_id = %token_id,
+                                error = %err,
+                                "Failed to deserialize token data, skipping",
+                            );
+                            None
+                        }
+                    }
+                })
+                .collect();
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            "Fetched payment processor tokens",
+        );
+
+        Ok(payment_processor_token_info_map)
+    }
+
+    /// Update connector customer payment processor tokens or add if doesn't exist
+    #[instrument(skip_all)]
+    pub async fn update_or_add_connector_customer_payment_processor_tokens(
+        state: &SessionState,
+        connector_customer_id: &str,
+        payment_processor_token_info_map: HashMap<String, PaymentProcessorTokenStatus>,
+    ) -> CustomResult<(), errors::StorageError> {
+        let redis_conn =
+            state
+                .store
+                .get_redis_conn()
+                .change_context(errors::StorageError::RedisError(
+                    errors::RedisError::RedisConnectionError.into(),
+                ))?;
+        let tokens_key = format!("customer:{connector_customer_id}:tokens");
+
+        // allocate capacity up-front to avoid rehashing
+        let mut serialized_payment_processor_tokens: HashMap<String, String> =
+            HashMap::with_capacity(payment_processor_token_info_map.len());
+
+        // serialize all tokens, preserving explicit error handling and attachable diagnostics
+        for (payment_processor_token_id, payment_processor_token_status) in
+            payment_processor_token_info_map
+        {
+            let serialized = serde_json::to_string(&payment_processor_token_status)
+                .change_context(errors::StorageError::SerializationFailed)
+                .attach_printable("Failed to serialize token status")?;
+
+            serialized_payment_processor_tokens.insert(payment_processor_token_id, serialized);
+        }
+        let seconds = &state.conf.revenue_recovery.redis_ttl_in_seconds;
+
+        // Update or add tokens
+        redis_conn
+            .set_hash_fields(
+                &tokens_key.into(),
+                serialized_payment_processor_tokens,
+                Some(*seconds),
+            )
+            .await
+            .change_context(errors::StorageError::RedisError(
+                errors::RedisError::SetHashFieldFailed.into(),
+            ))?;
+
+        tracing::info!(
+            connector_customer_id = %connector_customer_id,
+            "Successfully updated or added customer tokens",
+        );
+
+        Ok(())
+    }
+
+    /// Get current date in `yyyy-mm-dd` format.
+    pub fn get_current_date() -> String {
+        let today = date_time::now().date();
+
+        let (year, month, day) = (today.year(), today.month(), today.day());
+
+        format!("{year:04}-{month:02}-{day:02}",)
+    }
+
+    /// Normalize retry window to exactly `RETRY_WINDOW_DAYS` days (today to `RETRY_WINDOW_DAYS - 1` days ago).
+    pub fn normalize_retry_window(
+        payment_processor_token: &mut PaymentProcessorTokenStatus,
+        today: Date,
+    ) {
+        let mut normalized_retry_history: HashMap<Date, i32> = HashMap::new();
+
+        for days_ago in 0..RETRY_WINDOW_DAYS {
+            let date = today - Duration::days(days_ago.into());
+
+            payment_processor_token
+                .daily_retry_history
+                .get(&date)
+                .map(|&retry_count| {
+                    normalized_retry_history.insert(date, retry_count);
+                });
+        }
+
+        payment_processor_token.daily_retry_history = normalized_retry_history;
+    }
+
+    /// Get all payment processor tokens with retry information and wait times.
+    pub fn get_tokens_with_retry_metadata(
+        state: &SessionState,
+        payment_processor_token_info_map: &HashMap<String, PaymentProcessorTokenStatus>,
+    ) -> HashMap<String, PaymentProcessorTokenWithRetryInfo> {
+        let today = OffsetDateTime::now_utc().date();
+        let card_config = &state.conf.revenue_recovery.card_config;
+
+        let mut result: HashMap<String, PaymentProcessorTokenWithRetryInfo> =
+            HashMap::with_capacity(payment_processor_token_info_map.len());
+
+        for (payment_processor_token_id, payment_processor_token_status) in
+            payment_processor_token_info_map.iter()
+        {
+            let card_network = payment_processor_token_status
+                .payment_processor_token_details
+                .card_network
+                .clone();
+
+            // Calculate retry information.
+            let retry_info = Self::payment_processor_token_retry_info(
+                state,
+                payment_processor_token_status,
+                today,
+                card_network.clone(),
+            );
+
+            // Determine the wait time (max of monthly and daily wait hours).
+            let retry_wait_time_hours = retry_info
+                .monthly_wait_hours
+                .max(retry_info.daily_wait_hours);
+
+            // Obtain network-specific limits and compute remaining monthly retries.
+            let card_network_config = card_config.get_network_config(card_network);
+
+            let monthly_retry_remaining = card_network_config
+                .max_retry_count_for_thirty_day
+                .saturating_sub(retry_info.total_30_day_retries);
+
+            // Build the per-token result struct.
+            let token_with_retry_info = PaymentProcessorTokenWithRetryInfo {
+                token_status: payment_processor_token_status.clone(),
+                retry_wait_time_hours,
+                monthly_retry_remaining,
+            };
+
+            result.insert(payment_processor_token_id.clone(), token_with_retry_info);
+        }
+        tracing::debug!("Fetched payment processor tokens with retry metadata",);
+
+        result
+    }
+
+    /// Sum retries over exactly the last 30 days
+    fn calculate_total_30_day_retries(token: &PaymentProcessorTokenStatus, today: Date) -> i32 {
+        (0..RETRY_WINDOW_DAYS)
+            .map(|i| {
+                let date = today - Duration::days(i.into());
+                token
+                    .daily_retry_history
+                    .get(&date)
+                    .copied()
+                    .unwrap_or(INITIAL_RETRY_COUNT)
+            })
+            .sum()
+    }
+
+    /// Calculate wait hours
+    fn calculate_wait_hours(target_date: Date, now: OffsetDateTime) -> i64 {
+        let expiry_time = target_date.midnight().assume_utc();
+        (expiry_time - now).whole_hours().max(0)
+    }
+
+    /// Calculate retry counts for exactly the last 30 days
+    pub fn payment_processor_token_retry_info(
+        state: &SessionState,
+        token: &PaymentProcessorTokenStatus,
+        today: Date,
+        network_type: Option<CardNetwork>,
+    ) -> TokenRetryInfo {
+        let card_config = &state.conf.revenue_recovery.card_config;
+        let card_network_config = card_config.get_network_config(network_type);
+
+        let now = OffsetDateTime::now_utc();
+
+        let total_30_day_retries = Self::calculate_total_30_day_retries(token, today);
+
+        let monthly_wait_hours =
+            if total_30_day_retries >= card_network_config.max_retry_count_for_thirty_day {
+                (0..RETRY_WINDOW_DAYS)
+                    .map(|i| today - Duration::days(i.into()))
+                    .find(|date| token.daily_retry_history.get(date).copied().unwrap_or(0) > 0)
+                    .map(|date| Self::calculate_wait_hours(date + Duration::days(31), now))
+                    .unwrap_or(0)
+            } else {
+                0
+            };
+
+        let today_retries = token
+            .daily_retry_history
+            .get(&today)
+            .copied()
+            .unwrap_or(INITIAL_RETRY_COUNT);
+
+        let daily_wait_hours = if today_retries >= card_network_config.max_retries_per_day {
+            Self::calculate_wait_hours(today + Duration::days(1), now)
+        } else {
+            0
+        };
+
+        TokenRetryInfo {
+            monthly_wait_hours,
+            daily_wait_hours,
+            total_30_day_retries,
+        }
+    }
+
+    // Upsert payment processor token
+    #[instrument(skip_all)]
+    pub async fn upsert_payment_processor_token(
+        state: &SessionState,
+        connector_customer_id: &str,
+        token_data: PaymentProcessorTokenStatus,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let mut token_map =
+            Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id)
+                .await?;
+
+        let token_id = token_data
+            .payment_processor_token_details
+            .payment_processor_token
+            .clone();
+
+        let was_existing = token_map.contains_key(&token_id);
+
+        let error_code = token_data.error_code.clone();
+        let today = OffsetDateTime::now_utc().date();
+
+        token_map
+            .get_mut(&token_id)
+            .map(|existing_token| {
+                error_code.map(|err| existing_token.error_code = Some(err));
+
+                Self::normalize_retry_window(existing_token, today);
+
+                for (date, &value) in &token_data.daily_retry_history {
+                    existing_token
+                        .daily_retry_history
+                        .entry(*date)
+                        .and_modify(|v| *v += value)
+                        .or_insert(value);
+                }
+            })
+            .or_else(|| {
+                token_map.insert(token_id.clone(), token_data);
+                None
+            });
+
+        Self::update_or_add_connector_customer_payment_processor_tokens(
+            state,
+            connector_customer_id,
+            token_map,
+        )
+        .await?;
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            "Upsert payment processor tokens",
+        );
+
+        Ok(!was_existing)
+    }
+
+    // Update payment processor token error code with billing connector response
+    #[instrument(skip_all)]
+    pub async fn update_payment_processor_token_error_code_from_process_tracker(
+        state: &SessionState,
+        connector_customer_id: &str,
+        error_code: &Option<String>,
+        is_hard_decline: &Option<bool>,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let today = OffsetDateTime::now_utc().date();
+        let updated_token =
+            Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id)
+                .await?
+                .values()
+                .find(|status| status.scheduled_at.is_some())
+                .map(|status| PaymentProcessorTokenStatus {
+                    payment_processor_token_details: status.payment_processor_token_details.clone(),
+                    inserted_by_attempt_id: status.inserted_by_attempt_id.clone(),
+                    error_code: error_code.clone(),
+                    daily_retry_history: status.daily_retry_history.clone(),
+                    scheduled_at: None,
+                    is_hard_decline: *is_hard_decline,
+                });
+
+        match updated_token {
+            Some(mut token) => {
+                Self::normalize_retry_window(&mut token, today);
+
+                match token.error_code {
+                    None => token.daily_retry_history.clear(),
+                    Some(_) => {
+                        let current_count = token
+                            .daily_retry_history
+                            .get(&today)
+                            .copied()
+                            .unwrap_or(INITIAL_RETRY_COUNT);
+                        token.daily_retry_history.insert(today, current_count + 1);
+                    }
+                }
+
+                let mut tokens_map = HashMap::new();
+                tokens_map.insert(
+                    token
+                        .payment_processor_token_details
+                        .payment_processor_token
+                        .clone(),
+                    token.clone(),
+                );
+
+                Self::update_or_add_connector_customer_payment_processor_tokens(
+                    state,
+                    connector_customer_id,
+                    tokens_map,
+                )
+                .await?;
+                tracing::debug!(
+                    connector_customer_id = connector_customer_id,
+                    "Updated payment processor tokens with error code",
+                );
+                Ok(true)
+            }
+            None => {
+                tracing::debug!(
+                    connector_customer_id = connector_customer_id,
+                    "No Token found with scheduled time to update error code",
+                );
+                Ok(false)
+            }
+        }
+    }
+
+    // Update payment processor token schedule time
+    #[instrument(skip_all)]
+    pub async fn update_payment_processor_token_schedule_time(
+        state: &SessionState,
+        connector_customer_id: &str,
+        payment_processor_token: &str,
+        schedule_time: Option<PrimitiveDateTime>,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let updated_token =
+            Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id)
+                .await?
+                .values()
+                .find(|status| {
+                    status
+                        .payment_processor_token_details
+                        .payment_processor_token
+                        == payment_processor_token
+                })
+                .map(|status| PaymentProcessorTokenStatus {
+                    payment_processor_token_details: status.payment_processor_token_details.clone(),
+                    inserted_by_attempt_id: status.inserted_by_attempt_id.clone(),
+                    error_code: status.error_code.clone(),
+                    daily_retry_history: status.daily_retry_history.clone(),
+                    scheduled_at: schedule_time,
+                    is_hard_decline: status.is_hard_decline,
+                });
+
+        match updated_token {
+            Some(token) => {
+                let mut tokens_map = HashMap::new();
+                tokens_map.insert(
+                    token
+                        .payment_processor_token_details
+                        .payment_processor_token
+                        .clone(),
+                    token.clone(),
+                );
+                Self::update_or_add_connector_customer_payment_processor_tokens(
+                    state,
+                    connector_customer_id,
+                    tokens_map,
+                )
+                .await?;
+                tracing::debug!(
+                    connector_customer_id = connector_customer_id,
+                    "Updated payment processor tokens with schedule time",
+                );
+                Ok(true)
+            }
+            None => {
+                tracing::debug!(
+                    connector_customer_id = connector_customer_id,
+                    "payment processor tokens with not found",
+                );
+                Ok(false)
+            }
+        }
+    }
+
+    // Get payment processor token with schedule time
+    #[instrument(skip_all)]
+    pub async fn get_payment_processor_token_with_schedule_time(
+        state: &SessionState,
+        connector_customer_id: &str,
+    ) -> CustomResult<Option<PaymentProcessorTokenStatus>, errors::StorageError> {
+        let tokens =
+            Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id)
+                .await?;
+
+        let scheduled_token = tokens
+            .values()
+            .find(|status| status.scheduled_at.is_some())
+            .cloned();
+
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            "Fetched payment processor token with schedule time",
+        );
+
+        Ok(scheduled_token)
+    }
+
+    // Get payment processor token with max retry remaining for cascading retry algorithm
+    #[instrument(skip_all)]
+    pub async fn get_token_with_max_retry_remaining(
+        state: &SessionState,
+        connector_customer_id: &str,
+    ) -> CustomResult<Option<PaymentProcessorTokenWithRetryInfo>, errors::StorageError> {
+        // Get all tokens for the customer
+        let tokens_map =
+            Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id)
+                .await?;
+
+        // Tokens with retry metadata
+        let tokens_with_retry = Self::get_tokens_with_retry_metadata(state, &tokens_map);
+
+        // Find the token with max retry remaining
+        let max_retry_token = tokens_with_retry
+            .into_iter()
+            .filter(|(_, token_info)| !token_info.token_status.is_hard_decline.unwrap_or(false))
+            .max_by_key(|(_, token_info)| token_info.monthly_retry_remaining)
+            .map(|(_, token_info)| token_info);
+
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            "Fetched payment processor token with max retry remaining",
+        );
+
+        Ok(max_retry_token)
+    }
+
+    // Check if all tokens are hard declined or no token found for the customer
+    #[instrument(skip_all)]
+    pub async fn are_all_tokens_hard_declined(
+        state: &SessionState,
+        connector_customer_id: &str,
+    ) -> CustomResult<bool, errors::StorageError> {
+        let tokens_map =
+            Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id)
+                .await?;
+        let all_hard_declined = tokens_map.is_empty()
+            && tokens_map
+                .values()
+                .all(|token| token.is_hard_decline.unwrap_or(false));
+
+        tracing::debug!(
+            connector_customer_id = connector_customer_id,
+            all_hard_declined,
+            "Checked if all tokens are hard declined or no token found for the customer",
+        );
+
+        Ok(all_hard_declined)
+    }
+}
diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs
index c962aeb68e5..8f3b3f0e009 100644
--- a/crates/router/src/workflows/revenue_recovery.rs
+++ b/crates/router/src/workflows/revenue_recovery.rs
@@ -1,14 +1,19 @@
 #[cfg(feature = "v2")]
-use api_models::payments::PaymentsGetIntentRequest;
+use std::collections::HashMap;
+
+#[cfg(feature = "v2")]
+use api_models::{enums::RevenueRecoveryAlgorithmType, payments::PaymentsGetIntentRequest};
 #[cfg(feature = "v2")]
 use common_utils::{
+    errors::CustomResult,
+    ext_traits::AsyncExt,
     ext_traits::{StringExt, ValueExt},
     id_type,
 };
 #[cfg(feature = "v2")]
 use diesel_models::types::BillingConnectorPaymentMethodDetails;
 #[cfg(feature = "v2")]
-use error_stack::ResultExt;
+use error_stack::{Report, ResultExt};
 #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
 use external_services::{
     date_time, grpc_client::revenue_recovery::recovery_decider_client as external_grpc_client,
@@ -16,21 +21,37 @@ use external_services::{
 #[cfg(feature = "v2")]
 use hyperswitch_domain_models::{
     payment_method_data::PaymentMethodData,
-    payments::{
-        payment_attempt::PaymentAttempt, PaymentConfirmData, PaymentIntent, PaymentIntentData,
-    },
+    payments::{payment_attempt, PaymentConfirmData, PaymentIntent, PaymentIntentData},
+    router_flow_types,
     router_flow_types::Authorize,
 };
 #[cfg(feature = "v2")]
 use masking::{ExposeInterface, PeekInterface, Secret};
 #[cfg(feature = "v2")]
-use router_env::logger;
+use router_env::{logger, tracing};
 use scheduler::{consumer::workflows::ProcessTrackerWorkflow, errors};
 #[cfg(feature = "v2")]
 use scheduler::{types::process_data, utils as scheduler_utils};
 #[cfg(feature = "v2")]
 use storage_impl::errors as storage_errors;
+#[cfg(feature = "v2")]
+use time::Date;
 
+#[cfg(feature = "v2")]
+use crate::core::payments::operations;
+#[cfg(feature = "v2")]
+use crate::routes::app::ReqState;
+#[cfg(feature = "v2")]
+use crate::services;
+#[cfg(feature = "v2")]
+use crate::types::storage::{
+    revenue_recovery::RetryLimitsConfig,
+    revenue_recovery_redis_operation::{
+        PaymentProcessorTokenStatus, PaymentProcessorTokenWithRetryInfo, RedisTokenManager,
+    },
+};
+#[cfg(feature = "v2")]
+use crate::workflows::revenue_recovery::pcr::api;
 #[cfg(feature = "v2")]
 use crate::{
     core::{
@@ -42,11 +63,16 @@ use crate::{
     types::{
         api::{self as api_types},
         domain,
-        storage::revenue_recovery as pcr_storage_types,
+        storage::{
+            revenue_recovery as pcr_storage_types,
+            revenue_recovery_redis_operation::PaymentProcessorTokenDetails,
+        },
     },
 };
 use crate::{routes::SessionState, types::storage};
 pub struct ExecutePcrWorkflow;
+#[cfg(feature = "v2")]
+pub const REVENUE_RECOVERY: &str = "revenue_recovery";
 
 #[async_trait::async_trait]
 impl ProcessTrackerWorkflow<SessionState> for ExecutePcrWorkflow {
@@ -218,21 +244,21 @@ pub(crate) async fn get_schedule_time_to_retry_mit_payments(
 #[cfg(feature = "v2")]
 pub(crate) async fn get_schedule_time_for_smart_retry(
     state: &SessionState,
-    payment_attempt: &PaymentAttempt,
     payment_intent: &PaymentIntent,
-    retry_count: i32,
-) -> Option<time::PrimitiveDateTime> {
-    let first_error_message = match payment_attempt.error.as_ref() {
-        Some(error) => error.message.clone(),
-        None => {
-            logger::error!(
-                payment_intent_id = ?payment_intent.get_id(),
-                attempt_id = ?payment_attempt.get_id(),
-                "Payment attempt error information not found - cannot proceed with smart retry"
-            );
-            return None;
-        }
-    };
+    retry_after_time: Option<prost_types::Timestamp>,
+    token_with_retry_info: &PaymentProcessorTokenWithRetryInfo,
+) -> Result<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
+    let card_config = &state.conf.revenue_recovery.card_config;
+
+    // Not populating it right now
+    let first_error_message = "None".to_string();
+    let retry_count_left = token_with_retry_info.monthly_retry_remaining;
+    let pg_error_code = token_with_retry_info.token_status.error_code.clone();
+
+    let card_info = token_with_retry_info
+        .token_status
+        .payment_processor_token_details
+        .clone();
 
     let billing_state = payment_intent
         .billing_address
@@ -241,54 +267,19 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
         .and_then(|details| details.state.as_ref())
         .cloned();
 
-    // Check if payment_method_data itself is None
-    if payment_attempt.payment_method_data.is_none() {
-        logger::debug!(
-            payment_intent_id = ?payment_intent.get_id(),
-            attempt_id = ?payment_attempt.get_id(),
-            message = "payment_attempt.payment_method_data is None"
-        );
-    }
-
-    let billing_connector_payment_method_details = payment_intent
-        .feature_metadata
-        .as_ref()
-        .and_then(|revenue_recovery_data| {
-            revenue_recovery_data
-                .payment_revenue_recovery_metadata
-                .as_ref()
-        })
-        .and_then(|payment_metadata| {
-            payment_metadata
-                .billing_connector_payment_method_details
-                .as_ref()
-        });
-
     let revenue_recovery_metadata = payment_intent
         .feature_metadata
         .as_ref()
         .and_then(|metadata| metadata.payment_revenue_recovery_metadata.as_ref());
 
-    let card_network_str = billing_connector_payment_method_details
-        .and_then(|details| match details {
-            BillingConnectorPaymentMethodDetails::Card(card_info) => card_info.card_network.clone(),
-        })
-        .map(|cn| cn.to_string());
+    let card_network = card_info.card_network.clone();
+    let total_retry_count_within_network = card_config.get_network_config(card_network.clone());
 
-    let card_issuer_str =
-        billing_connector_payment_method_details.and_then(|details| match details {
-            BillingConnectorPaymentMethodDetails::Card(card_info) => card_info.card_issuer.clone(),
-        });
+    let card_network_str = card_network.map(|network| network.to_string());
 
-    let card_funding_str = payment_intent
-        .feature_metadata
-        .as_ref()
-        .and_then(|revenue_recovery_data| {
-            revenue_recovery_data
-                .payment_revenue_recovery_metadata
-                .as_ref()
-        })
-        .map(|payment_metadata| payment_metadata.payment_method_subtype.to_string());
+    let card_issuer_str = card_info.card_issuer.clone();
+
+    let card_funding_str = card_info.card_type.clone();
 
     let start_time_primitive = payment_intent.created_at;
     let recovery_timestamp_config = &state.conf.revenue_recovery.recovery_timestamp;
@@ -296,6 +287,7 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
     let modified_start_time_primitive = start_time_primitive.saturating_add(time::Duration::hours(
         recovery_timestamp_config.initial_timestamp_in_hours,
     ));
+
     let start_time_proto = date_time::convert_to_prost_timestamp(modified_start_time_primitive);
 
     let merchant_id = Some(payment_intent.merchant_id.get_string_repr().to_string());
@@ -321,33 +313,6 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
         .and_then(|details| details.city.as_ref())
         .cloned();
 
-    let attempt_currency = Some(payment_intent.amount_details.currency.to_string());
-    let attempt_status = Some(payment_attempt.status.to_string());
-    let attempt_amount = Some(
-        payment_attempt
-            .amount_details
-            .get_net_amount()
-            .get_amount_as_i64(),
-    );
-    let attempt_response_time = Some(date_time::convert_to_prost_timestamp(
-        payment_attempt.created_at,
-    ));
-    let payment_method_type = Some(payment_attempt.payment_method_type.to_string());
-    let payment_gateway = payment_attempt.connector.clone();
-
-    let pg_error_code = payment_attempt
-        .error
-        .as_ref()
-        .map(|error| error.code.clone());
-    let network_advice_code = payment_attempt
-        .error
-        .as_ref()
-        .and_then(|error| error.network_advice_code.clone());
-    let network_error_code = payment_attempt
-        .error
-        .as_ref()
-        .and_then(|error| error.network_decline_code.clone());
-
     let first_pg_error_code = revenue_recovery_metadata
         .and_then(|metadata| metadata.first_payment_attempt_pg_error_code.clone());
     let first_network_advice_code = revenue_recovery_metadata
@@ -365,29 +330,37 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
         card_funding: card_funding_str,
         card_network: card_network_str,
         card_issuer: card_issuer_str,
-        invoice_start_time: start_time_proto,
-        retry_count: Some(retry_count.into()),
+        invoice_start_time: Some(start_time_proto),
+        retry_count: Some(
+            (total_retry_count_within_network.max_retry_count_for_thirty_day - retry_count_left)
+                .into(),
+        ),
         merchant_id,
         invoice_amount,
         invoice_currency,
         invoice_due_date,
         billing_country,
         billing_city,
-        attempt_currency,
-        attempt_status,
-        attempt_amount,
+        attempt_currency: None,
+        attempt_status: None,
+        attempt_amount: None,
         pg_error_code,
-        network_advice_code,
-        network_error_code,
+        network_advice_code: None,
+        network_error_code: None,
         first_pg_error_code,
         first_network_advice_code,
         first_network_error_code,
-        attempt_response_time,
-        payment_method_type,
-        payment_gateway,
-        retry_count_left: None,
+        attempt_response_time: None,
+        payment_method_type: None,
+        payment_gateway: None,
+        retry_count_left: Some(retry_count_left.into()),
+        total_retry_count_within_network: Some(
+            total_retry_count_within_network
+                .max_retry_count_for_thirty_day
+                .into(),
+        ),
         first_error_msg_time: None,
-        wait_time: None,
+        wait_time: retry_after_time,
     };
 
     if let Some(mut client) = state.grpc_client.recovery_decider_client.clone() {
@@ -395,7 +368,7 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
             .decide_on_retry(decider_request.into(), state.get_recovery_grpc_headers())
             .await
         {
-            Ok(grpc_response) => grpc_response
+            Ok(grpc_response) => Ok(grpc_response
                 .retry_flag
                 .then_some(())
                 .and(grpc_response.retry_time)
@@ -409,16 +382,16 @@ pub(crate) async fn get_schedule_time_for_smart_retry(
                             None // If conversion fails, treat as no valid retry time
                         }
                     }
-                }),
+                })),
 
             Err(e) => {
                 logger::error!("Recovery decider gRPC call failed: {e:?}");
-                None
+                Ok(None)
             }
         }
     } else {
         logger::debug!("Recovery decider client is not configured");
-        None
+        Ok(None)
     }
 }
 
@@ -430,7 +403,7 @@ struct InternalDeciderRequest {
     card_funding: Option<String>,
     card_network: Option<String>,
     card_issuer: Option<String>,
-    invoice_start_time: prost_types::Timestamp,
+    invoice_start_time: Option<prost_types::Timestamp>,
     retry_count: Option<i64>,
     merchant_id: Option<String>,
     invoice_amount: Option<i64>,
@@ -451,6 +424,7 @@ struct InternalDeciderRequest {
     payment_method_type: Option<String>,
     payment_gateway: Option<String>,
     retry_count_left: Option<i64>,
+    total_retry_count_within_network: Option<i64>,
     first_error_msg_time: Option<prost_types::Timestamp>,
     wait_time: Option<prost_types::Timestamp>,
 }
@@ -464,7 +438,7 @@ impl From<InternalDeciderRequest> for external_grpc_client::DeciderRequest {
             card_funding: internal_request.card_funding,
             card_network: internal_request.card_network,
             card_issuer: internal_request.card_issuer,
-            invoice_start_time: Some(internal_request.invoice_start_time),
+            invoice_start_time: internal_request.invoice_start_time,
             retry_count: internal_request.retry_count,
             merchant_id: internal_request.merchant_id,
             invoice_amount: internal_request.invoice_amount,
@@ -485,8 +459,302 @@ impl From<InternalDeciderRequest> for external_grpc_client::DeciderRequest {
             payment_method_type: internal_request.payment_method_type,
             payment_gateway: internal_request.payment_gateway,
             retry_count_left: internal_request.retry_count_left,
+            total_retry_count_within_network: internal_request.total_retry_count_within_network,
             first_error_msg_time: internal_request.first_error_msg_time,
             wait_time: internal_request.wait_time,
         }
     }
 }
+
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone)]
+pub struct ScheduledToken {
+    pub token_details: PaymentProcessorTokenDetails,
+    pub schedule_time: time::PrimitiveDateTime,
+}
+
+#[cfg(feature = "v2")]
+pub async fn get_token_with_schedule_time_based_on_retry_alogrithm_type(
+    state: &SessionState,
+    connector_customer_id: &str,
+    payment_intent: &PaymentIntent,
+    retry_algorithm_type: RevenueRecoveryAlgorithmType,
+    retry_count: i32,
+) -> CustomResult<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
+    let mut scheduled_time = None;
+
+    match retry_algorithm_type {
+        RevenueRecoveryAlgorithmType::Monitoring => {
+            logger::error!("Monitoring type found for Revenue Recovery retry payment");
+        }
+
+        RevenueRecoveryAlgorithmType::Cascading => {
+            let time = get_schedule_time_to_retry_mit_payments(
+                state.store.as_ref(),
+                &payment_intent.merchant_id,
+                retry_count,
+            )
+            .await
+            .ok_or(errors::ProcessTrackerError::EApiErrorResponse)?;
+
+            scheduled_time = Some(time);
+
+            let token =
+                RedisTokenManager::get_token_with_max_retry_remaining(state, connector_customer_id)
+                    .await
+                    .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
+
+            match token {
+                Some(token) => {
+                    RedisTokenManager::update_payment_processor_token_schedule_time(
+                        state,
+                        connector_customer_id,
+                        &token
+                            .token_status
+                            .payment_processor_token_details
+                            .payment_processor_token,
+                        scheduled_time,
+                    )
+                    .await
+                    .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
+
+                    logger::debug!("PSP token available for cascading retry");
+                }
+                None => {
+                    logger::debug!("No PSP token available for cascading retry");
+                    scheduled_time = None;
+                }
+            }
+        }
+
+        RevenueRecoveryAlgorithmType::Smart => {
+            scheduled_time = get_best_psp_token_available_for_smart_retry(
+                state,
+                connector_customer_id,
+                payment_intent,
+            )
+            .await
+            .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
+        }
+    }
+
+    Ok(scheduled_time)
+}
+
+#[cfg(feature = "v2")]
+pub async fn get_best_psp_token_available_for_smart_retry(
+    state: &SessionState,
+    connector_customer_id: &str,
+    payment_intent: &PaymentIntent,
+) -> CustomResult<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
+    //  Lock using payment_id
+    let locked = RedisTokenManager::lock_connector_customer_status(
+        state,
+        connector_customer_id,
+        &payment_intent.id,
+    )
+    .await
+    .change_context(errors::ProcessTrackerError::ERedisError(
+        errors::RedisError::RedisConnectionError.into(),
+    ))?;
+
+    match !locked {
+        true => Ok(None),
+
+        false => {
+            // Get existing tokens from Redis
+            let existing_tokens =
+                RedisTokenManager::get_connector_customer_payment_processor_tokens(
+                    state,
+                    connector_customer_id,
+                )
+                .await
+                .change_context(errors::ProcessTrackerError::ERedisError(
+                    errors::RedisError::RedisConnectionError.into(),
+                ))?;
+
+            // TODO: Insert into payment_intent_feature_metadata (DB operation)
+
+            let result = RedisTokenManager::get_tokens_with_retry_metadata(state, &existing_tokens);
+
+            let best_token_time = call_decider_for_payment_processor_tokens_select_closet_time(
+                state,
+                &result,
+                payment_intent,
+                connector_customer_id,
+            )
+            .await
+            .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
+
+            Ok(best_token_time)
+        }
+    }
+}
+
+#[cfg(feature = "v2")]
+pub async fn calculate_smart_retry_time(
+    state: &SessionState,
+    payment_intent: &PaymentIntent,
+    token_with_retry_info: &PaymentProcessorTokenWithRetryInfo,
+) -> Result<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
+    let wait_hours = token_with_retry_info.retry_wait_time_hours;
+    let current_time = time::OffsetDateTime::now_utc();
+    let future_time = current_time + time::Duration::hours(wait_hours);
+
+    // Timestamp after which retry can be done without penalty
+    let future_timestamp = Some(prost_types::Timestamp {
+        seconds: future_time.unix_timestamp(),
+        nanos: 0,
+    });
+
+    get_schedule_time_for_smart_retry(
+        state,
+        payment_intent,
+        future_timestamp,
+        token_with_retry_info,
+    )
+    .await
+}
+
+#[cfg(feature = "v2")]
+async fn process_token_for_retry(
+    state: &SessionState,
+    token_with_retry_info: &PaymentProcessorTokenWithRetryInfo,
+    payment_intent: &PaymentIntent,
+) -> Result<Option<ScheduledToken>, errors::ProcessTrackerError> {
+    let token_status: &PaymentProcessorTokenStatus = &token_with_retry_info.token_status;
+    let inserted_by_attempt_id = &token_status.inserted_by_attempt_id;
+
+    let skip = token_status.is_hard_decline.unwrap_or(false);
+
+    match skip {
+        true => {
+            logger::info!(
+                "Skipping decider call due to hard decline for attempt_id: {}",
+                inserted_by_attempt_id.get_string_repr()
+            );
+            Ok(None)
+        }
+        false => {
+            let schedule_time =
+                calculate_smart_retry_time(state, payment_intent, token_with_retry_info).await?;
+            Ok(schedule_time.map(|schedule_time| ScheduledToken {
+                token_details: token_status.payment_processor_token_details.clone(),
+                schedule_time,
+            }))
+        }
+    }
+}
+
+#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments)]
+pub async fn call_decider_for_payment_processor_tokens_select_closet_time(
+    state: &SessionState,
+    processor_tokens: &HashMap<String, PaymentProcessorTokenWithRetryInfo>,
+    payment_intent: &PaymentIntent,
+    connector_customer_id: &str,
+) -> CustomResult<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
+    tracing::debug!("Filtered  payment attempts based on payment tokens",);
+    let mut tokens_with_schedule_time: Vec<ScheduledToken> = Vec::new();
+
+    for token_with_retry_info in processor_tokens.values() {
+        let token_details = &token_with_retry_info
+            .token_status
+            .payment_processor_token_details;
+        let error_code = token_with_retry_info.token_status.error_code.clone();
+
+        match error_code {
+            None => {
+                let utc_schedule_time =
+                    time::OffsetDateTime::now_utc() + time::Duration::minutes(1);
+                let schedule_time = time::PrimitiveDateTime::new(
+                    utc_schedule_time.date(),
+                    utc_schedule_time.time(),
+                );
+                tokens_with_schedule_time = vec![ScheduledToken {
+                    token_details: token_details.clone(),
+                    schedule_time,
+                }];
+                tracing::debug!(
+                    "Found payment processor token with no error code scheduling it for {schedule_time}",
+                );
+                break;
+            }
+            Some(_) => {
+                process_token_for_retry(state, token_with_retry_info, payment_intent)
+                    .await?
+                    .map(|token_with_schedule_time| {
+                        tokens_with_schedule_time.push(token_with_schedule_time)
+                    });
+            }
+        }
+    }
+
+    let best_token = tokens_with_schedule_time
+        .iter()
+        .min_by_key(|token| token.schedule_time)
+        .cloned();
+
+    match best_token {
+        None => {
+            RedisTokenManager::unlock_connector_customer_status(state, connector_customer_id)
+                .await
+                .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
+            tracing::debug!("No payment processor tokens available for scheduling");
+            Ok(None)
+        }
+
+        Some(token) => {
+            tracing::debug!("Found payment processor token with least schedule time");
+
+            RedisTokenManager::update_payment_processor_token_schedule_time(
+                state,
+                connector_customer_id,
+                &token.token_details.payment_processor_token,
+                Some(token.schedule_time),
+            )
+            .await
+            .change_context(errors::ProcessTrackerError::EApiErrorResponse)?;
+
+            Ok(Some(token.schedule_time))
+        }
+    }
+}
+
+#[cfg(feature = "v2")]
+pub async fn check_hard_decline(
+    state: &SessionState,
+    payment_attempt: &payment_attempt::PaymentAttempt,
+) -> Result<bool, error_stack::Report<storage_impl::errors::RecoveryError>> {
+    let error_message = payment_attempt
+        .error
+        .as_ref()
+        .map(|details| details.message.clone());
+
+    let error_code = payment_attempt
+        .error
+        .as_ref()
+        .map(|details| details.code.clone());
+
+    let connector_name = payment_attempt
+        .connector
+        .clone()
+        .ok_or(storage_impl::errors::RecoveryError::ValueNotFound)
+        .attach_printable("unable to derive payment connector from payment attempt")?;
+
+    let gsm_record = payments::helpers::get_gsm_record(
+        state,
+        error_code,
+        error_message,
+        connector_name,
+        REVENUE_RECOVERY.to_string(),
+    )
+    .await;
+
+    let is_hard_decline = gsm_record
+        .and_then(|record| record.error_category)
+        .map(|category| category == common_enums::ErrorCategory::HardDecline)
+        .unwrap_or(false);
+
+    Ok(is_hard_decline)
+}
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index b49713eb0ce..c42a880f707 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -786,3 +786,21 @@ billing_connectors_which_requires_invoice_sync_call = "recurly"
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
+
+
+
+[revenue_recovery.card_config.amex]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.mastercard]
+max_retries_per_day = 10
+max_retry_count_for_thirty_day = 35
+
+[revenue_recovery.card_config.visa]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
+
+[revenue_recovery.card_config.discover]
+max_retries_per_day = 20
+max_retry_count_for_thirty_day = 20
\ No newline at end of file
diff --git a/proto/recovery_decider.proto b/proto/recovery_decider.proto
index 28543b8fa28..b6346bc7ba1 100644
--- a/proto/recovery_decider.proto
+++ b/proto/recovery_decider.proto
@@ -35,8 +35,9 @@ message DeciderRequest {
   optional string payment_method_type = 24;
   optional string payment_gateway = 25;
   optional int64 retry_count_left = 26;
-  optional google.protobuf.Timestamp first_error_msg_time = 27;
-  optional google.protobuf.Timestamp wait_time = 28;
+  optional int64 total_retry_count_within_network = 27;
+  optional google.protobuf.Timestamp first_error_msg_time = 28;
+  optional google.protobuf.Timestamp wait_time = 29;
 }
 
 message DeciderResponse {
 | 
	2025-08-05T21:28:14Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This module implements a **Redis-backed system** for managing and selecting the best **payment processor token** during **payment retries**.
It ensures:
- **Safe** token usage (no race conditions with locks) locked on connector customer level - if a payment has been scheduled then all other invoices for that customer will be in a queue. 
- **Consistent** retry limit enforcement
---
## Why This Exists
In the **revenue recovery flow**, there is **no direct mapping between a customer and their payment methods**.
However, card networks enforce **retry limits** (daily and rolling 30-day) for **each merchant–customer card**.  
Without tracking at this level, retries could breach these limits, leading to:
- Higher decline rates
- Potential network penalties
### The Solution
1. **Group multiple cards of a customer** under a single **`connector_customer_id`**.
2. **Store all payment processor tokens** for that connector customer in Redis.
3. Allow tokens to be:
   - **Inserted** when a webhook is received
   - **Retrieved** during the process tracker’s calculation flow to select the best retry candidate
This enables:
- Enforcement of **daily** and **30-day rolling thresholds**
- Compliance with **network-level** retry rules
- Token availability across flows without additional database lookups
---
## Redis Schema
| Key Pattern | Type   | Purpose |
|-------------|--------|---------|
| `customer:{customer_id}:status` | String | Lock key storing the `payment_id` to prevent parallel updates |
| `customer:{customer_id}:tokens` | Hash   | Maps `token_id` → `TokenStatus` JSON |
### Example `TokenStatus` JSON
```json
{
  "token_id": "tok_abc123",
  "error_code": "do_not_honor",
  "network": "visa",
  "added_by_payment_id": "pay_xyz789",
  "retry_history": {
    "2025-08-01": 1,
    "2025-08-02": 2
  }
}
```
## Flow
### **Step 1 – Acquire Lock**
- Create a lock key:  
  `customer:{customer_id}:status` → value = `payment_id`
- Purpose: Prevent parallel processes from working on the same customer
- If the lock is already present:
  - Exit early with message: *"Customer is already locked by another process."*
---
### **Step 2– Fetch Existing Tokens**
- Retrieve all payment processor tokens from  
  `customer:{customer_id}:tokens`
- These tokens are then evaluated for retry eligibility
---
### **Step 3 – Check Retry Limits**
For each token:
- Count retries in the **last 30 days**
- Check if daily or rolling 30-day limit is exceeded
- If limit exceeded → give a wait time for those tokens 
- Calculate **wait time** before the token can be retried again
---
### **Step 4 – Decider Logic (Upcoming)**
- For all eligible tokens:
  1. Determine the ** schedule time** for the psp tokens
  2. Select the token with the **earliest schedule time**
---
### **Step 5 – Update Retry State**
- After Transaction Executed
- Increment **today’s retry count** for the selected token  
- Persist the updated `TokenStatus` back to Redis
---
### **Step 6 – Release Lock**
- Delete `customer:{customer_id}:status` lock key  
- Allow the next payment flow to proceed
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-- Curl 
### Payment Processor curl 
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '
{
    "connector_type": "payment_processor",
    "connector_name": "worldpayvantiv",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "u83996941026920501",
        "key1": "010193081",
        "api_secret": "qRfXV7aPcvkX6Fr"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "metadata": {
        "report_group": "Hello",
        "merchant_config_currency": "USD"
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
### Billing Processor curl 
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "custombilling",
    "connector_account_details": {
        "auth_type": "NoKey"
    },
    "feature_metadata" : {
        "revenue_recovery" : {
            "max_retry_count" : 9,
            "billing_connector_retry_threshold" : 0,
            "billing_account_reference" :{
                "{{connector_mca_id}}" : "{{connector_mca_id}}"
            },
            "switch_payment_method_config" : {
                "retry_threshold" : 0,
                "time_threshold_after_creation": 0
            }
        }
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
### Api 
```
curl --location 'http://localhost:8080/v2/payments/recovery' \
--header 'Authorization: api-key=dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--header 'x-profile-id: pro_xsbw9tuM9f6whrwaZKC2' \
--header 'x-merchant-id: cloth_seller_2px3Q1TUxtGOvO3Yzm0S' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--data '{
    "amount_details": {
        "order_amount": 2250,
        "currency": "USD"
    },
    "merchant_reference_id": "1234567891",
    "connector_transaction_id": "43255654",
    "connector_customer_id": "526755",
    "error": {
        "code": "110",
        "message": "Insufficient Funds"
    },
    "billing": {
        "address": {
            "state": "CA",
            "country": "US"
        }
    },
    "payment_method_type": "card",
    "payment_method_sub_type": "credit",
    "payment_method_data": {
        "primary_processor_payment_method_token": "2541911049890008",
        "additional_payment_method_info": {
            "card_exp_month": "12",
            "card_exp_year": "25",
            "last_four_digits": 1997,
            "card_network": "VISA",
            "card_issuer": "Wells Fargo NA",
            "card_type": "credit"
        }
    },
    "billing_started_at": "2024-05-29T08:10:58Z",
    "transaction_created_at": "2024-05-29T08:10:58Z",
    "attempt_status": "failure",
    "action": "schedule_failed_payment",
    "billing_merchant_connector_id": "mca_6y5xtQUL2tgnHbjS7Bai",
    "payment_merchant_connector_id": "mca_OWLpnzoAxkhT1eZVJ3Q3"
  }'
```
### Output 
The payment processor token details is getting stored in redis.
<img width="1081" height="131" alt="Screenshot 2025-08-22 at 1 05 58 PM" src="https://github.com/user-attachments/assets/c99f54e3-9845-438c-b129-e661db08cc08" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f5db00352b90e99e78b631fa8b9cde5800093a9d | 
	
-- Curl 
### Payment Processor curl 
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '
{
    "connector_type": "payment_processor",
    "connector_name": "worldpayvantiv",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "u83996941026920501",
        "key1": "010193081",
        "api_secret": "qRfXV7aPcvkX6Fr"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "metadata": {
        "report_group": "Hello",
        "merchant_config_currency": "USD"
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
### Billing Processor curl 
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "custombilling",
    "connector_account_details": {
        "auth_type": "NoKey"
    },
    "feature_metadata" : {
        "revenue_recovery" : {
            "max_retry_count" : 9,
            "billing_connector_retry_threshold" : 0,
            "billing_account_reference" :{
                "{{connector_mca_id}}" : "{{connector_mca_id}}"
            },
            "switch_payment_method_config" : {
                "retry_threshold" : 0,
                "time_threshold_after_creation": 0
            }
        }
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
### Api 
```
curl --location 'http://localhost:8080/v2/payments/recovery' \
--header 'Authorization: api-key=dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--header 'x-profile-id: pro_xsbw9tuM9f6whrwaZKC2' \
--header 'x-merchant-id: cloth_seller_2px3Q1TUxtGOvO3Yzm0S' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--data '{
    "amount_details": {
        "order_amount": 2250,
        "currency": "USD"
    },
    "merchant_reference_id": "1234567891",
    "connector_transaction_id": "43255654",
    "connector_customer_id": "526755",
    "error": {
        "code": "110",
        "message": "Insufficient Funds"
    },
    "billing": {
        "address": {
            "state": "CA",
            "country": "US"
        }
    },
    "payment_method_type": "card",
    "payment_method_sub_type": "credit",
    "payment_method_data": {
        "primary_processor_payment_method_token": "2541911049890008",
        "additional_payment_method_info": {
            "card_exp_month": "12",
            "card_exp_year": "25",
            "last_four_digits": 1997,
            "card_network": "VISA",
            "card_issuer": "Wells Fargo NA",
            "card_type": "credit"
        }
    },
    "billing_started_at": "2024-05-29T08:10:58Z",
    "transaction_created_at": "2024-05-29T08:10:58Z",
    "attempt_status": "failure",
    "action": "schedule_failed_payment",
    "billing_merchant_connector_id": "mca_6y5xtQUL2tgnHbjS7Bai",
    "payment_merchant_connector_id": "mca_OWLpnzoAxkhT1eZVJ3Q3"
  }'
```
### Output 
The payment processor token details is getting stored in redis.
<img width="1081" height="131" alt="Screenshot 2025-08-22 at 1 05 58 PM" src="https://github.com/user-attachments/assets/c99f54e3-9845-438c-b129-e661db08cc08" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8859 | 
	Bug: feat(api): Adds support to change reveue_recovery_retry_algorithm_type using UpdateProfileAPI (V2)
Add support to change `reveue_recovery_retry_algorithm_type` through ProfileUpdateAPI | 
	diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 22c1868f6ac..e7df178c1ed 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2989,6 +2989,11 @@ pub struct ProfileUpdate {
     /// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
     #[schema(value_type = Option<MerchantCountryCode>, example = "840")]
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+
+    /// Inidcates the state of revenue recovery algorithm type
+    #[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
+    pub revenue_recovery_retry_algorithm_type:
+        Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
 }
 
 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index c5a78c6f39f..0afe3402954 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -1363,6 +1363,7 @@ pub struct ProfileGeneralUpdate {
     pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
     pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
     pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
+    pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
 }
 
 #[cfg(feature = "v2")]
@@ -1443,6 +1444,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                     external_vault_connector_details,
                     merchant_category_code,
                     merchant_country_code,
+                    revenue_recovery_retry_algorithm_type,
                 } = *update;
                 Self {
                     profile_name,
@@ -1489,7 +1491,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
                     is_clear_pan_retries_enabled: None,
                     is_debit_routing_enabled,
                     merchant_business_country,
-                    revenue_recovery_retry_algorithm_type: None,
+                    revenue_recovery_retry_algorithm_type,
                     revenue_recovery_retry_algorithm_data: None,
                     is_iframe_redirection_enabled,
                     is_external_vault_enabled,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index c116f266dfe..9068aa2ba0d 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -4074,6 +4074,8 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
             }
         };
 
+        let revenue_recovery_retry_algorithm_type = self.revenue_recovery_retry_algorithm_type;
+
         Ok(domain::ProfileUpdate::Update(Box::new(
             domain::ProfileGeneralUpdate {
                 profile_name: self.profile_name,
@@ -4123,6 +4125,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
                     .map(ForeignInto::foreign_into),
                 merchant_category_code: self.merchant_category_code,
                 merchant_country_code: self.merchant_country_code,
+                revenue_recovery_retry_algorithm_type,
             },
         )))
     }
 | 
	2025-08-06T18:04:41Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This Pr provides support to change `revenue_recovery_retry_algorithm_type` under the profile using ProfileUpdate API.
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Create a Business Profile and hit the following api.
```
curl --location --request PUT '{{base_url}}/v2/profiles/{{profile_id}}' \
--header 'x-merchant-id: {{merchant_id}}' \
--header 'Authorization: {{admin_api_key}}' \
--header 'Content-Type: application/json' \
--header 'api-key: {{admin-api-key}}' \
--data '{
    "revenue_recovery_retry_algorithm_type": "monitoring"
}'
```
And verify the `revenue_recovery_retry_algorithm_type` status of the Business Profile In the DB.
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	e2bfce8974dec9348d5829c39ad1f9acd340b9e3 | 
	
Create a Business Profile and hit the following api.
```
curl --location --request PUT '{{base_url}}/v2/profiles/{{profile_id}}' \
--header 'x-merchant-id: {{merchant_id}}' \
--header 'Authorization: {{admin_api_key}}' \
--header 'Content-Type: application/json' \
--header 'api-key: {{admin-api-key}}' \
--data '{
    "revenue_recovery_retry_algorithm_type": "monitoring"
}'
```
And verify the `revenue_recovery_retry_algorithm_type` status of the Business Profile In the DB.
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8851 | 
	Bug: [BUG] (connector): [Netcetera]  Fix three_ds_requestor_challenge_ind field in Netcetera Response
### Bug Description
Currently we are not recieving field **_three_ds_requestor_challenge_ind_** in Netcetera's authentication response since the struct is incorrectly declared in the transformers file. 
1. **_three_ds_requestor_challenge_ind_** is currently a part of _**NetceteraAuthenticationSuccessResponse**_ enum, but it should be a field inside authenitcation request
2. **_three_ds_requestor_challenge_ind_** has type optional string, whereas it is vector of string (ref documentation - https://3dss.netcetera.com/3dsserver/doc/2.5.2.1/3ds-authentication) 
**Current structure**
```
NetceteraAuthenticationSuccessResponse{
....
three_ds_requestor_challenge_ind: Option<String>
...}
```
**Correct structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_request: {
three_ds_requestor_challenge_ind: Option<Vector<String>>,
}
...}
```
### Expected Behavior
When the struct is fixed in code, expected behavior is to recieve **three_ds_requestor_challenge_ind** field in  Netcetera's authentication response.
**correct structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_request: {
three_ds_requestor_challenge_ind: Option<Vector<String>>,
}
...}
```
### Actual Behavior
Currently we are not recieving field **_three_ds_requestor_challenge_ind_** in Netcetera's authentication response since the struct is incorrect, and as a result sending challengeCode as null to Cybersource
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
index fc334d68167..01189f6b926 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
@@ -158,6 +158,13 @@ impl
                     }
                     Some(ACSChallengeMandatedIndicator::N) | None => AuthNFlowType::Frictionless,
                 };
+
+                let challenge_code = response
+                    .authentication_request
+                    .as_ref()
+                    .and_then(|req| req.three_ds_requestor_challenge_ind.as_ref())
+                    .and_then(|v| v.first().cloned());
+
                 Ok(AuthenticationResponseData::AuthNResponse {
                     authn_flow_type,
                     authentication_value: response.authentication_value,
@@ -165,7 +172,7 @@ impl
                     connector_metadata: None,
                     ds_trans_id: response.authentication_response.ds_trans_id,
                     eci: response.eci,
-                    challenge_code: response.three_ds_requestor_challenge_ind,
+                    challenge_code,
                     challenge_cancel: response.challenge_cancel,
                     challenge_code_reason: response.trans_status_reason,
                     message_extension: response.message_extension.and_then(|v| {
@@ -653,13 +660,12 @@ pub struct NetceteraAuthenticationSuccessResponse {
     pub authentication_value: Option<Secret<String>>,
     pub eci: Option<String>,
     pub acs_challenge_mandated: Option<ACSChallengeMandatedIndicator>,
+    pub authentication_request: Option<AuthenticationRequest>,
     pub authentication_response: AuthenticationResponse,
     #[serde(rename = "base64EncodedChallengeRequest")]
     pub encoded_challenge_request: Option<String>,
     pub challenge_cancel: Option<String>,
     pub trans_status_reason: Option<String>,
-    #[serde(rename = "threeDSRequestorChallengeInd")]
-    pub three_ds_requestor_challenge_ind: Option<String>,
     pub message_extension: Option<Vec<MessageExtensionAttribute>>,
 }
 
@@ -669,6 +675,13 @@ pub struct NetceteraAuthenticationFailureResponse {
     pub error_details: NetceteraErrorDetails,
 }
 
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthenticationRequest {
+    #[serde(rename = "threeDSRequestorChallengeInd")]
+    pub three_ds_requestor_challenge_ind: Option<Vec<String>>,
+}
+
 #[derive(Debug, Deserialize, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct AuthenticationResponse {
 | 
	2025-08-06T10:59:53Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
Currently we are not recieving field **_three_ds_requestor_challenge_ind_** in Netcetera's authentication response since the struct is incorrectly declared in the transformers file.
1. **_three_ds_requestor_challenge_ind_** is currently a part of _**NetceteraAuthenticationSuccessResponse**_ enum, but it should be a field inside **_authenitcation_request_**
2. **_three_ds_requestor_challenge_ind_** has type optional string currently, but it should be a vector of string (ref documentation - https://3dss.netcetera.com/3dsserver/doc/2.5.2.1/3ds-authentication) 
**Current structure**
```
NetceteraAuthenticationSuccessResponse{
....
three_ds_requestor_challenge_ind: Option<String>
...}
```
**Correct structure**
```
NetceteraAuthenticationSuccessResponse{
....
authentication_request: {
three_ds_requestor_challenge_ind: Option<Vector<String>>,
}
...}
```
This PR introduces the above fix in the struct.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Tested netcetera's challenge via local hyperswitch sdk.
As expected, we are now able to get **_three_ds_requestor_challenge_ind_** field in the NetceteraAuthenticationSuccessResponse.
<img width="2560" height="135" alt="Screenshot 2025-08-06 at 4 29 03 PM" src="https://github.com/user-attachments/assets/45fee6c0-b785-4f3e-abb2-0d74468d2024" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	640d0552f96721d63c14fda4a07fc5987cea29a0 | 
	
Tested netcetera's challenge via local hyperswitch sdk.
As expected, we are now able to get **_three_ds_requestor_challenge_ind_** field in the NetceteraAuthenticationSuccessResponse.
<img width="2560" height="135" alt="Screenshot 2025-08-06 at 4 29 03 PM" src="https://github.com/user-attachments/assets/45fee6c0-b785-4f3e-abb2-0d74468d2024" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8863 | 
	Bug: [FEATURE] Add new calculate job for revenue-recovery
 | 
	diff --git a/crates/diesel_models/src/process_tracker.rs b/crates/diesel_models/src/process_tracker.rs
index 3aefb486810..962f917788d 100644
--- a/crates/diesel_models/src/process_tracker.rs
+++ b/crates/diesel_models/src/process_tracker.rs
@@ -255,6 +255,9 @@ pub mod business_status {
     /// This status indicates the completion of a execute task
     pub const EXECUTE_WORKFLOW_COMPLETE: &str = "COMPLETED_EXECUTE_TASK";
 
+    /// This status indicates the failure of a execute task
+    pub const EXECUTE_WORKFLOW_FAILURE: &str = "FAILED_EXECUTE_TASK";
+
     /// This status indicates that the execute task was completed to trigger the psync task
     pub const EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC: &str = "COMPLETED_EXECUTE_TASK_TO_TRIGGER_PSYNC";
 
@@ -276,4 +279,21 @@ pub mod business_status {
 
     /// This status indicates the completion of a review task
     pub const REVIEW_WORKFLOW_COMPLETE: &str = "COMPLETED_REVIEW_TASK";
+
+    /// For the CALCULATE_WORKFLOW
+    ///
+    /// This status indicates an invoice is queued
+    pub const CALCULATE_WORKFLOW_QUEUED: &str = "CALCULATE_WORKFLOW_QUEUED";
+
+    /// This status indicates an invoice has been declined due to hard decline
+    pub const CALCULATE_WORKFLOW_FINISH: &str = "FAILED_DUE_TO_HARD_DECLINE_ERROR";
+
+    /// This status indicates that the invoice is scheduled with the best available token
+    pub const CALCULATE_WORKFLOW_SCHEDULED: &str = "CALCULATE_WORKFLOW_SCHEDULED";
+
+    /// This status indicates the invoice is in payment sync state
+    pub const CALCULATE_WORKFLOW_PROCESSING: &str = "CALCULATE_WORKFLOW_PROCESSING";
+
+    /// This status indicates the workflow has completed successfully when the invoice is paid
+    pub const CALCULATE_WORKFLOW_COMPLETE: &str = "CALCULATE_WORKFLOW_COMPLETE";
 }
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 0a63c036780..1a8224b8140 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -518,6 +518,26 @@ pub struct PaymentIntent {
 
 #[cfg(feature = "v2")]
 impl PaymentIntent {
+    /// Extract customer_id from payment intent feature metadata
+    pub fn extract_connector_customer_id_from_payment_intent(
+        &self,
+    ) -> Result<String, common_utils::errors::ValidationError> {
+        self.feature_metadata
+            .as_ref()
+            .and_then(|metadata| metadata.payment_revenue_recovery_metadata.as_ref())
+            .map(|recovery| {
+                recovery
+                    .billing_connector_payment_details
+                    .connector_customer_id
+                    .clone()
+            })
+            .ok_or(
+                common_utils::errors::ValidationError::MissingRequiredField {
+                    field_name: "connector_customer_id".to_string(),
+                },
+            )
+    }
+
     fn get_payment_method_sub_type(&self) -> Option<common_enums::PaymentMethodType> {
         self.feature_metadata
             .as_ref()
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index bc8397b416b..bf5330a9325 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -486,6 +486,8 @@ pub enum RevenueRecoveryError {
     BillingConnectorPaymentsSyncFailed,
     #[error("Billing connector invoice sync call failed")]
     BillingConnectorInvoiceSyncFailed,
+    #[error("Failed to fetch connector customer ID")]
+    CustomerIdNotFound,
     #[error("Failed to get the retry count for payment intent")]
     RetryCountFetchFailed,
     #[error("Failed to get the billing threshold retry count")]
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index 235d57f96d7..a2a90f1e9e1 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -1,35 +1,154 @@
 pub mod api;
 pub mod transformers;
 pub mod types;
-use api_models::{enums, process_tracker::revenue_recovery};
+use api_models::{enums, process_tracker::revenue_recovery, webhooks};
 use common_utils::{
     self,
+    errors::CustomResult,
     ext_traits::{OptionExt, ValueExt},
     id_type,
 };
 use diesel_models::{enums as diesel_enum, process_tracker::business_status};
 use error_stack::{self, ResultExt};
-use hyperswitch_domain_models::{payments::PaymentIntent, ApiModelToDieselModelConvertor};
+use hyperswitch_domain_models::{
+    payments::PaymentIntent, revenue_recovery as domain_revenue_recovery,
+    ApiModelToDieselModelConvertor,
+};
 use scheduler::errors as sch_errors;
 
 use crate::{
     core::errors::{self, RouterResponse, RouterResult, StorageErrorExt},
     db::StorageInterface,
     logger,
-    routes::{metrics, SessionState},
+    routes::{app::ReqState, metrics, SessionState},
     services::ApplicationResponse,
     types::{
+        domain,
         storage::{self, revenue_recovery as pcr},
         transformers::ForeignInto,
     },
+    workflows,
 };
 
 pub const EXECUTE_WORKFLOW: &str = "EXECUTE_WORKFLOW";
 pub const PSYNC_WORKFLOW: &str = "PSYNC_WORKFLOW";
+pub const CALCULATE_WORKFLOW: &str = "CALCULATE_WORKFLOW";
+
+#[allow(clippy::too_many_arguments)]
+pub async fn upsert_calculate_pcr_task(
+    billing_connector_account: &domain::MerchantConnectorAccount,
+    state: &SessionState,
+    merchant_context: &domain::MerchantContext,
+    recovery_intent_from_payment_intent: &domain_revenue_recovery::RecoveryPaymentIntent,
+    business_profile: &domain::Profile,
+    intent_retry_count: u16,
+    payment_attempt_id: Option<id_type::GlobalAttemptId>,
+    runner: storage::ProcessTrackerRunner,
+    revenue_recovery_retry: diesel_enum::RevenueRecoveryAlgorithmType,
+) -> CustomResult<webhooks::WebhookResponseTracker, errors::RevenueRecoveryError> {
+    router_env::logger::info!("Starting calculate_job...");
+
+    let task = "CALCULATE_WORKFLOW";
+
+    let db = &*state.store;
+    let payment_id = &recovery_intent_from_payment_intent.payment_id;
+
+    // Create process tracker ID in the format: CALCULATE_WORKFLOW_{payment_intent_id}
+    let process_tracker_id = format!("{runner}_{task}_{}", payment_id.get_string_repr());
+
+    // Set scheduled time to 1 hour from now
+    let schedule_time = common_utils::date_time::now() + time::Duration::hours(1);
+
+    let payment_attempt_id = payment_attempt_id
+        .ok_or(error_stack::report!(
+            errors::RevenueRecoveryError::PaymentAttemptIdNotFound
+        ))
+        .attach_printable("payment attempt id is required for calculate workflow tracking")?;
+
+    // Check if a process tracker entry already exists for this payment intent
+    let existing_entry = db
+        .as_scheduler()
+        .find_process_by_id(&process_tracker_id)
+        .await
+        .change_context(errors::RevenueRecoveryError::ProcessTrackerResponseError)
+        .attach_printable(
+            "Failed to check for existing calculate workflow process tracker entry",
+        )?;
+
+    match existing_entry {
+        Some(existing_process) => {
+            router_env::logger::error!(
+                "Found existing CALCULATE_WORKFLOW task with  id: {}",
+                existing_process.id
+            );
+        }
+        None => {
+            // No entry exists - create a new one
+            router_env::logger::info!(
+                "No existing CALCULATE_WORKFLOW task found for payment_intent_id: {}, creating new entry scheduled for 1 hour from now",
+                payment_id.get_string_repr()
+            );
+
+            // Create tracking data
+            let calculate_workflow_tracking_data = pcr::RevenueRecoveryWorkflowTrackingData {
+                billing_mca_id: billing_connector_account.get_id(),
+                global_payment_id: payment_id.clone(),
+                merchant_id: merchant_context.get_merchant_account().get_id().to_owned(),
+                profile_id: business_profile.get_id().to_owned(),
+                payment_attempt_id,
+                revenue_recovery_retry,
+                invoice_scheduled_time: None,
+            };
+
+            let tag = ["PCR"];
+            let task = "CALCULATE_WORKFLOW";
+            let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
+
+            let process_tracker_entry = storage::ProcessTrackerNew::new(
+                process_tracker_id,
+                task,
+                runner,
+                tag,
+                calculate_workflow_tracking_data,
+                Some(1),
+                schedule_time,
+                common_types::consts::API_VERSION,
+            )
+            .change_context(errors::RevenueRecoveryError::ProcessTrackerCreationError)
+            .attach_printable("Failed to construct calculate workflow process tracker entry")?;
+
+            // Insert into process tracker with status New
+            db.as_scheduler()
+                .insert_process(process_tracker_entry)
+                .await
+                .change_context(errors::RevenueRecoveryError::ProcessTrackerResponseError)
+                .attach_printable(
+                    "Failed to enter calculate workflow process_tracker_entry in DB",
+                )?;
+
+            router_env::logger::info!(
+                "Successfully created new CALCULATE_WORKFLOW task for payment_intent_id: {}",
+                payment_id.get_string_repr()
+            );
+
+            metrics::TASKS_ADDED_COUNT.add(
+                1,
+                router_env::metric_attributes!(("flow", "CalculateWorkflow")),
+            );
+        }
+    }
+
+    Ok(webhooks::WebhookResponseTracker::Payment {
+        payment_id: payment_id.clone(),
+        status: recovery_intent_from_payment_intent.status,
+    })
+}
 
 pub async fn perform_execute_payment(
     state: &SessionState,
     execute_task_process: &storage::ProcessTracker,
+    profile: &domain::Profile,
+    merchant_context: domain::MerchantContext,
     tracking_data: &pcr::RevenueRecoveryWorkflowTrackingData,
     revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData,
     payment_intent: &PaymentIntent,
@@ -74,6 +193,8 @@ pub async fn perform_execute_payment(
                         revenue_recovery_payment_data.merchant_account.get_id(),
                         payment_intent,
                         execute_task_process,
+                        profile,
+                        merchant_context,
                         revenue_recovery_payment_data,
                         &revenue_recovery_metadata,
                     ))
@@ -218,6 +339,7 @@ async fn insert_psync_pcr_task_to_pt(
         profile_id,
         payment_attempt_id,
         revenue_recovery_retry,
+        invoice_scheduled_time: Some(schedule_time),
     };
     let tag = ["REVENUE_RECOVERY"];
     let process_tracker_entry = storage::ProcessTrackerNew::new(
@@ -249,6 +371,8 @@ async fn insert_psync_pcr_task_to_pt(
 pub async fn perform_payments_sync(
     state: &SessionState,
     process: &storage::ProcessTracker,
+    profile: &domain::Profile,
+    merchant_context: domain::MerchantContext,
     tracking_data: &pcr::RevenueRecoveryWorkflowTrackingData,
     revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData,
     payment_intent: &PaymentIntent,
@@ -274,6 +398,8 @@ pub async fn perform_payments_sync(
             state,
             payment_intent,
             process.clone(),
+            profile,
+            merchant_context,
             revenue_recovery_payment_data,
             payment_attempt,
             &mut revenue_recovery_metadata,
@@ -284,6 +410,416 @@ pub async fn perform_payments_sync(
     Ok(())
 }
 
+pub async fn perform_calculate_workflow(
+    state: &SessionState,
+    process: &storage::ProcessTracker,
+    profile: &domain::Profile,
+    merchant_context: domain::MerchantContext,
+    tracking_data: &pcr::RevenueRecoveryWorkflowTrackingData,
+    revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData,
+    payment_intent: &PaymentIntent,
+) -> Result<(), sch_errors::ProcessTrackerError> {
+    let db = &*state.store;
+    let merchant_id = revenue_recovery_payment_data.merchant_account.get_id();
+    let profile_id = revenue_recovery_payment_data.profile.get_id();
+    let billing_mca_id = revenue_recovery_payment_data.billing_mca.get_id();
+
+    logger::info!(
+        process_id = %process.id,
+        payment_id = %tracking_data.global_payment_id.get_string_repr(),
+        "Starting CALCULATE_WORKFLOW..."
+    );
+
+    // 1. Extract connector_customer_id and token_list from tracking_data
+    let connector_customer_id = payment_intent
+        .extract_connector_customer_id_from_payment_intent()
+        .change_context(errors::RecoveryError::ValueNotFound)
+        .attach_printable("Failed to extract customer ID from payment intent")?;
+
+    let merchant_context_from_revenue_recovery_payment_data =
+        domain::MerchantContext::NormalMerchant(Box::new(domain::Context(
+            revenue_recovery_payment_data.merchant_account.clone(),
+            revenue_recovery_payment_data.key_store.clone(),
+        )));
+
+    let retry_algorithm_type = match profile
+        .revenue_recovery_retry_algorithm_type
+        .filter(|retry_type|
+             *retry_type != common_enums::RevenueRecoveryAlgorithmType::Monitoring) // ignore Monitoring in profile
+        .unwrap_or(tracking_data.revenue_recovery_retry)                                                                  // fallback to tracking_data
+    {
+        common_enums::RevenueRecoveryAlgorithmType::Smart => common_enums::RevenueRecoveryAlgorithmType::Smart,
+        common_enums::RevenueRecoveryAlgorithmType::Cascading => common_enums::RevenueRecoveryAlgorithmType::Cascading,
+        common_enums::RevenueRecoveryAlgorithmType::Monitoring => {
+            return Err(sch_errors::ProcessTrackerError::ProcessUpdateFailed);
+        }
+    };
+
+    // 2. Get best available token
+    let best_time_to_schedule = match workflows::revenue_recovery::get_token_with_schedule_time_based_on_retry_alogrithm_type(
+        state,
+        &connector_customer_id,
+        payment_intent,
+        retry_algorithm_type,
+        process.retry_count,
+    )
+    .await
+    {
+        Ok(token_opt) => token_opt,
+        Err(e) => {
+            logger::error!(
+                error = ?e,
+                connector_customer_id = %connector_customer_id,
+                "Failed to get best PSP token"
+            );
+            None
+        }
+    };
+
+    match best_time_to_schedule {
+        Some(scheduled_time) => {
+            logger::info!(
+                process_id = %process.id,
+                connector_customer_id = %connector_customer_id,
+                "Found best available token, creating EXECUTE_WORKFLOW task"
+            );
+
+            // 3. If token found: create EXECUTE_WORKFLOW task and finish CALCULATE_WORKFLOW
+            insert_execute_pcr_task_to_pt(
+                &tracking_data.billing_mca_id,
+                state,
+                &tracking_data.merchant_id,
+                payment_intent,
+                &tracking_data.profile_id,
+                &tracking_data.payment_attempt_id,
+                storage::ProcessTrackerRunner::PassiveRecoveryWorkflow,
+                tracking_data.revenue_recovery_retry,
+                scheduled_time,
+            )
+            .await?;
+
+            db.as_scheduler()
+                .finish_process_with_business_status(
+                    process.clone(),
+                    business_status::CALCULATE_WORKFLOW_SCHEDULED,
+                )
+                .await
+                .map_err(|e| {
+                    logger::error!(
+                        process_id = %process.id,
+                        error = ?e,
+                        "Failed to update CALCULATE_WORKFLOW status to complete"
+                    );
+                    sch_errors::ProcessTrackerError::ProcessUpdateFailed
+                })?;
+
+            logger::info!(
+                process_id = %process.id,
+                connector_customer_id = %connector_customer_id,
+                "CALCULATE_WORKFLOW completed successfully"
+            );
+        }
+
+        None => {
+            let scheduled_token = match storage::revenue_recovery_redis_operation::
+                RedisTokenManager::get_payment_processor_token_with_schedule_time(state, &connector_customer_id)
+                .await {
+                    Ok(scheduled_token_opt) => scheduled_token_opt,
+                    Err(e) => {
+                        logger::error!(
+                            error = ?e,
+                            connector_customer_id = %connector_customer_id,
+                            "Failed to get PSP token status"
+                        );
+                        None
+                    }
+                };
+
+            match scheduled_token {
+                Some(scheduled_token) => {
+                    // Update scheduled time to scheduled time + 15 minutes
+                    // here scheduled_time is the wait time 15 minutes is a buffer time that we are adding
+                    logger::info!(
+                        process_id = %process.id,
+                        connector_customer_id = %connector_customer_id,
+                        "No token but time available, rescheduling for scheduled time + 15 mins"
+                    );
+
+                    update_calculate_job_schedule_time(
+                        db,
+                        process,
+                        time::Duration::minutes(15),
+                        scheduled_token.scheduled_at,
+                        &connector_customer_id,
+                    )
+                    .await?;
+                }
+                None => {
+                    let hard_decline_flag = storage::revenue_recovery_redis_operation::
+                        RedisTokenManager::are_all_tokens_hard_declined(
+                            state,
+                            &connector_customer_id
+                        )
+                        .await
+                        .ok()
+                        .unwrap_or(false);
+
+                    match hard_decline_flag {
+                        false => {
+                            logger::info!(
+                                process_id = %process.id,
+                                connector_customer_id = %connector_customer_id,
+                                "Hard decline flag is false, rescheduling for scheduled time + 15 mins"
+                            );
+
+                            update_calculate_job_schedule_time(
+                                db,
+                                process,
+                                time::Duration::minutes(15),
+                                Some(common_utils::date_time::now()),
+                                &connector_customer_id,
+                            )
+                            .await?;
+                        }
+                        true => {
+                            // Finish calculate workflow with CALCULATE_WORKFLOW_FINISH
+                            logger::info!(
+                                process_id = %process.id,
+                                connector_customer_id = %connector_customer_id,
+                                "No token available, finishing CALCULATE_WORKFLOW"
+                            );
+
+                            db.as_scheduler()
+                                .finish_process_with_business_status(
+                                    process.clone(),
+                                    business_status::CALCULATE_WORKFLOW_FINISH,
+                                )
+                                .await
+                                .map_err(|e| {
+                                    logger::error!(
+                                        process_id = %process.id,
+                                        error = ?e,
+                                        "Failed to finish CALCULATE_WORKFLOW"
+                                    );
+                                    sch_errors::ProcessTrackerError::ProcessUpdateFailed
+                                })?;
+
+                            logger::info!(
+                                process_id = %process.id,
+                                connector_customer_id = %connector_customer_id,
+                                "CALCULATE_WORKFLOW finished successfully"
+                            );
+                        }
+                    }
+                }
+            }
+        }
+    }
+    Ok(())
+}
+
+/// Update the schedule time for a CALCULATE_WORKFLOW process tracker
+async fn update_calculate_job_schedule_time(
+    db: &dyn StorageInterface,
+    process: &storage::ProcessTracker,
+    additional_time: time::Duration,
+    base_time: Option<time::PrimitiveDateTime>,
+    connector_customer_id: &str,
+) -> Result<(), sch_errors::ProcessTrackerError> {
+    let new_schedule_time =
+        base_time.unwrap_or_else(common_utils::date_time::now) + additional_time;
+
+    let pt_update = storage::ProcessTrackerUpdate::Update {
+        name: Some("CALCULATE_WORKFLOW".to_string()),
+        retry_count: Some(process.clone().retry_count),
+        schedule_time: Some(new_schedule_time),
+        tracking_data: Some(process.clone().tracking_data),
+        business_status: Some(String::from(business_status::PENDING)),
+        status: Some(common_enums::ProcessTrackerStatus::Pending),
+        updated_at: Some(common_utils::date_time::now()),
+    };
+
+    db.as_scheduler()
+        .update_process(process.clone(), pt_update)
+        .await
+        .map_err(|e| {
+            logger::error!(
+                process_id = %process.id,
+                error = ?e,
+                "Failed to reschedule CALCULATE_WORKFLOW"
+            );
+            sch_errors::ProcessTrackerError::ProcessUpdateFailed
+        })?;
+
+    logger::info!(
+        process_id = %process.id,
+        connector_customer_id = %connector_customer_id,
+        new_schedule_time = %new_schedule_time,
+        additional_time = ?additional_time,
+        "CALCULATE_WORKFLOW rescheduled successfully"
+    );
+
+    Ok(())
+}
+
+/// Insert Execute PCR Task to Process Tracker
+#[allow(clippy::too_many_arguments)]
+async fn insert_execute_pcr_task_to_pt(
+    billing_mca_id: &id_type::MerchantConnectorAccountId,
+    state: &SessionState,
+    merchant_id: &id_type::MerchantId,
+    payment_intent: &PaymentIntent,
+    profile_id: &id_type::ProfileId,
+    payment_attempt_id: &id_type::GlobalAttemptId,
+    runner: storage::ProcessTrackerRunner,
+    revenue_recovery_retry: diesel_enum::RevenueRecoveryAlgorithmType,
+    schedule_time: time::PrimitiveDateTime,
+) -> Result<storage::ProcessTracker, sch_errors::ProcessTrackerError> {
+    let task = "EXECUTE_WORKFLOW";
+
+    let payment_id = payment_intent.id.clone();
+
+    let process_tracker_id = format!("{runner}_{task}_{}", payment_id.get_string_repr());
+
+    // Check if a process tracker entry already exists for this payment intent
+    let existing_entry = state
+        .store
+        .find_process_by_id(&process_tracker_id)
+        .await
+        .map_err(|e| {
+            logger::error!(
+                payment_id = %payment_id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                error = ?e,
+                "Failed to check for existing execute workflow process tracker entry"
+            );
+            sch_errors::ProcessTrackerError::ProcessUpdateFailed
+        })?;
+
+    match existing_entry {
+        Some(existing_process)
+            if existing_process.business_status == business_status::EXECUTE_WORKFLOW_FAILURE
+                || existing_process.business_status
+                    == business_status::EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC =>
+        {
+            // Entry exists with EXECUTE_WORKFLOW_COMPLETE status - update it
+            logger::info!(
+                payment_id = %payment_id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                current_retry_count = %existing_process.retry_count,
+                "Found existing EXECUTE_WORKFLOW task with COMPLETE status, updating to PENDING with incremented retry count"
+            );
+
+            let pt_update = storage::ProcessTrackerUpdate::Update {
+                name: Some(task.to_string()),
+                retry_count: Some(existing_process.clone().retry_count + 1),
+                schedule_time: Some(schedule_time),
+                tracking_data: Some(existing_process.clone().tracking_data),
+                business_status: Some(String::from(business_status::PENDING)),
+                status: Some(enums::ProcessTrackerStatus::Pending),
+                updated_at: Some(common_utils::date_time::now()),
+            };
+
+            let updated_process = state
+                .store
+                .update_process(existing_process, pt_update)
+                .await
+                .map_err(|e| {
+                    logger::error!(
+                        payment_id = %payment_id.get_string_repr(),
+                        process_tracker_id = %process_tracker_id,
+                        error = ?e,
+                        "Failed to update existing execute workflow process tracker entry"
+                    );
+                    sch_errors::ProcessTrackerError::ProcessUpdateFailed
+                })?;
+
+            logger::info!(
+                payment_id = %payment_id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                new_retry_count = %updated_process.retry_count,
+                "Successfully updated existing EXECUTE_WORKFLOW task"
+            );
+
+            Ok(updated_process)
+        }
+        Some(existing_process) => {
+            // Entry exists but business status is not EXECUTE_WORKFLOW_COMPLETE
+            logger::info!(
+                payment_id = %payment_id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                current_business_status = %existing_process.business_status,
+            );
+
+            Ok(existing_process)
+        }
+        None => {
+            // No entry exists - create a new one
+            logger::info!(
+                payment_id = %payment_id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                "No existing EXECUTE_WORKFLOW task found, creating new entry"
+            );
+
+            let execute_workflow_tracking_data = pcr::RevenueRecoveryWorkflowTrackingData {
+                billing_mca_id: billing_mca_id.clone(),
+                global_payment_id: payment_id.clone(),
+                merchant_id: merchant_id.clone(),
+                profile_id: profile_id.clone(),
+                payment_attempt_id: payment_attempt_id.clone(),
+                revenue_recovery_retry,
+                invoice_scheduled_time: Some(schedule_time),
+            };
+
+            let tag = ["PCR"];
+            let process_tracker_entry = storage::ProcessTrackerNew::new(
+                process_tracker_id.clone(),
+                task,
+                runner,
+                tag,
+                execute_workflow_tracking_data,
+                Some(1),
+                schedule_time,
+                common_types::consts::API_VERSION,
+            )
+            .map_err(|e| {
+                logger::error!(
+                    payment_id = %payment_id.get_string_repr(),
+                    error = ?e,
+                    "Failed to construct execute workflow process tracker entry"
+                );
+                sch_errors::ProcessTrackerError::ProcessUpdateFailed
+            })?;
+
+            let response = state
+                .store
+                .insert_process(process_tracker_entry)
+                .await
+                .map_err(|e| {
+                    logger::error!(
+                        payment_id = %payment_id.get_string_repr(),
+                        error = ?e,
+                        "Failed to insert execute workflow process tracker entry"
+                    );
+                    sch_errors::ProcessTrackerError::ProcessUpdateFailed
+                })?;
+
+            metrics::TASKS_ADDED_COUNT.add(
+                1,
+                router_env::metric_attributes!(("flow", "RevenueRecoveryExecute")),
+            );
+
+            logger::info!(
+                payment_id = %payment_id.get_string_repr(),
+                process_tracker_id = %response.id,
+                "Successfully created new EXECUTE_WORKFLOW task"
+            );
+
+            Ok(response)
+        }
+    }
+}
+
 pub async fn retrieve_revenue_recovery_process_tracker(
     state: SessionState,
     id: id_type::GlobalPaymentId,
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index 1bccb5134bb..e3401baa40f 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -31,11 +31,12 @@ use hyperswitch_domain_models::{
 };
 use time::PrimitiveDateTime;
 
+use super::errors::StorageErrorExt;
 use crate::{
     core::{
         errors::{self, RouterResult},
         payments::{self, helpers, operations::Operation},
-        revenue_recovery::{self as revenue_recovery_core},
+        revenue_recovery::{self as revenue_recovery_core, perform_calculate_workflow},
         webhooks::recovery_incoming as recovery_incoming_flow,
     },
     db::StorageInterface,
@@ -43,9 +44,13 @@ use crate::{
     routes::SessionState,
     services::{self, connector_integration_interface::RouterDataConversion},
     types::{
-        self, api as api_types, api::payments as payments_types, storage, transformers::ForeignInto,
+        self, api as api_types, api::payments as payments_types, domain, storage,
+        transformers::ForeignInto,
+    },
+    workflows::{
+        payment_sync,
+        revenue_recovery::{self, get_schedule_time_to_retry_mit_payments},
     },
-    workflows::{payment_sync, revenue_recovery::get_schedule_time_to_retry_mit_payments},
 };
 
 type RecoveryResult<T> = error_stack::Result<T, errors::RecoveryError>;
@@ -93,15 +98,23 @@ impl RevenueRecoveryPaymentsAttemptStatus {
         Ok(())
     }
 
+    #[allow(clippy::too_many_arguments)]
     pub(crate) async fn update_pt_status_based_on_attempt_status_for_payments_sync(
         &self,
         state: &SessionState,
         payment_intent: &PaymentIntent,
         process_tracker: storage::ProcessTracker,
+        profile: &domain::Profile,
+        merchant_context: domain::MerchantContext,
         revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
         payment_attempt: PaymentAttempt,
         revenue_recovery_metadata: &mut PaymentRevenueRecoveryMetadata,
     ) -> Result<(), errors::ProcessTrackerError> {
+        let connector_customer_id = payment_intent
+            .extract_connector_customer_id_from_payment_intent()
+            .change_context(errors::RecoveryError::ValueNotFound)
+            .attach_printable("Failed to extract customer ID from payment intent")?;
+
         let db = &*state.store;
 
         let recovery_payment_intent =
@@ -143,6 +156,26 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                     );
                 };
 
+                let is_hard_decline = revenue_recovery::check_hard_decline(state, &payment_attempt)
+                    .await
+                    .ok();
+
+                // update the status of token in redis
+                let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
+                    state,
+                    &connector_customer_id,
+                    &None,
+                    &is_hard_decline
+                )
+                .await;
+
+                // unlocking the token
+                let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
+                    state,
+                    &connector_customer_id,
+                )
+                .await;
+
                 // Record a successful transaction back to Billing Connector
                 // TODO: Add support for retrying failed outgoing recordback webhooks
                 record_back_to_billing_connector(
@@ -175,26 +208,38 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                     );
                 };
 
-                // get a reschedule time
-                let schedule_time = get_schedule_time_to_retry_mit_payments(
-                    db,
-                    &revenue_recovery_payment_data
-                        .merchant_account
-                        .get_id()
-                        .clone(),
-                    process_tracker.retry_count + 1,
+                let error_code = recovery_payment_attempt.error_code;
+
+                let is_hard_decline = revenue_recovery::check_hard_decline(state, &payment_attempt)
+                    .await
+                    .ok();
+
+                // update the status of token in redis
+                let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
+                    state,
+                    &connector_customer_id,
+                    &error_code,
+                    &is_hard_decline
                 )
                 .await;
 
-                // check if retry is possible
-                if let Some(schedule_time) = schedule_time {
-                    // schedule a retry
-                    // TODO: Update connecter called field and active attempt
+                // unlocking the token
+                let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
+                    state,
+                    &connector_customer_id,
+                )
+                .await;
 
-                    db.as_scheduler()
-                        .retry_process(process_tracker.clone(), schedule_time)
-                        .await?;
-                }
+                // Reopen calculate workflow on payment failure
+                reopen_calculate_workflow_on_payment_failure(
+                    state,
+                    &process_tracker,
+                    profile,
+                    merchant_context,
+                    payment_intent,
+                    revenue_recovery_payment_data,
+                )
+                .await?;
             }
             Self::Processing => {
                 // do a psync payment
@@ -203,6 +248,8 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                     revenue_recovery_payment_data,
                     payment_intent,
                     &process_tracker,
+                    profile,
+                    merchant_context,
                     payment_attempt,
                 ))
                 .await?;
@@ -307,105 +354,227 @@ pub enum Action {
     ManualReviewAction,
 }
 impl Action {
+    #[allow(clippy::too_many_arguments)]
     pub async fn execute_payment(
         state: &SessionState,
         merchant_id: &id_type::MerchantId,
         payment_intent: &PaymentIntent,
         process: &storage::ProcessTracker,
+        profile: &domain::Profile,
+        merchant_context: domain::MerchantContext,
         revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
         revenue_recovery_metadata: &PaymentRevenueRecoveryMetadata,
     ) -> RecoveryResult<Self> {
-        let response = revenue_recovery_core::api::call_proxy_api(
-            state,
-            payment_intent,
-            revenue_recovery_payment_data,
-            revenue_recovery_metadata,
-        )
-        .await;
-        let recovery_payment_intent =
-            hyperswitch_domain_models::revenue_recovery::RecoveryPaymentIntent::from(
-                payment_intent,
-            );
+        let connector_customer_id = payment_intent
+            .extract_connector_customer_id_from_payment_intent()
+            .change_context(errors::RecoveryError::ValueNotFound)
+            .attach_printable("Failed to extract customer ID from payment intent")?;
 
-        // handle proxy api's response
-        match response {
-            Ok(payment_data) => match payment_data.payment_attempt.status.foreign_into() {
-                RevenueRecoveryPaymentsAttemptStatus::Succeeded => {
-                    let recovery_payment_attempt =
-                        hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from(
-                            &payment_data.payment_attempt,
-                        );
-
-                    let recovery_payment_tuple = recovery_incoming_flow::RecoveryPaymentTuple::new(
-                        &recovery_payment_intent,
-                        &recovery_payment_attempt,
-                    );
+        let scheduled_token = match storage::revenue_recovery_redis_operation::
+        RedisTokenManager::get_payment_processor_token_with_schedule_time(state, &connector_customer_id)
+        .await {
+            Ok(scheduled_token_opt) => scheduled_token_opt,
+            Err(e) => {
+                logger::error!(
+                    error = ?e,
+                    connector_customer_id = %connector_customer_id,
+                    "Failed to get PSP token status"
+                );
+                None
+            }
+        };
 
-                    // publish events to kafka
-                    if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka(
+        match scheduled_token {
+            Some(scheduled_token) => {
+                let response = revenue_recovery_core::api::call_proxy_api(
                     state,
-                    &recovery_payment_tuple,
-                    Some(process.retry_count+1)
+                    payment_intent,
+                    revenue_recovery_payment_data,
+                    revenue_recovery_metadata,
                 )
-                .await{
-                    router_env::logger::error!(
-                        "Failed to publish revenue recovery event to kafka: {:?}",
-                        e
+                .await;
+
+                let recovery_payment_intent =
+                    hyperswitch_domain_models::revenue_recovery::RecoveryPaymentIntent::from(
+                        payment_intent,
                     );
-                };
 
-                    Ok(Self::SuccessfulPayment(
-                        payment_data.payment_attempt.clone(),
-                    ))
+                // handle proxy api's response
+                match response {
+                    Ok(payment_data) => match payment_data.payment_attempt.status.foreign_into() {
+                        RevenueRecoveryPaymentsAttemptStatus::Succeeded => {
+                            let recovery_payment_attempt =
+                                hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from(
+                                    &payment_data.payment_attempt,
+                                );
+
+                            let recovery_payment_tuple =
+                                recovery_incoming_flow::RecoveryPaymentTuple::new(
+                                    &recovery_payment_intent,
+                                    &recovery_payment_attempt,
+                                );
+
+                            // publish events to kafka
+                            if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka(
+                            state,
+                            &recovery_payment_tuple,
+                            Some(process.retry_count+1)
+                        )
+                        .await{
+                            router_env::logger::error!(
+                                "Failed to publish revenue recovery event to kafka: {:?}",
+                                e
+                            );
+                        };
+
+                            let is_hard_decline = revenue_recovery::check_hard_decline(
+                                state,
+                                &payment_data.payment_attempt,
+                            )
+                            .await
+                            .ok();
+
+                            // update the status of token in redis
+                            let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
+                                state,
+                                &connector_customer_id,
+                                &None,
+                                &is_hard_decline
+                            )
+                            .await;
+
+                            // unlocking the token
+                            let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
+                    state,
+                    &connector_customer_id,
+                )
+                .await;
+
+                            Ok(Self::SuccessfulPayment(
+                                payment_data.payment_attempt.clone(),
+                            ))
+                        }
+                        RevenueRecoveryPaymentsAttemptStatus::Failed => {
+                            let recovery_payment_attempt =
+                                hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from(
+                                    &payment_data.payment_attempt,
+                                );
+
+                            let recovery_payment_tuple =
+                                recovery_incoming_flow::RecoveryPaymentTuple::new(
+                                    &recovery_payment_intent,
+                                    &recovery_payment_attempt,
+                                );
+
+                            // publish events to kafka
+                            if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka(
+                                state,
+                                &recovery_payment_tuple,
+                                Some(process.retry_count+1)
+                            )
+                            .await{
+                                router_env::logger::error!(
+                                    "Failed to publish revenue recovery event to kafka: {:?}",
+                                    e
+                                );
+                            };
+
+                            let error_code = payment_data
+                                .payment_attempt
+                                .clone()
+                                .error
+                                .map(|error| error.code);
+
+                            let is_hard_decline = revenue_recovery::check_hard_decline(
+                                state,
+                                &payment_data.payment_attempt,
+                            )
+                            .await
+                            .ok();
+
+                            let _update_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
+                                state,
+                                &connector_customer_id,
+                                &error_code,
+                                &is_hard_decline
+                            )
+                            .await;
+
+                            // unlocking the token
+                            let _unlock_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
+                                state,
+                                &connector_customer_id,
+                            )
+                            .await;
+
+                            // Reopen calculate workflow on payment failure
+                            reopen_calculate_workflow_on_payment_failure(
+                                state,
+                                process,
+                                profile,
+                                merchant_context,
+                                payment_intent,
+                                revenue_recovery_payment_data,
+                            )
+                            .await?;
+
+                            // Return terminal failure to finish the current execute workflow
+                            Ok(Self::TerminalFailure(payment_data.payment_attempt.clone()))
+                        }
+
+                        RevenueRecoveryPaymentsAttemptStatus::Processing => {
+                            Ok(Self::SyncPayment(payment_data.payment_attempt.clone()))
+                        }
+                        RevenueRecoveryPaymentsAttemptStatus::InvalidStatus(action) => {
+                            logger::info!(?action, "Invalid Payment Status For PCR Payment");
+                            Ok(Self::ManualReviewAction)
+                        }
+                    },
+                    Err(err) =>
+                    // check for an active attempt being constructed or not
+                    {
+                        logger::error!(execute_payment_res=?err);
+                        Ok(Self::ReviewPayment)
+                    }
                 }
-                RevenueRecoveryPaymentsAttemptStatus::Failed => {
-                    let recovery_payment_attempt =
-                        hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from(
-                            &payment_data.payment_attempt,
-                        );
-
-                    let recovery_payment_tuple = recovery_incoming_flow::RecoveryPaymentTuple::new(
-                        &recovery_payment_intent,
-                        &recovery_payment_attempt,
-                    );
+            }
+            None => {
+                let response = revenue_recovery_core::api::call_psync_api(
+                    state,
+                    payment_intent.get_id(),
+                    revenue_recovery_payment_data,
+                )
+                .await;
 
-                    // publish events to kafka
-                    if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka(
-                        state,
-                        &recovery_payment_tuple,
-                        Some(process.retry_count+1)
-                    )
-                    .await{
-                        router_env::logger::error!(
-                            "Failed to publish revenue recovery event to kafka: {:?}",
-                            e
-                        );
-                    };
-
-                    Self::decide_retry_failure_action(
-                        state,
-                        merchant_id,
+                let payment_status_data = response
+                    .change_context(errors::RecoveryError::PaymentCallFailed)
+                    .attach_printable("Error while executing the Psync call")?;
+
+                let payment_attempt = payment_status_data.payment_attempt;
+
+                logger::info!(
+                    process_id = %process.id,
+                    connector_customer_id = %connector_customer_id,
+                    "No token available, finishing CALCULATE_WORKFLOW"
+                );
+
+                state
+                    .store
+                    .as_scheduler()
+                    .finish_process_with_business_status(
                         process.clone(),
-                        revenue_recovery_payment_data,
-                        &payment_data.payment_attempt,
-                        payment_intent,
+                        business_status::CALCULATE_WORKFLOW_FINISH,
                     )
                     .await
-                }
+                    .change_context(errors::RecoveryError::ProcessTrackerFailure)
+                    .attach_printable("Failed to finish CALCULATE_WORKFLOW")?;
 
-                RevenueRecoveryPaymentsAttemptStatus::Processing => {
-                    Ok(Self::SyncPayment(payment_data.payment_attempt.clone()))
-                }
-                RevenueRecoveryPaymentsAttemptStatus::InvalidStatus(action) => {
-                    logger::info!(?action, "Invalid Payment Status For PCR Payment");
-                    Ok(Self::ManualReviewAction)
-                }
-            },
-            Err(err) =>
-            // check for an active attempt being constructed or not
-            {
-                logger::error!(execute_payment_res=?err);
-                Ok(Self::ReviewPayment)
+                logger::info!(
+                    process_id = %process.id,
+                    connector_customer_id = %connector_customer_id,
+                    "CALCULATE_WORKFLOW finished successfully"
+                );
+                Ok(Self::TerminalFailure(payment_attempt.clone()))
             }
         }
     }
@@ -486,16 +655,45 @@ impl Action {
                 Ok(())
             }
             Self::TerminalFailure(payment_attempt) => {
+                // update the connector payment transmission field to Unsuccessful and unset active attempt id
+                revenue_recovery_metadata.set_payment_transmission_field_for_api_request(
+                    enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful,
+                );
+
+                let payment_update_req =
+                PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api(
+                    payment_intent
+                        .feature_metadata
+                        .clone()
+                        .unwrap_or_default()
+                        .convert_back()
+                        .set_payment_revenue_recovery_metadata_using_api(
+                            revenue_recovery_metadata.clone(),
+                        ),
+                    api_enums::UpdateActiveAttempt::Unset,
+                );
+                logger::info!(
+                    "Call made to payments update intent api , with the request body {:?}",
+                    payment_update_req
+                );
+                revenue_recovery_core::api::update_payment_intent_api(
+                    state,
+                    payment_intent.id.clone(),
+                    revenue_recovery_payment_data,
+                    payment_update_req,
+                )
+                .await
+                .change_context(errors::RecoveryError::PaymentCallFailed)?;
+
                 db.as_scheduler()
                     .finish_process_with_business_status(
                         execute_task_process.clone(),
-                        business_status::EXECUTE_WORKFLOW_COMPLETE,
+                        business_status::EXECUTE_WORKFLOW_FAILURE,
                     )
                     .await
                     .change_context(errors::RecoveryError::ProcessTrackerFailure)
                     .attach_printable("Failed to update the process tracker")?;
                 // TODO: Add support for retrying failed outgoing recordback webhooks
-
                 Ok(())
             }
             Self::SuccessfulPayment(payment_attempt) => {
@@ -551,6 +749,8 @@ impl Action {
         revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
         payment_intent: &PaymentIntent,
         process: &storage::ProcessTracker,
+        profile: &domain::Profile,
+        merchant_context: domain::MerchantContext,
         payment_attempt: PaymentAttempt,
     ) -> RecoveryResult<Self> {
         let response = revenue_recovery_core::api::call_psync_api(
@@ -563,18 +763,74 @@ impl Action {
         match response {
             Ok(_payment_data) => match payment_attempt.status.foreign_into() {
                 RevenueRecoveryPaymentsAttemptStatus::Succeeded => {
+                    let connector_customer_id = payment_intent
+                        .extract_connector_customer_id_from_payment_intent()
+                        .change_context(errors::RecoveryError::ValueNotFound)
+                        .attach_printable("Failed to extract customer ID from payment intent")?;
+
+                    let is_hard_decline =
+                        revenue_recovery::check_hard_decline(state, &payment_attempt)
+                            .await
+                            .ok();
+
+                    // update the status of token in redis
+                    let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
+                    state,
+                    &connector_customer_id,
+                    &None,
+                    &is_hard_decline
+                )
+                .await;
+
+                    // unlocking the token
+                    let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
+                    state,
+                    &connector_customer_id,
+                )
+                .await;
+
                     Ok(Self::SuccessfulPayment(payment_attempt))
                 }
                 RevenueRecoveryPaymentsAttemptStatus::Failed => {
-                    Self::decide_retry_failure_action(
+                    let connector_customer_id = payment_intent
+                        .extract_connector_customer_id_from_payment_intent()
+                        .change_context(errors::RecoveryError::ValueNotFound)
+                        .attach_printable("Failed to extract customer ID from payment intent")?;
+
+                    let error_code = payment_attempt.clone().error.map(|error| error.code);
+
+                    let is_hard_decline =
+                        revenue_recovery::check_hard_decline(state, &payment_attempt)
+                            .await
+                            .ok();
+
+                    let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker(
+                            state,
+                            &connector_customer_id,
+                            &error_code,
+                            &is_hard_decline
+                        )
+                        .await;
+
+                    // unlocking the token
+                    let _unlock_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status(
                         state,
-                        revenue_recovery_payment_data.merchant_account.get_id(),
-                        process.clone(),
-                        revenue_recovery_payment_data,
-                        &payment_attempt,
+                        &connector_customer_id,
+                    )
+                    .await;
+
+                    // Reopen calculate workflow on payment failure
+                    reopen_calculate_workflow_on_payment_failure(
+                        state,
+                        process,
+                        profile,
+                        merchant_context,
                         payment_intent,
+                        revenue_recovery_payment_data,
                     )
-                    .await
+                    .await?;
+
+                    Ok(Self::TerminalFailure(payment_attempt.clone()))
                 }
 
                 RevenueRecoveryPaymentsAttemptStatus::Processing => {
@@ -684,6 +940,37 @@ impl Action {
             }
 
             Self::TerminalFailure(payment_attempt) => {
+                // update the connector payment transmission field to Unsuccessful and unset active attempt id
+                revenue_recovery_metadata.set_payment_transmission_field_for_api_request(
+                    enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful,
+                );
+
+                let payment_update_req =
+                PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api(
+                    payment_intent
+                        .feature_metadata
+                        .clone()
+                        .unwrap_or_default()
+                        .convert_back()
+                        .set_payment_revenue_recovery_metadata_using_api(
+                            revenue_recovery_metadata.clone(),
+                        ),
+                    api_enums::UpdateActiveAttempt::Unset,
+                );
+                logger::info!(
+                    "Call made to payments update intent api , with the request body {:?}",
+                    payment_update_req
+                );
+
+                revenue_recovery_core::api::update_payment_intent_api(
+                    state,
+                    payment_intent.id.clone(),
+                    revenue_recovery_payment_data,
+                    payment_update_req,
+                )
+                .await
+                .change_context(errors::RecoveryError::PaymentCallFailed)?;
+
                 // TODO: Add support for retrying failed outgoing recordback webhooks
                 // finish the current psync task
                 db.as_scheduler()
@@ -804,6 +1091,140 @@ impl Action {
         }
     }
 }
+
+/// Reopen calculate workflow when payment fails
+pub async fn reopen_calculate_workflow_on_payment_failure(
+    state: &SessionState,
+    process: &storage::ProcessTracker,
+    profile: &domain::Profile,
+    merchant_context: domain::MerchantContext,
+    payment_intent: &PaymentIntent,
+    revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
+) -> RecoveryResult<()> {
+    let db = &*state.store;
+    let id = payment_intent.id.clone();
+    let task = revenue_recovery_core::CALCULATE_WORKFLOW;
+    let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow;
+
+    // Construct the process tracker ID for CALCULATE_WORKFLOW
+    let process_tracker_id = format!("{}_{}_{}", runner, task, id.get_string_repr());
+
+    logger::info!(
+        payment_id = %id.get_string_repr(),
+        process_tracker_id = %process_tracker_id,
+        "Attempting to reopen CALCULATE_WORKFLOW on payment failure"
+    );
+
+    // Find the existing CALCULATE_WORKFLOW process tracker
+    let calculate_process = db
+        .find_process_by_id(&process_tracker_id)
+        .await
+        .change_context(errors::RecoveryError::ProcessTrackerFailure)
+        .attach_printable("Failed to find CALCULATE_WORKFLOW process tracker")?;
+
+    match calculate_process {
+        Some(process) => {
+            logger::info!(
+                payment_id = %id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                current_status = %process.business_status,
+                current_retry_count = process.retry_count,
+                "Found existing CALCULATE_WORKFLOW, updating status and retry count"
+            );
+
+            // Update the process tracker to reopen the calculate workflow
+            // 1. Change status from "finish" to "pending"
+            // 2. Increase retry count by 1
+            // 3. Set business status to QUEUED
+            // 4. Schedule for immediate execution
+            let new_retry_count = process.retry_count + 1;
+            let new_schedule_time = common_utils::date_time::now() + time::Duration::hours(1);
+
+            let pt_update = storage::ProcessTrackerUpdate::Update {
+                name: Some(task.to_string()),
+                retry_count: Some(new_retry_count),
+                schedule_time: Some(new_schedule_time),
+                tracking_data: Some(process.clone().tracking_data),
+                business_status: Some(String::from(business_status::PENDING)),
+                status: Some(common_enums::ProcessTrackerStatus::Pending),
+                updated_at: Some(common_utils::date_time::now()),
+            };
+
+            db.update_process(process.clone(), pt_update)
+                .await
+                .change_context(errors::RecoveryError::ProcessTrackerFailure)
+                .attach_printable("Failed to update CALCULATE_WORKFLOW process tracker")?;
+
+            logger::info!(
+                payment_id = %id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                new_retry_count = new_retry_count,
+                new_schedule_time = %new_schedule_time,
+                "Successfully reopened CALCULATE_WORKFLOW with increased retry count"
+            );
+        }
+        None => {
+            logger::info!(
+                payment_id = %id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                "CALCULATE_WORKFLOW process tracker not found, creating new entry"
+            );
+
+            // Create tracking data for the new CALCULATE_WORKFLOW
+            let tracking_data = create_calculate_workflow_tracking_data(
+                payment_intent,
+                revenue_recovery_payment_data,
+            )?;
+
+            // Call the existing perform_calculate_workflow function
+            perform_calculate_workflow(
+                state,
+                process,
+                profile,
+                merchant_context,
+                &tracking_data,
+                revenue_recovery_payment_data,
+                payment_intent,
+            )
+            .await
+            .change_context(errors::RecoveryError::ProcessTrackerFailure)
+            .attach_printable("Failed to perform calculate workflow")?;
+
+            logger::info!(
+                payment_id = %id.get_string_repr(),
+                process_tracker_id = %process_tracker_id,
+                "Successfully created new CALCULATE_WORKFLOW entry using perform_calculate_workflow"
+            );
+        }
+    }
+
+    Ok(())
+}
+
+/// Create tracking data for the CALCULATE_WORKFLOW
+fn create_calculate_workflow_tracking_data(
+    payment_intent: &PaymentIntent,
+    revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
+) -> RecoveryResult<storage::revenue_recovery::RevenueRecoveryWorkflowTrackingData> {
+    let tracking_data = storage::revenue_recovery::RevenueRecoveryWorkflowTrackingData {
+        merchant_id: revenue_recovery_payment_data
+            .merchant_account
+            .get_id()
+            .clone(),
+        profile_id: revenue_recovery_payment_data.profile.get_id().clone(),
+        global_payment_id: payment_intent.id.clone(),
+        payment_attempt_id: payment_intent
+            .active_attempt_id
+            .clone()
+            .ok_or(storage_impl::errors::RecoveryError::ValueNotFound)?,
+        billing_mca_id: revenue_recovery_payment_data.billing_mca.get_id().clone(),
+        revenue_recovery_retry: revenue_recovery_payment_data.retry_algorithm,
+        invoice_scheduled_time: None, // Will be set by perform_calculate_workflow
+    };
+
+    Ok(tracking_data)
+}
+
 // TODO: Move these to impl based functions
 async fn record_back_to_billing_connector(
     state: &SessionState,
diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs
index 5f00dd0c5f2..9238b30723f 100644
--- a/crates/router/src/core/webhooks/recovery_incoming.rs
+++ b/crates/router/src/core/webhooks/recovery_incoming.rs
@@ -7,19 +7,25 @@ use common_utils::{
 };
 use diesel_models::process_tracker as storage;
 use error_stack::{report, ResultExt};
+use futures::stream::SelectNextSome;
 use hyperswitch_domain_models::{
-    payments as domain_payments, revenue_recovery, router_data_v2::flow_common_types,
-    router_flow_types, router_request_types::revenue_recovery as revenue_recovery_request,
-    router_response_types::revenue_recovery as revenue_recovery_response, types as router_types,
+    payments as domain_payments,
+    revenue_recovery::{self, RecoveryPaymentIntent},
+    router_data_v2::flow_common_types,
+    router_flow_types,
+    router_request_types::revenue_recovery as revenue_recovery_request,
+    router_response_types::revenue_recovery as revenue_recovery_response,
+    types as router_types,
 };
 use hyperswitch_interfaces::webhooks as interface_webhooks;
 use masking::{PeekInterface, Secret};
 use router_env::{instrument, logger, tracing};
 use services::kafka;
+use storage::business_status;
 
 use crate::{
     core::{
-        admin,
+        self, admin,
         errors::{self, CustomResult},
         payments::{self, helpers},
     },
@@ -232,6 +238,7 @@ async fn handle_monitoring_threshold(
     }
     Ok(webhooks::WebhookResponseTracker::NoEffect)
 }
+
 #[allow(clippy::too_many_arguments)]
 async fn handle_schedule_failed_payment(
     billing_connector_account: &domain::MerchantConnectorAccount,
@@ -248,6 +255,8 @@ async fn handle_schedule_failed_payment(
 ) -> CustomResult<webhooks::WebhookResponseTracker, errors::RevenueRecoveryError> {
     let (recovery_attempt_from_payment_attempt, recovery_intent_from_payment_attempt) =
         payment_attempt_with_recovery_intent;
+
+    // When intent_retry_count is less than or equal to threshold
     (intent_retry_count <= mca_retry_threshold)
         .then(|| {
             logger::error!(
@@ -258,12 +267,13 @@ async fn handle_schedule_failed_payment(
             Ok(webhooks::WebhookResponseTracker::NoEffect)
         })
         .async_unwrap_or_else(|| async {
-            RevenueRecoveryAttempt::insert_execute_pcr_task(
-                &billing_connector_account.get_id(),
-                &*state.store,
-                merchant_context.get_merchant_account().get_id().to_owned(),
-                recovery_intent_from_payment_attempt.clone(),
-                business_profile.get_id().to_owned(),
+            // Call calculate_job
+            core::revenue_recovery::upsert_calculate_pcr_task(
+                billing_connector_account,
+                state,
+                merchant_context,
+                recovery_intent_from_payment_attempt,
+                business_profile,
                 intent_retry_count,
                 recovery_attempt_from_payment_attempt
                     .as_ref()
@@ -926,6 +936,7 @@ impl RevenueRecoveryAttempt {
                 profile_id,
                 payment_attempt_id,
                 revenue_recovery_retry,
+                invoice_scheduled_time: Some(schedule_time),
             };
 
         let tag = ["PCR"];
diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs
index 81a012ba414..af84ed2170f 100644
--- a/crates/router/src/types/storage/revenue_recovery.rs
+++ b/crates/router/src/types/storage/revenue_recovery.rs
@@ -13,7 +13,7 @@ use masking::PeekInterface;
 use router_env::logger;
 use serde::{Deserialize, Serialize};
 
-use crate::{db::StorageInterface, routes::SessionState, workflows::revenue_recovery};
+use crate::{db::StorageInterface, routes::SessionState, types, workflows::revenue_recovery};
 #[derive(serde::Serialize, serde::Deserialize, Debug)]
 pub struct RevenueRecoveryWorkflowTrackingData {
     pub merchant_id: id_type::MerchantId,
@@ -22,6 +22,7 @@ pub struct RevenueRecoveryWorkflowTrackingData {
     pub payment_attempt_id: id_type::GlobalAttemptId,
     pub billing_mca_id: id_type::MerchantConnectorAccountId,
     pub revenue_recovery_retry: enums::RevenueRecoveryAlgorithmType,
+    pub invoice_scheduled_time: Option<time::PrimitiveDateTime>,
 }
 
 #[derive(Debug, Clone)]
diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs
index 8f3b3f0e009..dc1d97bc422 100644
--- a/crates/router/src/workflows/revenue_recovery.rs
+++ b/crates/router/src/workflows/revenue_recovery.rs
@@ -114,7 +114,7 @@ impl ProcessTrackerWorkflow<SessionState> for ExecutePcrWorkflow {
         >(
             state,
             state.get_req_state(),
-            merchant_context_from_revenue_recovery_payment_data,
+            merchant_context_from_revenue_recovery_payment_data.clone(),
             revenue_recovery_payment_data.profile.clone(),
             payments::operations::PaymentGetIntent,
             request,
@@ -128,6 +128,8 @@ impl ProcessTrackerWorkflow<SessionState> for ExecutePcrWorkflow {
                 Box::pin(pcr::perform_execute_payment(
                     state,
                     &process,
+                    &revenue_recovery_payment_data.profile.clone(),
+                    merchant_context_from_revenue_recovery_payment_data.clone(),
                     &tracking_data,
                     &revenue_recovery_payment_data,
                     &payment_data.payment_intent,
@@ -138,6 +140,8 @@ impl ProcessTrackerWorkflow<SessionState> for ExecutePcrWorkflow {
                 Box::pin(pcr::perform_payments_sync(
                     state,
                     &process,
+                    &revenue_recovery_payment_data.profile.clone(),
+                    merchant_context_from_revenue_recovery_payment_data.clone(),
                     &tracking_data,
                     &revenue_recovery_payment_data,
                     &payment_data.payment_intent,
@@ -145,6 +149,18 @@ impl ProcessTrackerWorkflow<SessionState> for ExecutePcrWorkflow {
                 .await?;
                 Ok(())
             }
+            Some("CALCULATE_WORKFLOW") => {
+                Box::pin(pcr::perform_calculate_workflow(
+                    state,
+                    &process,
+                    &revenue_recovery_payment_data.profile.clone(),
+                    merchant_context_from_revenue_recovery_payment_data,
+                    &tracking_data,
+                    &revenue_recovery_payment_data,
+                    &payment_data.payment_intent,
+                ))
+                .await
+            }
 
             _ => Err(errors::ProcessTrackerError::JobNotFound),
         }
 | 
	2025-08-06T03:26:33Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
**CALCULATE WORKFLOW**
CALCULATE WORKFLOW
When we receive failed webhook and its intent retry count is more than the threshold, it will inserted into calculate job with the schedule time with 1 hour from now, before inserting it will first check the DB for existing entry for CALCULATE_WORKFLOW_{payment_intent},
If found and business_status is CALCULATE_WORKFLOW_QUEUED, then we just update the existing entry with scheduled time with plus hour.
If found and business_status is not CALCULATE_WORKFLOW_QUEUED, we do not insert the entry
If not found, make a new entry with scheduled time as 1 hour plus from now time and feed token list from payment_intent to tracking_data
Introduced one new field in tracking_data
Invoice_scheduled_time Option (used as scheduling time in execute workflow and as well as for dashboard purpose)
At the scheduled time, consumer picks it up and perform tasks like:-
Call a function(best_token_with_time() ) that returns Option<{(token, scheduled_time)}>
We pass scheduled time in tracking_data as well as  pass in insert_execute_task_to_pt so that we can schedule EXECUTE WORKFLOW at that time, we change calculate flow's the business_status to CALCULATE_WORKFLOW_SCHEDULED and status as Finish also lock the customer of that active token with redis fn call.
If we receive None from best_token_with_time(), then we call get_payment_processor_token_with_schedule_time() whose return type is also Option<{PSPstatusdetails}>, if this is Some() then we just requeue it with wait time return by this fn, and add 15 minutes as  buffer time and update the business_status as CALCULATE_WORKFLOW_QUEUED, else if it returns None then we mark the invoice as finish and finish the calculate workflow since this is a HARD DECLINE.
EXECUTE WORKFLOW
When the consumer picks up the execute task, it tries to do payment by calling proxy_api at the scheduled_time, here we have three possibilities for response of payment:-
Success:-
Update the token with success status and also update calculate_workflow entry’s business_status to CALCULATE_WORKFLOW_COMPLETED and status to Finish and also unlock the customer with redis fn call and change the status of token to success in redis.
Failure:-
Finish the task by updating the status to Finish and business status to EXECUTE_WORKFLOW_FINISH, increment the retry count by 1 and also unlock the customer with redis fn call, then find the calculate job for the id, and update its the business status to CALCULATE_WORKFLOW_QUEUED and scheduled time to now() + 1 hr
Pending:-
Will call PSYNC, update the business status of calculate job to CALCULATE_WORKFLOW_PROCESSING
PSYNC WORKFLOW
When the consumer picks up the psync task, here we have three possibilities:-
Success:-
Update the token with success status and also update calculate_workflow entry’s business_status to CALCULATE_WORKFLOW_COMPLETED and status to Finish.
Failure:-
Finish the task by updating the status to Finish and business status to EXECUTE_WORKFLOW_FINISH and also increment the retry count by 1, find the calculate job for the id, and update the business status to CALCULATE_WORKFLOW_QUEUED and scheduled time to now() + 1 hr
Pending:-
Will call PSYNC, update the business status of calculate job to CALCULATE_WORKFLOW_PROCESSING
<img width="1530" height="308" alt="Screenshot 2025-08-13 at 16 42 06" src="https://github.com/user-attachments/assets/bc598e19-4404-4d1f-b736-be73501a5464" />
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
How to test invoice queuing and card switching: 
Create a business profile -  where the default revenue_recovery_algorithm_type would be Monitoring by default. (Need to update it to Cascading and Smart and test the flows.
Create a Payment Processor (worldpayvantiv) 
```curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '
{
    "connector_type": "payment_processor",
    "connector_name": "worldpayvantiv",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "u83996941026920501",
        "key1": "010193081",
        "api_secret": "qRfXV7aPcvkX6Fr"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "metadata": {
        "report_group": "Hello",
        "merchant_config_currency": "USD"
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
Create Billing Processor for custom billing 
```curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "custombilling",
    "connector_account_details": {
        "auth_type": "NoKey"
    },
    "feature_metadata" : {
        "revenue_recovery" : {
            "max_retry_count" : 9,
            "billing_connector_retry_threshold" : 0,
            "billing_account_reference" :{
                "{{connector_mca_id}}" : "{{connector_mca_id}}"
            },
            "switch_payment_method_config" : {
                "retry_threshold" : 0,
                "time_threshold_after_creation": 0
            }
        }
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
Use the payment/recovery api 
```curl --location 'http://localhost:8080/v2/payments/recovery' \
--header 'Authorization: api-key=dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--header 'x-profile-id: pro_xsbw9tuM9f6whrwaZKC2' \
--header 'x-merchant-id: cloth_seller_2px3Q1TUxtGOvO3Yzm0S' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--data '{
    "amount_details": {
        "order_amount": 2250,
        "currency": "USD"
    },
    "merchant_reference_id": "1234567891",
    "connector_transaction_id": "43255654",
    "connector_customer_id": "526755",
    "error": {
        "code": "110",
        "message": "Insufficient Funds"
    },
    "billing": {
        "address": {
            "state": "CA",
            "country": "US"
        }
    },
    "payment_method_type": "card",
    "payment_method_sub_type": "credit",
    "payment_method_data": {
        "primary_processor_payment_method_token": "2541911049890008",
        "additional_payment_method_info": {
            "card_exp_month": "12",
            "card_exp_year": "25",
            "last_four_digits": 1997,
            "card_network": "VISA",
            "card_issuer": "Wells Fargo NA",
            "card_type": "credit"
        }
    },
    "billing_started_at": "2024-05-29T08:10:58Z",
    "transaction_created_at": "2024-05-29T08:10:58Z",
    "attempt_status": "failure",
    "action": "schedule_failed_payment",
    "billing_merchant_connector_id": "mca_6y5xtQUL2tgnHbjS7Bai",
    "payment_merchant_connector_id": "mca_OWLpnzoAxkhT1eZVJ3Q3"
  }'
```
We need to hit recovery api curl multiple times by changing, here merchant reference is      invoice_id : 
    "merchant_reference_id": "1234567891",
    "connector_transaction_id": "43255654",
    "connector_customer_id": "526755",
There should be entry in the process tracker only when the retries exceed the threshold. 
In the given curl we have kept the retry threshold as 0. 
Redis will contain keys 
<img width="721" height="117" alt="Screenshot 2025-08-25 at 18 04 14" src="https://github.com/user-attachments/assets/2ce5a60f-a537-41f3-8c9c-33a510337b77" />
Cascading 
When the profile is in CASCADING phase, the decider should not be called(gRPC call).
It should take the retry date from config and schedule accordingly. 
Process Tracker entry  (Calculate Job) :
<img width="688" height="138" alt="Screenshot 2025-08-25 at 18 05 02" src="https://github.com/user-attachments/assets/2a0abbc8-d40f-40bb-adcd-f6ce9e2ed6a2" />
Process Tracker  (Execute Job) : 
<img width="684" height="150" alt="Screenshot 2025-08-25 at 18 05 35" src="https://github.com/user-attachments/assets/689c47b9-3cc9-456c-b212-1b48c3076f07" />
At the scheduled time proxy api is called. 
<img width="690" height="264" alt="Screenshot 2025-08-25 at 18 06 11" src="https://github.com/user-attachments/assets/1097d92c-64b8-4023-aebc-b140dabcaa72" />
After which if payment is successful- Psync flow triggered 
<img width="686" height="234" alt="Screenshot 2025-08-25 at 18 07 52" src="https://github.com/user-attachments/assets/6dfa5a86-44f9-415f-84ac-34a5205096ed" />
And end with business_status as global failure on succeeded status in psync call. 
Smart 
When the profile is in SMART phase, the decider should be called(gRPC call).
Process Tracker entry  (Calculate Job) :
<img width="687" height="239" alt="Screenshot 2025-08-25 at 18 08 18" src="https://github.com/user-attachments/assets/32d47ab0-4a99-4efe-a25f-71bddaab0da0" />
Process Tracker  (Execute Job) : 
<img width="685" height="248" alt="Screenshot 2025-08-25 at 18 08 40" src="https://github.com/user-attachments/assets/e8a1a97b-45f6-4c8e-83dc-1cc2a79e04de" />
Process Tracker status after Proxy call 
Process Tracker  (Execute Job) : 
<img width="682" height="236" alt="Screenshot 2025-08-25 at 18 10 07" src="https://github.com/user-attachments/assets/a9b60a59-a4ac-481d-8cba-487e4be582f2" />
Process Tracker (Psync Flow )
<img width="680" height="242" alt="Screenshot 2025-08-25 at 18 10 34" src="https://github.com/user-attachments/assets/f4e741a2-38fb-45c2-aaea-03beef0386ed" />
In psync job, if we get a response as failed from connector 
The calculate job is reopened . 
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	0b59b9086cd68eef346413a27d03fa61fb6bb1f7 | 
	
How to test invoice queuing and card switching: 
Create a business profile -  where the default revenue_recovery_algorithm_type would be Monitoring by default. (Need to update it to Cascading and Smart and test the flows.
Create a Payment Processor (worldpayvantiv) 
```curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '
{
    "connector_type": "payment_processor",
    "connector_name": "worldpayvantiv",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "u83996941026920501",
        "key1": "010193081",
        "api_secret": "qRfXV7aPcvkX6Fr"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "metadata": {
        "report_group": "Hello",
        "merchant_config_currency": "USD"
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
Create Billing Processor for custom billing 
```curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: {{}}' \
--header 'x-profile-id: {{}}' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: {{}}' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "custombilling",
    "connector_account_details": {
        "auth_type": "NoKey"
    },
    "feature_metadata" : {
        "revenue_recovery" : {
            "max_retry_count" : 9,
            "billing_connector_retry_threshold" : 0,
            "billing_account_reference" :{
                "{{connector_mca_id}}" : "{{connector_mca_id}}"
            },
            "switch_payment_method_config" : {
                "retry_threshold" : 0,
                "time_threshold_after_creation": 0
            }
        }
    },
    "profile_id": "pro_6BnIGqGPytQ3vwObbAw6"
}'
```
Use the payment/recovery api 
```curl --location 'http://localhost:8080/v2/payments/recovery' \
--header 'Authorization: api-key=dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--header 'x-profile-id: pro_xsbw9tuM9f6whrwaZKC2' \
--header 'x-merchant-id: cloth_seller_2px3Q1TUxtGOvO3Yzm0S' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \
--data '{
    "amount_details": {
        "order_amount": 2250,
        "currency": "USD"
    },
    "merchant_reference_id": "1234567891",
    "connector_transaction_id": "43255654",
    "connector_customer_id": "526755",
    "error": {
        "code": "110",
        "message": "Insufficient Funds"
    },
    "billing": {
        "address": {
            "state": "CA",
            "country": "US"
        }
    },
    "payment_method_type": "card",
    "payment_method_sub_type": "credit",
    "payment_method_data": {
        "primary_processor_payment_method_token": "2541911049890008",
        "additional_payment_method_info": {
            "card_exp_month": "12",
            "card_exp_year": "25",
            "last_four_digits": 1997,
            "card_network": "VISA",
            "card_issuer": "Wells Fargo NA",
            "card_type": "credit"
        }
    },
    "billing_started_at": "2024-05-29T08:10:58Z",
    "transaction_created_at": "2024-05-29T08:10:58Z",
    "attempt_status": "failure",
    "action": "schedule_failed_payment",
    "billing_merchant_connector_id": "mca_6y5xtQUL2tgnHbjS7Bai",
    "payment_merchant_connector_id": "mca_OWLpnzoAxkhT1eZVJ3Q3"
  }'
```
We need to hit recovery api curl multiple times by changing, here merchant reference is      invoice_id : 
    "merchant_reference_id": "1234567891",
    "connector_transaction_id": "43255654",
    "connector_customer_id": "526755",
There should be entry in the process tracker only when the retries exceed the threshold. 
In the given curl we have kept the retry threshold as 0. 
Redis will contain keys 
<img width="721" height="117" alt="Screenshot 2025-08-25 at 18 04 14" src="https://github.com/user-attachments/assets/2ce5a60f-a537-41f3-8c9c-33a510337b77" />
Cascading 
When the profile is in CASCADING phase, the decider should not be called(gRPC call).
It should take the retry date from config and schedule accordingly. 
Process Tracker entry  (Calculate Job) :
<img width="688" height="138" alt="Screenshot 2025-08-25 at 18 05 02" src="https://github.com/user-attachments/assets/2a0abbc8-d40f-40bb-adcd-f6ce9e2ed6a2" />
Process Tracker  (Execute Job) : 
<img width="684" height="150" alt="Screenshot 2025-08-25 at 18 05 35" src="https://github.com/user-attachments/assets/689c47b9-3cc9-456c-b212-1b48c3076f07" />
At the scheduled time proxy api is called. 
<img width="690" height="264" alt="Screenshot 2025-08-25 at 18 06 11" src="https://github.com/user-attachments/assets/1097d92c-64b8-4023-aebc-b140dabcaa72" />
After which if payment is successful- Psync flow triggered 
<img width="686" height="234" alt="Screenshot 2025-08-25 at 18 07 52" src="https://github.com/user-attachments/assets/6dfa5a86-44f9-415f-84ac-34a5205096ed" />
And end with business_status as global failure on succeeded status in psync call. 
Smart 
When the profile is in SMART phase, the decider should be called(gRPC call).
Process Tracker entry  (Calculate Job) :
<img width="687" height="239" alt="Screenshot 2025-08-25 at 18 08 18" src="https://github.com/user-attachments/assets/32d47ab0-4a99-4efe-a25f-71bddaab0da0" />
Process Tracker  (Execute Job) : 
<img width="685" height="248" alt="Screenshot 2025-08-25 at 18 08 40" src="https://github.com/user-attachments/assets/e8a1a97b-45f6-4c8e-83dc-1cc2a79e04de" />
Process Tracker status after Proxy call 
Process Tracker  (Execute Job) : 
<img width="682" height="236" alt="Screenshot 2025-08-25 at 18 10 07" src="https://github.com/user-attachments/assets/a9b60a59-a4ac-481d-8cba-487e4be582f2" />
Process Tracker (Psync Flow )
<img width="680" height="242" alt="Screenshot 2025-08-25 at 18 10 34" src="https://github.com/user-attachments/assets/f4e741a2-38fb-45c2-aaea-03beef0386ed" />
In psync job, if we get a response as failed from connector 
The calculate job is reopened . 
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8855 | 
	Bug: [FEATURE] Add Gateway System Tracking in Feature Metadata for Routing Stickiness
# Add Gateway System Tracking in Feature Metadata for Routing Stickiness
  ## Problem Statement
  Currently, payment routing decisions between Direct routing (hyperswitch) and Unified Connector Service (UCS) are made
  independently for each payment operation. This creates inconsistency issues where different operations for the same payment
  intent may be routed through different gateway systems.
  ### Current Behavior
  - Payment creation may route through Direct routing
  - Payment confirmation may route through UCS
  - Payment sync may route through Direct routing again
  - Each operation makes routing decisions without considering previous choices
  ### Impact
  1. **Payment State Inconsistency**: Different operations using different gateway systems can lead to conflicting payment
  states
  2. **Routing Conflicts**: Operations may fail due to gateway system mismatches
  3. **Debugging Complexity**: Payment flows become difficult to trace when they span multiple gateway systems
  4. **Potential Data Loss**: Inconsistent routing may cause payment data to be scattered across systems
  5. **Merchant Experience**: Unpredictable payment behavior affects merchant confidence
  ## Proposed Solution
  Implement routing stickiness by tracking the gateway system used for initial payment routing and ensuring all subsequent
  operations use the same system.
  ### Technical Approach
  - Add `GatewaySystem` enum to track routing decisions (Direct vs UCS)
  - Store gateway system information in payment intent's feature metadata
  - Implement routing logic that considers previous gateway system usage
  - Add comprehensive logging for payment routing decisions
  - Update all payment operations to preserve routing consistency
  ### Key Components
  1. **Gateway System Enum**: Define clear categorization of routing types
  2. **Feature Metadata Storage**: Persist routing decisions for stickiness
  3. **Routing Logic Enhancement**: Consider previous decisions in routing algorithms
  4. **Observability**: Add logging for debugging and monitoring
  5. **Data Consistency**: Ensure metadata is properly maintained across operations | 
	diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 41938fc23d3..32b6cdf4116 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2220,6 +2220,34 @@ pub enum PaymentMethod {
     MobilePayment,
 }
 
+/// Indicates the gateway system through which the payment is processed.
+#[derive(
+    Clone,
+    Copy,
+    Debug,
+    Default,
+    Eq,
+    PartialOrd,
+    Ord,
+    Hash,
+    PartialEq,
+    serde::Deserialize,
+    serde::Serialize,
+    strum::Display,
+    strum::VariantNames,
+    strum::EnumIter,
+    strum::EnumString,
+    ToSchema,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum GatewaySystem {
+    #[default]
+    Direct,
+    UnifiedConnectorService,
+}
+
 /// The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow.
 #[derive(
     Clone,
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 0f56be31309..acc8d4b21f8 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -2,6 +2,7 @@ use common_enums::{PaymentMethodType, RequestIncrementalAuthorization};
 use common_types::primitive_wrappers::RequestExtendedAuthorizationBool;
 use common_utils::{encryption::Encryption, pii, types::MinorUnit};
 use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
+use masking::ExposeInterface;
 use serde::{Deserialize, Serialize};
 use time::PrimitiveDateTime;
 
@@ -492,6 +493,7 @@ pub enum PaymentIntentUpdate {
         fingerprint_id: Option<String>,
         updated_by: String,
         incremental_authorization_allowed: Option<bool>,
+        feature_metadata: Option<masking::Secret<serde_json::Value>>,
     },
     MetadataUpdate {
         metadata: serde_json::Value,
@@ -517,6 +519,7 @@ pub enum PaymentIntentUpdate {
         status: storage_enums::IntentStatus,
         updated_by: String,
         incremental_authorization_allowed: Option<bool>,
+        feature_metadata: Option<masking::Secret<serde_json::Value>>,
     },
     PaymentAttemptAndAttemptCountUpdate {
         active_attempt_id: String,
@@ -625,6 +628,7 @@ pub struct PaymentIntentUpdateFields {
     pub force_3ds_challenge: Option<bool>,
     pub is_iframe_redirection_enabled: Option<bool>,
     pub payment_channel: Option<common_enums::PaymentChannel>,
+    pub feature_metadata: Option<masking::Secret<serde_json::Value>>,
     pub tax_status: Option<common_enums::TaxStatus>,
     pub discount_amount: Option<MinorUnit>,
     pub order_date: Option<PrimitiveDateTime>,
@@ -845,6 +849,7 @@ pub struct PaymentIntentUpdateInternal {
     pub is_iframe_redirection_enabled: Option<bool>,
     pub extended_return_url: Option<String>,
     pub payment_channel: Option<common_enums::PaymentChannel>,
+    pub feature_metadata: Option<masking::Secret<serde_json::Value>>,
     pub tax_status: Option<common_enums::TaxStatus>,
     pub discount_amount: Option<MinorUnit>,
     pub order_date: Option<PrimitiveDateTime>,
@@ -897,6 +902,7 @@ impl PaymentIntentUpdate {
             is_iframe_redirection_enabled,
             extended_return_url,
             payment_channel,
+            feature_metadata,
             tax_status,
             discount_amount,
             order_date,
@@ -953,6 +959,9 @@ impl PaymentIntentUpdate {
                 .or(source.is_iframe_redirection_enabled),
             extended_return_url: extended_return_url.or(source.extended_return_url),
             payment_channel: payment_channel.or(source.payment_channel),
+            feature_metadata: feature_metadata
+                .map(|value| value.expose())
+                .or(source.feature_metadata),
             tax_status: tax_status.or(source.tax_status),
             discount_amount: discount_amount.or(source.discount_amount),
             order_date: order_date.or(source.order_date),
@@ -1013,6 +1022,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1062,6 +1072,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,
                 extended_return_url: value.return_url,
                 payment_channel: value.payment_channel,
+                feature_metadata: value.feature_metadata,
                 tax_status: value.tax_status,
                 discount_amount: value.discount_amount,
                 order_date: value.order_date,
@@ -1118,6 +1129,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: return_url,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1129,6 +1141,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 status,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             } => Self {
                 status: Some(status),
                 modified_at: common_utils::date_time::now(),
@@ -1170,6 +1183,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1223,6 +1237,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1239,6 +1254,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 // customer_id,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             } => Self {
                 // amount,
                 // currency: Some(currency),
@@ -1283,6 +1299,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1335,6 +1352,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1388,6 +1406,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1440,6 +1459,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1492,6 +1512,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1543,6 +1564,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1591,6 +1613,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1641,6 +1664,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1691,6 +1715,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1739,6 +1764,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
@@ -1792,6 +1818,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 is_iframe_redirection_enabled: None,
                 extended_return_url: None,
                 payment_channel: None,
+                feature_metadata: None,
                 tax_status: None,
                 discount_amount: None,
                 order_date: None,
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index 0cdb553059c..a13e1c7f265 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -101,7 +101,7 @@ impl FeatureMetadata {
 }
 
 #[cfg(feature = "v1")]
-#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
 #[diesel(sql_type = Json)]
 pub struct FeatureMetadata {
     /// Redirection response coming in request as metadata field only for redirection scenarios
@@ -110,6 +110,8 @@ pub struct FeatureMetadata {
     pub search_tags: Option<Vec<HashedString<WithType>>>,
     /// Recurring payment details required for apple pay Merchant Token
     pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
+    /// The system that the gateway is integrated with, e.g., `Direct`(through hyperswitch), `UnifiedConnectorService`(through ucs), etc.
+    pub gateway_system: Option<common_enums::GatewaySystem>,
 }
 
 #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 4f6313ea31a..699d8dad7ee 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -186,7 +186,10 @@ impl UnifiedConnectorServiceClient {
                     }
                 }
             }
-            None => None,
+            None => {
+                router_env::logger::error!(?config.unified_connector_service, "Unified Connector Service config is missing");
+                None
+            }
         }
     }
 
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index dac5aa13410..70f7c4830cf 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -121,6 +121,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
             search_tags,
             apple_pay_recurring_details: apple_pay_recurring_details
                 .map(ApplePayRecurringDetails::convert_from),
+            gateway_system: None,
         }
     }
 
@@ -129,6 +130,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
             redirect_response,
             search_tags,
             apple_pay_recurring_details,
+            ..
         } = self;
 
         ApiFeatureMetadata {
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 55f8252ac21..60158ebdc12 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -249,6 +249,7 @@ pub struct PaymentIntentUpdateFields {
     pub duty_amount: Option<MinorUnit>,
     pub is_confirm_operation: bool,
     pub payment_channel: Option<common_enums::PaymentChannel>,
+    pub feature_metadata: Option<Secret<serde_json::Value>>,
     pub enable_partial_authorization: Option<bool>,
 }
 
@@ -261,6 +262,7 @@ pub enum PaymentIntentUpdate {
         updated_by: String,
         fingerprint_id: Option<String>,
         incremental_authorization_allowed: Option<bool>,
+        feature_metadata: Option<Secret<serde_json::Value>>,
     },
     MetadataUpdate {
         metadata: serde_json::Value,
@@ -286,6 +288,7 @@ pub enum PaymentIntentUpdate {
         status: common_enums::IntentStatus,
         incremental_authorization_allowed: Option<bool>,
         updated_by: String,
+        feature_metadata: Option<Secret<serde_json::Value>>,
     },
     PaymentAttemptAndAttemptCountUpdate {
         active_attempt_id: String,
@@ -437,6 +440,7 @@ pub struct PaymentIntentUpdateInternal {
     pub force_3ds_challenge: Option<bool>,
     pub is_iframe_redirection_enabled: Option<bool>,
     pub payment_channel: Option<common_enums::PaymentChannel>,
+    pub feature_metadata: Option<Secret<serde_json::Value>>,
     pub tax_status: Option<common_enums::TaxStatus>,
     pub discount_amount: Option<MinorUnit>,
     pub order_date: Option<PrimitiveDateTime>,
@@ -874,11 +878,13 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 status,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             } => Self {
                 status: Some(status),
                 modified_at: Some(common_utils::date_time::now()),
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
                 ..Default::default()
             },
             PaymentIntentUpdate::MerchantStatusUpdate {
@@ -903,6 +909,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 // customer_id,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             } => Self {
                 // amount,
                 // currency: Some(currency),
@@ -913,6 +920,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
                 modified_at: Some(common_utils::date_time::now()),
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
                 ..Default::default()
             },
             PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {
@@ -1034,12 +1042,14 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {
                 fingerprint_id,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             } => Self::ResponseUpdate {
                 status,
                 amount_captured,
                 fingerprint_id,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             },
             PaymentIntentUpdate::MetadataUpdate {
                 metadata,
@@ -1081,6 +1091,7 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {
                     force_3ds_challenge: value.force_3ds_challenge,
                     is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,
                     payment_channel: value.payment_channel,
+                    feature_metadata: value.feature_metadata,
                     tax_status: value.tax_status,
                     discount_amount: value.discount_amount,
                     order_date: value.order_date,
@@ -1121,10 +1132,12 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {
                 status,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             } => Self::PGStatusUpdate {
                 status,
                 updated_by,
                 incremental_authorization_allowed,
+                feature_metadata,
             },
             PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {
                 active_attempt_id,
@@ -1246,6 +1259,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
             force_3ds_challenge,
             is_iframe_redirection_enabled,
             payment_channel,
+            feature_metadata,
             tax_status,
             discount_amount,
             order_date,
@@ -1294,6 +1308,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
             is_iframe_redirection_enabled,
             extended_return_url: return_url,
             payment_channel,
+            feature_metadata,
             tax_status,
             discount_amount,
             order_date,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index b31550d4122..2637e134690 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -34,7 +34,7 @@ use api_models::{
     mandates::RecurringDetails,
     payments::{self as payments_api},
 };
-pub use common_enums::enums::CallConnectorAction;
+pub use common_enums::enums::{CallConnectorAction, GatewaySystem};
 use common_types::payments as common_payments_types;
 use common_utils::{
     ext_traits::{AsyncExt, StringExt},
@@ -91,6 +91,8 @@ use self::{
     operations::{BoxedOperation, Operation, PaymentResponse},
     routing::{self as self_routing, SessionFlowRoutingInput},
 };
+#[cfg(feature = "v1")]
+use super::unified_connector_service::update_gateway_system_in_feature_metadata;
 use super::{
     errors::StorageErrorExt, payment_methods::surcharge_decision_configs, routing::TransactionData,
     unified_connector_service::should_call_unified_connector_service,
@@ -4043,7 +4045,22 @@ where
         services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,
 {
     record_time_taken_with(|| async {
-        if should_call_unified_connector_service(state, merchant_context, &router_data).await? {
+        if should_call_unified_connector_service(
+            state,
+            merchant_context,
+            &router_data,
+            Some(payment_data),
+        )
+        .await?
+        {
+            router_env::logger::info!(
+                "Processing payment through UCS gateway system - payment_id={}, attempt_id={}",
+                payment_data
+                    .get_payment_intent()
+                    .payment_id
+                    .get_string_repr(),
+                payment_data.get_payment_attempt().attempt_id
+            );
             if should_add_task_to_process_tracker(payment_data) {
                 operation
                     .to_domain()?
@@ -4058,6 +4075,12 @@ where
                     .ok();
             }
 
+            // Update feature metadata to track UCS usage for stickiness
+            update_gateway_system_in_feature_metadata(
+                payment_data,
+                GatewaySystem::UnifiedConnectorService,
+            )?;
+
             (_, *payment_data) = operation
                 .to_update_tracker()?
                 .update_trackers(
@@ -4083,6 +4106,18 @@ where
 
             Ok((router_data, merchant_connector_account))
         } else {
+            router_env::logger::info!(
+                "Processing payment through Direct gateway system - payment_id={}, attempt_id={}",
+                payment_data
+                    .get_payment_intent()
+                    .payment_id
+                    .get_string_repr(),
+                payment_data.get_payment_attempt().attempt_id
+            );
+
+            // Update feature metadata to track Direct routing usage for stickiness
+            update_gateway_system_in_feature_metadata(payment_data, GatewaySystem::Direct)?;
+
             call_connector_service(
                 state,
                 req_state,
@@ -4440,8 +4475,13 @@ where
         .await?;
 
     // do order creation
-    let should_call_unified_connector_service =
-        should_call_unified_connector_service(state, merchant_context, &router_data).await?;
+    let should_call_unified_connector_service = should_call_unified_connector_service(
+        state,
+        merchant_context,
+        &router_data,
+        Some(payment_data),
+    )
+    .await?;
 
     let (connector_request, should_continue_further) = if !should_call_unified_connector_service {
         let mut should_continue_further = true;
@@ -4501,6 +4541,12 @@ where
 
     record_time_taken_with(|| async {
         if should_call_unified_connector_service {
+            router_env::logger::info!(
+                "Processing payment through UCS gateway system- payment_id={}, attempt_id={}",
+                payment_data.get_payment_intent().id.get_string_repr(),
+                payment_data.get_payment_attempt().id.get_string_repr()
+            );
+
             router_data
                 .call_unified_connector_service(
                     state,
@@ -4556,7 +4602,19 @@ where
         services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,
 {
     record_time_taken_with(|| async {
-        if should_call_unified_connector_service(state, merchant_context, &router_data).await? {
+        if should_call_unified_connector_service(
+            state,
+            merchant_context,
+            &router_data,
+            Some(payment_data),
+        )
+        .await?
+        {
+            router_env::logger::info!(
+                "Executing payment through UCS gateway system - payment_id={}, attempt_id={}",
+                payment_data.get_payment_intent().id.get_string_repr(),
+                payment_data.get_payment_attempt().id.get_string_repr()
+            );
             if should_add_task_to_process_tracker(payment_data) {
                 operation
                     .to_domain()?
@@ -4596,6 +4654,12 @@ where
 
             Ok(router_data)
         } else {
+            router_env::logger::info!(
+                "Processing payment through Direct gateway system - payment_id={}, attempt_id={}",
+                payment_data.get_payment_intent().id.get_string_repr(),
+                payment_data.get_payment_attempt().id.get_string_repr()
+            );
+
             call_connector_service(
                 state,
                 req_state,
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index dfe3657b0f7..92c84985c9d 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -256,6 +256,11 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelReques
                     status: enums::IntentStatus::Cancelled,
                     updated_by: storage_scheme.to_string(),
                     incremental_authorization_allowed: None,
+                    feature_metadata: payment_data
+                        .payment_intent
+                        .feature_metadata
+                        .clone()
+                        .map(masking::Secret::new),
                 };
                 (Some(payment_intent_update), enums::AttemptStatus::Voided)
             } else {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 9b2f2d85e8e..7cc48fd6f44 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -2056,6 +2056,11 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
                             .is_iframe_redirection_enabled,
                         is_confirm_operation: true, // Indicates that this is a confirm operation
                         payment_channel: payment_data.payment_intent.payment_channel,
+                        feature_metadata: payment_data
+                            .payment_intent
+                            .feature_metadata
+                            .clone()
+                            .map(masking::Secret::new),
                         tax_status: payment_data.payment_intent.tax_status,
                         discount_amount: payment_data.payment_intent.discount_amount,
                         order_date: payment_data.payment_intent.order_date,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 450ca96630f..29a1e43ec96 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -2113,6 +2113,11 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
             updated_by: storage_scheme.to_string(),
             // make this false only if initial payment fails, if incremental authorization call fails don't make it false
             incremental_authorization_allowed: Some(false),
+            feature_metadata: payment_data
+                .payment_intent
+                .feature_metadata
+                .clone()
+                .map(masking::Secret::new),
         },
         Ok(_) => storage::PaymentIntentUpdate::ResponseUpdate {
             status: api_models::enums::IntentStatus::foreign_from(
@@ -2124,6 +2129,11 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
             incremental_authorization_allowed: payment_data
                 .payment_intent
                 .incremental_authorization_allowed,
+            feature_metadata: payment_data
+                .payment_intent
+                .feature_metadata
+                .clone()
+                .map(masking::Secret::new),
         },
     };
 
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index e2e4fb824bd..6026a82e0d4 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -953,6 +953,11 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
                         .is_iframe_redirection_enabled,
                     is_confirm_operation: false, // this is not a confirm operation
                     payment_channel: payment_data.payment_intent.payment_channel,
+                    feature_metadata: payment_data
+                        .payment_intent
+                        .feature_metadata
+                        .clone()
+                        .map(masking::Secret::new),
                     tax_status: payment_data.payment_intent.tax_status,
                     discount_amount: payment_data.payment_intent.discount_amount,
                     order_date: payment_data.payment_intent.order_date,
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 4e32095dea7..b00440e89f3 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1,6 +1,7 @@
 use api_models::admin;
-use common_enums::{AttemptStatus, PaymentMethodType};
+use common_enums::{AttemptStatus, GatewaySystem, PaymentMethodType};
 use common_utils::{errors::CustomResult, ext_traits::ValueExt};
+use diesel_models::types::FeatureMetadata;
 use error_stack::ResultExt;
 use external_services::grpc_client::unified_connector_service::{
     ConnectorAuthMetadata, UnifiedConnectorServiceError,
@@ -23,9 +24,12 @@ use unified_connector_service_client::payments::{
 use crate::{
     consts,
     core::{
-        errors::{ApiErrorResponse, RouterResult},
-        payments::helpers::{
-            is_ucs_enabled, should_execute_based_on_rollout, MerchantConnectorAccountType,
+        errors::{self, RouterResult},
+        payments::{
+            helpers::{
+                is_ucs_enabled, should_execute_based_on_rollout, MerchantConnectorAccountType,
+            },
+            OperationSessionGetters, OperationSessionSetters,
         },
         utils::get_flow_name,
     },
@@ -39,21 +43,62 @@ pub mod transformers;
 // Re-export webhook transformer types for easier access
 pub use transformers::WebhookTransformData;
 
-pub async fn should_call_unified_connector_service<F: Clone, T>(
+/// Generic version of should_call_unified_connector_service that works with any type
+/// implementing OperationSessionGetters trait
+pub async fn should_call_unified_connector_service<F: Clone, T, D>(
     state: &SessionState,
     merchant_context: &MerchantContext,
     router_data: &RouterData<F, T, PaymentsResponseData>,
-) -> RouterResult<bool> {
+    payment_data: Option<&D>,
+) -> RouterResult<bool>
+where
+    D: OperationSessionGetters<F>,
+{
+    // Check basic UCS availability first
     if state.grpc_client.unified_connector_service_client.is_none() {
+        router_env::logger::debug!(
+            "Unified Connector Service client is not available, skipping UCS decision"
+        );
         return Ok(false);
     }
 
     let ucs_config_key = consts::UCS_ENABLED;
-
     if !is_ucs_enabled(state, ucs_config_key).await {
+        router_env::logger::debug!(
+            "Unified Connector Service is not enabled, skipping UCS decision"
+        );
         return Ok(false);
     }
 
+    // Apply stickiness logic if payment_data is available
+    if let Some(payment_data) = payment_data {
+        let previous_gateway_system = extract_gateway_system_from_payment_intent(payment_data);
+
+        match previous_gateway_system {
+            Some(GatewaySystem::UnifiedConnectorService) => {
+                // Payment intent previously used UCS, maintain stickiness to UCS
+                router_env::logger::info!(
+                    "Payment gateway system decision: UCS (sticky) - payment intent previously used UCS"
+                );
+                return Ok(true);
+            }
+            Some(GatewaySystem::Direct) => {
+                // Payment intent previously used Direct, maintain stickiness to Direct (return false for UCS)
+                router_env::logger::info!(
+                    "Payment gateway system decision: Direct (sticky) - payment intent previously used Direct"
+                );
+                return Ok(false);
+            }
+            None => {
+                // No previous gateway system set, continue with normal gateway system logic
+                router_env::logger::debug!(
+                    "UCS stickiness: No previous gateway system set, applying normal gateway system logic"
+                );
+            }
+        }
+    }
+
+    // Continue with normal UCS gateway system logic
     let merchant_id = merchant_context
         .get_merchant_account()
         .get_id()
@@ -71,8 +116,13 @@ pub async fn should_call_unified_connector_service<F: Clone, T>(
         .is_some_and(|config| config.ucs_only_connectors.contains(&connector_name));
 
     if is_ucs_only_connector {
+        router_env::logger::info!(
+            "Payment gateway system decision: UCS (forced) - merchant_id={}, connector={}, payment_method={}, flow={}",
+            merchant_id, connector_name, payment_method, flow_name
+        );
         return Ok(true);
     }
+
     let config_key = format!(
         "{}_{}_{}_{}_{}",
         consts::UCS_ROLLOUT_PERCENT_CONFIG_PREFIX,
@@ -83,9 +133,87 @@ pub async fn should_call_unified_connector_service<F: Clone, T>(
     );
 
     let should_execute = should_execute_based_on_rollout(state, &config_key).await?;
+
+    // Log gateway system decision
+    if should_execute {
+        router_env::logger::info!(
+            "Payment gateway system decision: UCS - merchant_id={}, connector={}, payment_method={}, flow={}",
+            merchant_id, connector_name, payment_method, flow_name
+        );
+    } else {
+        router_env::logger::info!(
+            "Payment gateway system decision: Direct - merchant_id={}, connector={}, payment_method={}, flow={}",
+            merchant_id, connector_name, payment_method, flow_name
+        );
+    }
+
     Ok(should_execute)
 }
 
+/// Extracts the gateway system from the payment intent's feature metadata
+/// Returns None if metadata is missing, corrupted, or doesn't contain gateway_system
+fn extract_gateway_system_from_payment_intent<F: Clone, D>(
+    payment_data: &D,
+) -> Option<GatewaySystem>
+where
+    D: OperationSessionGetters<F>,
+{
+    #[cfg(feature = "v1")]
+    {
+        payment_data
+            .get_payment_intent()
+            .feature_metadata
+            .as_ref()
+            .and_then(|metadata| {
+                // Try to parse the JSON value as FeatureMetadata
+                // Log errors but don't fail the flow for corrupted metadata
+                match serde_json::from_value::<FeatureMetadata>(metadata.clone()) {
+                    Ok(feature_metadata) => feature_metadata.gateway_system,
+                    Err(err) => {
+                        router_env::logger::warn!(
+                            "Failed to parse feature_metadata for gateway_system extraction: {}",
+                            err
+                        );
+                        None
+                    }
+                }
+            })
+    }
+    #[cfg(feature = "v2")]
+    {
+        None // V2 does not use feature metadata for gateway system tracking
+    }
+}
+
+/// Updates the payment intent's feature metadata to track the gateway system being used
+#[cfg(feature = "v1")]
+pub fn update_gateway_system_in_feature_metadata<F: Clone, D>(
+    payment_data: &mut D,
+    gateway_system: GatewaySystem,
+) -> RouterResult<()>
+where
+    D: OperationSessionGetters<F> + OperationSessionSetters<F>,
+{
+    let mut payment_intent = payment_data.get_payment_intent().clone();
+
+    let existing_metadata = payment_intent.feature_metadata.as_ref();
+
+    let mut feature_metadata = existing_metadata
+        .and_then(|metadata| serde_json::from_value::<FeatureMetadata>(metadata.clone()).ok())
+        .unwrap_or_default();
+
+    feature_metadata.gateway_system = Some(gateway_system);
+
+    let updated_metadata = serde_json::to_value(feature_metadata)
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Failed to serialize feature metadata")?;
+
+    payment_intent.feature_metadata = Some(updated_metadata.clone());
+    payment_data.set_payment_intent(payment_intent);
+
+    Ok(())
+}
+
 pub async fn should_call_unified_connector_service_for_webhooks(
     state: &SessionState,
     merchant_context: &MerchantContext,
@@ -422,7 +550,7 @@ pub async fn call_unified_connector_service_for_webhook(
         .unified_connector_service_client
         .as_ref()
         .ok_or_else(|| {
-            error_stack::report!(ApiErrorResponse::WebhookProcessingFailure)
+            error_stack::report!(errors::ApiErrorResponse::WebhookProcessingFailure)
                 .attach_printable("UCS client is not available for webhook processing")
         })?;
 
@@ -472,10 +600,10 @@ pub async fn call_unified_connector_service_for_webhook(
             build_unified_connector_service_auth_metadata(mca_type, merchant_context)
         })
         .transpose()
-        .change_context(ApiErrorResponse::InternalServerError)
+        .change_context(errors::ApiErrorResponse::InternalServerError)
         .attach_printable("Failed to build UCS auth metadata")?
         .ok_or_else(|| {
-            error_stack::report!(ApiErrorResponse::InternalServerError).attach_printable(
+            error_stack::report!(errors::ApiErrorResponse::InternalServerError).attach_printable(
                 "Missing merchant connector account for UCS webhook transformation",
             )
         })?;
@@ -504,7 +632,7 @@ pub async fn call_unified_connector_service_for_webhook(
         }
         Err(err) => {
             // When UCS is configured, we don't fall back to direct connector processing
-            Err(ApiErrorResponse::WebhookProcessingFailure)
+            Err(errors::ApiErrorResponse::WebhookProcessingFailure)
                 .attach_printable(format!("UCS webhook processing failed: {err}"))
         }
     }
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index c5c25bcc3e3..52a72a2d020 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -139,7 +139,7 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
                         .as_ref()
                         .is_none()
                 {
-                    let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::PGStatusUpdate { status: api_models::enums::IntentStatus::Failed,updated_by: merchant_account.storage_scheme.to_string(), incremental_authorization_allowed: Some(false) };
+                    let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::PGStatusUpdate { status: api_models::enums::IntentStatus::Failed,updated_by: merchant_account.storage_scheme.to_string(), incremental_authorization_allowed: Some(false), feature_metadata: payment_data.payment_intent.feature_metadata.clone().map(masking::Secret::new), };
                     let payment_attempt_update =
                         hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ErrorUpdate {
                             connector: None,
 | 
	2025-08-06T12:41:26Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
## Description
This change adds gateway system tracking in the feature metadata to enable routing stickiness and improve payment flow routing decisions. The implementation includes:
- Adding a new `GatewaySystem` enum to track whether payments are processed through Direct routing (hyperswitch) or Unified Connector Service (UCS)
- Storing the gateway system information in payment intent's feature metadata for routing stickiness
- Implementing routing logic that considers previous gateway system usage when making routing decisions
- Adding comprehensive logging for payment routing decisions for better observability
- Updating all payment update operations to preserve feature metadata consistency
### Additional Changes
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!-- 
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Previously, payment routing decisions between Direct routing and UCS were made independently for each payment operation, which could lead to inconsistent routing for the same payment intent across different operations (confirm, capture, sync, etc.). This lack of stickiness could cause issues with:
1. Payment state consistency across different operations
2. Potential routing conflicts when different operations use different gateway systems
3. Difficulty in tracking and debugging payment flows that span multiple operations
This change ensures that once a payment intent is routed through a specific gateway system (Direct or UCS), all subsequent operations for that payment maintain the same routing decision.
## How did you test it?
- Tested payment creation, confirmation, and sync operations with both Direct and UCS routing
- Verified that routing decisions are properly logged and persisted in feature metadata
- Confirmed that stickiness logic correctly routes subsequent operations through the same gateway system
- Tested error scenarios to ensure graceful fallback when metadata is corrupted or missing
##### Authorize 
```bash
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ***************' \
--data-raw '{
    "amount": 1000,
    "currency": "INR",
    
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "Uzzu54523",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request.",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "upi",
    
    
    "payment_method_type": "upi_collect",
    
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "success@razorpay"
            }
            
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "IN",
                "first_name": "Swangi",
                "last_name": "Kumari"
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
        
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "46282",
            "country": "IN",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "46282",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "all_keys_required": true
}'
```
```json
{
    "payment_id": "pay_1NzPXUQFRkXlvHOIW3Jq",
    "merchant_id": "merchant_1754554769",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "razorpay",
    "client_secret": "pay_1NzPXUQFRkXlvHOIW3Jq_secret_bhXTPfgXbwB11rmrC0DR",
    "created": "2025-08-08T10:58:58.767Z",
    "currency": "INR",
    "customer_id": "Uzzu54523",
    "customer": {
        "id": "Uzzu54523",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request.",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "upi",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "su*****@razorpay"
            }
        },
        "billing": {
            "address": {
                "city": "San Fransico",
                "country": "IN",
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "zip": "94122",
                "state": "California",
                "first_name": "Swangi",
                "last_name": "Kumari",
                "origin_zip": null
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "upi_collect",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Uzzu54523",
        "created_at": 1754650738,
        "expires": 1754654338,
        "secret": "epk_7a28f568d1834cf983b36bc50e45970f"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_R2odTWpZA226ue",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "order_R2odSokuwuMexQ",
    "payment_link": null,
    "profile_id": "pro_NkNnZmnjCEuoOKyqoev5",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_JtzW87JrlcfmX6fssydo",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-08T11:13:58.767Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-08T10:59:02.234Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"razorpay_payment_id\":\"pay_R2odTWpZA226ue\"}",
    "enable_partial_authorization": null
}
```
##### Psync
```bash
curl --location 'http://localhost:8080/payments/pay_1NzPXUQFRkXlvHOIW3Jq?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: *****************************'
```
```json
{
    "payment_id": "pay_4dezIe3S2nraarfCsnly",
    "merchant_id": "merchant_1754554769",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "razorpay",
    "client_secret": "pay_4dezIe3S2nraarfCsnly_secret_fPafwmfIQcGWTr96zQtm",
    "created": "2025-08-07T11:07:00.954Z",
    "currency": "INR",
    "customer_id": "Uzzu54523",
    "customer": {
        "id": "Uzzu54523",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request.",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_4dezIe3S2nraarfCsnly_1",
            "status": "authentication_pending",
            "amount": 1000,
            "order_tax_amount": null,
            "currency": "INR",
            "connector": "razorpay",
            "error_message": null,
            "payment_method": "upi",
            "connector_transaction_id": "pay_R2QErM6QamRIFx",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-08-07T11:07:00.954Z",
            "modified_at": "2025-08-07T11:07:05.271Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "upi_collect",
            "reference_id": "order_R2QEqgtrS7lSPD",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "upi",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "su*****@razorpay"
            }
        },
        "billing": {
            "address": {
                "city": "San Fransico",
                "country": "IN",
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "zip": "94122",
                "state": "California",
                "first_name": "Swangi",
                "last_name": "Kumari",
                "origin_zip": null
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "upi_collect",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_R2QErM6QamRIFx",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": "order_R2QEqgtrS7lSPD",
    "payment_link": null,
    "profile_id": "pro_NkNnZmnjCEuoOKyqoev5",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_JtzW87JrlcfmX6fssydo",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-07T11:22:00.954Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-07T11:11:29.281Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"entity\":\"collection\",\"count\":1,\"items\":[{\"id\":\"pay_R2QErM6QamRIFx\",\"entity\":\"payment\",\"amount\":1000,\"currency\":\"INR\",\"status\":\"captured\",\"order_id\":\"order_R2QEqgtrS7lSPD\",\"invoice_id\":null,\"international\":false,\"method\":\"upi\",\"amount_refunded\":0,\"refund_status\":null,\"captured\":true,\"description\":\"Payment via Razorpay\",\"card_id\":null,\"bank\":null,\"wallet\":null,\"vpa\":\"success@razorpay\",\"email\":\"swangi.kumari@juspay.in\",\"contact\":\"+918056594427\",\"notes\":{\"optimizer_provider_name\":\"razorpay\"},\"fee\":25,\"tax\":4,\"error_code\":null,\"error_description\":null,\"error_source\":null,\"error_step\":null,\"error_reason\":null,\"acquirer_data\":{\"rrn\":\"232178449311\",\"upi_transaction_id\":\"007AC04E0A02D40AA98FE252C69C7305\"},\"gateway_provider\":\"Razorpay\",\"created_at\":1754564823,\"upi\":{\"vpa\":\"success@razorpay\"}}]}",
    "enable_partial_authorization": null
}
```
#### What to look for?
- in logs you will be able to see 
```sh 
info:: Processing payment through Direct gateway system - payment_id=pay_4dezIe3S2nraarfCsnly, attempt_id=pay_4dezIe3S2nraarfCsnly_1
```
```sh
info:: Payment gateway system decision: Direct (sticky) - payment intent previously used Direct
```
###### Additional Note: 
This is also pushed to kafka topic for sessionizing
<img width="1295" height="882" alt="Screenshot 2025-08-07 at 4 46 52 PM" src="https://github.com/user-attachments/assets/d4c69638-0191-4cda-96be-35cee3015e33" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
 | 
	d4d8236e3102505553334b3d395496ae97ee8e14 | 
	- Tested payment creation, confirmation, and sync operations with both Direct and UCS routing
- Verified that routing decisions are properly logged and persisted in feature metadata
- Confirmed that stickiness logic correctly routes subsequent operations through the same gateway system
- Tested error scenarios to ensure graceful fallback when metadata is corrupted or missing
##### Authorize 
```bash
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ***************' \
--data-raw '{
    "amount": 1000,
    "currency": "INR",
    
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "Uzzu54523",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request.",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "upi",
    
    
    "payment_method_type": "upi_collect",
    
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "success@razorpay"
            }
            
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "IN",
                "first_name": "Swangi",
                "last_name": "Kumari"
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
        
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "46282",
            "country": "IN",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "46282",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "all_keys_required": true
}'
```
```json
{
    "payment_id": "pay_1NzPXUQFRkXlvHOIW3Jq",
    "merchant_id": "merchant_1754554769",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "razorpay",
    "client_secret": "pay_1NzPXUQFRkXlvHOIW3Jq_secret_bhXTPfgXbwB11rmrC0DR",
    "created": "2025-08-08T10:58:58.767Z",
    "currency": "INR",
    "customer_id": "Uzzu54523",
    "customer": {
        "id": "Uzzu54523",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request.",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "upi",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "su*****@razorpay"
            }
        },
        "billing": {
            "address": {
                "city": "San Fransico",
                "country": "IN",
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "zip": "94122",
                "state": "California",
                "first_name": "Swangi",
                "last_name": "Kumari",
                "origin_zip": null
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "upi_collect",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Uzzu54523",
        "created_at": 1754650738,
        "expires": 1754654338,
        "secret": "epk_7a28f568d1834cf983b36bc50e45970f"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_R2odTWpZA226ue",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "order_R2odSokuwuMexQ",
    "payment_link": null,
    "profile_id": "pro_NkNnZmnjCEuoOKyqoev5",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_JtzW87JrlcfmX6fssydo",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-08T11:13:58.767Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-08T10:59:02.234Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"razorpay_payment_id\":\"pay_R2odTWpZA226ue\"}",
    "enable_partial_authorization": null
}
```
##### Psync
```bash
curl --location 'http://localhost:8080/payments/pay_1NzPXUQFRkXlvHOIW3Jq?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: *****************************'
```
```json
{
    "payment_id": "pay_4dezIe3S2nraarfCsnly",
    "merchant_id": "merchant_1754554769",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "razorpay",
    "client_secret": "pay_4dezIe3S2nraarfCsnly_secret_fPafwmfIQcGWTr96zQtm",
    "created": "2025-08-07T11:07:00.954Z",
    "currency": "INR",
    "customer_id": "Uzzu54523",
    "customer": {
        "id": "Uzzu54523",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request.",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_4dezIe3S2nraarfCsnly_1",
            "status": "authentication_pending",
            "amount": 1000,
            "order_tax_amount": null,
            "currency": "INR",
            "connector": "razorpay",
            "error_message": null,
            "payment_method": "upi",
            "connector_transaction_id": "pay_R2QErM6QamRIFx",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-08-07T11:07:00.954Z",
            "modified_at": "2025-08-07T11:07:05.271Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "upi_collect",
            "reference_id": "order_R2QEqgtrS7lSPD",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "upi",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "su*****@razorpay"
            }
        },
        "billing": {
            "address": {
                "city": "San Fransico",
                "country": "IN",
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "zip": "94122",
                "state": "California",
                "first_name": "Swangi",
                "last_name": "Kumari",
                "origin_zip": null
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "upi_collect",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_R2QErM6QamRIFx",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": "order_R2QEqgtrS7lSPD",
    "payment_link": null,
    "profile_id": "pro_NkNnZmnjCEuoOKyqoev5",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_JtzW87JrlcfmX6fssydo",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-07T11:22:00.954Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-07T11:11:29.281Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"entity\":\"collection\",\"count\":1,\"items\":[{\"id\":\"pay_R2QErM6QamRIFx\",\"entity\":\"payment\",\"amount\":1000,\"currency\":\"INR\",\"status\":\"captured\",\"order_id\":\"order_R2QEqgtrS7lSPD\",\"invoice_id\":null,\"international\":false,\"method\":\"upi\",\"amount_refunded\":0,\"refund_status\":null,\"captured\":true,\"description\":\"Payment via Razorpay\",\"card_id\":null,\"bank\":null,\"wallet\":null,\"vpa\":\"success@razorpay\",\"email\":\"swangi.kumari@juspay.in\",\"contact\":\"+918056594427\",\"notes\":{\"optimizer_provider_name\":\"razorpay\"},\"fee\":25,\"tax\":4,\"error_code\":null,\"error_description\":null,\"error_source\":null,\"error_step\":null,\"error_reason\":null,\"acquirer_data\":{\"rrn\":\"232178449311\",\"upi_transaction_id\":\"007AC04E0A02D40AA98FE252C69C7305\"},\"gateway_provider\":\"Razorpay\",\"created_at\":1754564823,\"upi\":{\"vpa\":\"success@razorpay\"}}]}",
    "enable_partial_authorization": null
}
```
#### What to look for?
- in logs you will be able to see 
```sh 
info:: Processing payment through Direct gateway system - payment_id=pay_4dezIe3S2nraarfCsnly, attempt_id=pay_4dezIe3S2nraarfCsnly_1
```
```sh
info:: Payment gateway system decision: Direct (sticky) - payment intent previously used Direct
```
###### Additional Note: 
This is also pushed to kafka topic for sessionizing
<img width="1295" height="882" alt="Screenshot 2025-08-07 at 4 46 52 PM" src="https://github.com/user-attachments/assets/d4c69638-0191-4cda-96be-35cee3015e33" />
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8845 | 
	Bug: [BUG] Fix Refund Reason Type in Adyen
### Bug Description
The reason field in AdyenRefundRequest is currently of type Option<String>, which allows any arbitrary string to be passed as the refund reason. Adyen supports only a fixed set of values (FRAUD, CUSTOMER REQUEST, RETURN, DUPLICATE, OTHER). If an unsupported value is passed, the connector throws an error at runtime. This results in a failure that could be avoided earlier in the flow.
### Expected Behavior
The reason field should be strongly typed as Option<AdyenRefundRequestReason>, an enum with all supported values. Any value outside the allowed set should be mapped to OTHER internally, ensuring the connector does not throw unexpected errors.
### Actual Behavior
Currently, if the refund reason is anything other than the accepted Adyen values, the connector fails and returns an error response. There’s no early validation or fallback mechanism to handle unsupported values.
### Steps To Reproduce
1. Set reason = Some("INVALID_REASON") in a refund request.
2. The system accepts the value since it's an Option<String>.
3. Connector forwards the request to Adyen.
4. Adyen rejects it due to unsupported reason.
5. The system returns an error response from the connector.
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution: macOS
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 0b378a05718..3bba4ca57d0 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -114,6 +114,8 @@ payment_method_type = "apple_pay"
 payment_method_type = "google_pay"
 [[adyen.wallet]]
 payment_method_type = "paypal"
+[[adyen.voucher]]
+  payment_method_type = "boleto"
 [adyen.connector_auth.BodyKey]
 api_key = "Adyen API Key"
 key1 = "Adyen Account Id"
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 3d04375b106..1625ee900e7 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -1,3 +1,5 @@
+use std::str::FromStr;
+
 #[cfg(feature = "payouts")]
 use api_models::payouts::{self, PayoutMethodData};
 use api_models::{
@@ -1391,12 +1393,37 @@ pub struct DokuBankData {
 pub struct AdyenRefundRequest {
     merchant_account: Secret<String>,
     amount: Amount,
-    merchant_refund_reason: Option<String>,
+    merchant_refund_reason: Option<AdyenRefundRequestReason>,
     reference: String,
     splits: Option<Vec<AdyenSplitData>>,
     store: Option<String>,
 }
 
+#[derive(Debug, Serialize, Deserialize)]
+pub enum AdyenRefundRequestReason {
+    FRAUD,
+    #[serde(rename = "CUSTOMER REQUEST")]
+    CUSTOMERREQUEST,
+    RETURN,
+    DUPLICATE,
+    OTHER,
+}
+
+impl FromStr for AdyenRefundRequestReason {
+    type Err = error_stack::Report<errors::ConnectorError>;
+
+    fn from_str(s: &str) -> Result<Self, Self::Err> {
+        match s.to_uppercase().as_str() {
+            "FRAUD" => Ok(Self::FRAUD),
+            "CUSTOMER REQUEST" => Ok(Self::CUSTOMERREQUEST),
+            "RETURN" => Ok(Self::RETURN),
+            "DUPLICATE" => Ok(Self::DUPLICATE),
+            "OTHER" => Ok(Self::OTHER),
+            _ => Ok(Self::OTHER),
+        }
+    }
+}
+
 #[derive(Default, Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct AdyenRefundResponse {
@@ -4693,7 +4720,13 @@ impl<F> TryFrom<&AdyenRouterData<&RefundsRouterData<F>>> for AdyenRefundRequest
                 currency: item.router_data.request.currency,
                 value: item.amount,
             },
-            merchant_refund_reason: item.router_data.request.reason.clone(),
+            merchant_refund_reason: item
+                .router_data
+                .request
+                .reason
+                .as_ref()
+                .map(|reason| AdyenRefundRequestReason::from_str(reason))
+                .transpose()?,
             reference: item.router_data.request.refund_id.clone(),
             store,
             splits,
 | 
	2025-08-06T04:03:19Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Closes this [issue](https://github.com/juspay/hyperswitch/issues/8845)
## Description
<!-- Describe your changes in detail -->
This PR updates the reason field in AdyenRefundRequest from Option<String> to Option<AdyenRefundRequestReason>, a strongly typed enum. This change ensures only supported values (FRAUD, CUSTOMER REQUEST, RETURN, DUPLICATE, OTHER) are used.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Postman Test
A. Refund(with valid reason):
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Emxcc7NEApdtpDZyA54Hc0hN43a4wvBTlJ0wIGGeGquavEbsE4lhVWQcyPV8jMFu' \
--data '{
    "payment_id": "pay_aUwRQFUMFVSuIsfGRRiq",
    "amount": 100,
    "reason": "CUSTOMER REQUEST",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }  
}'
```
Response:
```
{
    "refund_id": "ref_3UOUCY4WziTz0iWhRGjT",
    "payment_id": "pay_aUwRQFUMFVSuIsfGRRiq",
    "amount": 100,
    "currency": "USD",
    "status": "pending",
    "reason": "CUSTOMER REQUEST",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-06T04:02:37.782Z",
    "updated_at": "2025-08-06T04:02:39.280Z",
    "connector": "adyen",
    "profile_id": "pro_H4NAjXx3vY9NI4nQbXom",
    "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
B. Refund (with invalid reason):
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_8rgdhjpDZyA54Hc0hN43a4wvBTlJ0wIGGeGquavEbsa.kjsfhgubdhrsj' \
--data '{
    "payment_id": "pay_dwfsrgdfnQSuIsfGRerjgh",
    "amount": 100,
    "reason": "customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }  
}'
```
Response:
```
{
    "refund_id": "ref_7JGWziplkiWhRaSg",
    "payment_id": "pay_dwfsrgdfnQSuIsfGRerjgh",
    "amount": 100,
    "currency": "USD",
    "status": "pending",
    "reason": "OTHER",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-06T04:02:37.782Z",
    "updated_at": "2025-08-06T04:02:39.280Z",
    "connector": "adyen",
    "profile_id": "pro_H4NAjXx3vY9NI4nQbXom",
    "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	c1d982e3009ebe192b350c2067bf9c2a708d7320 | 
	
Postman Test
A. Refund(with valid reason):
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Emxcc7NEApdtpDZyA54Hc0hN43a4wvBTlJ0wIGGeGquavEbsE4lhVWQcyPV8jMFu' \
--data '{
    "payment_id": "pay_aUwRQFUMFVSuIsfGRRiq",
    "amount": 100,
    "reason": "CUSTOMER REQUEST",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }  
}'
```
Response:
```
{
    "refund_id": "ref_3UOUCY4WziTz0iWhRGjT",
    "payment_id": "pay_aUwRQFUMFVSuIsfGRRiq",
    "amount": 100,
    "currency": "USD",
    "status": "pending",
    "reason": "CUSTOMER REQUEST",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-06T04:02:37.782Z",
    "updated_at": "2025-08-06T04:02:39.280Z",
    "connector": "adyen",
    "profile_id": "pro_H4NAjXx3vY9NI4nQbXom",
    "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
B. Refund (with invalid reason):
Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_8rgdhjpDZyA54Hc0hN43a4wvBTlJ0wIGGeGquavEbsa.kjsfhgubdhrsj' \
--data '{
    "payment_id": "pay_dwfsrgdfnQSuIsfGRerjgh",
    "amount": 100,
    "reason": "customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }  
}'
```
Response:
```
{
    "refund_id": "ref_7JGWziplkiWhRaSg",
    "payment_id": "pay_dwfsrgdfnQSuIsfGRerjgh",
    "amount": 100,
    "currency": "USD",
    "status": "pending",
    "reason": "OTHER",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-08-06T04:02:37.782Z",
    "updated_at": "2025-08-06T04:02:39.280Z",
    "connector": "adyen",
    "profile_id": "pro_H4NAjXx3vY9NI4nQbXom",
    "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8841 | 
	Bug: refactor(euclid): refactor logs for evaluation of equality for dynamic routing evaluate response
Improve the logs for better diffs between legacy and decision_engine's euclid. | 
	diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 547f49ce552..19ddeb7f15f 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -48,7 +48,6 @@ use rand::SeedableRng;
 use router_env::{instrument, tracing};
 use rustc_hash::FxHashMap;
 use storage_impl::redis::cache::{CacheKey, CGRAPH_CACHE, ROUTING_CACHE};
-use utils::perform_decision_euclid_routing;
 
 #[cfg(feature = "v2")]
 use crate::core::admin;
@@ -492,33 +491,24 @@ pub async fn perform_static_routing_v1(
             .to_string(),
     };
 
-    let de_euclid_connectors = if state.conf.open_router.static_routing_enabled {
-        let routing_events_wrapper = utils::RoutingEventsWrapper::new(
-            state.tenant.tenant_id.clone(),
-            state.request_id,
-            payment_id,
-            business_profile.get_id().to_owned(),
-            business_profile.merchant_id.to_owned(),
-            "DecisionEngine: Euclid Static Routing".to_string(),
-            None,
-            true,
-            false,
-        );
-
-        perform_decision_euclid_routing(
+    // Decision of de-routing is stored
+    let de_evaluated_connector = if !state.conf.open_router.static_routing_enabled {
+        logger::debug!("decision_engine_euclid: decision_engine routing not enabled");
+        Vec::default()
+    } else {
+        utils::decision_engine_routing(
             state,
             backend_input.clone(),
-            business_profile.get_id().get_string_repr().to_string(),
-            routing_events_wrapper,
+            business_profile,
+            payment_id,
             get_merchant_fallback_config().await?,
         )
         .await
         .map_err(|e|
             // errors are ignored as this is just for diff checking as of now (optional flow).
             logger::error!(decision_engine_euclid_evaluate_error=?e, "decision_engine_euclid: error in evaluation of rule")
-        ).unwrap_or_default()
-    } else {
-        Vec::default()
+        )
+        .unwrap_or_default()
     };
 
     let (routable_connectors, routing_approach) = match cached_algorithm.as_ref() {
@@ -538,8 +528,14 @@ pub async fn perform_static_routing_v1(
         ),
     };
 
+    // Results are logged for diff(between legacy and decision_engine's euclid) and have parameters as:
+    // is_equal: verifies all output are matching in order,
+    // is_equal_length: matches length of both outputs (useful for verifying volume based routing
+    // results)
+    // de_response: response from the decision_engine's euclid
+    // hs_response: response from legacy_euclid
     utils::compare_and_log_result(
-        de_euclid_connectors.clone(),
+        de_evaluated_connector.clone(),
         routable_connectors.clone(),
         "evaluate_routing".to_string(),
     );
@@ -549,7 +545,7 @@ pub async fn perform_static_routing_v1(
             state,
             business_profile,
             routable_connectors,
-            de_euclid_connectors,
+            de_evaluated_connector,
         )
         .await,
         routing_approach,
diff --git a/crates/router/src/core/payments/routing/utils.rs b/crates/router/src/core/payments/routing/utils.rs
index d9d5ed1de26..3c7a081d41f 100644
--- a/crates/router/src/core/payments/routing/utils.rs
+++ b/crates/router/src/core/payments/routing/utils.rs
@@ -1,4 +1,7 @@
-use std::collections::{HashMap, HashSet};
+use std::{
+    collections::{HashMap, HashSet},
+    str::FromStr,
+};
 
 use api_models::{
     open_router as or_types,
@@ -9,7 +12,7 @@ use api_models::{
     },
 };
 use async_trait::async_trait;
-use common_enums::TransactionType;
+use common_enums::{RoutableConnectors, TransactionType};
 use common_utils::{
     ext_traits::{BytesExt, StringExt},
     id_type,
@@ -30,6 +33,7 @@ use serde::{Deserialize, Serialize};
 use super::RoutingResult;
 use crate::{
     core::errors,
+    db::domain,
     routes::{app::SessionStateInfo, SessionState},
     services::{self, logger},
     types::transformers::ForeignInto,
@@ -301,7 +305,7 @@ pub async fn perform_decision_euclid_routing(
     created_by: String,
     events_wrapper: RoutingEventsWrapper<RoutingEvaluateRequest>,
     fallback_output: Vec<RoutableConnectorChoice>,
-) -> RoutingResult<Vec<RoutableConnectorChoice>> {
+) -> RoutingResult<RoutingEvaluateResponse> {
     logger::debug!("decision_engine_euclid: evaluate api call for euclid routing evaluation");
 
     let mut events_wrapper = events_wrapper;
@@ -348,8 +352,254 @@ pub async fn perform_decision_euclid_routing(
 
     logger::debug!(decision_engine_euclid_response=?euclid_response,"decision_engine_euclid");
     logger::debug!(decision_engine_euclid_selected_connector=?euclid_response.evaluated_output,"decision_engine_euclid");
+    Ok(euclid_response)
+}
+
+/// This function transforms the decision_engine response in a way that's usable for further flows:
+/// It places evaluated_output connectors first, followed by remaining output connectors (no duplicates).
+pub fn transform_de_output_for_router(
+    de_output: Vec<ConnectorInfo>,
+    de_evaluated_output: Vec<RoutableConnectorChoice>,
+) -> RoutingResult<Vec<RoutableConnectorChoice>> {
+    let mut seen = HashSet::new();
+
+    // evaluated connectors on top, to ensure the fallback is based on other connectors.
+    let mut ordered = Vec::with_capacity(de_output.len() + de_evaluated_output.len());
+    for eval_conn in de_evaluated_output {
+        if seen.insert(eval_conn.connector) {
+            ordered.push(eval_conn);
+        }
+    }
+
+    // Add remaining connectors from de_output (only if not already seen), for fallback
+    for conn in de_output {
+        let key = RoutableConnectors::from_str(&conn.gateway_name).map_err(|_| {
+            errors::RoutingError::GenericConversionError {
+                from: "String".to_string(),
+                to: "RoutableConnectors".to_string(),
+            }
+        })?;
+        if seen.insert(key) {
+            let de_choice = DeRoutableConnectorChoice::try_from(conn)?;
+            ordered.push(RoutableConnectorChoice::from(de_choice));
+        }
+    }
+    Ok(ordered)
+}
+
+pub async fn decision_engine_routing(
+    state: &SessionState,
+    backend_input: BackendInput,
+    business_profile: &domain::Profile,
+    payment_id: String,
+    merchant_fallback_config: Vec<RoutableConnectorChoice>,
+) -> RoutingResult<Vec<RoutableConnectorChoice>> {
+    let routing_events_wrapper = RoutingEventsWrapper::new(
+        state.tenant.tenant_id.clone(),
+        state.request_id,
+        payment_id,
+        business_profile.get_id().to_owned(),
+        business_profile.merchant_id.to_owned(),
+        "DecisionEngine: Euclid Static Routing".to_string(),
+        None,
+        true,
+        false,
+    );
+
+    let de_euclid_evaluate_response = perform_decision_euclid_routing(
+        state,
+        backend_input.clone(),
+        business_profile.get_id().get_string_repr().to_string(),
+        routing_events_wrapper,
+        merchant_fallback_config,
+    )
+    .await;
+
+    let Ok(de_euclid_response) = de_euclid_evaluate_response else {
+        logger::error!("decision_engine_euclid_evaluation_error: error in evaluation of rule");
+        return Ok(Vec::default());
+    };
+
+    let de_output_conenctor = extract_de_output_connectors(de_euclid_response.output)
+            .map_err(|e| {
+                logger::error!(error=?e, "decision_engine_euclid_evaluation_error: Failed to extract connector from Output");
+                e
+            })?;
+
+    transform_de_output_for_router(
+            de_output_conenctor.clone(),
+            de_euclid_response.evaluated_output.clone(),
+        )
+        .map_err(|e| {
+            logger::error!(error=?e, "decision_engine_euclid_evaluation_error: failed to transform connector from de-output");
+            e
+        })
+}
+
+/// Custom deserializer for output from decision_engine, this is required as untagged enum is
+/// stored but the enum requires tagged deserialization, hence deserializing it into specific
+/// variants
+pub fn extract_de_output_connectors(
+    output_value: serde_json::Value,
+) -> RoutingResult<Vec<ConnectorInfo>> {
+    const SINGLE: &str = "straight_through";
+    const PRIORITY: &str = "priority";
+    const VOLUME_SPLIT: &str = "volume_split";
+    const VOLUME_SPLIT_PRIORITY: &str = "volume_split_priority";
+
+    let obj = output_value.as_object().ok_or_else(|| {
+        logger::error!("decision_engine_euclid_error: output is not a JSON object");
+        errors::RoutingError::OpenRouterError("Expected output to be a JSON object".into())
+    })?;
+
+    let type_str = obj.get("type").and_then(|v| v.as_str()).ok_or_else(|| {
+        logger::error!("decision_engine_euclid_error: missing or invalid 'type' in output");
+        errors::RoutingError::OpenRouterError("Missing or invalid 'type' field in output".into())
+    })?;
+
+    match type_str {
+        SINGLE => {
+            let connector_value = obj.get("connector").ok_or_else(|| {
+                logger::error!(
+                    "decision_engine_euclid_error: missing 'connector' field for type=single"
+                );
+                errors::RoutingError::OpenRouterError(
+                    "Missing 'connector' field for single output".into(),
+                )
+            })?;
+            let connector: ConnectorInfo = serde_json::from_value(connector_value.clone())
+                .map_err(|e| {
+                    logger::error!(
+                        ?e,
+                        "decision_engine_euclid_error: Failed to parse single connector"
+                    );
+                    errors::RoutingError::OpenRouterError(
+                        "Failed to deserialize single connector".into(),
+                    )
+                })?;
+            Ok(vec![connector])
+        }
+
+        PRIORITY => {
+            let connectors_value = obj.get("connectors").ok_or_else(|| {
+                logger::error!(
+                    "decision_engine_euclid_error: missing 'connectors' field for type=priority"
+                );
+                errors::RoutingError::OpenRouterError(
+                    "Missing 'connectors' field for priority output".into(),
+                )
+            })?;
+            let connectors: Vec<ConnectorInfo> = serde_json::from_value(connectors_value.clone())
+                .map_err(|e| {
+                logger::error!(
+                    ?e,
+                    "decision_engine_euclid_error: Failed to parse connectors for priority"
+                );
+                errors::RoutingError::OpenRouterError(
+                    "Failed to deserialize priority connectors".into(),
+                )
+            })?;
+            Ok(connectors)
+        }
+
+        VOLUME_SPLIT => {
+            let splits_value = obj.get("splits").ok_or_else(|| {
+                logger::error!(
+                    "decision_engine_euclid_error: missing 'splits' field for type=volume_split"
+                );
+                errors::RoutingError::OpenRouterError(
+                    "Missing 'splits' field for volume_split output".into(),
+                )
+            })?;
 
-    Ok(euclid_response.evaluated_output)
+            // Transform each {connector, split} into {output, split}
+            let fixed_splits: Vec<_> = splits_value
+                .as_array()
+                .ok_or_else(|| {
+                    logger::error!("decision_engine_euclid_error: 'splits' is not an array");
+                    errors::RoutingError::OpenRouterError("'splits' field must be an array".into())
+                })?
+                .iter()
+                .map(|entry| {
+                    let mut entry_map = entry.as_object().cloned().ok_or_else(|| {
+                        logger::error!(
+                            "decision_engine_euclid_error: invalid split entry in volume_split"
+                        );
+                        errors::RoutingError::OpenRouterError(
+                            "Invalid entry in splits array".into(),
+                        )
+                    })?;
+                    if let Some(connector) = entry_map.remove("connector") {
+                        entry_map.insert("output".to_string(), connector);
+                    }
+                    Ok::<_, error_stack::Report<errors::RoutingError>>(serde_json::Value::Object(
+                        entry_map,
+                    ))
+                })
+                .collect::<Result<Vec<_>, _>>()?;
+
+            let splits: Vec<VolumeSplit<ConnectorInfo>> =
+                serde_json::from_value(serde_json::Value::Array(fixed_splits)).map_err(|e| {
+                    logger::error!(
+                        ?e,
+                        "decision_engine_euclid_error: Failed to parse volume_split"
+                    );
+                    errors::RoutingError::OpenRouterError(
+                        "Failed to deserialize volume_split connectors".into(),
+                    )
+                })?;
+
+            Ok(splits.into_iter().map(|s| s.output).collect())
+        }
+
+        VOLUME_SPLIT_PRIORITY => {
+            let splits_value = obj.get("splits").ok_or_else(|| {
+                logger::error!("decision_engine_euclid_error: missing 'splits' field for type=volume_split_priority");
+                errors::RoutingError::OpenRouterError("Missing 'splits' field for volume_split_priority output".into())
+            })?;
+
+            // Transform each {connector: [...], split} into {output: [...], split}
+            let fixed_splits: Vec<_> = splits_value
+                .as_array()
+                .ok_or_else(|| {
+                    logger::error!("decision_engine_euclid_error: 'splits' is not an array");
+                    errors::RoutingError::OpenRouterError("'splits' field must be an array".into())
+                })?
+                .iter()
+                .map(|entry| {
+                    let mut entry_map = entry.as_object().cloned().ok_or_else(|| {
+                        logger::error!("decision_engine_euclid_error: invalid split entry in volume_split_priority");
+                        errors::RoutingError::OpenRouterError("Invalid entry in splits array".into())
+                    })?;
+                    if let Some(connector) = entry_map.remove("connector") {
+                        entry_map.insert("output".to_string(), connector);
+                    }
+                    Ok::<_, error_stack::Report<errors::RoutingError>>(serde_json::Value::Object(entry_map))
+                })
+                .collect::<Result<Vec<_>, _>>()?;
+
+            let splits: Vec<VolumeSplit<Vec<ConnectorInfo>>> =
+                serde_json::from_value(serde_json::Value::Array(fixed_splits)).map_err(|e| {
+                    logger::error!(
+                        ?e,
+                        "decision_engine_euclid_error: Failed to parse volume_split_priority"
+                    );
+                    errors::RoutingError::OpenRouterError(
+                        "Failed to deserialize volume_split_priority connectors".into(),
+                    )
+                })?;
+
+            Ok(splits.into_iter().flat_map(|s| s.output).collect())
+        }
+
+        other => {
+            logger::error!(type_str=%other, "decision_engine_euclid_error: unknown output type");
+            Err(
+                errors::RoutingError::OpenRouterError(format!("Unknown output type: {other}"))
+                    .into(),
+            )
+        }
+    }
 }
 
 pub async fn create_de_euclid_routing_algo(
@@ -460,17 +710,13 @@ pub fn compare_and_log_result<T: RoutingEq<T> + Serialize>(
     result: Vec<T>,
     flow: String,
 ) {
-    let is_equal = de_result.len() == result.len()
-        && de_result
-            .iter()
-            .zip(result.iter())
-            .all(|(a, b)| T::is_equal(a, b));
-
-    if is_equal {
-        router_env::logger::info!(routing_flow=?flow, is_equal=?is_equal, "decision_engine_euclid");
-    } else {
-        router_env::logger::debug!(routing_flow=?flow, is_equal=?is_equal, de_response=?to_json_string(&de_result), hs_response=?to_json_string(&result), "decision_engine_euclid");
-    }
+    let is_equal = de_result
+        .iter()
+        .zip(result.iter())
+        .all(|(a, b)| T::is_equal(a, b));
+
+    let is_equal_in_length = de_result.len() == result.len();
+    router_env::logger::debug!(routing_flow=?flow, is_equal=?is_equal, is_equal_length=?is_equal_in_length, de_response=?to_json_string(&de_result), hs_response=?to_json_string(&result), "decision_engine_euclid");
 }
 
 pub trait RoutingEq<T> {
@@ -685,6 +931,8 @@ impl DecisionEngineErrorsInterface for or_types::ErrorResponse {
     }
 }
 
+pub type Metadata = HashMap<String, serde_json::Value>;
+
 /// Represents a single comparison condition.
 #[derive(Clone, Debug, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]
@@ -775,6 +1023,36 @@ pub struct ConnectorInfo {
     pub gateway_id: Option<String>,
 }
 
+impl TryFrom<ConnectorInfo> for DeRoutableConnectorChoice {
+    type Error = error_stack::Report<errors::RoutingError>;
+
+    fn try_from(c: ConnectorInfo) -> Result<Self, Self::Error> {
+        let gateway_id = c
+            .gateway_id
+            .map(|mca| {
+                id_type::MerchantConnectorAccountId::wrap(mca)
+                    .change_context(errors::RoutingError::GenericConversionError {
+                        from: "String".to_string(),
+                        to: "MerchantConnectorAccountId".to_string(),
+                    })
+                    .attach_printable("unable to convert MerchantConnectorAccountId from string")
+            })
+            .transpose()?;
+
+        let gateway_name = RoutableConnectors::from_str(&c.gateway_name)
+            .map_err(|_| errors::RoutingError::GenericConversionError {
+                from: "String".to_string(),
+                to: "RoutableConnectors".to_string(),
+            })
+            .attach_printable("unable to convert connector name to RoutableConnectors")?;
+
+        Ok(Self {
+            gateway_name,
+            gateway_id,
+        })
+    }
+}
+
 impl ConnectorInfo {
     pub fn new(gateway_name: String, gateway_id: Option<String>) -> Self {
         Self {
@@ -795,7 +1073,6 @@ pub enum Output {
 
 pub type Globals = HashMap<String, HashSet<ValueType>>;
 
-pub type Metadata = HashMap<String, serde_json::Value>;
 /// The program, having a default connector selection and
 /// a bunch of rules. Also can hold arbitrary metadata.
 #[derive(Clone, Debug, Serialize, Deserialize)]
 | 
	2025-08-04T12:02:20Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR refactors the routing logic to improve how **logs are emitted and connector evaluation is handled** when dynamic routing is performed using the Decision Engine (Euclid). Key updates include:
- Replaces raw response propagation from `perform_decision_euclid_routing` with a wrapped `RoutingEvaluateResponse` containing both `output` and `evaluated_output`.
- Introduces a new function `extract_de_output_connectors()` to deserialize and normalize `output` from Euclid into a list of `ConnectorInfo`.
- Adds `transform_de_output_for_router()` to combine `output` and `evaluated_output`, ensuring deduplication and priority order.
- Enhances logging in `compare_and_log_result` to include diff details between `de_result` and `router_result` more clearly.
- Adds `TryFrom<ConnectorInfo> for DeRoutableConnectorChoice` to safely convert API inputs to internal representations.
## Diff Hunk Explanation
### `crates/router/src/core/payments/routing.rs`
- Renamed `de_euclid_connectors` → `de_evaluated_connector` to reflect the structured response.
- Wrapped `perform_decision_euclid_routing` call with success match block to:
  - Extract connectors from `output` using `extract_de_output_connectors`.
  - Merge `output` and `evaluated_output` using `transform_de_output_for_router`.
- Updated logs to emit clearer error/debug statements during extraction, transformation, and comparison.
### `crates/router/src/core/payments/routing/utils.rs`
- Refactored `perform_decision_euclid_routing` to return `RoutingEvaluateResponse` instead of just connector list.
- Added `extract_de_output_connectors`: deserializes various output types (`single`, `priority`, `volume_split`, etc.).
- Added `transform_de_output_for_router`: deduplicates connectors and maintains priority between `evaluated_output` and fallback `output`.
- Improved `compare_and_log_result` to log equality and diff details between Decision Engine result and final connector result.
- Introduced `TryFrom<ConnectorInfo>` for `DeRoutableConnectorChoice`.
This refactor sets the stage for cleaner observability and deterministic routing behavior between evaluated and fallback paths.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
The testing guidelines are present in this [doc](https://docs.google.com/document/d/1Atb-5bIgA-H_H2lS2O-plhtGUqHK4fcQ1XDXWjrcTHE/edit?usp=sharing).
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	d418e1e59e2f4fd725c07a70cccabb992e1c12c6 | 
	
The testing guidelines are present in this [doc](https://docs.google.com/document/d/1Atb-5bIgA-H_H2lS2O-plhtGUqHK4fcQ1XDXWjrcTHE/edit?usp=sharing).
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8842 | 
	Bug: [FEATURE]:Store the user query of the chat bot
Store the user query and response from the ai service for the analysis.
Allow the api only for internal user 
 | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index b725be102c1..134e0a49e84 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1257,6 +1257,7 @@ allow_connected_merchants = false # Enable or disable connected merchant account
 [chat]
 enabled = false                                # Enable or disable chat features
 hyperswitch_ai_host = "http://0.0.0.0:8000"    # Hyperswitch ai workflow host
+encryption_key = ""                            # Key to encrypt and decrypt chats
 
 [proxy_status_mapping]
 proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index bfba035c1f3..fe8b09cd7db 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -419,6 +419,7 @@ max_random_schedule_delay_in_seconds = 300 # max random delay in seconds to sche
 [chat]
 enabled = false                                # Enable or disable chat features
 hyperswitch_ai_host = "http://0.0.0.0:8000"    # Hyperswitch ai workflow host
+encryption_key = ""                            # Key to encrypt and decrypt chats
 
 [proxy_status_mapping]
 proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/development.toml b/config/development.toml
index 940e43b50ca..e4cbe3af226 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1368,6 +1368,7 @@ version = "HOSTNAME"
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
+encryption_key = ""
 
 [proxy_status_mapping]
 proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index d299323f2c1..62f6830832c 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1226,6 +1226,7 @@ allow_connected_merchants = true
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
+encryption_key = ""
 
 [authentication_providers]
 click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
diff --git a/crates/api_models/src/chat.rs b/crates/api_models/src/chat.rs
index c66b42cc4f4..975197fd3fc 100644
--- a/crates/api_models/src/chat.rs
+++ b/crates/api_models/src/chat.rs
@@ -1,12 +1,13 @@
 use common_utils::id_type;
 use masking::Secret;
+use time::PrimitiveDateTime;
 
 #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
 pub struct ChatRequest {
     pub message: Secret<String>,
 }
 
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
 pub struct ChatResponse {
     pub response: Secret<serde_json::Value>,
     pub merchant_id: id_type::MerchantId,
@@ -16,3 +17,32 @@ pub struct ChatResponse {
     #[serde(skip_serializing)]
     pub row_count: Option<i32>,
 }
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ChatListRequest {
+    pub merchant_id: Option<id_type::MerchantId>,
+    pub limit: Option<i64>,
+    pub offset: Option<i64>,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ChatConversation {
+    pub id: String,
+    pub session_id: Option<String>,
+    pub user_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub profile_id: Option<String>,
+    pub org_id: Option<String>,
+    pub role_id: Option<String>,
+    pub user_query: Secret<String>,
+    pub response: Secret<serde_json::Value>,
+    pub database_query: Option<String>,
+    pub interaction_status: Option<String>,
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub created_at: PrimitiveDateTime,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ChatListResponse {
+    pub conversations: Vec<ChatConversation>,
+}
diff --git a/crates/api_models/src/events/chat.rs b/crates/api_models/src/events/chat.rs
index 42fefe487e9..38f20b0c3bb 100644
--- a/crates/api_models/src/events/chat.rs
+++ b/crates/api_models/src/events/chat.rs
@@ -1,5 +1,8 @@
 use common_utils::events::{ApiEventMetric, ApiEventsType};
 
-use crate::chat::{ChatRequest, ChatResponse};
+use crate::chat::{ChatListRequest, ChatListResponse, ChatRequest, ChatResponse};
 
-common_utils::impl_api_event_type!(Chat, (ChatRequest, ChatResponse));
+common_utils::impl_api_event_type!(
+    Chat,
+    (ChatRequest, ChatResponse, ChatListRequest, ChatListResponse)
+);
diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs
index 28508749f35..59ec5377690 100644
--- a/crates/common_utils/src/consts.rs
+++ b/crates/common_utils/src/consts.rs
@@ -197,3 +197,9 @@ pub const REQUEST_TIME_OUT: u64 = 30;
 
 /// API client request timeout for ai service (in seconds)
 pub const REQUEST_TIME_OUT_FOR_AI_SERVICE: u64 = 120;
+
+/// Default limit for list operations (can be used across different entities)
+pub const DEFAULT_LIST_LIMIT: i64 = 100;
+
+/// Default offset for list operations (can be used across different entities)
+pub const DEFAULT_LIST_OFFSET: i64 = 0;
diff --git a/crates/diesel_models/src/hyperswitch_ai_interaction.rs b/crates/diesel_models/src/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..a22bd288c19
--- /dev/null
+++ b/crates/diesel_models/src/hyperswitch_ai_interaction.rs
@@ -0,0 +1,49 @@
+use common_utils::encryption::Encryption;
+use diesel::{self, Identifiable, Insertable, Queryable, Selectable};
+use serde::{Deserialize, Serialize};
+use time::PrimitiveDateTime;
+
+use crate::schema::hyperswitch_ai_interaction;
+
+#[derive(
+    Clone,
+    Debug,
+    Deserialize,
+    Identifiable,
+    Queryable,
+    Selectable,
+    Serialize,
+    router_derive::DebugAsDisplay,
+)]
+#[diesel(table_name = hyperswitch_ai_interaction, primary_key(id, created_at), check_for_backend(diesel::pg::Pg))]
+pub struct HyperswitchAiInteraction {
+    pub id: String,
+    pub session_id: Option<String>,
+    pub user_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub profile_id: Option<String>,
+    pub org_id: Option<String>,
+    pub role_id: Option<String>,
+    pub user_query: Option<Encryption>,
+    pub response: Option<Encryption>,
+    pub database_query: Option<String>,
+    pub interaction_status: Option<String>,
+    pub created_at: PrimitiveDateTime,
+}
+
+#[derive(router_derive::Setter, Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
+#[diesel(table_name = hyperswitch_ai_interaction)]
+pub struct HyperswitchAiInteractionNew {
+    pub id: String,
+    pub session_id: Option<String>,
+    pub user_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub profile_id: Option<String>,
+    pub org_id: Option<String>,
+    pub role_id: Option<String>,
+    pub user_query: Option<Encryption>,
+    pub response: Option<Encryption>,
+    pub database_query: Option<String>,
+    pub interaction_status: Option<String>,
+    pub created_at: PrimitiveDateTime,
+}
diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs
index caf979b2c5f..b715134f926 100644
--- a/crates/diesel_models/src/lib.rs
+++ b/crates/diesel_models/src/lib.rs
@@ -23,6 +23,7 @@ pub mod file;
 pub mod fraud_check;
 pub mod generic_link;
 pub mod gsm;
+pub mod hyperswitch_ai_interaction;
 #[cfg(feature = "kv_store")]
 pub mod kv;
 pub mod locker_mock_up;
@@ -69,10 +70,11 @@ pub type StorageResult<T> = error_stack::Result<T, errors::DatabaseError>;
 pub type PgPooledConn = async_bb8_diesel::Connection<diesel::PgConnection>;
 pub use self::{
     address::*, api_keys::*, callback_mapper::*, cards_info::*, configs::*, customers::*,
-    dispute::*, ephemeral_key::*, events::*, file::*, generic_link::*, locker_mock_up::*,
-    mandate::*, merchant_account::*, merchant_connector_account::*, payment_attempt::*,
-    payment_intent::*, payment_method::*, payout_attempt::*, payouts::*, process_tracker::*,
-    refund::*, reverse_lookup::*, user_authentication_method::*,
+    dispute::*, ephemeral_key::*, events::*, file::*, generic_link::*,
+    hyperswitch_ai_interaction::*, locker_mock_up::*, mandate::*, merchant_account::*,
+    merchant_connector_account::*, payment_attempt::*, payment_intent::*, payment_method::*,
+    payout_attempt::*, payouts::*, process_tracker::*, refund::*, reverse_lookup::*,
+    user_authentication_method::*,
 };
 /// The types and implementations provided by this module are required for the schema generated by
 /// `diesel_cli` 2.0 to work with the types defined in Rust code. This is because
diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs
index 17eae2427e7..2dc6c18a1a1 100644
--- a/crates/diesel_models/src/query.rs
+++ b/crates/diesel_models/src/query.rs
@@ -21,6 +21,7 @@ pub mod fraud_check;
 pub mod generic_link;
 pub mod generics;
 pub mod gsm;
+pub mod hyperswitch_ai_interaction;
 pub mod locker_mock_up;
 pub mod mandate;
 pub mod merchant_account;
diff --git a/crates/diesel_models/src/query/hyperswitch_ai_interaction.rs b/crates/diesel_models/src/query/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..91db3ec468e
--- /dev/null
+++ b/crates/diesel_models/src/query/hyperswitch_ai_interaction.rs
@@ -0,0 +1,32 @@
+use diesel::{associations::HasTable, ExpressionMethods};
+
+use crate::{
+    hyperswitch_ai_interaction::{HyperswitchAiInteraction, HyperswitchAiInteractionNew},
+    query::generics,
+    schema::hyperswitch_ai_interaction::dsl,
+    PgPooledConn, StorageResult,
+};
+
+impl HyperswitchAiInteractionNew {
+    pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<HyperswitchAiInteraction> {
+        generics::generic_insert(conn, self).await
+    }
+}
+
+impl HyperswitchAiInteraction {
+    pub async fn filter_by_optional_merchant_id(
+        conn: &PgPooledConn,
+        merchant_id: Option<&common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> StorageResult<Vec<Self>> {
+        generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
+            conn,
+            dsl::merchant_id.eq(merchant_id.cloned()),
+            Some(limit),
+            Some(offset),
+            Some(dsl::created_at.desc()),
+        )
+        .await
+    }
+}
diff --git a/crates/diesel_models/src/query/utils.rs b/crates/diesel_models/src/query/utils.rs
index fe2f43d419b..96a41f10ca0 100644
--- a/crates/diesel_models/src/query/utils.rs
+++ b/crates/diesel_models/src/query/utils.rs
@@ -52,6 +52,12 @@ mod composite_key {
             self.0
         }
     }
+    impl CompositeKey for <schema::hyperswitch_ai_interaction::table as diesel::Table>::PrimaryKey {
+        type UK = schema::hyperswitch_ai_interaction::dsl::id;
+        fn get_local_unique_key(&self) -> Self::UK {
+            self.0
+        }
+    }
     impl CompositeKey for <schema_v2::incremental_authorization::table as diesel::Table>::PrimaryKey {
         type UK = schema_v2::incremental_authorization::dsl::authorization_id;
         fn get_local_unique_key(&self) -> Self::UK {
@@ -139,6 +145,7 @@ impl_get_primary_key_for_composite!(
     schema::customers::table,
     schema::blocklist::table,
     schema::incremental_authorization::table,
+    schema::hyperswitch_ai_interaction::table,
     schema_v2::incremental_authorization::table,
     schema_v2::blocklist::table
 );
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 79df62ac4b2..271d2a79ba0 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -632,6 +632,62 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction_default (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1667,6 +1723,8 @@ diesel::allow_tables_to_appear_in_same_query!(
     fraud_check,
     gateway_status_map,
     generic_link,
+    hyperswitch_ai_interaction,
+    hyperswitch_ai_interaction_default,
     incremental_authorization,
     locker_mock_up,
     mandate,
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index b2e674f34a5..4195475f88d 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -646,6 +646,62 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction_default (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1622,6 +1678,8 @@ diesel::allow_tables_to_appear_in_same_query!(
     fraud_check,
     gateway_status_map,
     generic_link,
+    hyperswitch_ai_interaction,
+    hyperswitch_ai_interaction_default,
     incremental_authorization,
     locker_mock_up,
     mandate,
diff --git a/crates/hyperswitch_domain_models/src/chat.rs b/crates/hyperswitch_domain_models/src/chat.rs
index 31b9f806db7..9243f535c07 100644
--- a/crates/hyperswitch_domain_models/src/chat.rs
+++ b/crates/hyperswitch_domain_models/src/chat.rs
@@ -12,4 +12,5 @@ pub struct HyperswitchAiDataRequest {
     pub profile_id: id_type::ProfileId,
     pub org_id: id_type::OrganizationId,
     pub query: GetDataMessage,
+    pub entity_type: common_enums::EntityType,
 }
diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index 3f85f8e2b3a..53ce32b033e 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -298,6 +298,29 @@ impl SecretsHandler for settings::UserAuthMethodSettings {
     }
 }
 
+#[async_trait::async_trait]
+impl SecretsHandler for settings::ChatSettings {
+    async fn convert_to_raw_secret(
+        value: SecretStateContainer<Self, SecuredSecret>,
+        secret_management_client: &dyn SecretManagementInterface,
+    ) -> CustomResult<SecretStateContainer<Self, RawSecret>, SecretsManagementError> {
+        let chat_settings = value.get_inner();
+
+        let encryption_key = if chat_settings.enabled {
+            secret_management_client
+                .get_secret(chat_settings.encryption_key.clone())
+                .await?
+        } else {
+            chat_settings.encryption_key.clone()
+        };
+
+        Ok(value.transition_state(|chat_settings| Self {
+            encryption_key,
+            ..chat_settings
+        }))
+    }
+}
+
 #[async_trait::async_trait]
 impl SecretsHandler for settings::NetworkTokenizationService {
     async fn convert_to_raw_secret(
@@ -450,9 +473,14 @@ pub(crate) async fn fetch_raw_secrets(
         })
         .await;
 
+    #[allow(clippy::expect_used)]
+    let chat = settings::ChatSettings::convert_to_raw_secret(conf.chat, secret_management_client)
+        .await
+        .expect("Failed to decrypt chat configs");
+
     Settings {
         server: conf.server,
-        chat: conf.chat,
+        chat,
         master_database,
         redis: conf.redis,
         log: conf.log,
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 84bc63ca799..1923af66b35 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -71,7 +71,7 @@ pub struct Settings<S: SecretState> {
     pub server: Server,
     pub proxy: Proxy,
     pub env: Env,
-    pub chat: ChatSettings,
+    pub chat: SecretStateContainer<ChatSettings, S>,
     pub master_database: SecretStateContainer<Database, S>,
     #[cfg(feature = "olap")]
     pub replica_database: SecretStateContainer<Database, S>,
@@ -207,6 +207,7 @@ pub struct Platform {
 pub struct ChatSettings {
     pub enabled: bool,
     pub hyperswitch_ai_host: String,
+    pub encryption_key: Secret<String>,
 }
 
 #[derive(Debug, Clone, Default, Deserialize)]
@@ -1048,8 +1049,7 @@ impl Settings<SecuredSecret> {
         self.secrets.get_inner().validate()?;
         self.locker.validate()?;
         self.connectors.validate("connectors")?;
-        self.chat.validate()?;
-
+        self.chat.get_inner().validate()?;
         self.cors.validate()?;
 
         self.scheduler
diff --git a/crates/router/src/core/chat.rs b/crates/router/src/core/chat.rs
index 837a259bed4..a690986a04a 100644
--- a/crates/router/src/core/chat.rs
+++ b/crates/router/src/core/chat.rs
@@ -1,18 +1,24 @@
 use api_models::chat as chat_api;
 use common_utils::{
     consts,
+    crypto::{DecodeMessage, GcmAes256},
     errors::CustomResult,
     request::{Method, RequestBuilder, RequestContent},
 };
 use error_stack::ResultExt;
 use external_services::http_client;
 use hyperswitch_domain_models::chat as chat_domain;
-use router_env::{instrument, logger, tracing};
+use masking::ExposeInterface;
+use router_env::{
+    instrument, logger,
+    tracing::{self, Instrument},
+};
 
 use crate::{
     db::errors::chat::ChatErrors,
     routes::{app::SessionStateInfo, SessionState},
-    services::{authentication as auth, ApplicationResponse},
+    services::{authentication as auth, authorization::roles, ApplicationResponse},
+    utils,
 };
 
 #[instrument(skip_all, fields(?session_id))]
@@ -22,15 +28,34 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
     req: chat_api::ChatRequest,
     session_id: Option<&str>,
 ) -> CustomResult<ApplicationResponse<chat_api::ChatResponse>, ChatErrors> {
-    let url = format!("{}/webhook", state.conf.chat.hyperswitch_ai_host);
-    let request_id = state.get_request_id();
+    let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id(
+        &state,
+        &user_from_token.role_id,
+        &user_from_token.org_id,
+        user_from_token
+            .tenant_id
+            .as_ref()
+            .unwrap_or(&state.tenant.tenant_id),
+    )
+    .await
+    .change_context(ChatErrors::InternalServerError)
+    .attach_printable("Failed to retrieve role information")?;
+    let url = format!(
+        "{}/webhook",
+        state.conf.chat.get_inner().hyperswitch_ai_host
+    );
+    let request_id = state
+        .get_request_id()
+        .unwrap_or_else(|| uuid::Uuid::new_v4().to_string());
+
     let request_body = chat_domain::HyperswitchAiDataRequest {
         query: chat_domain::GetDataMessage {
-            message: req.message,
+            message: req.message.clone(),
         },
-        org_id: user_from_token.org_id,
-        merchant_id: user_from_token.merchant_id,
-        profile_id: user_from_token.profile_id,
+        org_id: user_from_token.org_id.clone(),
+        merchant_id: user_from_token.merchant_id.clone(),
+        profile_id: user_from_token.profile_id.clone(),
+        entity_type: role_info.get_entity_type(),
     };
     logger::info!("Request for AI service: {:?}", request_body);
 
@@ -38,11 +63,9 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
         .method(Method::Post)
         .url(&url)
         .attach_default_headers()
+        .header(consts::X_REQUEST_ID, &request_id)
         .set_body(RequestContent::Json(Box::new(request_body.clone())));
 
-    if let Some(request_id) = request_id {
-        request_builder = request_builder.header(consts::X_REQUEST_ID, &request_id);
-    }
     if let Some(session_id) = session_id {
         request_builder = request_builder.header(consts::X_CHAT_SESSION_ID, session_id);
     }
@@ -57,10 +80,132 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
     .await
     .change_context(ChatErrors::InternalServerError)
     .attach_printable("Error when sending request to AI service")?
-    .json::<_>()
+    .json::<chat_api::ChatResponse>()
     .await
     .change_context(ChatErrors::InternalServerError)
     .attach_printable("Error when deserializing response from AI service")?;
 
-    Ok(ApplicationResponse::Json(response))
+    let response_to_return = response.clone();
+    tokio::spawn(
+        async move {
+            let new_hyperswitch_ai_interaction = utils::chat::construct_hyperswitch_ai_interaction(
+                &state,
+                &user_from_token,
+                &req,
+                &response,
+                &request_id,
+            )
+            .await;
+
+            match new_hyperswitch_ai_interaction {
+                Ok(interaction) => {
+                    let db = state.store.as_ref();
+                    if let Err(e) = db.insert_hyperswitch_ai_interaction(interaction).await {
+                        logger::error!("Failed to insert hyperswitch_ai_interaction: {:?}", e);
+                    }
+                }
+                Err(e) => {
+                    logger::error!("Failed to construct hyperswitch_ai_interaction: {:?}", e);
+                }
+            }
+        }
+        .in_current_span(),
+    );
+
+    Ok(ApplicationResponse::Json(response_to_return))
+}
+
+#[instrument(skip_all)]
+pub async fn list_chat_conversations(
+    state: SessionState,
+    user_from_token: auth::UserFromToken,
+    req: chat_api::ChatListRequest,
+) -> CustomResult<ApplicationResponse<chat_api::ChatListResponse>, ChatErrors> {
+    let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id(
+        &state,
+        &user_from_token.role_id,
+        &user_from_token.org_id,
+        user_from_token
+            .tenant_id
+            .as_ref()
+            .unwrap_or(&state.tenant.tenant_id),
+    )
+    .await
+    .change_context(ChatErrors::InternalServerError)
+    .attach_printable("Failed to retrieve role information")?;
+
+    if !role_info.is_internal() {
+        return Err(error_stack::Report::new(ChatErrors::UnauthorizedAccess)
+            .attach_printable("Only internal roles are allowed for this operation"));
+    }
+
+    let db = state.store.as_ref();
+    let hyperswitch_ai_interactions = db
+        .list_hyperswitch_ai_interactions(
+            req.merchant_id,
+            req.limit.unwrap_or(consts::DEFAULT_LIST_LIMIT),
+            req.offset.unwrap_or(consts::DEFAULT_LIST_OFFSET),
+        )
+        .await
+        .change_context(ChatErrors::InternalServerError)
+        .attach_printable("Error when fetching hyperswitch_ai_interactions")?;
+
+    let encryption_key = state.conf.chat.get_inner().encryption_key.clone().expose();
+    let key = match hex::decode(&encryption_key) {
+        Ok(key) => key,
+        Err(e) => {
+            router_env::logger::error!("Failed to decode encryption key: {}", e);
+            encryption_key.as_bytes().to_vec()
+        }
+    };
+
+    let mut conversations = Vec::new();
+
+    for interaction in hyperswitch_ai_interactions {
+        let user_query_encrypted = interaction
+            .user_query
+            .ok_or(ChatErrors::InternalServerError)
+            .attach_printable("Missing user_query field in hyperswitch_ai_interaction")?;
+        let response_encrypted = interaction
+            .response
+            .ok_or(ChatErrors::InternalServerError)
+            .attach_printable("Missing response field in hyperswitch_ai_interaction")?;
+
+        let user_query_decrypted_bytes = GcmAes256
+            .decode_message(&key, user_query_encrypted.into_inner())
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to decrypt user query")?;
+
+        let response_decrypted_bytes = GcmAes256
+            .decode_message(&key, response_encrypted.into_inner())
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to decrypt response")?;
+
+        let user_query_decrypted = String::from_utf8(user_query_decrypted_bytes)
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to convert decrypted user query to string")?;
+
+        let response_decrypted = serde_json::from_slice(&response_decrypted_bytes)
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to deserialize decrypted response")?;
+
+        conversations.push(chat_api::ChatConversation {
+            id: interaction.id,
+            session_id: interaction.session_id,
+            user_id: interaction.user_id,
+            merchant_id: interaction.merchant_id,
+            profile_id: interaction.profile_id,
+            org_id: interaction.org_id,
+            role_id: interaction.role_id,
+            user_query: user_query_decrypted.into(),
+            response: response_decrypted,
+            database_query: interaction.database_query,
+            interaction_status: interaction.interaction_status,
+            created_at: interaction.created_at,
+        });
+    }
+
+    return Ok(ApplicationResponse::Json(chat_api::ChatListResponse {
+        conversations,
+    }));
 }
diff --git a/crates/router/src/core/errors/chat.rs b/crates/router/src/core/errors/chat.rs
index a96afa67de8..d23f0e9bb77 100644
--- a/crates/router/src/core/errors/chat.rs
+++ b/crates/router/src/core/errors/chat.rs
@@ -6,6 +6,8 @@ pub enum ChatErrors {
     MissingConfigError,
     #[error("Chat response deserialization failed")]
     ChatResponseDeserializationFailed,
+    #[error("Unauthorized access")]
+    UnauthorizedAccess,
 }
 
 impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ChatErrors {
@@ -22,6 +24,9 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
             Self::ChatResponseDeserializationFailed => {
                 AER::BadRequest(ApiError::new(sub_code, 2, self.get_error_message(), None))
             }
+            Self::UnauthorizedAccess => {
+                AER::Unauthorized(ApiError::new(sub_code, 3, self.get_error_message(), None))
+            }
         }
     }
 }
@@ -32,6 +37,7 @@ impl ChatErrors {
             Self::InternalServerError => "Something went wrong".to_string(),
             Self::MissingConfigError => "Missing webhook url".to_string(),
             Self::ChatResponseDeserializationFailed => "Failed to parse chat response".to_string(),
+            Self::UnauthorizedAccess => "Not authorized to access the resource".to_string(),
         }
     }
 }
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index f675e316aef..ab3b7cba577 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -20,6 +20,7 @@ pub mod fraud_check;
 pub mod generic_link;
 pub mod gsm;
 pub mod health_check;
+pub mod hyperswitch_ai_interaction;
 pub mod kafka_store;
 pub mod locker_mock_up;
 pub mod mandate;
@@ -137,6 +138,7 @@ pub trait StorageInterface:
     + user::sample_data::BatchSampleDataInterface
     + health_check::HealthCheckDbInterface
     + user_authentication_method::UserAuthenticationMethodInterface
+    + hyperswitch_ai_interaction::HyperswitchAiInteractionInterface
     + authentication::AuthenticationInterface
     + generic_link::GenericLinkInterface
     + relay::RelayInterface
diff --git a/crates/router/src/db/hyperswitch_ai_interaction.rs b/crates/router/src/db/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..4ecf741a088
--- /dev/null
+++ b/crates/router/src/db/hyperswitch_ai_interaction.rs
@@ -0,0 +1,123 @@
+use diesel_models::hyperswitch_ai_interaction as storage;
+use error_stack::report;
+use router_env::{instrument, tracing};
+
+use super::MockDb;
+use crate::{
+    connection,
+    core::errors::{self, CustomResult},
+    services::Store,
+};
+
+#[async_trait::async_trait]
+pub trait HyperswitchAiInteractionInterface {
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError>;
+
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError>;
+}
+
+#[async_trait::async_trait]
+impl HyperswitchAiInteractionInterface for Store {
+    #[instrument(skip_all)]
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        hyperswitch_ai_interaction
+            .insert(&conn)
+            .await
+            .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    #[instrument(skip_all)]
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError> {
+        let conn = connection::pg_connection_read(self).await?;
+        storage::HyperswitchAiInteraction::filter_by_optional_merchant_id(
+            &conn,
+            merchant_id.as_ref(),
+            limit,
+            offset,
+        )
+        .await
+        .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+}
+
+#[async_trait::async_trait]
+impl HyperswitchAiInteractionInterface for MockDb {
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError> {
+        let mut hyperswitch_ai_interactions = self.hyperswitch_ai_interactions.lock().await;
+        let hyperswitch_ai_interaction = storage::HyperswitchAiInteraction {
+            id: hyperswitch_ai_interaction.id,
+            session_id: hyperswitch_ai_interaction.session_id,
+            user_id: hyperswitch_ai_interaction.user_id,
+            merchant_id: hyperswitch_ai_interaction.merchant_id,
+            profile_id: hyperswitch_ai_interaction.profile_id,
+            org_id: hyperswitch_ai_interaction.org_id,
+            role_id: hyperswitch_ai_interaction.role_id,
+            user_query: hyperswitch_ai_interaction.user_query,
+            response: hyperswitch_ai_interaction.response,
+            database_query: hyperswitch_ai_interaction.database_query,
+            interaction_status: hyperswitch_ai_interaction.interaction_status,
+            created_at: hyperswitch_ai_interaction.created_at,
+        };
+        hyperswitch_ai_interactions.push(hyperswitch_ai_interaction.clone());
+        Ok(hyperswitch_ai_interaction)
+    }
+
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError> {
+        let hyperswitch_ai_interactions = self.hyperswitch_ai_interactions.lock().await;
+
+        let offset_usize = offset.try_into().unwrap_or_else(|_| {
+            common_utils::consts::DEFAULT_LIST_OFFSET
+                .try_into()
+                .unwrap_or(usize::MIN)
+        });
+
+        let limit_usize = limit.try_into().unwrap_or_else(|_| {
+            common_utils::consts::DEFAULT_LIST_LIMIT
+                .try_into()
+                .unwrap_or(usize::MAX)
+        });
+
+        let filtered_interactions: Vec<storage::HyperswitchAiInteraction> =
+            hyperswitch_ai_interactions
+                .iter()
+                .filter(
+                    |interaction| match (merchant_id.as_ref(), &interaction.merchant_id) {
+                        (Some(merchant_id), Some(interaction_merchant_id)) => {
+                            interaction_merchant_id == &merchant_id.get_string_repr().to_owned()
+                        }
+                        (None, _) => true,
+                        _ => false,
+                    },
+                )
+                .skip(offset_usize)
+                .take(limit_usize)
+                .cloned()
+                .collect();
+        Ok(filtered_interactions)
+    }
+}
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 9eaef17b9c5..68ef8d19619 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -43,6 +43,7 @@ use time::PrimitiveDateTime;
 use super::{
     dashboard_metadata::DashboardMetadataInterface,
     ephemeral_key::ClientSecretInterface,
+    hyperswitch_ai_interaction::HyperswitchAiInteractionInterface,
     role::RoleInterface,
     user::{sample_data::BatchSampleDataInterface, theme::ThemeInterface, UserInterface},
     user_authentication_method::UserAuthenticationMethodInterface,
@@ -4127,6 +4128,29 @@ impl UserAuthenticationMethodInterface for KafkaStore {
     }
 }
 
+#[async_trait::async_trait]
+impl HyperswitchAiInteractionInterface for KafkaStore {
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError> {
+        self.diesel_store
+            .insert_hyperswitch_ai_interaction(hyperswitch_ai_interaction)
+            .await
+    }
+
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError> {
+        self.diesel_store
+            .list_hyperswitch_ai_interactions(merchant_id, limit, offset)
+            .await
+    }
+}
+
 #[async_trait::async_trait]
 impl ThemeInterface for KafkaStore {
     async fn insert_theme(
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index ef3f8081b9a..f12730d7b63 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2343,12 +2343,16 @@ pub struct Chat;
 impl Chat {
     pub fn server(state: AppState) -> Scope {
         let mut route = web::scope("/chat").app_data(web::Data::new(state.clone()));
-        if state.conf.chat.enabled {
+        if state.conf.chat.get_inner().enabled {
             route = route.service(
-                web::scope("/ai").service(
-                    web::resource("/data")
-                        .route(web::post().to(chat::get_data_from_hyperswitch_ai_workflow)),
-                ),
+                web::scope("/ai")
+                    .service(
+                        web::resource("/data")
+                            .route(web::post().to(chat::get_data_from_hyperswitch_ai_workflow)),
+                    )
+                    .service(
+                        web::resource("/list").route(web::get().to(chat::get_all_conversations)),
+                    ),
             );
         }
         route
diff --git a/crates/router/src/routes/chat.rs b/crates/router/src/routes/chat.rs
index e3970cc6a4c..f670bb8e166 100644
--- a/crates/router/src/routes/chat.rs
+++ b/crates/router/src/routes/chat.rs
@@ -45,3 +45,24 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
     ))
     .await
 }
+
+#[instrument(skip_all)]
+pub async fn get_all_conversations(
+    state: web::Data<AppState>,
+    http_req: HttpRequest,
+    payload: web::Query<chat_api::ChatListRequest>,
+) -> HttpResponse {
+    let flow = Flow::ListAllChatInteractions;
+    Box::pin(api::server_wrap(
+        flow.clone(),
+        state,
+        &http_req,
+        payload.into_inner(),
+        |state, user: auth::UserFromToken, payload, _| {
+            chat_core::list_chat_conversations(state, user, payload)
+        },
+        &auth::DashboardNoPermissionAuth,
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 0c42909b457..c3efb561b42 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -315,7 +315,7 @@ impl From<Flow> for ApiIdentifier {
             | Flow::ListAllThemesInLineage
             | Flow::CloneConnector => Self::User,
 
-            Flow::GetDataFromHyperswitchAiFlow => Self::AiWorkflow,
+            Flow::GetDataFromHyperswitchAiFlow | Flow::ListAllChatInteractions => Self::AiWorkflow,
 
             Flow::ListRolesV2
             | Flow::ListInvitableRolesAtEntityLevel
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 5d4c4a8bb29..e9c26dd30c2 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -21,6 +21,7 @@ pub mod file;
 pub mod fraud_check;
 pub mod generic_link;
 pub mod gsm;
+pub mod hyperswitch_ai_interaction;
 #[cfg(feature = "kv_store")]
 pub mod kv;
 pub mod locker_mock_up;
@@ -75,8 +76,9 @@ pub use self::{
     blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, callback_mapper::*,
     capture::*, cards_info::*, configs::*, customers::*, dashboard_metadata::*, dispute::*,
     dynamic_routing_stats::*, ephemeral_key::*, events::*, file::*, fraud_check::*,
-    generic_link::*, gsm::*, locker_mock_up::*, mandate::*, merchant_account::*,
-    merchant_connector_account::*, merchant_key_store::*, payment_link::*, payment_method::*,
-    process_tracker::*, refund::*, reverse_lookup::*, role::*, routing_algorithm::*,
-    subscription::*, unified_translations::*, user::*, user_authentication_method::*, user_role::*,
+    generic_link::*, gsm::*, hyperswitch_ai_interaction::*, locker_mock_up::*, mandate::*,
+    merchant_account::*, merchant_connector_account::*, merchant_key_store::*, payment_link::*,
+    payment_method::*, process_tracker::*, refund::*, reverse_lookup::*, role::*,
+    routing_algorithm::*, subscription::*, unified_translations::*, user::*,
+    user_authentication_method::*, user_role::*,
 };
diff --git a/crates/router/src/types/storage/hyperswitch_ai_interaction.rs b/crates/router/src/types/storage/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..30ba3efb49d
--- /dev/null
+++ b/crates/router/src/types/storage/hyperswitch_ai_interaction.rs
@@ -0,0 +1 @@
+pub use diesel_models::hyperswitch_ai_interaction::*;
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index e2acbc4db23..71f1ed404b2 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -1,3 +1,4 @@
+pub mod chat;
 #[cfg(feature = "olap")]
 pub mod connector_onboarding;
 pub mod currency;
diff --git a/crates/router/src/utils/chat.rs b/crates/router/src/utils/chat.rs
new file mode 100644
index 00000000000..c32b6190a95
--- /dev/null
+++ b/crates/router/src/utils/chat.rs
@@ -0,0 +1,70 @@
+use api_models::chat as chat_api;
+use common_utils::{type_name, types::keymanager::Identifier};
+use diesel_models::hyperswitch_ai_interaction::{
+    HyperswitchAiInteraction, HyperswitchAiInteractionNew,
+};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation};
+use masking::ExposeInterface;
+
+use crate::{
+    core::errors::{self, CustomResult},
+    routes::SessionState,
+    services::authentication as auth,
+};
+
+pub async fn construct_hyperswitch_ai_interaction(
+    state: &SessionState,
+    user_from_token: &auth::UserFromToken,
+    req: &chat_api::ChatRequest,
+    response: &chat_api::ChatResponse,
+    request_id: &str,
+) -> CustomResult<HyperswitchAiInteractionNew, errors::ApiErrorResponse> {
+    let encryption_key = state.conf.chat.get_inner().encryption_key.clone().expose();
+    let key = match hex::decode(&encryption_key) {
+        Ok(key) => key,
+        Err(e) => {
+            router_env::logger::error!("Failed to decode encryption key: {}", e);
+            // Fallback to using the string as bytes, which was the previous behavior
+            encryption_key.as_bytes().to_vec()
+        }
+    };
+    let encrypted_user_query = crypto_operation::<String, masking::WithType>(
+        &state.into(),
+        type_name!(HyperswitchAiInteraction),
+        CryptoOperation::Encrypt(req.message.clone()),
+        Identifier::Merchant(user_from_token.merchant_id.clone()),
+        &key,
+    )
+    .await
+    .and_then(|val| val.try_into_operation())
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed to encrypt user query")?;
+
+    let encrypted_response = crypto_operation::<serde_json::Value, masking::WithType>(
+        &state.into(),
+        type_name!(HyperswitchAiInteraction),
+        CryptoOperation::Encrypt(response.response.clone()),
+        Identifier::Merchant(user_from_token.merchant_id.clone()),
+        &key,
+    )
+    .await
+    .and_then(|val| val.try_into_operation())
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed to encrypt response")?;
+
+    Ok(HyperswitchAiInteractionNew {
+        id: request_id.to_owned(),
+        session_id: Some(request_id.to_string()),
+        user_id: Some(user_from_token.user_id.clone()),
+        merchant_id: Some(user_from_token.merchant_id.get_string_repr().to_string()),
+        profile_id: Some(user_from_token.profile_id.get_string_repr().to_string()),
+        org_id: Some(user_from_token.org_id.get_string_repr().to_string()),
+        role_id: Some(user_from_token.role_id.clone()),
+        user_query: Some(encrypted_user_query.into()),
+        response: Some(encrypted_response.into()),
+        database_query: response.query_executed.clone().map(|q| q.expose()),
+        interaction_status: Some(response.status.clone()),
+        created_at: common_utils::date_time::now(),
+    })
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index ae5f34fd78f..2345469a4e1 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -357,6 +357,8 @@ pub enum Flow {
     GsmRuleDelete,
     /// Get data from embedded flow
     GetDataFromHyperswitchAiFlow,
+    // List all chat interactions
+    ListAllChatInteractions,
     /// User Sign Up
     UserSignUp,
     /// User Sign Up
diff --git a/crates/storage_impl/src/mock_db.rs b/crates/storage_impl/src/mock_db.rs
index 884d9747943..b3fc53fb8cf 100644
--- a/crates/storage_impl/src/mock_db.rs
+++ b/crates/storage_impl/src/mock_db.rs
@@ -65,6 +65,8 @@ pub struct MockDb {
     pub user_authentication_methods:
         Arc<Mutex<Vec<store::user_authentication_method::UserAuthenticationMethod>>>,
     pub themes: Arc<Mutex<Vec<store::user::theme::Theme>>>,
+    pub hyperswitch_ai_interactions:
+        Arc<Mutex<Vec<store::hyperswitch_ai_interaction::HyperswitchAiInteraction>>>,
 }
 
 impl MockDb {
@@ -113,6 +115,7 @@ impl MockDb {
             user_key_store: Default::default(),
             user_authentication_methods: Default::default(),
             themes: Default::default(),
+            hyperswitch_ai_interactions: Default::default(),
         })
     }
 
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 7508208069d..d85f5251c39 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -829,8 +829,7 @@ billing_connectors_which_requires_invoice_sync_call = "recurly"
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
-
-
+encryption_key = ""
 
 [revenue_recovery.card_config.amex]
 max_retries_per_day = 20
@@ -846,4 +845,4 @@ max_retry_count_for_thirty_day = 20
 
 [revenue_recovery.card_config.discover]
 max_retries_per_day = 20
-max_retry_count_for_thirty_day = 20
\ No newline at end of file
+max_retry_count_for_thirty_day = 20
diff --git a/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/down.sql b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/down.sql
new file mode 100644
index 00000000000..8cd51507c46
--- /dev/null
+++ b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+-- CASCADE will automatically drop all child partitions
+DROP TABLE IF EXISTS hyperswitch_ai_interaction CASCADE;
diff --git a/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/up.sql b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/up.sql
new file mode 100644
index 00000000000..e67da66d139
--- /dev/null
+++ b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/up.sql
@@ -0,0 +1,21 @@
+-- Your SQL goes here
+CREATE TABLE hyperswitch_ai_interaction (
+    id VARCHAR(64) NOT NULL,
+    session_id VARCHAR(64),
+    user_id VARCHAR(64),
+    merchant_id VARCHAR(64),
+    profile_id VARCHAR(64),
+    org_id VARCHAR(64),
+    role_id VARCHAR(64),
+    user_query BYTEA,
+    response BYTEA,
+    database_query TEXT,
+    interaction_status VARCHAR(64),
+    created_at TIMESTAMP NOT NULL,
+    PRIMARY KEY (id, created_at)
+) PARTITION BY RANGE (created_at);
+
+-- Create a default partition
+CREATE TABLE hyperswitch_ai_interaction_default
+    PARTITION OF hyperswitch_ai_interaction DEFAULT;
+
 | 
	2025-08-04T07:06:02Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Store the user query and response from the ai service for the analysis.
- Allow the api only for internal user
### Additional Changes
This pull request introduces support for encrypted chat conversations and adds database models and APIs for storing and retrieving chat interactions. The changes span configuration, API models, database schema, and core logic to enable secure chat storage and querying, with proper secret management for encryption keys.
**Chat encryption and configuration:**
* Added `encryption_key` to `[chat]` sections in all config files and updated `ChatSettings` to use a secret for the encryption key, with secret management integration for secure handling.
**Chat API model extensions:**
* Added new API models for listing chat conversations (`ChatListRequest`, `ChatConversation`, `ChatListResponse`)
**Database schema and models for chat interactions:**
* Introduced `hyperswitch_ai_interaction` table and corresponding Rust models for storing encrypted chat queries and 
**Core chat logic improvements:**
* Enhanced chat workflow to fetch role information, set entity type, and use the decrypted chat encryption key for secure communication with the AI service. 
**Run this as part of migration**
 1.Manual Partition creation for next two year.
 2.Creates partitions for each 3-month range
 3.Add calendar event to re run this after two year. 
```
DO $$
DECLARE
    start_date date;
    end_date date;
    i int;
    partition_name text;
BEGIN
    -- Get start date as the beginning of the current quarter
    start_date := date_trunc('quarter', current_date)::date;
    -- Create 8 quarterly partitions (2 years)
    FOR i IN 1..8 LOOP
        end_date := (start_date + interval '3 month')::date;
        partition_name := format(
            'hyperswitch_ai_interaction_%s_q%s',
            to_char(start_date, 'YYYY'),
            extract(quarter from start_date)
        );
        EXECUTE format(
            'CREATE TABLE IF NOT EXISTS %I PARTITION OF hyperswitch_ai_interaction
             FOR VALUES FROM (%L) TO (%L)',
            partition_name, start_date, end_date
        );
        start_date := end_date;
    END LOOP;
END$$;
```
**General enhancements and constants:**
* Added default limit and offset constants for list operations, improving pagination support for chat conversation queries.
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Closes #8847 
## How did you test it?
Hitting AI service, should store information in DB
```
curl --location 'http://localhost:8080/chat/ai/data' \
--header 'x-feature: integ-custom' \
--header 'x-chat-session-id: chat-dop' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
        "message": "total count of payments"
    
}'
```
Can check hyperswitch AI interaction table for it.
Internal roles can see the list of interactions for the given merchant id
List
```
curl --location 'http://localhost:8080/chat/ai/list?merchant_id=merchant_id' \
--header 'Authorization: Bearer JWT' \
--data ''
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	d6e925fd348af9b69bd3a756cd21142eeccd180a | 
	Hitting AI service, should store information in DB
```
curl --location 'http://localhost:8080/chat/ai/data' \
--header 'x-feature: integ-custom' \
--header 'x-chat-session-id: chat-dop' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
        "message": "total count of payments"
    
}'
```
Can check hyperswitch AI interaction table for it.
Internal roles can see the list of interactions for the given merchant id
List
```
curl --location 'http://localhost:8080/chat/ai/list?merchant_id=merchant_id' \
--header 'Authorization: Bearer JWT' \
--data ''
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8847 | 
	Bug: feat: Add schema to store chat request response
- add schema for chat, to store request and response
- store chats to chat schema asynchronously
- encrypt the sensitive data
- have endpoint to list the chat data and decrypt it properly
 | 
	diff --git a/config/config.example.toml b/config/config.example.toml
index b725be102c1..134e0a49e84 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1257,6 +1257,7 @@ allow_connected_merchants = false # Enable or disable connected merchant account
 [chat]
 enabled = false                                # Enable or disable chat features
 hyperswitch_ai_host = "http://0.0.0.0:8000"    # Hyperswitch ai workflow host
+encryption_key = ""                            # Key to encrypt and decrypt chats
 
 [proxy_status_mapping]
 proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index bfba035c1f3..fe8b09cd7db 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -419,6 +419,7 @@ max_random_schedule_delay_in_seconds = 300 # max random delay in seconds to sche
 [chat]
 enabled = false                                # Enable or disable chat features
 hyperswitch_ai_host = "http://0.0.0.0:8000"    # Hyperswitch ai workflow host
+encryption_key = ""                            # Key to encrypt and decrypt chats
 
 [proxy_status_mapping]
 proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/development.toml b/config/development.toml
index 940e43b50ca..e4cbe3af226 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1368,6 +1368,7 @@ version = "HOSTNAME"
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
+encryption_key = ""
 
 [proxy_status_mapping]
 proxy_connector_http_status_code = false    # If enabled, the http status code of the connector will be proxied in the response
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index d299323f2c1..62f6830832c 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1226,6 +1226,7 @@ allow_connected_merchants = true
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
+encryption_key = ""
 
 [authentication_providers]
 click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
diff --git a/crates/api_models/src/chat.rs b/crates/api_models/src/chat.rs
index c66b42cc4f4..975197fd3fc 100644
--- a/crates/api_models/src/chat.rs
+++ b/crates/api_models/src/chat.rs
@@ -1,12 +1,13 @@
 use common_utils::id_type;
 use masking::Secret;
+use time::PrimitiveDateTime;
 
 #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
 pub struct ChatRequest {
     pub message: Secret<String>,
 }
 
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
 pub struct ChatResponse {
     pub response: Secret<serde_json::Value>,
     pub merchant_id: id_type::MerchantId,
@@ -16,3 +17,32 @@ pub struct ChatResponse {
     #[serde(skip_serializing)]
     pub row_count: Option<i32>,
 }
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ChatListRequest {
+    pub merchant_id: Option<id_type::MerchantId>,
+    pub limit: Option<i64>,
+    pub offset: Option<i64>,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ChatConversation {
+    pub id: String,
+    pub session_id: Option<String>,
+    pub user_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub profile_id: Option<String>,
+    pub org_id: Option<String>,
+    pub role_id: Option<String>,
+    pub user_query: Secret<String>,
+    pub response: Secret<serde_json::Value>,
+    pub database_query: Option<String>,
+    pub interaction_status: Option<String>,
+    #[serde(with = "common_utils::custom_serde::iso8601")]
+    pub created_at: PrimitiveDateTime,
+}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct ChatListResponse {
+    pub conversations: Vec<ChatConversation>,
+}
diff --git a/crates/api_models/src/events/chat.rs b/crates/api_models/src/events/chat.rs
index 42fefe487e9..38f20b0c3bb 100644
--- a/crates/api_models/src/events/chat.rs
+++ b/crates/api_models/src/events/chat.rs
@@ -1,5 +1,8 @@
 use common_utils::events::{ApiEventMetric, ApiEventsType};
 
-use crate::chat::{ChatRequest, ChatResponse};
+use crate::chat::{ChatListRequest, ChatListResponse, ChatRequest, ChatResponse};
 
-common_utils::impl_api_event_type!(Chat, (ChatRequest, ChatResponse));
+common_utils::impl_api_event_type!(
+    Chat,
+    (ChatRequest, ChatResponse, ChatListRequest, ChatListResponse)
+);
diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs
index 28508749f35..59ec5377690 100644
--- a/crates/common_utils/src/consts.rs
+++ b/crates/common_utils/src/consts.rs
@@ -197,3 +197,9 @@ pub const REQUEST_TIME_OUT: u64 = 30;
 
 /// API client request timeout for ai service (in seconds)
 pub const REQUEST_TIME_OUT_FOR_AI_SERVICE: u64 = 120;
+
+/// Default limit for list operations (can be used across different entities)
+pub const DEFAULT_LIST_LIMIT: i64 = 100;
+
+/// Default offset for list operations (can be used across different entities)
+pub const DEFAULT_LIST_OFFSET: i64 = 0;
diff --git a/crates/diesel_models/src/hyperswitch_ai_interaction.rs b/crates/diesel_models/src/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..a22bd288c19
--- /dev/null
+++ b/crates/diesel_models/src/hyperswitch_ai_interaction.rs
@@ -0,0 +1,49 @@
+use common_utils::encryption::Encryption;
+use diesel::{self, Identifiable, Insertable, Queryable, Selectable};
+use serde::{Deserialize, Serialize};
+use time::PrimitiveDateTime;
+
+use crate::schema::hyperswitch_ai_interaction;
+
+#[derive(
+    Clone,
+    Debug,
+    Deserialize,
+    Identifiable,
+    Queryable,
+    Selectable,
+    Serialize,
+    router_derive::DebugAsDisplay,
+)]
+#[diesel(table_name = hyperswitch_ai_interaction, primary_key(id, created_at), check_for_backend(diesel::pg::Pg))]
+pub struct HyperswitchAiInteraction {
+    pub id: String,
+    pub session_id: Option<String>,
+    pub user_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub profile_id: Option<String>,
+    pub org_id: Option<String>,
+    pub role_id: Option<String>,
+    pub user_query: Option<Encryption>,
+    pub response: Option<Encryption>,
+    pub database_query: Option<String>,
+    pub interaction_status: Option<String>,
+    pub created_at: PrimitiveDateTime,
+}
+
+#[derive(router_derive::Setter, Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
+#[diesel(table_name = hyperswitch_ai_interaction)]
+pub struct HyperswitchAiInteractionNew {
+    pub id: String,
+    pub session_id: Option<String>,
+    pub user_id: Option<String>,
+    pub merchant_id: Option<String>,
+    pub profile_id: Option<String>,
+    pub org_id: Option<String>,
+    pub role_id: Option<String>,
+    pub user_query: Option<Encryption>,
+    pub response: Option<Encryption>,
+    pub database_query: Option<String>,
+    pub interaction_status: Option<String>,
+    pub created_at: PrimitiveDateTime,
+}
diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs
index caf979b2c5f..b715134f926 100644
--- a/crates/diesel_models/src/lib.rs
+++ b/crates/diesel_models/src/lib.rs
@@ -23,6 +23,7 @@ pub mod file;
 pub mod fraud_check;
 pub mod generic_link;
 pub mod gsm;
+pub mod hyperswitch_ai_interaction;
 #[cfg(feature = "kv_store")]
 pub mod kv;
 pub mod locker_mock_up;
@@ -69,10 +70,11 @@ pub type StorageResult<T> = error_stack::Result<T, errors::DatabaseError>;
 pub type PgPooledConn = async_bb8_diesel::Connection<diesel::PgConnection>;
 pub use self::{
     address::*, api_keys::*, callback_mapper::*, cards_info::*, configs::*, customers::*,
-    dispute::*, ephemeral_key::*, events::*, file::*, generic_link::*, locker_mock_up::*,
-    mandate::*, merchant_account::*, merchant_connector_account::*, payment_attempt::*,
-    payment_intent::*, payment_method::*, payout_attempt::*, payouts::*, process_tracker::*,
-    refund::*, reverse_lookup::*, user_authentication_method::*,
+    dispute::*, ephemeral_key::*, events::*, file::*, generic_link::*,
+    hyperswitch_ai_interaction::*, locker_mock_up::*, mandate::*, merchant_account::*,
+    merchant_connector_account::*, payment_attempt::*, payment_intent::*, payment_method::*,
+    payout_attempt::*, payouts::*, process_tracker::*, refund::*, reverse_lookup::*,
+    user_authentication_method::*,
 };
 /// The types and implementations provided by this module are required for the schema generated by
 /// `diesel_cli` 2.0 to work with the types defined in Rust code. This is because
diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs
index 17eae2427e7..2dc6c18a1a1 100644
--- a/crates/diesel_models/src/query.rs
+++ b/crates/diesel_models/src/query.rs
@@ -21,6 +21,7 @@ pub mod fraud_check;
 pub mod generic_link;
 pub mod generics;
 pub mod gsm;
+pub mod hyperswitch_ai_interaction;
 pub mod locker_mock_up;
 pub mod mandate;
 pub mod merchant_account;
diff --git a/crates/diesel_models/src/query/hyperswitch_ai_interaction.rs b/crates/diesel_models/src/query/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..91db3ec468e
--- /dev/null
+++ b/crates/diesel_models/src/query/hyperswitch_ai_interaction.rs
@@ -0,0 +1,32 @@
+use diesel::{associations::HasTable, ExpressionMethods};
+
+use crate::{
+    hyperswitch_ai_interaction::{HyperswitchAiInteraction, HyperswitchAiInteractionNew},
+    query::generics,
+    schema::hyperswitch_ai_interaction::dsl,
+    PgPooledConn, StorageResult,
+};
+
+impl HyperswitchAiInteractionNew {
+    pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<HyperswitchAiInteraction> {
+        generics::generic_insert(conn, self).await
+    }
+}
+
+impl HyperswitchAiInteraction {
+    pub async fn filter_by_optional_merchant_id(
+        conn: &PgPooledConn,
+        merchant_id: Option<&common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> StorageResult<Vec<Self>> {
+        generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
+            conn,
+            dsl::merchant_id.eq(merchant_id.cloned()),
+            Some(limit),
+            Some(offset),
+            Some(dsl::created_at.desc()),
+        )
+        .await
+    }
+}
diff --git a/crates/diesel_models/src/query/utils.rs b/crates/diesel_models/src/query/utils.rs
index fe2f43d419b..96a41f10ca0 100644
--- a/crates/diesel_models/src/query/utils.rs
+++ b/crates/diesel_models/src/query/utils.rs
@@ -52,6 +52,12 @@ mod composite_key {
             self.0
         }
     }
+    impl CompositeKey for <schema::hyperswitch_ai_interaction::table as diesel::Table>::PrimaryKey {
+        type UK = schema::hyperswitch_ai_interaction::dsl::id;
+        fn get_local_unique_key(&self) -> Self::UK {
+            self.0
+        }
+    }
     impl CompositeKey for <schema_v2::incremental_authorization::table as diesel::Table>::PrimaryKey {
         type UK = schema_v2::incremental_authorization::dsl::authorization_id;
         fn get_local_unique_key(&self) -> Self::UK {
@@ -139,6 +145,7 @@ impl_get_primary_key_for_composite!(
     schema::customers::table,
     schema::blocklist::table,
     schema::incremental_authorization::table,
+    schema::hyperswitch_ai_interaction::table,
     schema_v2::incremental_authorization::table,
     schema_v2::blocklist::table
 );
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 79df62ac4b2..271d2a79ba0 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -632,6 +632,62 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction_default (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1667,6 +1723,8 @@ diesel::allow_tables_to_appear_in_same_query!(
     fraud_check,
     gateway_status_map,
     generic_link,
+    hyperswitch_ai_interaction,
+    hyperswitch_ai_interaction_default,
     incremental_authorization,
     locker_mock_up,
     mandate,
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index b2e674f34a5..4195475f88d 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -646,6 +646,62 @@ diesel::table! {
     }
 }
 
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
+diesel::table! {
+    use diesel::sql_types::*;
+    use crate::enums::diesel_exports::*;
+
+    hyperswitch_ai_interaction_default (id, created_at) {
+        #[max_length = 64]
+        id -> Varchar,
+        #[max_length = 64]
+        session_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        user_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        merchant_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        profile_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        org_id -> Nullable<Varchar>,
+        #[max_length = 64]
+        role_id -> Nullable<Varchar>,
+        user_query -> Nullable<Bytea>,
+        response -> Nullable<Bytea>,
+        database_query -> Nullable<Text>,
+        #[max_length = 64]
+        interaction_status -> Nullable<Varchar>,
+        created_at -> Timestamp,
+    }
+}
+
 diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
@@ -1622,6 +1678,8 @@ diesel::allow_tables_to_appear_in_same_query!(
     fraud_check,
     gateway_status_map,
     generic_link,
+    hyperswitch_ai_interaction,
+    hyperswitch_ai_interaction_default,
     incremental_authorization,
     locker_mock_up,
     mandate,
diff --git a/crates/hyperswitch_domain_models/src/chat.rs b/crates/hyperswitch_domain_models/src/chat.rs
index 31b9f806db7..9243f535c07 100644
--- a/crates/hyperswitch_domain_models/src/chat.rs
+++ b/crates/hyperswitch_domain_models/src/chat.rs
@@ -12,4 +12,5 @@ pub struct HyperswitchAiDataRequest {
     pub profile_id: id_type::ProfileId,
     pub org_id: id_type::OrganizationId,
     pub query: GetDataMessage,
+    pub entity_type: common_enums::EntityType,
 }
diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index 3f85f8e2b3a..53ce32b033e 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -298,6 +298,29 @@ impl SecretsHandler for settings::UserAuthMethodSettings {
     }
 }
 
+#[async_trait::async_trait]
+impl SecretsHandler for settings::ChatSettings {
+    async fn convert_to_raw_secret(
+        value: SecretStateContainer<Self, SecuredSecret>,
+        secret_management_client: &dyn SecretManagementInterface,
+    ) -> CustomResult<SecretStateContainer<Self, RawSecret>, SecretsManagementError> {
+        let chat_settings = value.get_inner();
+
+        let encryption_key = if chat_settings.enabled {
+            secret_management_client
+                .get_secret(chat_settings.encryption_key.clone())
+                .await?
+        } else {
+            chat_settings.encryption_key.clone()
+        };
+
+        Ok(value.transition_state(|chat_settings| Self {
+            encryption_key,
+            ..chat_settings
+        }))
+    }
+}
+
 #[async_trait::async_trait]
 impl SecretsHandler for settings::NetworkTokenizationService {
     async fn convert_to_raw_secret(
@@ -450,9 +473,14 @@ pub(crate) async fn fetch_raw_secrets(
         })
         .await;
 
+    #[allow(clippy::expect_used)]
+    let chat = settings::ChatSettings::convert_to_raw_secret(conf.chat, secret_management_client)
+        .await
+        .expect("Failed to decrypt chat configs");
+
     Settings {
         server: conf.server,
-        chat: conf.chat,
+        chat,
         master_database,
         redis: conf.redis,
         log: conf.log,
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 84bc63ca799..1923af66b35 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -71,7 +71,7 @@ pub struct Settings<S: SecretState> {
     pub server: Server,
     pub proxy: Proxy,
     pub env: Env,
-    pub chat: ChatSettings,
+    pub chat: SecretStateContainer<ChatSettings, S>,
     pub master_database: SecretStateContainer<Database, S>,
     #[cfg(feature = "olap")]
     pub replica_database: SecretStateContainer<Database, S>,
@@ -207,6 +207,7 @@ pub struct Platform {
 pub struct ChatSettings {
     pub enabled: bool,
     pub hyperswitch_ai_host: String,
+    pub encryption_key: Secret<String>,
 }
 
 #[derive(Debug, Clone, Default, Deserialize)]
@@ -1048,8 +1049,7 @@ impl Settings<SecuredSecret> {
         self.secrets.get_inner().validate()?;
         self.locker.validate()?;
         self.connectors.validate("connectors")?;
-        self.chat.validate()?;
-
+        self.chat.get_inner().validate()?;
         self.cors.validate()?;
 
         self.scheduler
diff --git a/crates/router/src/core/chat.rs b/crates/router/src/core/chat.rs
index 837a259bed4..a690986a04a 100644
--- a/crates/router/src/core/chat.rs
+++ b/crates/router/src/core/chat.rs
@@ -1,18 +1,24 @@
 use api_models::chat as chat_api;
 use common_utils::{
     consts,
+    crypto::{DecodeMessage, GcmAes256},
     errors::CustomResult,
     request::{Method, RequestBuilder, RequestContent},
 };
 use error_stack::ResultExt;
 use external_services::http_client;
 use hyperswitch_domain_models::chat as chat_domain;
-use router_env::{instrument, logger, tracing};
+use masking::ExposeInterface;
+use router_env::{
+    instrument, logger,
+    tracing::{self, Instrument},
+};
 
 use crate::{
     db::errors::chat::ChatErrors,
     routes::{app::SessionStateInfo, SessionState},
-    services::{authentication as auth, ApplicationResponse},
+    services::{authentication as auth, authorization::roles, ApplicationResponse},
+    utils,
 };
 
 #[instrument(skip_all, fields(?session_id))]
@@ -22,15 +28,34 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
     req: chat_api::ChatRequest,
     session_id: Option<&str>,
 ) -> CustomResult<ApplicationResponse<chat_api::ChatResponse>, ChatErrors> {
-    let url = format!("{}/webhook", state.conf.chat.hyperswitch_ai_host);
-    let request_id = state.get_request_id();
+    let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id(
+        &state,
+        &user_from_token.role_id,
+        &user_from_token.org_id,
+        user_from_token
+            .tenant_id
+            .as_ref()
+            .unwrap_or(&state.tenant.tenant_id),
+    )
+    .await
+    .change_context(ChatErrors::InternalServerError)
+    .attach_printable("Failed to retrieve role information")?;
+    let url = format!(
+        "{}/webhook",
+        state.conf.chat.get_inner().hyperswitch_ai_host
+    );
+    let request_id = state
+        .get_request_id()
+        .unwrap_or_else(|| uuid::Uuid::new_v4().to_string());
+
     let request_body = chat_domain::HyperswitchAiDataRequest {
         query: chat_domain::GetDataMessage {
-            message: req.message,
+            message: req.message.clone(),
         },
-        org_id: user_from_token.org_id,
-        merchant_id: user_from_token.merchant_id,
-        profile_id: user_from_token.profile_id,
+        org_id: user_from_token.org_id.clone(),
+        merchant_id: user_from_token.merchant_id.clone(),
+        profile_id: user_from_token.profile_id.clone(),
+        entity_type: role_info.get_entity_type(),
     };
     logger::info!("Request for AI service: {:?}", request_body);
 
@@ -38,11 +63,9 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
         .method(Method::Post)
         .url(&url)
         .attach_default_headers()
+        .header(consts::X_REQUEST_ID, &request_id)
         .set_body(RequestContent::Json(Box::new(request_body.clone())));
 
-    if let Some(request_id) = request_id {
-        request_builder = request_builder.header(consts::X_REQUEST_ID, &request_id);
-    }
     if let Some(session_id) = session_id {
         request_builder = request_builder.header(consts::X_CHAT_SESSION_ID, session_id);
     }
@@ -57,10 +80,132 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
     .await
     .change_context(ChatErrors::InternalServerError)
     .attach_printable("Error when sending request to AI service")?
-    .json::<_>()
+    .json::<chat_api::ChatResponse>()
     .await
     .change_context(ChatErrors::InternalServerError)
     .attach_printable("Error when deserializing response from AI service")?;
 
-    Ok(ApplicationResponse::Json(response))
+    let response_to_return = response.clone();
+    tokio::spawn(
+        async move {
+            let new_hyperswitch_ai_interaction = utils::chat::construct_hyperswitch_ai_interaction(
+                &state,
+                &user_from_token,
+                &req,
+                &response,
+                &request_id,
+            )
+            .await;
+
+            match new_hyperswitch_ai_interaction {
+                Ok(interaction) => {
+                    let db = state.store.as_ref();
+                    if let Err(e) = db.insert_hyperswitch_ai_interaction(interaction).await {
+                        logger::error!("Failed to insert hyperswitch_ai_interaction: {:?}", e);
+                    }
+                }
+                Err(e) => {
+                    logger::error!("Failed to construct hyperswitch_ai_interaction: {:?}", e);
+                }
+            }
+        }
+        .in_current_span(),
+    );
+
+    Ok(ApplicationResponse::Json(response_to_return))
+}
+
+#[instrument(skip_all)]
+pub async fn list_chat_conversations(
+    state: SessionState,
+    user_from_token: auth::UserFromToken,
+    req: chat_api::ChatListRequest,
+) -> CustomResult<ApplicationResponse<chat_api::ChatListResponse>, ChatErrors> {
+    let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id(
+        &state,
+        &user_from_token.role_id,
+        &user_from_token.org_id,
+        user_from_token
+            .tenant_id
+            .as_ref()
+            .unwrap_or(&state.tenant.tenant_id),
+    )
+    .await
+    .change_context(ChatErrors::InternalServerError)
+    .attach_printable("Failed to retrieve role information")?;
+
+    if !role_info.is_internal() {
+        return Err(error_stack::Report::new(ChatErrors::UnauthorizedAccess)
+            .attach_printable("Only internal roles are allowed for this operation"));
+    }
+
+    let db = state.store.as_ref();
+    let hyperswitch_ai_interactions = db
+        .list_hyperswitch_ai_interactions(
+            req.merchant_id,
+            req.limit.unwrap_or(consts::DEFAULT_LIST_LIMIT),
+            req.offset.unwrap_or(consts::DEFAULT_LIST_OFFSET),
+        )
+        .await
+        .change_context(ChatErrors::InternalServerError)
+        .attach_printable("Error when fetching hyperswitch_ai_interactions")?;
+
+    let encryption_key = state.conf.chat.get_inner().encryption_key.clone().expose();
+    let key = match hex::decode(&encryption_key) {
+        Ok(key) => key,
+        Err(e) => {
+            router_env::logger::error!("Failed to decode encryption key: {}", e);
+            encryption_key.as_bytes().to_vec()
+        }
+    };
+
+    let mut conversations = Vec::new();
+
+    for interaction in hyperswitch_ai_interactions {
+        let user_query_encrypted = interaction
+            .user_query
+            .ok_or(ChatErrors::InternalServerError)
+            .attach_printable("Missing user_query field in hyperswitch_ai_interaction")?;
+        let response_encrypted = interaction
+            .response
+            .ok_or(ChatErrors::InternalServerError)
+            .attach_printable("Missing response field in hyperswitch_ai_interaction")?;
+
+        let user_query_decrypted_bytes = GcmAes256
+            .decode_message(&key, user_query_encrypted.into_inner())
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to decrypt user query")?;
+
+        let response_decrypted_bytes = GcmAes256
+            .decode_message(&key, response_encrypted.into_inner())
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to decrypt response")?;
+
+        let user_query_decrypted = String::from_utf8(user_query_decrypted_bytes)
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to convert decrypted user query to string")?;
+
+        let response_decrypted = serde_json::from_slice(&response_decrypted_bytes)
+            .change_context(ChatErrors::InternalServerError)
+            .attach_printable("Failed to deserialize decrypted response")?;
+
+        conversations.push(chat_api::ChatConversation {
+            id: interaction.id,
+            session_id: interaction.session_id,
+            user_id: interaction.user_id,
+            merchant_id: interaction.merchant_id,
+            profile_id: interaction.profile_id,
+            org_id: interaction.org_id,
+            role_id: interaction.role_id,
+            user_query: user_query_decrypted.into(),
+            response: response_decrypted,
+            database_query: interaction.database_query,
+            interaction_status: interaction.interaction_status,
+            created_at: interaction.created_at,
+        });
+    }
+
+    return Ok(ApplicationResponse::Json(chat_api::ChatListResponse {
+        conversations,
+    }));
 }
diff --git a/crates/router/src/core/errors/chat.rs b/crates/router/src/core/errors/chat.rs
index a96afa67de8..d23f0e9bb77 100644
--- a/crates/router/src/core/errors/chat.rs
+++ b/crates/router/src/core/errors/chat.rs
@@ -6,6 +6,8 @@ pub enum ChatErrors {
     MissingConfigError,
     #[error("Chat response deserialization failed")]
     ChatResponseDeserializationFailed,
+    #[error("Unauthorized access")]
+    UnauthorizedAccess,
 }
 
 impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ChatErrors {
@@ -22,6 +24,9 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
             Self::ChatResponseDeserializationFailed => {
                 AER::BadRequest(ApiError::new(sub_code, 2, self.get_error_message(), None))
             }
+            Self::UnauthorizedAccess => {
+                AER::Unauthorized(ApiError::new(sub_code, 3, self.get_error_message(), None))
+            }
         }
     }
 }
@@ -32,6 +37,7 @@ impl ChatErrors {
             Self::InternalServerError => "Something went wrong".to_string(),
             Self::MissingConfigError => "Missing webhook url".to_string(),
             Self::ChatResponseDeserializationFailed => "Failed to parse chat response".to_string(),
+            Self::UnauthorizedAccess => "Not authorized to access the resource".to_string(),
         }
     }
 }
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index f675e316aef..ab3b7cba577 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -20,6 +20,7 @@ pub mod fraud_check;
 pub mod generic_link;
 pub mod gsm;
 pub mod health_check;
+pub mod hyperswitch_ai_interaction;
 pub mod kafka_store;
 pub mod locker_mock_up;
 pub mod mandate;
@@ -137,6 +138,7 @@ pub trait StorageInterface:
     + user::sample_data::BatchSampleDataInterface
     + health_check::HealthCheckDbInterface
     + user_authentication_method::UserAuthenticationMethodInterface
+    + hyperswitch_ai_interaction::HyperswitchAiInteractionInterface
     + authentication::AuthenticationInterface
     + generic_link::GenericLinkInterface
     + relay::RelayInterface
diff --git a/crates/router/src/db/hyperswitch_ai_interaction.rs b/crates/router/src/db/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..4ecf741a088
--- /dev/null
+++ b/crates/router/src/db/hyperswitch_ai_interaction.rs
@@ -0,0 +1,123 @@
+use diesel_models::hyperswitch_ai_interaction as storage;
+use error_stack::report;
+use router_env::{instrument, tracing};
+
+use super::MockDb;
+use crate::{
+    connection,
+    core::errors::{self, CustomResult},
+    services::Store,
+};
+
+#[async_trait::async_trait]
+pub trait HyperswitchAiInteractionInterface {
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError>;
+
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError>;
+}
+
+#[async_trait::async_trait]
+impl HyperswitchAiInteractionInterface for Store {
+    #[instrument(skip_all)]
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError> {
+        let conn = connection::pg_connection_write(self).await?;
+        hyperswitch_ai_interaction
+            .insert(&conn)
+            .await
+            .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+
+    #[instrument(skip_all)]
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError> {
+        let conn = connection::pg_connection_read(self).await?;
+        storage::HyperswitchAiInteraction::filter_by_optional_merchant_id(
+            &conn,
+            merchant_id.as_ref(),
+            limit,
+            offset,
+        )
+        .await
+        .map_err(|error| report!(errors::StorageError::from(error)))
+    }
+}
+
+#[async_trait::async_trait]
+impl HyperswitchAiInteractionInterface for MockDb {
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError> {
+        let mut hyperswitch_ai_interactions = self.hyperswitch_ai_interactions.lock().await;
+        let hyperswitch_ai_interaction = storage::HyperswitchAiInteraction {
+            id: hyperswitch_ai_interaction.id,
+            session_id: hyperswitch_ai_interaction.session_id,
+            user_id: hyperswitch_ai_interaction.user_id,
+            merchant_id: hyperswitch_ai_interaction.merchant_id,
+            profile_id: hyperswitch_ai_interaction.profile_id,
+            org_id: hyperswitch_ai_interaction.org_id,
+            role_id: hyperswitch_ai_interaction.role_id,
+            user_query: hyperswitch_ai_interaction.user_query,
+            response: hyperswitch_ai_interaction.response,
+            database_query: hyperswitch_ai_interaction.database_query,
+            interaction_status: hyperswitch_ai_interaction.interaction_status,
+            created_at: hyperswitch_ai_interaction.created_at,
+        };
+        hyperswitch_ai_interactions.push(hyperswitch_ai_interaction.clone());
+        Ok(hyperswitch_ai_interaction)
+    }
+
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<common_utils::id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError> {
+        let hyperswitch_ai_interactions = self.hyperswitch_ai_interactions.lock().await;
+
+        let offset_usize = offset.try_into().unwrap_or_else(|_| {
+            common_utils::consts::DEFAULT_LIST_OFFSET
+                .try_into()
+                .unwrap_or(usize::MIN)
+        });
+
+        let limit_usize = limit.try_into().unwrap_or_else(|_| {
+            common_utils::consts::DEFAULT_LIST_LIMIT
+                .try_into()
+                .unwrap_or(usize::MAX)
+        });
+
+        let filtered_interactions: Vec<storage::HyperswitchAiInteraction> =
+            hyperswitch_ai_interactions
+                .iter()
+                .filter(
+                    |interaction| match (merchant_id.as_ref(), &interaction.merchant_id) {
+                        (Some(merchant_id), Some(interaction_merchant_id)) => {
+                            interaction_merchant_id == &merchant_id.get_string_repr().to_owned()
+                        }
+                        (None, _) => true,
+                        _ => false,
+                    },
+                )
+                .skip(offset_usize)
+                .take(limit_usize)
+                .cloned()
+                .collect();
+        Ok(filtered_interactions)
+    }
+}
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 9eaef17b9c5..68ef8d19619 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -43,6 +43,7 @@ use time::PrimitiveDateTime;
 use super::{
     dashboard_metadata::DashboardMetadataInterface,
     ephemeral_key::ClientSecretInterface,
+    hyperswitch_ai_interaction::HyperswitchAiInteractionInterface,
     role::RoleInterface,
     user::{sample_data::BatchSampleDataInterface, theme::ThemeInterface, UserInterface},
     user_authentication_method::UserAuthenticationMethodInterface,
@@ -4127,6 +4128,29 @@ impl UserAuthenticationMethodInterface for KafkaStore {
     }
 }
 
+#[async_trait::async_trait]
+impl HyperswitchAiInteractionInterface for KafkaStore {
+    async fn insert_hyperswitch_ai_interaction(
+        &self,
+        hyperswitch_ai_interaction: storage::HyperswitchAiInteractionNew,
+    ) -> CustomResult<storage::HyperswitchAiInteraction, errors::StorageError> {
+        self.diesel_store
+            .insert_hyperswitch_ai_interaction(hyperswitch_ai_interaction)
+            .await
+    }
+
+    async fn list_hyperswitch_ai_interactions(
+        &self,
+        merchant_id: Option<id_type::MerchantId>,
+        limit: i64,
+        offset: i64,
+    ) -> CustomResult<Vec<storage::HyperswitchAiInteraction>, errors::StorageError> {
+        self.diesel_store
+            .list_hyperswitch_ai_interactions(merchant_id, limit, offset)
+            .await
+    }
+}
+
 #[async_trait::async_trait]
 impl ThemeInterface for KafkaStore {
     async fn insert_theme(
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index ef3f8081b9a..f12730d7b63 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2343,12 +2343,16 @@ pub struct Chat;
 impl Chat {
     pub fn server(state: AppState) -> Scope {
         let mut route = web::scope("/chat").app_data(web::Data::new(state.clone()));
-        if state.conf.chat.enabled {
+        if state.conf.chat.get_inner().enabled {
             route = route.service(
-                web::scope("/ai").service(
-                    web::resource("/data")
-                        .route(web::post().to(chat::get_data_from_hyperswitch_ai_workflow)),
-                ),
+                web::scope("/ai")
+                    .service(
+                        web::resource("/data")
+                            .route(web::post().to(chat::get_data_from_hyperswitch_ai_workflow)),
+                    )
+                    .service(
+                        web::resource("/list").route(web::get().to(chat::get_all_conversations)),
+                    ),
             );
         }
         route
diff --git a/crates/router/src/routes/chat.rs b/crates/router/src/routes/chat.rs
index e3970cc6a4c..f670bb8e166 100644
--- a/crates/router/src/routes/chat.rs
+++ b/crates/router/src/routes/chat.rs
@@ -45,3 +45,24 @@ pub async fn get_data_from_hyperswitch_ai_workflow(
     ))
     .await
 }
+
+#[instrument(skip_all)]
+pub async fn get_all_conversations(
+    state: web::Data<AppState>,
+    http_req: HttpRequest,
+    payload: web::Query<chat_api::ChatListRequest>,
+) -> HttpResponse {
+    let flow = Flow::ListAllChatInteractions;
+    Box::pin(api::server_wrap(
+        flow.clone(),
+        state,
+        &http_req,
+        payload.into_inner(),
+        |state, user: auth::UserFromToken, payload, _| {
+            chat_core::list_chat_conversations(state, user, payload)
+        },
+        &auth::DashboardNoPermissionAuth,
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 0c42909b457..c3efb561b42 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -315,7 +315,7 @@ impl From<Flow> for ApiIdentifier {
             | Flow::ListAllThemesInLineage
             | Flow::CloneConnector => Self::User,
 
-            Flow::GetDataFromHyperswitchAiFlow => Self::AiWorkflow,
+            Flow::GetDataFromHyperswitchAiFlow | Flow::ListAllChatInteractions => Self::AiWorkflow,
 
             Flow::ListRolesV2
             | Flow::ListInvitableRolesAtEntityLevel
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index 5d4c4a8bb29..e9c26dd30c2 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -21,6 +21,7 @@ pub mod file;
 pub mod fraud_check;
 pub mod generic_link;
 pub mod gsm;
+pub mod hyperswitch_ai_interaction;
 #[cfg(feature = "kv_store")]
 pub mod kv;
 pub mod locker_mock_up;
@@ -75,8 +76,9 @@ pub use self::{
     blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, callback_mapper::*,
     capture::*, cards_info::*, configs::*, customers::*, dashboard_metadata::*, dispute::*,
     dynamic_routing_stats::*, ephemeral_key::*, events::*, file::*, fraud_check::*,
-    generic_link::*, gsm::*, locker_mock_up::*, mandate::*, merchant_account::*,
-    merchant_connector_account::*, merchant_key_store::*, payment_link::*, payment_method::*,
-    process_tracker::*, refund::*, reverse_lookup::*, role::*, routing_algorithm::*,
-    subscription::*, unified_translations::*, user::*, user_authentication_method::*, user_role::*,
+    generic_link::*, gsm::*, hyperswitch_ai_interaction::*, locker_mock_up::*, mandate::*,
+    merchant_account::*, merchant_connector_account::*, merchant_key_store::*, payment_link::*,
+    payment_method::*, process_tracker::*, refund::*, reverse_lookup::*, role::*,
+    routing_algorithm::*, subscription::*, unified_translations::*, user::*,
+    user_authentication_method::*, user_role::*,
 };
diff --git a/crates/router/src/types/storage/hyperswitch_ai_interaction.rs b/crates/router/src/types/storage/hyperswitch_ai_interaction.rs
new file mode 100644
index 00000000000..30ba3efb49d
--- /dev/null
+++ b/crates/router/src/types/storage/hyperswitch_ai_interaction.rs
@@ -0,0 +1 @@
+pub use diesel_models::hyperswitch_ai_interaction::*;
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index e2acbc4db23..71f1ed404b2 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -1,3 +1,4 @@
+pub mod chat;
 #[cfg(feature = "olap")]
 pub mod connector_onboarding;
 pub mod currency;
diff --git a/crates/router/src/utils/chat.rs b/crates/router/src/utils/chat.rs
new file mode 100644
index 00000000000..c32b6190a95
--- /dev/null
+++ b/crates/router/src/utils/chat.rs
@@ -0,0 +1,70 @@
+use api_models::chat as chat_api;
+use common_utils::{type_name, types::keymanager::Identifier};
+use diesel_models::hyperswitch_ai_interaction::{
+    HyperswitchAiInteraction, HyperswitchAiInteractionNew,
+};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation};
+use masking::ExposeInterface;
+
+use crate::{
+    core::errors::{self, CustomResult},
+    routes::SessionState,
+    services::authentication as auth,
+};
+
+pub async fn construct_hyperswitch_ai_interaction(
+    state: &SessionState,
+    user_from_token: &auth::UserFromToken,
+    req: &chat_api::ChatRequest,
+    response: &chat_api::ChatResponse,
+    request_id: &str,
+) -> CustomResult<HyperswitchAiInteractionNew, errors::ApiErrorResponse> {
+    let encryption_key = state.conf.chat.get_inner().encryption_key.clone().expose();
+    let key = match hex::decode(&encryption_key) {
+        Ok(key) => key,
+        Err(e) => {
+            router_env::logger::error!("Failed to decode encryption key: {}", e);
+            // Fallback to using the string as bytes, which was the previous behavior
+            encryption_key.as_bytes().to_vec()
+        }
+    };
+    let encrypted_user_query = crypto_operation::<String, masking::WithType>(
+        &state.into(),
+        type_name!(HyperswitchAiInteraction),
+        CryptoOperation::Encrypt(req.message.clone()),
+        Identifier::Merchant(user_from_token.merchant_id.clone()),
+        &key,
+    )
+    .await
+    .and_then(|val| val.try_into_operation())
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed to encrypt user query")?;
+
+    let encrypted_response = crypto_operation::<serde_json::Value, masking::WithType>(
+        &state.into(),
+        type_name!(HyperswitchAiInteraction),
+        CryptoOperation::Encrypt(response.response.clone()),
+        Identifier::Merchant(user_from_token.merchant_id.clone()),
+        &key,
+    )
+    .await
+    .and_then(|val| val.try_into_operation())
+    .change_context(errors::ApiErrorResponse::InternalServerError)
+    .attach_printable("Failed to encrypt response")?;
+
+    Ok(HyperswitchAiInteractionNew {
+        id: request_id.to_owned(),
+        session_id: Some(request_id.to_string()),
+        user_id: Some(user_from_token.user_id.clone()),
+        merchant_id: Some(user_from_token.merchant_id.get_string_repr().to_string()),
+        profile_id: Some(user_from_token.profile_id.get_string_repr().to_string()),
+        org_id: Some(user_from_token.org_id.get_string_repr().to_string()),
+        role_id: Some(user_from_token.role_id.clone()),
+        user_query: Some(encrypted_user_query.into()),
+        response: Some(encrypted_response.into()),
+        database_query: response.query_executed.clone().map(|q| q.expose()),
+        interaction_status: Some(response.status.clone()),
+        created_at: common_utils::date_time::now(),
+    })
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index ae5f34fd78f..2345469a4e1 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -357,6 +357,8 @@ pub enum Flow {
     GsmRuleDelete,
     /// Get data from embedded flow
     GetDataFromHyperswitchAiFlow,
+    // List all chat interactions
+    ListAllChatInteractions,
     /// User Sign Up
     UserSignUp,
     /// User Sign Up
diff --git a/crates/storage_impl/src/mock_db.rs b/crates/storage_impl/src/mock_db.rs
index 884d9747943..b3fc53fb8cf 100644
--- a/crates/storage_impl/src/mock_db.rs
+++ b/crates/storage_impl/src/mock_db.rs
@@ -65,6 +65,8 @@ pub struct MockDb {
     pub user_authentication_methods:
         Arc<Mutex<Vec<store::user_authentication_method::UserAuthenticationMethod>>>,
     pub themes: Arc<Mutex<Vec<store::user::theme::Theme>>>,
+    pub hyperswitch_ai_interactions:
+        Arc<Mutex<Vec<store::hyperswitch_ai_interaction::HyperswitchAiInteraction>>>,
 }
 
 impl MockDb {
@@ -113,6 +115,7 @@ impl MockDb {
             user_key_store: Default::default(),
             user_authentication_methods: Default::default(),
             themes: Default::default(),
+            hyperswitch_ai_interactions: Default::default(),
         })
     }
 
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 7508208069d..d85f5251c39 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -829,8 +829,7 @@ billing_connectors_which_requires_invoice_sync_call = "recurly"
 [chat]
 enabled = false
 hyperswitch_ai_host = "http://0.0.0.0:8000"
-
-
+encryption_key = ""
 
 [revenue_recovery.card_config.amex]
 max_retries_per_day = 20
@@ -846,4 +845,4 @@ max_retry_count_for_thirty_day = 20
 
 [revenue_recovery.card_config.discover]
 max_retries_per_day = 20
-max_retry_count_for_thirty_day = 20
\ No newline at end of file
+max_retry_count_for_thirty_day = 20
diff --git a/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/down.sql b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/down.sql
new file mode 100644
index 00000000000..8cd51507c46
--- /dev/null
+++ b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+-- CASCADE will automatically drop all child partitions
+DROP TABLE IF EXISTS hyperswitch_ai_interaction CASCADE;
diff --git a/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/up.sql b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/up.sql
new file mode 100644
index 00000000000..e67da66d139
--- /dev/null
+++ b/migrations/2025-07-21-120614_add_table_for_hyperswitch_ai_interactions/up.sql
@@ -0,0 +1,21 @@
+-- Your SQL goes here
+CREATE TABLE hyperswitch_ai_interaction (
+    id VARCHAR(64) NOT NULL,
+    session_id VARCHAR(64),
+    user_id VARCHAR(64),
+    merchant_id VARCHAR(64),
+    profile_id VARCHAR(64),
+    org_id VARCHAR(64),
+    role_id VARCHAR(64),
+    user_query BYTEA,
+    response BYTEA,
+    database_query TEXT,
+    interaction_status VARCHAR(64),
+    created_at TIMESTAMP NOT NULL,
+    PRIMARY KEY (id, created_at)
+) PARTITION BY RANGE (created_at);
+
+-- Create a default partition
+CREATE TABLE hyperswitch_ai_interaction_default
+    PARTITION OF hyperswitch_ai_interaction DEFAULT;
+
 | 
	2025-08-04T07:06:02Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Store the user query and response from the ai service for the analysis.
- Allow the api only for internal user
### Additional Changes
This pull request introduces support for encrypted chat conversations and adds database models and APIs for storing and retrieving chat interactions. The changes span configuration, API models, database schema, and core logic to enable secure chat storage and querying, with proper secret management for encryption keys.
**Chat encryption and configuration:**
* Added `encryption_key` to `[chat]` sections in all config files and updated `ChatSettings` to use a secret for the encryption key, with secret management integration for secure handling.
**Chat API model extensions:**
* Added new API models for listing chat conversations (`ChatListRequest`, `ChatConversation`, `ChatListResponse`)
**Database schema and models for chat interactions:**
* Introduced `hyperswitch_ai_interaction` table and corresponding Rust models for storing encrypted chat queries and 
**Core chat logic improvements:**
* Enhanced chat workflow to fetch role information, set entity type, and use the decrypted chat encryption key for secure communication with the AI service. 
**Run this as part of migration**
 1.Manual Partition creation for next two year.
 2.Creates partitions for each 3-month range
 3.Add calendar event to re run this after two year. 
```
DO $$
DECLARE
    start_date date;
    end_date date;
    i int;
    partition_name text;
BEGIN
    -- Get start date as the beginning of the current quarter
    start_date := date_trunc('quarter', current_date)::date;
    -- Create 8 quarterly partitions (2 years)
    FOR i IN 1..8 LOOP
        end_date := (start_date + interval '3 month')::date;
        partition_name := format(
            'hyperswitch_ai_interaction_%s_q%s',
            to_char(start_date, 'YYYY'),
            extract(quarter from start_date)
        );
        EXECUTE format(
            'CREATE TABLE IF NOT EXISTS %I PARTITION OF hyperswitch_ai_interaction
             FOR VALUES FROM (%L) TO (%L)',
            partition_name, start_date, end_date
        );
        start_date := end_date;
    END LOOP;
END$$;
```
**General enhancements and constants:**
* Added default limit and offset constants for list operations, improving pagination support for chat conversation queries.
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
Closes #8847 
## How did you test it?
Hitting AI service, should store information in DB
```
curl --location 'http://localhost:8080/chat/ai/data' \
--header 'x-feature: integ-custom' \
--header 'x-chat-session-id: chat-dop' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
        "message": "total count of payments"
    
}'
```
Can check hyperswitch AI interaction table for it.
Internal roles can see the list of interactions for the given merchant id
List
```
curl --location 'http://localhost:8080/chat/ai/list?merchant_id=merchant_id' \
--header 'Authorization: Bearer JWT' \
--data ''
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	d6e925fd348af9b69bd3a756cd21142eeccd180a | 
	Hitting AI service, should store information in DB
```
curl --location 'http://localhost:8080/chat/ai/data' \
--header 'x-feature: integ-custom' \
--header 'x-chat-session-id: chat-dop' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
        "message": "total count of payments"
    
}'
```
Can check hyperswitch AI interaction table for it.
Internal roles can see the list of interactions for the given merchant id
List
```
curl --location 'http://localhost:8080/chat/ai/list?merchant_id=merchant_id' \
--header 'Authorization: Bearer JWT' \
--data ''
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8811 | 
	Bug: [BUG] recurring payouts fail when address is needed
### Bug Description
Recurring payouts are failing when billing details are not supplied during payout creation.
### Expected Behavior
Billing details should be fetched from DB while making recurring payouts.
### Actual Behavior
Billing details are not stored / fetched in payment_methods while making recurring payouts.
### Steps To Reproduce
1. Create a payout using raw details
2. Retrieve the `payout_method_id`
3. Process a payout using `payout_method_id` without billing details
Should throw an error saying billing details are mandatory.
```json
{
    "error": {
        "type": "invalid_request",
        "message": "Missing required param: billing.address",
        "code": "IR_04"
    }
}
```
### Context For The Bug
_No response_
### Environment
/ -
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index c7784118847..e4ce038b3bd 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -175,7 +175,8 @@ pub fn make_dsl_input_for_payouts(
         billing_country: payout_data
             .billing_address
             .as_ref()
-            .and_then(|bic| bic.country)
+            .and_then(|ba| ba.address.as_ref())
+            .and_then(|addr| addr.country)
             .map(api_enums::Country::from_alpha2),
         business_label: payout_data.payout_attempt.business_label.clone(),
         setup_future_usage: None,
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 300fca52939..491957045c7 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -29,7 +29,7 @@ use diesel_models::{
 use error_stack::{report, ResultExt};
 #[cfg(feature = "olap")]
 use futures::future::join_all;
-use hyperswitch_domain_models::payment_methods::PaymentMethod;
+use hyperswitch_domain_models::{self as domain_models, payment_methods::PaymentMethod};
 use masking::{PeekInterface, Secret};
 #[cfg(feature = "payout_retry")]
 use retry::GsmValidation;
@@ -66,7 +66,7 @@ use crate::{
 // ********************************************** TYPES **********************************************
 #[derive(Clone)]
 pub struct PayoutData {
-    pub billing_address: Option<domain::Address>,
+    pub billing_address: Option<domain_models::address::Address>,
     pub business_profile: domain::Profile,
     pub customer_details: Option<domain::Customer>,
     pub merchant_connector_account: Option<payment_helpers::MerchantConnectorAccountType>,
@@ -812,7 +812,7 @@ pub async fn payouts_list_core(
                     })
                     .ok()
                     .as_ref()
-                    .map(hyperswitch_domain_models::address::Address::from)
+                    .map(domain_models::address::Address::from)
                     .map(payment_enums::Address::from)
                 });
 
@@ -2537,10 +2537,7 @@ pub async fn response_handler(
     let billing_address = payout_data.billing_address.to_owned();
     let customer_details = payout_data.customer_details.to_owned();
     let customer_id = payouts.customer_id;
-    let billing = billing_address
-        .as_ref()
-        .map(hyperswitch_domain_models::address::Address::from)
-        .map(From::from);
+    let billing = billing_address.map(From::from);
 
     let translated_unified_message = helpers::get_translated_unified_code_and_message(
         state,
@@ -2672,29 +2669,17 @@ pub async fn payout_create_db_entries(
         _ => None,
     };
 
-    // We have to do this because the function that is being used to create / get address is from payments
-    // which expects a payment_id
-    let payout_id_as_payment_id_type = id_type::PaymentId::try_from(std::borrow::Cow::Owned(
-        payout_id.get_string_repr().to_string(),
-    ))
-    .change_context(errors::ApiErrorResponse::InvalidRequestData {
-        message: "payout_id contains invalid data".to_string(),
-    })
-    .attach_printable("Error converting payout_id to PaymentId type")?;
-
-    // Get or create address
-    let billing_address = payment_helpers::create_or_find_address_for_payment_by_request(
+    // Get or create billing address
+    let (billing_address, address_id) = helpers::resolve_billing_address_for_payout(
         state,
         req.billing.as_ref(),
         None,
-        merchant_id,
+        payment_method.as_ref(),
+        merchant_context,
         customer_id.as_ref(),
-        merchant_context.get_merchant_key_store(),
-        &payout_id_as_payment_id_type,
-        merchant_context.get_merchant_account().storage_scheme,
+        payout_id,
     )
     .await?;
-    let address_id = billing_address.to_owned().map(|address| address.address_id);
 
     // Make payouts entry
     let currency = req.currency.to_owned().get_required_value("currency")?;
@@ -2931,7 +2916,8 @@ pub async fn make_payout_data(
         &payout_id_as_payment_id_type,
         merchant_context.get_merchant_account().storage_scheme,
     )
-    .await?;
+    .await?
+    .map(|addr| domain_models::address::Address::from(&addr));
 
     let payout_id = &payouts.payout_id;
 
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 8f104451be5..c80a089e5d4 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -4,7 +4,7 @@ use common_utils::{
     crypto::Encryptable,
     encryption::Encryption,
     errors::CustomResult,
-    ext_traits::{AsyncExt, StringExt},
+    ext_traits::{AsyncExt, StringExt, ValueExt},
     fp_utils, id_type, payout_method_utils as payout_additional, pii, type_name,
     types::{
         keymanager::{Identifier, KeyManagerState},
@@ -605,6 +605,22 @@ pub async fn save_payout_data_to_locker(
             )
         };
 
+    let payment_method_billing_address = payout_data
+        .billing_address
+        .clone()
+        .async_map(|billing_addr| async {
+            cards::create_encrypted_data(
+                &key_manager_state,
+                merchant_context.get_merchant_key_store(),
+                billing_addr,
+            )
+            .await
+        })
+        .await
+        .transpose()
+        .change_context(errors::ApiErrorResponse::InternalServerError)
+        .attach_printable("Unable to encrypt billing address")?;
+
     // Insert new entry in payment_methods table
     if should_insert_in_pm_table {
         let payment_method_id = common_utils::generate_id(consts::ID_LENGTH, "pm");
@@ -625,7 +641,7 @@ pub async fn save_payout_data_to_locker(
                 connector_mandate_details,
                 None,
                 None,
-                None,
+                payment_method_billing_address,
                 None,
                 None,
                 None,
@@ -1268,37 +1284,19 @@ pub async fn update_payouts_and_payout_attempt(
         payout_data.payouts.customer_id.clone()
     };
 
-    // We have to do this because the function that is being used to create / get address is from payments
-    // which expects a payment_id
-    let payout_id_as_payment_id_type = id_type::PaymentId::try_from(std::borrow::Cow::Owned(
-        payout_id.get_string_repr().to_string(),
-    ))
-    .change_context(errors::ApiErrorResponse::InvalidRequestData {
-        message: "payout_id contains invalid data for PaymentId conversion".to_string(),
-    })
-    .attach_printable("Error converting payout_id to PaymentId type")?;
-
-    // Fetch address details from request and create new or else use existing address that was attached
-    let billing_address = payment_helpers::create_or_find_address_for_payment_by_request(
+    let (billing_address, address_id) = resolve_billing_address_for_payout(
         state,
         req.billing.as_ref(),
-        None,
-        merchant_context.get_merchant_account().get_id(),
+        payout_data.payouts.address_id.as_ref(),
+        payout_data.payment_method.as_ref(),
+        merchant_context,
         customer_id.as_ref(),
-        merchant_context.get_merchant_key_store(),
-        &payout_id_as_payment_id_type,
-        merchant_context.get_merchant_account().storage_scheme,
+        &payout_id,
     )
     .await?;
-    let address_id = if billing_address.is_some() {
-        payout_data.billing_address = billing_address;
-        payout_data
-            .billing_address
-            .as_ref()
-            .map(|address| address.address_id.clone())
-    } else {
-        payout_data.payouts.address_id.clone()
-    };
+
+    // Update payout state with resolved billing address
+    payout_data.billing_address = billing_address;
 
     // Update DB with new data
     let payouts = payout_data.payouts.to_owned();
@@ -1536,3 +1534,105 @@ pub async fn get_additional_payout_data(
         }
     }
 }
+
+pub async fn resolve_billing_address_for_payout(
+    state: &SessionState,
+    req_billing: Option<&api_models::payments::Address>,
+    existing_address_id: Option<&String>,
+    payment_method: Option<&hyperswitch_domain_models::payment_methods::PaymentMethod>,
+    merchant_context: &domain::MerchantContext,
+    customer_id: Option<&id_type::CustomerId>,
+    payout_id: &id_type::PayoutId,
+) -> RouterResult<(
+    Option<hyperswitch_domain_models::address::Address>,
+    Option<String>,
+)> {
+    let payout_id_as_payment_id = id_type::PaymentId::try_from(std::borrow::Cow::Owned(
+        payout_id.get_string_repr().to_string(),
+    ))
+    .change_context(errors::ApiErrorResponse::InvalidRequestData {
+        message: "payout_id contains invalid data for PaymentId conversion".to_string(),
+    })
+    .attach_printable("Error converting payout_id to PaymentId type")?;
+
+    match (req_billing, existing_address_id, payment_method) {
+        // Address in request
+        (Some(_), _, _) => {
+            let billing_address = payment_helpers::create_or_find_address_for_payment_by_request(
+                state,
+                req_billing,
+                None,
+                merchant_context.get_merchant_account().get_id(),
+                customer_id,
+                merchant_context.get_merchant_key_store(),
+                &payout_id_as_payment_id,
+                merchant_context.get_merchant_account().storage_scheme,
+            )
+            .await?;
+            let address_id = billing_address.as_ref().map(|a| a.address_id.clone());
+            let hyperswitch_address = billing_address
+                .map(|addr| hyperswitch_domain_models::address::Address::from(&addr));
+            Ok((hyperswitch_address, address_id))
+        }
+
+        // Existing address using address_id
+        (None, Some(address_id), _) => {
+            let billing_address = payment_helpers::create_or_find_address_for_payment_by_request(
+                state,
+                None,
+                Some(address_id),
+                merchant_context.get_merchant_account().get_id(),
+                customer_id,
+                merchant_context.get_merchant_key_store(),
+                &payout_id_as_payment_id,
+                merchant_context.get_merchant_account().storage_scheme,
+            )
+            .await?;
+            let hyperswitch_address = billing_address
+                .map(|addr| hyperswitch_domain_models::address::Address::from(&addr));
+            Ok((hyperswitch_address, Some(address_id.clone())))
+        }
+
+        // Existing address in stored payment method
+        (None, None, Some(pm)) => {
+            pm.payment_method_billing_address.as_ref().map_or_else(
+                || {
+                    logger::info!("No billing address found in payment method");
+                    Ok((None, None))
+                },
+                |encrypted_billing_address| {
+                    logger::info!("Found encrypted billing address data in payment method");
+
+                    #[cfg(feature = "v1")]
+                    {
+                        encrypted_billing_address
+                            .clone()
+                            .into_inner()
+                            .expose()
+                            .parse_value::<hyperswitch_domain_models::address::Address>(
+                                "payment_method_billing_address",
+                            )
+                            .map(|domain_address| {
+                                logger::info!("Successfully parsed as hyperswitch_domain_models::address::Address");
+                                (Some(domain_address), None)
+                            })
+                            .map_err(|e| {
+                                logger::error!("Failed to parse billing address into (hyperswitch_domain_models::address::Address): {:?}", e);
+                                errors::ApiErrorResponse::InternalServerError
+                            })
+                            .attach_printable("Failed to parse stored billing address")
+                    }
+
+                    #[cfg(feature = "v2")]
+                    {
+                        // TODO: Implement v2 logic when needed
+                        logger::warn!("v2 billing address resolution not yet implemented");
+                        Ok((None, None))
+                    }
+                },
+            )
+        }
+
+        (None, None, None) => Ok((None, None)),
+    }
+}
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 4a56078858f..432a148fc41 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -98,30 +98,7 @@ pub async fn construct_payout_router_data<'a, F>(
 
     let billing = payout_data.billing_address.to_owned();
 
-    let billing_address = billing.map(|a| {
-        let phone_details = api_models::payments::PhoneDetails {
-            number: a.phone_number.clone().map(Encryptable::into_inner),
-            country_code: a.country_code.to_owned(),
-        };
-        let address_details = api_models::payments::AddressDetails {
-            city: a.city.to_owned(),
-            country: a.country.to_owned(),
-            line1: a.line1.clone().map(Encryptable::into_inner),
-            line2: a.line2.clone().map(Encryptable::into_inner),
-            line3: a.line3.clone().map(Encryptable::into_inner),
-            zip: a.zip.clone().map(Encryptable::into_inner),
-            first_name: a.first_name.clone().map(Encryptable::into_inner),
-            last_name: a.last_name.clone().map(Encryptable::into_inner),
-            state: a.state.map(Encryptable::into_inner),
-            origin_zip: a.origin_zip.map(Encryptable::into_inner),
-        };
-
-        api_models::payments::Address {
-            phone: Some(phone_details),
-            address: Some(address_details),
-            email: a.email.to_owned().map(Email::from),
-        }
-    });
+    let billing_address = billing.map(api_models::payments::Address::from);
 
     let address = PaymentAddress::new(None, billing_address.map(From::from), None, None);
 
 | 
	2025-09-04T09:52:17Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR adds capability for payouts to use billing address in payment_methods.
1. During first payout (with recurring: true) - payment_method entry created will store the billing address
2. During recurring payouts - stored billing address will be fetched and used
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
4. `crates/router/src/configs`
5. `loadtest/config`
-->
## Motivation and Context
This fixes the bug where it required address as a mandatory field for recurring payouts (payout using stored tokens).
## How did you test it?
Scenarios to test (for address)
1. Processing CIPT and using that token for processing payout
2. Processing a recurring payout and using that token for processing payout
<details>
    <summary>1. Create payments CIT</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_nCYTBLS606xu5drbUngHWbjGv7PNWKuXbYzppYkoykcCnz4vFyEqbdW1hKW1BBUy' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_XpJkLrIhn3boVv94ixmE","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_data":{"card":{"card_number":"4111111111111111","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737"},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"IT","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"}},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":2890}'
Response
    {"payment_id":"pay_DeekxhJrZ9CWyCTQCq4r","merchant_id":"merchant_1756974399","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"adyen","client_secret":"pay_DeekxhJrZ9CWyCTQCq4r_secret_Ch5L75UesuEC9Err8YZU","created":"2025-09-04T09:36:22.282Z","currency":"EUR","customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","customer":{"id":"cus_MQ79t5dcAGyQnVVXZ5vg","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1111","card_type":"CREDIT","card_network":"Visa","card_issuer":"JP Morgan","card_issuing_country":"INDIA","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":{"address":{"city":"San Fransico","country":"IT","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"}},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","created_at":1756978582,"expires":1756982182,"secret":"epk_27ed6fdabc164aceb5e0aa888832c373"},"manual_retry_allowed":false,"connector_transaction_id":"WDV92WCPCC5FX875","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_DeekxhJrZ9CWyCTQCq4r_1","payment_link":null,"profile_id":"pro_XpJkLrIhn3boVv94ixmE","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_Z5SC1uhu0kS6KvrnsxNY","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T10:24:32.282Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_zRVZxGagdzsBMg5LmYct","network_transaction_id":"900345051761757","payment_method_status":"active","updated":"2025-09-04T09:36:23.649Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"GJ7C3STP34XQLV75","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
</details>
<details>
    <summary>2. Process payout using stored payment_method_id</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_nCYTBLS606xu5drbUngHWbjGv7PNWKuXbYzppYkoykcCnz4vFyEqbdW1hKW1BBUy' \
        --data '{"payout_method_id":"pm_zRVZxGagdzsBMg5LmYct","amount":1,"currency":"EUR","customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","phone_country_code":"+65","description":"Its my first payout request","connector":["adyen"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_XpJkLrIhn3boVv94ixmE"}'
Response
    {"payout_id":"payout_uPw0KZVYyb3RnOrChh9Q","merchant_id":"merchant_1756974399","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"joseph Doe"}},"billing":{"address":{"city":"San Fransico","country":"IT","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"auto_fulfill":true,"customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","customer":{"id":"cus_MQ79t5dcAGyQnVVXZ5vg","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_uPw0KZVYyb3RnOrChh9Q_secret_lVBCc5ylHYJonPY9Zhb3","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_5EG2zvgrEvH6Lv8xm3Ni","status":"success","error_message":null,"error_code":null,"profile_id":"pro_XpJkLrIhn3boVv94ixmE","created":"2025-09-04T09:37:16.364Z","connector_transaction_id":"RWZXLHMQMCJXKN75","priority":null,"payout_link":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_zRVZxGagdzsBMg5LmYct"}
</details>
<details>
    <summary>3. Create payout using raw details</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Iikb8EKUsyOh2DtqlE3HmqD6xdzI47h94XHiKKHTgA5YVT1ng4iyMCqSCBgsUDf8' \
        --data-raw '{"amount":100,"currency":"EUR","profile_id":"pro_tQvMhyOhPPzlg5agzwAM","customer":{"id":"cus_Z51PFM8B1iROSJcMzllP","email":"new_cust@example.com","name":"John Doe","phone":"999999999","phone_country_code":"+65"},"connector":["adyen"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111 1111 1111 1111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"US","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
   {"payout_id":"payout_p9MwtbQ0ta4tItSgXqBf","merchant_id":"merchant_1756971567","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_Z51PFM8B1iROSJcMzllP","customer":{"id":"cus_Z51PFM8B1iROSJcMzllP","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_p9MwtbQ0ta4tItSgXqBf_secret_HiUN8ag2hf8gWxZj3HuY","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_5fXDmw6DZLP3aod1Zhsn","status":"success","error_message":null,"error_code":null,"profile_id":"pro_tQvMhyOhPPzlg5agzwAM","created":"2025-09-04T07:41:23.654Z","connector_transaction_id":"GB85JNB87RXVS3V5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_cNt6gdwVpysyWzbHIDmo"}
</details>
<details>
    <summary>4. Process payout using payout_method_id</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Iikb8EKUsyOh2DtqlE3HmqD6xdzI47h94XHiKKHTgA5YVT1ng4iyMCqSCBgsUDf8' \
        --data '{"payout_method_id":"pm_cNt6gdwVpysyWzbHIDmo","amount":1,"currency":"EUR","customer_id":"cus_Z51PFM8B1iROSJcMzllP","phone_country_code":"+65","description":"Its my first payout request","connector":["adyen"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_tQvMhyOhPPzlg5agzwAM"}'
Response
    {"payout_id":"payout_NKBml9En5YOW4ZfPKoDI","merchant_id":"merchant_1756971567","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_Z51PFM8B1iROSJcMzllP","customer":{"id":"cus_Z51PFM8B1iROSJcMzllP","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_NKBml9En5YOW4ZfPKoDI_secret_fhKX0pr2SlIZjRDynimH","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_5fXDmw6DZLP3aod1Zhsn","status":"success","error_message":null,"error_code":null,"profile_id":"pro_tQvMhyOhPPzlg5agzwAM","created":"2025-09-04T07:44:05.254Z","connector_transaction_id":"LV4DQ6NDVV652VT5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_cNt6gdwVpysyWzbHIDmo"}
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	5e1fd0b187b99698936a8a0cb0d839a60b830de2 | 
	Scenarios to test (for address)
1. Processing CIPT and using that token for processing payout
2. Processing a recurring payout and using that token for processing payout
<details>
    <summary>1. Create payments CIT</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_nCYTBLS606xu5drbUngHWbjGv7PNWKuXbYzppYkoykcCnz4vFyEqbdW1hKW1BBUy' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_XpJkLrIhn3boVv94ixmE","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_data":{"card":{"card_number":"4111111111111111","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737"},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"IT","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"}},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":2890}'
Response
    {"payment_id":"pay_DeekxhJrZ9CWyCTQCq4r","merchant_id":"merchant_1756974399","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"adyen","client_secret":"pay_DeekxhJrZ9CWyCTQCq4r_secret_Ch5L75UesuEC9Err8YZU","created":"2025-09-04T09:36:22.282Z","currency":"EUR","customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","customer":{"id":"cus_MQ79t5dcAGyQnVVXZ5vg","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1111","card_type":"CREDIT","card_network":"Visa","card_issuer":"JP Morgan","card_issuing_country":"INDIA","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":{"address":{"city":"San Fransico","country":"IT","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"}},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","created_at":1756978582,"expires":1756982182,"secret":"epk_27ed6fdabc164aceb5e0aa888832c373"},"manual_retry_allowed":false,"connector_transaction_id":"WDV92WCPCC5FX875","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_DeekxhJrZ9CWyCTQCq4r_1","payment_link":null,"profile_id":"pro_XpJkLrIhn3boVv94ixmE","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_Z5SC1uhu0kS6KvrnsxNY","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T10:24:32.282Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_zRVZxGagdzsBMg5LmYct","network_transaction_id":"900345051761757","payment_method_status":"active","updated":"2025-09-04T09:36:23.649Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"GJ7C3STP34XQLV75","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}
</details>
<details>
    <summary>2. Process payout using stored payment_method_id</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_nCYTBLS606xu5drbUngHWbjGv7PNWKuXbYzppYkoykcCnz4vFyEqbdW1hKW1BBUy' \
        --data '{"payout_method_id":"pm_zRVZxGagdzsBMg5LmYct","amount":1,"currency":"EUR","customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","phone_country_code":"+65","description":"Its my first payout request","connector":["adyen"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_XpJkLrIhn3boVv94ixmE"}'
Response
    {"payout_id":"payout_uPw0KZVYyb3RnOrChh9Q","merchant_id":"merchant_1756974399","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"joseph Doe"}},"billing":{"address":{"city":"San Fransico","country":"IT","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"auto_fulfill":true,"customer_id":"cus_MQ79t5dcAGyQnVVXZ5vg","customer":{"id":"cus_MQ79t5dcAGyQnVVXZ5vg","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_uPw0KZVYyb3RnOrChh9Q_secret_lVBCc5ylHYJonPY9Zhb3","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_5EG2zvgrEvH6Lv8xm3Ni","status":"success","error_message":null,"error_code":null,"profile_id":"pro_XpJkLrIhn3boVv94ixmE","created":"2025-09-04T09:37:16.364Z","connector_transaction_id":"RWZXLHMQMCJXKN75","priority":null,"payout_link":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_zRVZxGagdzsBMg5LmYct"}
</details>
<details>
    <summary>3. Create payout using raw details</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Iikb8EKUsyOh2DtqlE3HmqD6xdzI47h94XHiKKHTgA5YVT1ng4iyMCqSCBgsUDf8' \
        --data-raw '{"amount":100,"currency":"EUR","profile_id":"pro_tQvMhyOhPPzlg5agzwAM","customer":{"id":"cus_Z51PFM8B1iROSJcMzllP","email":"new_cust@example.com","name":"John Doe","phone":"999999999","phone_country_code":"+65"},"connector":["adyen"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111 1111 1111 1111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"US","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}'
Response
   {"payout_id":"payout_p9MwtbQ0ta4tItSgXqBf","merchant_id":"merchant_1756971567","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_Z51PFM8B1iROSJcMzllP","customer":{"id":"cus_Z51PFM8B1iROSJcMzllP","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_p9MwtbQ0ta4tItSgXqBf_secret_HiUN8ag2hf8gWxZj3HuY","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_5fXDmw6DZLP3aod1Zhsn","status":"success","error_message":null,"error_code":null,"profile_id":"pro_tQvMhyOhPPzlg5agzwAM","created":"2025-09-04T07:41:23.654Z","connector_transaction_id":"GB85JNB87RXVS3V5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_cNt6gdwVpysyWzbHIDmo"}
</details>
<details>
    <summary>4. Process payout using payout_method_id</summary>
cURL
    curl --location --request POST 'http://localhost:8080/payouts/create' \
        --header 'Content-Type: application/json' \
        --header 'api-key: dev_Iikb8EKUsyOh2DtqlE3HmqD6xdzI47h94XHiKKHTgA5YVT1ng4iyMCqSCBgsUDf8' \
        --data '{"payout_method_id":"pm_cNt6gdwVpysyWzbHIDmo","amount":1,"currency":"EUR","customer_id":"cus_Z51PFM8B1iROSJcMzllP","phone_country_code":"+65","description":"Its my first payout request","connector":["adyen"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_tQvMhyOhPPzlg5agzwAM"}'
Response
    {"payout_id":"payout_NKBml9En5YOW4ZfPKoDI","merchant_id":"merchant_1756971567","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyen","payout_type":"card","payout_method_data":{"card":{"card_issuer":"JP Morgan","card_network":"Visa","card_type":"CREDIT","card_issuing_country":"INDIA","bank_code":"JP_JPM","last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_Z51PFM8B1iROSJcMzllP","customer":{"id":"cus_Z51PFM8B1iROSJcMzllP","name":"Albert Klaassen","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_NKBml9En5YOW4ZfPKoDI_secret_fhKX0pr2SlIZjRDynimH","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_5fXDmw6DZLP3aod1Zhsn","status":"success","error_message":null,"error_code":null,"profile_id":"pro_tQvMhyOhPPzlg5agzwAM","created":"2025-09-04T07:44:05.254Z","connector_transaction_id":"LV4DQ6NDVV652VT5","priority":null,"payout_link":null,"email":null,"name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_cNt6gdwVpysyWzbHIDmo"}
</details>
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8844 | 
	Bug: [FEATURE] Add support for health check endpoint and setting up configs in v2
### Feature Description
v2 application needs to have an endpoint for setting up configs and health check endpoint.
### Possible Implementation
Replicate the v1 implementation
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/api_models/src/health_check.rs b/crates/api_models/src/health_check.rs
index a6261da1be0..e782a3a100c 100644
--- a/crates/api_models/src/health_check.rs
+++ b/crates/api_models/src/health_check.rs
@@ -14,6 +14,7 @@ pub struct RouterHealthCheckResponse {
     pub grpc_health_check: HealthCheckMap,
     #[cfg(feature = "dynamic_routing")]
     pub decision_engine: bool,
+    pub unified_connector_service: Option<bool>,
 }
 
 impl common_utils::events::ApiEventMetric for RouterHealthCheckResponse {}
diff --git a/crates/router/src/core/health_check.rs b/crates/router/src/core/health_check.rs
index 7bc65e4d0e4..5df265ec4ee 100644
--- a/crates/router/src/core/health_check.rs
+++ b/crates/router/src/core/health_check.rs
@@ -40,6 +40,10 @@ pub trait HealthCheckInterface {
     async fn health_check_decision_engine(
         &self,
     ) -> CustomResult<HealthState, errors::HealthCheckDecisionEngineError>;
+
+    async fn health_check_unified_connector_service(
+        &self,
+    ) -> CustomResult<HealthState, errors::HealthCheckUnifiedConnectorServiceError>;
 }
 
 #[async_trait::async_trait]
@@ -210,4 +214,19 @@ impl HealthCheckInterface for app::SessionState {
             Ok(HealthState::NotApplicable)
         }
     }
+
+    async fn health_check_unified_connector_service(
+        &self,
+    ) -> CustomResult<HealthState, errors::HealthCheckUnifiedConnectorServiceError> {
+        if let Some(_ucs_client) = &self.grpc_client.unified_connector_service_client {
+            // For now, we'll just check if the client exists and is configured
+            // In the future, this could be enhanced to make an actual health check call
+            // to the unified connector service if it supports health check endpoints
+            logger::debug!("Unified Connector Service client is configured and available");
+            Ok(HealthState::Running)
+        } else {
+            logger::debug!("Unified Connector Service client not configured");
+            Ok(HealthState::NotApplicable)
+        }
+    }
 }
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 9584a9af160..08a0d0f386e 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -557,6 +557,7 @@ impl AppState {
 
 pub struct Health;
 
+#[cfg(feature = "v1")]
 impl Health {
     pub fn server(state: AppState) -> Scope {
         web::scope("health")
@@ -566,6 +567,16 @@ impl Health {
     }
 }
 
+#[cfg(feature = "v2")]
+impl Health {
+    pub fn server(state: AppState) -> Scope {
+        web::scope("/v2/health")
+            .app_data(web::Data::new(state))
+            .service(web::resource("").route(web::get().to(health)))
+            .service(web::resource("/ready").route(web::get().to(deep_health_check)))
+    }
+}
+
 #[cfg(feature = "dummy_connector")]
 pub struct DummyConnector;
 
@@ -1852,7 +1863,7 @@ impl Webhooks {
 
 pub struct Configs;
 
-#[cfg(any(feature = "olap", feature = "oltp"))]
+#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))]
 impl Configs {
     pub fn server(config: AppState) -> Scope {
         web::scope("/configs")
@@ -1867,6 +1878,21 @@ impl Configs {
     }
 }
 
+#[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))]
+impl Configs {
+    pub fn server(config: AppState) -> Scope {
+        web::scope("/v2/configs")
+            .app_data(web::Data::new(config))
+            .service(web::resource("/").route(web::post().to(config_key_create)))
+            .service(
+                web::resource("/{key}")
+                    .route(web::get().to(config_key_retrieve))
+                    .route(web::post().to(config_key_update))
+                    .route(web::delete().to(config_key_delete)),
+            )
+    }
+}
+
 pub struct ApplePayCertificatesMigration;
 
 #[cfg(all(feature = "olap", feature = "v1"))]
diff --git a/crates/router/src/routes/configs.rs b/crates/router/src/routes/configs.rs
index 74b9cd73b1e..1425fda32ba 100644
--- a/crates/router/src/routes/configs.rs
+++ b/crates/router/src/routes/configs.rs
@@ -8,6 +8,11 @@ use crate::{
     types::api as api_types,
 };
 
+#[cfg(feature = "v1")]
+const ADMIN_API_AUTH: auth::AdminApiAuth = auth::AdminApiAuth;
+#[cfg(feature = "v2")]
+const ADMIN_API_AUTH: auth::V2AdminApiAuth = auth::V2AdminApiAuth;
+
 #[instrument(skip_all, fields(flow = ?Flow::CreateConfigKey))]
 pub async fn config_key_create(
     state: web::Data<AppState>,
@@ -23,7 +28,7 @@ pub async fn config_key_create(
         &req,
         payload,
         |state, _, data, _| configs::set_config(state, data),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     )
     .await
@@ -43,7 +48,7 @@ pub async fn config_key_retrieve(
         &req,
         &key,
         |state, _, key, _| configs::read_config(state, key),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     )
     .await
@@ -66,7 +71,7 @@ pub async fn config_key_update(
         &req,
         &payload,
         |state, _, payload, _| configs::update_config(state, payload),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     )
     .await
@@ -87,7 +92,7 @@ pub async fn config_key_delete(
         &req,
         key,
         |state, _, key, _| configs::config_delete(state, key),
-        &auth::AdminApiAuth,
+        &ADMIN_API_AUTH,
         api_locking::LockAction::NotApplicable,
     )
     .await
diff --git a/crates/router/src/routes/health.rs b/crates/router/src/routes/health.rs
index f2ed05030da..b7818c0db5b 100644
--- a/crates/router/src/routes/health.rs
+++ b/crates/router/src/routes/health.rs
@@ -150,6 +150,21 @@ async fn deep_health_check_func(
 
     logger::debug!("Outgoing Request health check end");
 
+    logger::debug!("Unified Connector Service health check begin");
+
+    let unified_connector_service_status = state
+        .health_check_unified_connector_service()
+        .await
+        .map_err(|error| {
+            let message = error.to_string();
+            error.change_context(errors::ApiErrorResponse::HealthCheckError {
+                component: "Unified Connector Service",
+                message,
+            })
+        })?;
+
+    logger::debug!("Unified Connector Service health check end");
+
     let response = RouterHealthCheckResponse {
         database: db_status.into(),
         redis: redis_status.into(),
@@ -163,6 +178,7 @@ async fn deep_health_check_func(
         grpc_health_check,
         #[cfg(feature = "dynamic_routing")]
         decision_engine: decision_engine_health_check.into(),
+        unified_connector_service: unified_connector_service_status.into(),
     };
 
     Ok(api::ApplicationResponse::Json(response))
diff --git a/crates/storage_impl/src/errors.rs b/crates/storage_impl/src/errors.rs
index 89326d9a71c..a2b4dad779b 100644
--- a/crates/storage_impl/src/errors.rs
+++ b/crates/storage_impl/src/errors.rs
@@ -294,3 +294,9 @@ pub enum HealthCheckDecisionEngineError {
     #[error("Failed to establish Decision Engine connection")]
     FailedToCallDecisionEngineService,
 }
+
+#[derive(Debug, Clone, thiserror::Error)]
+pub enum HealthCheckUnifiedConnectorServiceError {
+    #[error("Failed to establish Unified Connector Service connection")]
+    FailedToCallUnifiedConnectorService,
+}
 | 
	2025-08-05T06:19:58Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Introduced` /v2/configs` and `/v2/health` endpoints and for v2
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
introduced configs and health endpoints for v2
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Manual.
1. Hit V2 health endpoint.
```
curl --location '{{base_url}}/v2/health/ready' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--data ''
```
response:
```
{
    "database": true,
    "redis": true,
    "analytics": true,
    "opensearch": false,
    "outgoing_request": true,
    "unified_connector_service": true
}
```
2. Create a test v2 config
```
curl --location '{{baseUrl}}/v2/configs/' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--header 'authorization: admin-api-key=test_admin' \
--data '
{
    "key": "test_v2_config_1",
    "value": "true"
}
'
```
2. Retrive the test v2 config
```
curl --location '{{baseUrl}}/v2/configs/test_v2_config_1' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--header 'authorization: admin-api-key=test_admin' \
--data ''
```
Response for 2 and 3:
```
{
    "key": "test_v2_config_1",
    "value": "true"
}
```
3. Config Update 
```
curl --location '{{baseUrl}}/v2/configs/test_v2_config_1' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--header 'authorization: admin-api-key=test_admin' \
--data '{
    "value": "false"
}'
```
Response:
```
{
    "key": "test_v2_config_1",
    "value": "true"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	90f3b09a77484a4262608b0a4eeca7d452a4c968 | 
	
Manual.
1. Hit V2 health endpoint.
```
curl --location '{{base_url}}/v2/health/ready' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--data ''
```
response:
```
{
    "database": true,
    "redis": true,
    "analytics": true,
    "opensearch": false,
    "outgoing_request": true,
    "unified_connector_service": true
}
```
2. Create a test v2 config
```
curl --location '{{baseUrl}}/v2/configs/' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--header 'authorization: admin-api-key=test_admin' \
--data '
{
    "key": "test_v2_config_1",
    "value": "true"
}
'
```
2. Retrive the test v2 config
```
curl --location '{{baseUrl}}/v2/configs/test_v2_config_1' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--header 'authorization: admin-api-key=test_admin' \
--data ''
```
Response for 2 and 3:
```
{
    "key": "test_v2_config_1",
    "value": "true"
}
```
3. Config Update 
```
curl --location '{{baseUrl}}/v2/configs/test_v2_config_1' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: public' \
--header 'authorization: admin-api-key=test_admin' \
--data '{
    "value": "false"
}'
```
Response:
```
{
    "key": "test_v2_config_1",
    "value": "true"
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8807 | 
	Bug: [FIX]: Take merchant ID from headers in API Key Revoke (v2)
For `API Key - Revoke` in v2, the merchant ID is currently being passed in the path. We need to instead read the `X-Merchant-ID` header to get the merchant ID. | 
	diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index d76b338dc36..34b421d9e14 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -425,18 +425,18 @@ pub async fn update_api_key_expiry_task(
 #[instrument(skip_all)]
 pub async fn revoke_api_key(
     state: SessionState,
-    merchant_id: &common_utils::id_type::MerchantId,
+    merchant_id: common_utils::id_type::MerchantId,
     key_id: &common_utils::id_type::ApiKeyId,
 ) -> RouterResponse<api::RevokeApiKeyResponse> {
     let store = state.store.as_ref();
 
     let api_key = store
-        .find_api_key_by_merchant_id_key_id_optional(merchant_id, key_id)
+        .find_api_key_by_merchant_id_key_id_optional(&merchant_id, key_id)
         .await
         .to_not_found_response(errors::ApiErrorResponse::ApiKeyNotFound)?;
 
     let revoked = store
-        .revoke_api_key(merchant_id, key_id)
+        .revoke_api_key(&merchant_id, key_id)
         .await
         .to_not_found_response(errors::ApiErrorResponse::ApiKeyNotFound)?;
 
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 3acb1c07064..e6ad485e2a2 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -243,7 +243,9 @@ pub async fn api_key_revoke(
         state,
         &req,
         (&merchant_id, &key_id),
-        |state, _, (merchant_id, key_id), _| api_keys::revoke_api_key(state, merchant_id, key_id),
+        |state, _, (merchant_id, key_id), _| {
+            api_keys::revoke_api_key(state, merchant_id.clone(), key_id)
+        },
         auth::auth_type(
             &auth::PlatformOrgAdminAuthWithMerchantIdFromRoute {
                 merchant_id_from_route: merchant_id.clone(),
@@ -265,24 +267,25 @@ pub async fn api_key_revoke(
 pub async fn api_key_revoke(
     state: web::Data<AppState>,
     req: HttpRequest,
-    path: web::Path<(
-        common_utils::id_type::MerchantId,
-        common_utils::id_type::ApiKeyId,
-    )>,
+    path: web::Path<common_utils::id_type::ApiKeyId>,
 ) -> impl Responder {
     let flow = Flow::ApiKeyRevoke;
-    let (merchant_id, key_id) = path.into_inner();
+    let key_id = path.into_inner();
 
     Box::pin(api::server_wrap(
         flow,
         state,
         &req,
-        (&merchant_id, &key_id),
-        |state, _, (merchant_id, key_id), _| api_keys::revoke_api_key(state, merchant_id, key_id),
+        &key_id,
+        |state,
+         auth::AuthenticationDataWithoutProfile {
+             merchant_account, ..
+         },
+         key_id,
+         _| api_keys::revoke_api_key(state, merchant_account.get_id().to_owned(), key_id),
         auth::auth_type(
-            &auth::V2AdminApiAuth,
-            &auth::JWTAuthMerchantFromRoute {
-                merchant_id: merchant_id.clone(),
+            &auth::AdminApiAuthWithMerchantIdFromHeader,
+            &auth::JWTAuthMerchantFromHeader {
                 required_permission: Permission::MerchantApiKeyWrite,
             },
             req.headers(),
 | 
	2025-07-31T08:31:25Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Removed merchant ID from path in `API Keys - Revoke`
- Changed auth to read merchant ID from headers
### Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Closes #8807 
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- V1:
Request:
```
curl --location --request DELETE 'http://localhost:8080/api_keys/merchant_1753949938/dev_8Xwp8SIyp0R4ItROu0tR' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin'
```
Response:
```json
{
    "merchant_id": "merchant_1753949938",
    "key_id": "dev_8Xwp8SIyp0R4ItROu0tR",
    "revoked": true
}
```
- V2:
Request:
```
curl --location --request DELETE 'http://localhost:8080/v2/api-keys/dev_DULXUEOAUgYKxuxE7PQN' \
--header 'x-merchant-id: cloth_seller_v2_hFIzh6a4wFsbtEkKYLxD' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: test_admin'
```
Response:
```json
{
    "merchant_id": "cloth_seller_v2_hFIzh6a4wFsbtEkKYLxD",
    "key_id": "dev_DULXUEOAUgYKxuxE7PQN",
    "revoked": true
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	794dce168e6b4d280c9c742a6e8a3b3283e09602 | 
	
- V1:
Request:
```
curl --location --request DELETE 'http://localhost:8080/api_keys/merchant_1753949938/dev_8Xwp8SIyp0R4ItROu0tR' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin'
```
Response:
```json
{
    "merchant_id": "merchant_1753949938",
    "key_id": "dev_8Xwp8SIyp0R4ItROu0tR",
    "revoked": true
}
```
- V2:
Request:
```
curl --location --request DELETE 'http://localhost:8080/v2/api-keys/dev_DULXUEOAUgYKxuxE7PQN' \
--header 'x-merchant-id: cloth_seller_v2_hFIzh6a4wFsbtEkKYLxD' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: test_admin'
```
Response:
```json
{
    "merchant_id": "cloth_seller_v2_hFIzh6a4wFsbtEkKYLxD",
    "key_id": "dev_DULXUEOAUgYKxuxE7PQN",
    "revoked": true
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8804 | 
	Bug: [FEATURE] Request fields to be populated on top level
### Feature Description
Few fields of request to be passed on to top level for certain operations
### Possible Implementation
parse the value and then add it to the events
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None | 
	diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index d4eb34838d6..4f53a2ef2df 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -547,5 +547,6 @@ pub(crate) async fn fetch_raw_secrets(
         clone_connector_allowlist: conf.clone_connector_allowlist,
         merchant_id_auth: conf.merchant_id_auth,
         infra_values: conf.infra_values,
+        enhancement: conf.enhancement,
     }
 }
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index ae4c8a3cda0..6e4454063ce 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -162,6 +162,8 @@ pub struct Settings<S: SecretState> {
     pub merchant_id_auth: MerchantIdAuthSettings,
     #[serde(default)]
     pub infra_values: Option<HashMap<String, String>>,
+    #[serde(default)]
+    pub enhancement: Option<HashMap<String, String>>,
 }
 
 #[derive(Debug, Deserialize, Clone, Default)]
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index cb731c43717..f52b0d44c80 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -132,6 +132,7 @@ pub struct SessionState {
     pub locale: String,
     pub crm_client: Arc<dyn CrmInterface>,
     pub infra_components: Option<serde_json::Value>,
+    pub enhancement: Option<HashMap<String, String>>,
 }
 impl scheduler::SchedulerSessionState for SessionState {
     fn get_db(&self) -> Box<dyn SchedulerInterface> {
@@ -245,6 +246,7 @@ pub struct AppState {
     pub theme_storage_client: Arc<dyn FileStorageInterface>,
     pub crm_client: Arc<dyn CrmInterface>,
     pub infra_components: Option<serde_json::Value>,
+    pub enhancement: Option<HashMap<String, String>>,
 }
 impl scheduler::SchedulerAppState for AppState {
     fn get_tenants(&self) -> Vec<id_type::TenantId> {
@@ -410,6 +412,7 @@ impl AppState {
 
             let grpc_client = conf.grpc_client.get_grpc_client_interface().await;
             let infra_component_values = Self::process_env_mappings(conf.infra_values.clone());
+            let enhancement = conf.enhancement.clone();
             Self {
                 flow_name: String::from("default"),
                 stores,
@@ -431,6 +434,7 @@ impl AppState {
                 theme_storage_client,
                 crm_client,
                 infra_components: infra_component_values,
+                enhancement,
             }
         })
         .await
@@ -526,6 +530,7 @@ impl AppState {
             locale: locale.unwrap_or(common_utils::consts::DEFAULT_LOCALE.to_string()),
             crm_client: self.crm_client.clone(),
             infra_components: self.infra_components.clone(),
+            enhancement: self.enhancement.clone(),
         })
     }
 
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 9b6c091a577..792edb71997 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -701,7 +701,11 @@ where
         }
     };
 
-    let infra = state.infra_components.clone();
+    let infra = extract_mapped_fields(
+        &serialized_request,
+        state.enhancement.as_ref(),
+        state.infra_components.as_ref(),
+    );
 
     let api_event = ApiEvent::new(
         tenant_id,
@@ -2065,6 +2069,64 @@ pub fn get_payment_link_status(
     }
 }
 
+pub fn extract_mapped_fields(
+    value: &serde_json::Value,
+    mapping: Option<&HashMap<String, String>>,
+    existing_enhancement: Option<&serde_json::Value>,
+) -> Option<serde_json::Value> {
+    let mapping = mapping?;
+
+    if mapping.is_empty() {
+        return existing_enhancement.cloned();
+    }
+
+    let mut enhancement = match existing_enhancement {
+        Some(existing) if existing.is_object() => existing.clone(),
+        _ => serde_json::json!({}),
+    };
+
+    for (dot_path, output_key) in mapping {
+        if let Some(extracted_value) = extract_field_by_dot_path(value, dot_path) {
+            if let Some(obj) = enhancement.as_object_mut() {
+                obj.insert(output_key.clone(), extracted_value);
+            }
+        }
+    }
+
+    if enhancement.as_object().is_some_and(|obj| !obj.is_empty()) {
+        Some(enhancement)
+    } else {
+        None
+    }
+}
+
+pub fn extract_field_by_dot_path(
+    value: &serde_json::Value,
+    path: &str,
+) -> Option<serde_json::Value> {
+    let parts: Vec<&str> = path.split('.').collect();
+    let mut current = value;
+
+    for part in parts {
+        match current {
+            serde_json::Value::Object(obj) => {
+                current = obj.get(part)?;
+            }
+            serde_json::Value::Array(arr) => {
+                // Try to parse part as array index
+                if let Ok(index) = part.parse::<usize>() {
+                    current = arr.get(index)?;
+                } else {
+                    return None;
+                }
+            }
+            _ => return None,
+        }
+    }
+
+    Some(current.clone())
+}
+
 #[cfg(test)]
 mod tests {
     #[test]
 | 
	2025-07-29T06:12:18Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This feature allows based on deployment config , it is able to query Request Body and add as a top level fields in the Kafka events
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
We wanted a feature where we could add fields from Request Body to top level fields in kafka events irrespective of the flow
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Test 1
In ```development.toml```
```bash
[enhancement]
"merchant_reference_id" = "txn_uuid"
```
<img width="540" height="732" alt="Screenshot 2025-07-29 at 11 40 30 AM" src="https://github.com/user-attachments/assets/8eb747d8-7bc7-441f-8cb3-e1d992ee1671" />
```json
{
	"tenant_id": "public",
	"merchant_id": "cloth_seller_kGLq5ZsmKL6hISw8HI9A",
	"api_flow": "PaymentsCreateIntent",
	"created_at_timestamp": 1753767564159,
	"request_id": "019854b1-52c2-7080-ab7f-114e169fc92b",
	"latency": 170,
	"status_code": 200,
	"api_auth_type": "api_key",
	"authentication_data": {
		"merchant_id": "cloth_seller_kGLq5ZsmKL6hISw8HI9A",
		"key_id": "dev_ekHYWGqV5It7fLj62AOa"
	},
	"request": "{\"amount_details\":{\"order_amount\":{\"Value\":100},\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"skip_external_tax_calculation\":\"skip\",\"skip_surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019841789b727750b33d014ce2fabf10\",\"customer_present\":null,\"description\":null,\"return_url\":null,\"setup_future_usage\":null,\"apply_mit_exemption\":null,\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":null,\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":null,\"payment_link_config\":null,\"request_incremental_authorization\":null,\"session_expiry\":null,\"frm_metadata\":null,\"request_external_three_ds_authentication\":null,\"force_3ds_challenge\":null,\"merchant_connector_details\":null}",
	"user_agent": "PostmanRuntime/7.44.1",
	"ip_addr": "::1",
	"url_path": "/v2/payments/create-intent",
	"response": "{\"id\":\"12345_pay_019854b152cf7bc2b538db792c40bcc6\",\"status\":\"requires_payment_method\",\"amount_details\":{\"order_amount\":100,\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"external_tax_calculation\":\"skip\",\"surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"client_secret\":\"*** alloc::string::String ***\",\"profile_id\":\"pro_uJBgizwyNrvQmKZVxuUo\",\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019841789b727750b33d014ce2fabf10\",\"customer_present\":\"present\",\"description\":null,\"return_url\":null,\"setup_future_usage\":\"on_session\",\"apply_mit_exemption\":\"Skip\",\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":null,\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":\"Skip\",\"payment_link_config\":null,\"request_incremental_authorization\":\"default\",\"expires_on\":\"2025-07-29T05:54:24.111Z\",\"frm_metadata\":null,\"request_external_three_ds_authentication\":\"Skip\"}",
	"error": null,
	"flow_type": "payment",
	"payment_id": "12345_pay_019854b152cf7bc2b538db792c40bcc6",
	"hs_latency": null,
	"http_method": "POST",
	"cluster": "my_own_cluster",
	"txn_uuid": "NOPA"
}
```
Test 2
In ```development.toml```
```bash
[enhancement]
"merchant_reference_id" = "udf_txn_uuid"
"shipping.address.country" = "country"
```
```json
{
	"tenant_id": "public",
	"merchant_id": "cloth_seller_PdFuIUDbxVwvu7kZJ3DC",
	"api_flow": "PaymentsCreateIntent",
	"created_at_timestamp": 1753795822163,
	"request_id": "01985660-8135-7422-afa3-9c4aa8c4ff23",
	"latency": 264,
	"status_code": 200,
	"api_auth_type": "api_key",
	"authentication_data": {
		"merchant_id": "cloth_seller_PdFuIUDbxVwvu7kZJ3DC",
		"key_id": "dev_SImQYDU2oDTEQ9RqnY4R"
	},
	"request": "{\"amount_details\":{\"order_amount\":{\"Value\":100},\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"skip_external_tax_calculation\":\"skip\",\"skip_surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019854ddfc4179a1b56936f3ef50cf48\",\"customer_present\":null,\"description\":null,\"return_url\":null,\"setup_future_usage\":null,\"apply_mit_exemption\":null,\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":\"*** serde_json::value::Value ***\",\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":null,\"payment_link_config\":null,\"request_incremental_authorization\":null,\"session_expiry\":null,\"frm_metadata\":null,\"request_external_three_ds_authentication\":null,\"force_3ds_challenge\":null,\"merchant_connector_details\":null}",
	"user_agent": "PostmanRuntime/7.44.1",
	"ip_addr": "::1",
	"url_path": "/v2/payments/create-intent",
	"response": "{\"id\":\"12345_pay_0198566081457b12a4925e86e34cbe96\",\"status\":\"requires_payment_method\",\"amount_details\":{\"order_amount\":100,\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"external_tax_calculation\":\"skip\",\"surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"client_secret\":\"*** alloc::string::String ***\",\"profile_id\":\"pro_LWkFikerdXPyjg0lghL3\",\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019854ddfc4179a1b56936f3ef50cf48\",\"customer_present\":\"present\",\"description\":null,\"return_url\":null,\"setup_future_usage\":\"on_session\",\"apply_mit_exemption\":\"Skip\",\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":\"*** serde_json::value::Value ***\",\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":\"Skip\",\"payment_link_config\":null,\"request_incremental_authorization\":\"default\",\"expires_on\":\"2025-07-29T13:45:22.074Z\",\"frm_metadata\":null,\"request_external_three_ds_authentication\":\"Skip\"}",
	"error": null,
	"flow_type": "payment",
	"payment_id": "12345_pay_0198566081457b12a4925e86e34cbe96",
	"hs_latency": null,
	"http_method": "POST",
	"country": "NL",
	"udf_txn_uuid": "NOPA"
}
```
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	1e6a088c04b40c7fdd5bc65c1973056bf58de764 | 
	
Test 1
In ```development.toml```
```bash
[enhancement]
"merchant_reference_id" = "txn_uuid"
```
<img width="540" height="732" alt="Screenshot 2025-07-29 at 11 40 30 AM" src="https://github.com/user-attachments/assets/8eb747d8-7bc7-441f-8cb3-e1d992ee1671" />
```json
{
	"tenant_id": "public",
	"merchant_id": "cloth_seller_kGLq5ZsmKL6hISw8HI9A",
	"api_flow": "PaymentsCreateIntent",
	"created_at_timestamp": 1753767564159,
	"request_id": "019854b1-52c2-7080-ab7f-114e169fc92b",
	"latency": 170,
	"status_code": 200,
	"api_auth_type": "api_key",
	"authentication_data": {
		"merchant_id": "cloth_seller_kGLq5ZsmKL6hISw8HI9A",
		"key_id": "dev_ekHYWGqV5It7fLj62AOa"
	},
	"request": "{\"amount_details\":{\"order_amount\":{\"Value\":100},\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"skip_external_tax_calculation\":\"skip\",\"skip_surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019841789b727750b33d014ce2fabf10\",\"customer_present\":null,\"description\":null,\"return_url\":null,\"setup_future_usage\":null,\"apply_mit_exemption\":null,\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":null,\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":null,\"payment_link_config\":null,\"request_incremental_authorization\":null,\"session_expiry\":null,\"frm_metadata\":null,\"request_external_three_ds_authentication\":null,\"force_3ds_challenge\":null,\"merchant_connector_details\":null}",
	"user_agent": "PostmanRuntime/7.44.1",
	"ip_addr": "::1",
	"url_path": "/v2/payments/create-intent",
	"response": "{\"id\":\"12345_pay_019854b152cf7bc2b538db792c40bcc6\",\"status\":\"requires_payment_method\",\"amount_details\":{\"order_amount\":100,\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"external_tax_calculation\":\"skip\",\"surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"client_secret\":\"*** alloc::string::String ***\",\"profile_id\":\"pro_uJBgizwyNrvQmKZVxuUo\",\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019841789b727750b33d014ce2fabf10\",\"customer_present\":\"present\",\"description\":null,\"return_url\":null,\"setup_future_usage\":\"on_session\",\"apply_mit_exemption\":\"Skip\",\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":null,\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":\"Skip\",\"payment_link_config\":null,\"request_incremental_authorization\":\"default\",\"expires_on\":\"2025-07-29T05:54:24.111Z\",\"frm_metadata\":null,\"request_external_three_ds_authentication\":\"Skip\"}",
	"error": null,
	"flow_type": "payment",
	"payment_id": "12345_pay_019854b152cf7bc2b538db792c40bcc6",
	"hs_latency": null,
	"http_method": "POST",
	"cluster": "my_own_cluster",
	"txn_uuid": "NOPA"
}
```
Test 2
In ```development.toml```
```bash
[enhancement]
"merchant_reference_id" = "udf_txn_uuid"
"shipping.address.country" = "country"
```
```json
{
	"tenant_id": "public",
	"merchant_id": "cloth_seller_PdFuIUDbxVwvu7kZJ3DC",
	"api_flow": "PaymentsCreateIntent",
	"created_at_timestamp": 1753795822163,
	"request_id": "01985660-8135-7422-afa3-9c4aa8c4ff23",
	"latency": 264,
	"status_code": 200,
	"api_auth_type": "api_key",
	"authentication_data": {
		"merchant_id": "cloth_seller_PdFuIUDbxVwvu7kZJ3DC",
		"key_id": "dev_SImQYDU2oDTEQ9RqnY4R"
	},
	"request": "{\"amount_details\":{\"order_amount\":{\"Value\":100},\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"skip_external_tax_calculation\":\"skip\",\"skip_surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019854ddfc4179a1b56936f3ef50cf48\",\"customer_present\":null,\"description\":null,\"return_url\":null,\"setup_future_usage\":null,\"apply_mit_exemption\":null,\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":\"*** serde_json::value::Value ***\",\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":null,\"payment_link_config\":null,\"request_incremental_authorization\":null,\"session_expiry\":null,\"frm_metadata\":null,\"request_external_three_ds_authentication\":null,\"force_3ds_challenge\":null,\"merchant_connector_details\":null}",
	"user_agent": "PostmanRuntime/7.44.1",
	"ip_addr": "::1",
	"url_path": "/v2/payments/create-intent",
	"response": "{\"id\":\"12345_pay_0198566081457b12a4925e86e34cbe96\",\"status\":\"requires_payment_method\",\"amount_details\":{\"order_amount\":100,\"currency\":\"USD\",\"shipping_cost\":null,\"order_tax_amount\":null,\"external_tax_calculation\":\"skip\",\"surcharge_calculation\":\"skip\",\"surcharge_amount\":null,\"tax_on_surcharge\":null},\"client_secret\":\"*** alloc::string::String ***\",\"profile_id\":\"pro_LWkFikerdXPyjg0lghL3\",\"merchant_reference_id\":\"NOPA\",\"routing_algorithm_id\":null,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"billing\":{\"address\":{\"city\":\"test\",\"country\":\"NL\",\"line1\":\"*** alloc::string::String ***\",\"line2\":\"*** alloc::string::String ***\",\"line3\":\"*** alloc::string::String ***\",\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":{\"number\":\"*** alloc::string::String ***\",\"country_code\":\"+1\"},\"email\":\"*****@example.com\"},\"shipping\":{\"address\":{\"city\":\"Karwar\",\"country\":\"NL\",\"line1\":null,\"line2\":null,\"line3\":null,\"zip\":\"*** alloc::string::String ***\",\"state\":\"*** alloc::string::String ***\",\"first_name\":\"*** alloc::string::String ***\",\"last_name\":\"*** alloc::string::String ***\"},\"phone\":null,\"email\":\"*******@example.com\"},\"customer_id\":\"12345_cus_019854ddfc4179a1b56936f3ef50cf48\",\"customer_present\":\"present\",\"description\":null,\"return_url\":null,\"setup_future_usage\":\"on_session\",\"apply_mit_exemption\":\"Skip\",\"statement_descriptor\":null,\"order_details\":null,\"allowed_payment_method_types\":null,\"metadata\":\"*** serde_json::value::Value ***\",\"connector_metadata\":null,\"feature_metadata\":null,\"payment_link_enabled\":\"Skip\",\"payment_link_config\":null,\"request_incremental_authorization\":\"default\",\"expires_on\":\"2025-07-29T13:45:22.074Z\",\"frm_metadata\":null,\"request_external_three_ds_authentication\":\"Skip\"}",
	"error": null,
	"flow_type": "payment",
	"payment_id": "12345_pay_0198566081457b12a4925e86e34cbe96",
	"hs_latency": null,
	"http_method": "POST",
	"country": "NL",
	"udf_txn_uuid": "NOPA"
}
```
 | |
| 
	juspay/hyperswitch | 
	juspay__hyperswitch-8806 | 
	Bug: [BUG] Add additional authentication fields for 3ds external authentication
### Bug Description
Cybersource payments via Netcetera are failing for a France based acquirer in prod with Carte Bancaires card, the below fields needs to be added to fix the same.
1. challenge_code
2. challenge_code_reason
3. challenge_cancel
4. message_extension
### Expected Behavior
Payments are currently failing in prod a france based acquirer
### Actual Behavior
Payments should pass
### Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
### Context For The Bug
_No response_
### Environment
Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``
### Have you spent some time checking if this bug has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
Yes, I am willing to submit a PR! | 
	diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs
index 915d661bad2..c844df0a699 100644
--- a/crates/diesel_models/src/authentication.rs
+++ b/crates/diesel_models/src/authentication.rs
@@ -1,4 +1,4 @@
-use common_utils::encryption::Encryption;
+use common_utils::{encryption::Encryption, pii};
 use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
 use serde::{self, Deserialize, Serialize};
 use serde_json;
@@ -61,6 +61,10 @@ pub struct Authentication {
     pub browser_info: Option<serde_json::Value>,
     pub email: Option<Encryption>,
     pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
+    pub challenge_code: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
+    pub message_extension: Option<pii::SecretSerdeValue>,
 }
 
 impl Authentication {
@@ -121,6 +125,10 @@ pub struct AuthenticationNew {
     pub browser_info: Option<serde_json::Value>,
     pub email: Option<Encryption>,
     pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
+    pub challenge_code: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
+    pub message_extension: Option<pii::SecretSerdeValue>,
 }
 
 #[derive(Debug)]
@@ -167,11 +175,17 @@ pub enum AuthenticationUpdate {
         authentication_status: common_enums::AuthenticationStatus,
         ds_trans_id: Option<String>,
         eci: Option<String>,
+        challenge_code: Option<String>,
+        challenge_cancel: Option<String>,
+        challenge_code_reason: Option<String>,
+        message_extension: Option<pii::SecretSerdeValue>,
     },
     PostAuthenticationUpdate {
         trans_status: common_enums::TransactionStatus,
         eci: Option<String>,
         authentication_status: common_enums::AuthenticationStatus,
+        challenge_cancel: Option<String>,
+        challenge_code_reason: Option<String>,
     },
     ErrorUpdate {
         error_message: Option<String>,
@@ -227,6 +241,10 @@ pub struct AuthenticationUpdateInternal {
     pub browser_info: Option<serde_json::Value>,
     pub email: Option<Encryption>,
     pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
+    pub challenge_code: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
+    pub message_extension: Option<pii::SecretSerdeValue>,
 }
 
 impl Default for AuthenticationUpdateInternal {
@@ -267,6 +285,10 @@ impl Default for AuthenticationUpdateInternal {
             browser_info: Default::default(),
             email: Default::default(),
             profile_acquirer_id: Default::default(),
+            challenge_code: Default::default(),
+            challenge_cancel: Default::default(),
+            challenge_code_reason: Default::default(),
+            message_extension: Default::default(),
         }
     }
 }
@@ -309,6 +331,10 @@ impl AuthenticationUpdateInternal {
             browser_info,
             email,
             profile_acquirer_id,
+            challenge_code,
+            challenge_cancel,
+            challenge_code_reason,
+            message_extension,
         } = self;
         Authentication {
             connector_authentication_id: connector_authentication_id
@@ -350,6 +376,10 @@ impl AuthenticationUpdateInternal {
             browser_info: browser_info.or(source.browser_info),
             email: email.or(source.email),
             profile_acquirer_id: profile_acquirer_id.or(source.profile_acquirer_id),
+            challenge_code: challenge_code.or(source.challenge_code),
+            challenge_cancel: challenge_cancel.or(source.challenge_cancel),
+            challenge_code_reason: challenge_code_reason.or(source.challenge_code_reason),
+            message_extension: message_extension.or(source.message_extension),
             ..source
         }
     }
@@ -438,6 +468,10 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
                 authentication_status,
                 ds_trans_id,
                 eci,
+                challenge_code,
+                challenge_cancel,
+                challenge_code_reason,
+                message_extension,
             } => Self {
                 trans_status: Some(trans_status),
                 authentication_type: Some(authentication_type),
@@ -450,16 +484,24 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
                 authentication_status: Some(authentication_status),
                 ds_trans_id,
                 eci,
+                challenge_code,
+                challenge_cancel,
+                challenge_code_reason,
+                message_extension,
                 ..Default::default()
             },
             AuthenticationUpdate::PostAuthenticationUpdate {
                 trans_status,
                 eci,
                 authentication_status,
+                challenge_cancel,
+                challenge_code_reason,
             } => Self {
                 trans_status: Some(trans_status),
                 eci,
                 authentication_status: Some(authentication_status),
+                challenge_cancel,
+                challenge_code_reason,
                 ..Default::default()
             },
             AuthenticationUpdate::PreAuthenticationVersionCallUpdate {
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index c141f765536..16eb56df20d 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -137,6 +137,10 @@ diesel::table! {
         email -> Nullable<Bytea>,
         #[max_length = 128]
         profile_acquirer_id -> Nullable<Varchar>,
+        challenge_code -> Nullable<Varchar>,
+        challenge_cancel -> Nullable<Varchar>,
+        challenge_code_reason -> Nullable<Varchar>,
+        message_extension -> Nullable<Jsonb>,
     }
 }
 
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index e434e43b2c6..08fdecfd107 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -137,6 +137,10 @@ diesel::table! {
         email -> Nullable<Bytea>,
         #[max_length = 128]
         profile_acquirer_id -> Nullable<Varchar>,
+        challenge_code -> Nullable<Varchar>,
+        challenge_cancel -> Nullable<Varchar>,
+        challenge_code_reason -> Nullable<Varchar>,
+        message_extension -> Nullable<Jsonb>,
     }
 }
 
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index 2112989969e..ffef8b20c07 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -34,8 +34,9 @@ use hyperswitch_domain_models::{
         SetupMandate,
     },
     router_request_types::{
-        CompleteAuthorizeData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,
-        PaymentsPreProcessingData, PaymentsSyncData, ResponseId, SetupMandateRequestData,
+        authentication::MessageExtensionAttribute, CompleteAuthorizeData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSyncData,
+        ResponseId, SetupMandateRequestData,
     },
     router_response_types::{
         MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData,
@@ -313,6 +314,7 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
                 ))?
             }
         };
+        let cavv_algorithm = Some("2".to_string());
 
         let processing_information = ProcessingInformation {
             capture: Some(false),
@@ -322,6 +324,7 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
             authorization_options,
             commerce_indicator: String::from("internet"),
             payment_solution: solution.map(String::from),
+            cavv_algorithm,
         };
         Ok(Self {
             processing_information,
@@ -355,6 +358,7 @@ pub struct ProcessingInformation {
     capture: Option<bool>,
     capture_options: Option<CaptureOptions>,
     payment_solution: Option<String>,
+    cavv_algorithm: Option<String>,
 }
 
 #[derive(Debug, Serialize)]
@@ -389,6 +393,7 @@ pub struct CybersourceConsumerAuthInformation {
     /// Raw electronic commerce indicator (ECI)
     eci_raw: Option<String>,
     /// This field is supported only on Asia, Middle East, and Africa Gateway
+    /// Also needed for Credit Mutuel-CIC in France and Mastercard Identity Check transactions
     /// This field is only applicable for Mastercard and Visa Transactions
     pares_status: Option<CybersourceParesStatus>,
     //This field is used to send the authentication date in yyyyMMDDHHMMSS format
@@ -396,6 +401,16 @@ pub struct CybersourceConsumerAuthInformation {
     /// This field indicates the 3D Secure transaction flow. It is only supported for secure transactions in France.
     /// The possible values are - CH (Challenge), FD (Frictionless with delegation), FR (Frictionless)
     effective_authentication_type: Option<EffectiveAuthenticationType>,
+    /// This field indicates the authentication type or challenge presented to the cardholder at checkout.
+    challenge_code: Option<String>,
+    /// This field indicates the reason for payer authentication response status. It is only supported for secure transactions in France.
+    pares_status_reason: Option<String>,
+    /// This field indicates the reason why strong authentication was cancelled. It is only supported for secure transactions in France.
+    challenge_cancel_code: Option<String>,
+    /// This field indicates the score calculated by the 3D Securing platform. It is only supported for secure transactions in France.
+    network_score: Option<u32>,
+    /// This is the transaction ID generated by the access control server. This field is supported only for secure transactions in France.
+    acs_transaction_id: Option<String>,
 }
 
 #[derive(Debug, Serialize)]
@@ -971,6 +986,11 @@ impl
                     .map(|eci| get_commerce_indicator_for_external_authentication(network, eci))
             });
 
+        // The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.
+        // In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.
+        // This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).
+        let cavv_algorithm = Some("2".to_string());
+
         Ok(Self {
             capture: Some(matches!(
                 item.router_data.request.capture_method,
@@ -983,6 +1003,7 @@ impl
             capture_options: None,
             commerce_indicator: commerce_indicator_for_external_authentication
                 .unwrap_or(commerce_indicator),
+            cavv_algorithm,
         })
     }
 }
@@ -1079,6 +1100,8 @@ impl
             } else {
                 (None, None, None)
             };
+        let cavv_algorithm = Some("2".to_string());
+
         Ok(Self {
             capture: Some(matches!(
                 item.router_data.request.capture_method,
@@ -1093,6 +1116,7 @@ impl
                 .indicator
                 .to_owned()
                 .unwrap_or(String::from("internet")),
+            cavv_algorithm,
         })
     }
 }
@@ -1241,6 +1265,53 @@ fn convert_metadata_to_merchant_defined_info(metadata: Value) -> Vec<MerchantDef
     vector
 }
 
+/*
+Example Message Extension:
+
+[
+    MessageExtensionAttribute {
+        name: "CB-SCORE".to_string(),
+        id: "A000000042_CB-SCORE".to_string(),
+        criticality_indicator: false,
+        data: "some value".to_string(),
+    },
+]
+
+In this case, the **network score** is `42`, which should be extracted from the `id` field.
+The score is encoded in the numeric part of the `id` (after removing the leading 'A' and before the underscore).
+
+Note: This field represents the score calculated by the 3D Securing platform.
+It is only supported for secure transactions in France.
+*/
+
+fn extract_score_id(message_extensions: &[MessageExtensionAttribute]) -> Option<u32> {
+    message_extensions.iter().find_map(|attr| {
+        attr.id
+            .ends_with("CB-SCORE")
+            .then(|| {
+                attr.id
+                    .split('_')
+                    .next()
+                    .and_then(|p| p.strip_prefix('A'))
+                    .and_then(|s| {
+                        s.parse::<u32>().map(Some).unwrap_or_else(|err| {
+                            router_env::logger::error!(
+                                "Failed to parse score_id from '{}': {}",
+                                s,
+                                err
+                            );
+                            None
+                        })
+                    })
+                    .or_else(|| {
+                        router_env::logger::error!("Unexpected prefix format in id: {}", attr.id);
+                        None
+                    })
+            })
+            .flatten()
+    })
+}
+
 impl From<common_enums::DecoupledAuthenticationType> for EffectiveAuthenticationType {
     fn from(auth_type: common_enums::DecoupledAuthenticationType) -> Self {
         match auth_type {
@@ -1289,12 +1360,10 @@ impl
             None => ccard.get_card_issuer().ok().map(String::from),
         };
 
-        let pares_status =
-            if card_type == Some("001".to_string()) || card_type == Some("002".to_string()) {
-                Some(CybersourceParesStatus::AuthenticationSuccessful)
-            } else {
-                None
-            };
+        // For all card payments, we are explicitly setting `pares_status` to `AuthenticationSuccessful`
+        // to indicate that the Payer Authentication was successful, regardless of actual ACS response.
+        // This is a default behavior and may be adjusted based on future integration requirements.
+        let pares_status = Some(CybersourceParesStatus::AuthenticationSuccessful);
 
         let security_code = if item
             .router_data
@@ -1349,7 +1418,29 @@ impl
                 )
                 .ok();
                 let effective_authentication_type = authn_data.authentication_type.map(Into::into);
-
+                let network_score: Option<u32> =
+                    if ccard.card_network == Some(common_enums::CardNetwork::CartesBancaires) {
+                        match authn_data.message_extension.as_ref() {
+                            Some(secret) => {
+                                let exposed_value = secret.clone().expose();
+                                match serde_json::from_value::<Vec<MessageExtensionAttribute>>(
+                                    exposed_value,
+                                ) {
+                                    Ok(exts) => extract_score_id(&exts),
+                                    Err(err) => {
+                                        router_env::logger::error!(
+                                            "Failed to deserialize message_extension: {:?}",
+                                            err
+                                        );
+                                        None
+                                    }
+                                }
+                            }
+                            None => None,
+                        }
+                    } else {
+                        None
+                    };
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1366,6 +1457,11 @@ impl
                     eci_raw: authn_data.eci.clone(),
                     authentication_date,
                     effective_authentication_type,
+                    challenge_code: authn_data.challenge_code.clone(),
+                    pares_status_reason: authn_data.challenge_code_reason.clone(),
+                    challenge_cancel_code: authn_data.challenge_cancel.clone(),
+                    network_score,
+                    acs_transaction_id: authn_data.acs_trans_id.clone(),
                 }
             });
 
@@ -1406,12 +1502,10 @@ impl
             Err(_) => None,
         };
 
-        let pares_status =
-            if card_type == Some("001".to_string()) || card_type == Some("002".to_string()) {
-                Some(CybersourceParesStatus::AuthenticationSuccessful)
-            } else {
-                None
-            };
+        // For all card payments, we are explicitly setting `pares_status` to `AuthenticationSuccessful`
+        // to indicate that the Payer Authentication was successful, regardless of actual ACS response.
+        // This is a default behavior and may be adjusted based on future integration requirements.
+        let pares_status = Some(CybersourceParesStatus::AuthenticationSuccessful);
 
         let payment_information = PaymentInformation::Cards(Box::new(CardPaymentInformation {
             card: Card {
@@ -1451,6 +1545,29 @@ impl
                     date_time::DateFormat::YYYYMMDDHHmmss,
                 )
                 .ok();
+                let network_score: Option<u32> =
+                    if ccard.card_network == Some(common_enums::CardNetwork::CartesBancaires) {
+                        match authn_data.message_extension.as_ref() {
+                            Some(secret) => {
+                                let exposed_value = secret.clone().expose();
+                                match serde_json::from_value::<Vec<MessageExtensionAttribute>>(
+                                    exposed_value,
+                                ) {
+                                    Ok(exts) => extract_score_id(&exts),
+                                    Err(err) => {
+                                        router_env::logger::error!(
+                                            "Failed to deserialize message_extension: {:?}",
+                                            err
+                                        );
+                                        None
+                                    }
+                                }
+                            }
+                            None => None,
+                        }
+                    } else {
+                        None
+                    };
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1467,6 +1584,11 @@ impl
                     eci_raw: authn_data.eci.clone(),
                     authentication_date,
                     effective_authentication_type,
+                    challenge_code: authn_data.challenge_code.clone(),
+                    pares_status_reason: authn_data.challenge_code_reason.clone(),
+                    challenge_cancel_code: authn_data.challenge_cancel.clone(),
+                    network_score,
+                    acs_transaction_id: authn_data.acs_trans_id.clone(),
                 }
             });
 
@@ -1510,12 +1632,10 @@ impl
             Err(_) => None,
         };
 
-        let pares_status =
-            if card_type == Some("001".to_string()) || card_type == Some("002".to_string()) {
-                Some(CybersourceParesStatus::AuthenticationSuccessful)
-            } else {
-                None
-            };
+        // For all card payments, we are explicitly setting `pares_status` to `AuthenticationSuccessful`
+        // to indicate that the Payer Authentication was successful, regardless of actual ACS response.
+        // This is a default behavior and may be adjusted based on future integration requirements.
+        let pares_status = Some(CybersourceParesStatus::AuthenticationSuccessful);
 
         let payment_information =
             PaymentInformation::NetworkToken(Box::new(NetworkTokenPaymentInformation {
@@ -1556,6 +1676,30 @@ impl
                     date_time::DateFormat::YYYYMMDDHHmmss,
                 )
                 .ok();
+                let network_score: Option<u32> = if token_data.card_network
+                    == Some(common_enums::CardNetwork::CartesBancaires)
+                {
+                    match authn_data.message_extension.as_ref() {
+                        Some(secret) => {
+                            let exposed_value = secret.clone().expose();
+                            match serde_json::from_value::<Vec<MessageExtensionAttribute>>(
+                                exposed_value,
+                            ) {
+                                Ok(exts) => extract_score_id(&exts),
+                                Err(err) => {
+                                    router_env::logger::error!(
+                                        "Failed to deserialize message_extension: {:?}",
+                                        err
+                                    );
+                                    None
+                                }
+                            }
+                        }
+                        None => None,
+                    }
+                } else {
+                    None
+                };
                 CybersourceConsumerAuthInformation {
                     pares_status,
                     ucaf_collection_indicator,
@@ -1572,6 +1716,11 @@ impl
                     eci_raw: authn_data.eci.clone(),
                     authentication_date,
                     effective_authentication_type,
+                    challenge_code: authn_data.challenge_code.clone(),
+                    pares_status_reason: authn_data.challenge_code_reason.clone(),
+                    challenge_cancel_code: authn_data.challenge_cancel.clone(),
+                    network_score,
+                    acs_transaction_id: authn_data.acs_trans_id.clone(),
                 }
             });
 
@@ -1707,12 +1856,10 @@ impl
             None => ccard.get_card_issuer().ok().map(String::from),
         };
 
-        let pares_status =
-            if card_type == Some("001".to_string()) || card_type == Some("002".to_string()) {
-                Some(CybersourceParesStatus::AuthenticationSuccessful)
-            } else {
-                None
-            };
+        // For all card payments, we are explicitly setting `pares_status` to `AuthenticationSuccessful`
+        // to indicate that the Payer Authentication was successful, regardless of actual ACS response.
+        // This is a default behavior and may be adjusted based on future integration requirements.
+        let pares_status = Some(CybersourceParesStatus::AuthenticationSuccessful);
 
         let payment_information = PaymentInformation::Cards(Box::new(CardPaymentInformation {
             card: Card {
@@ -1757,6 +1904,11 @@ impl
             eci_raw: None,
             authentication_date: None,
             effective_authentication_type: None,
+            challenge_code: None,
+            pares_status_reason: None,
+            challenge_cancel_code: None,
+            network_score: None,
+            acs_transaction_id: None,
         });
 
         let merchant_defined_information = item
@@ -1855,6 +2007,11 @@ impl
                 eci_raw: None,
                 authentication_date: None,
                 effective_authentication_type: None,
+                challenge_code: None,
+                pares_status_reason: None,
+                challenge_cancel_code: None,
+                network_score: None,
+                acs_transaction_id: None,
             }),
             merchant_defined_information,
         })
@@ -2000,6 +2157,11 @@ impl
                 eci_raw: None,
                 authentication_date: None,
                 effective_authentication_type: None,
+                challenge_code: None,
+                pares_status_reason: None,
+                challenge_cancel_code: None,
+                network_score: None,
+                acs_transaction_id: None,
             }),
             merchant_defined_information,
         })
@@ -2202,6 +2364,11 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
                                                 eci_raw: None,
                                                 authentication_date: None,
                                                 effective_authentication_type: None,
+                                                challenge_code: None,
+                                                pares_status_reason: None,
+                                                challenge_cancel_code: None,
+                                                network_score: None,
+                                                acs_transaction_id: None,
                                             },
                                         ),
                                     })
@@ -2471,6 +2638,7 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>
         )
         .then_some(true);
 
+        let cavv_algorithm = Some("2".to_string());
         Ok(Self {
             processing_information: ProcessingInformation {
                 capture_options: Some(CaptureOptions {
@@ -2484,6 +2652,7 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>
                 capture: None,
                 commerce_indicator: String::from("internet"),
                 payment_solution: None,
+                cavv_algorithm,
             },
             order_information: OrderInformationWithBill {
                 amount_details: Amount {
@@ -2509,6 +2678,7 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>
     ) -> Result<Self, Self::Error> {
         let connector_merchant_config =
             CybersourceConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?;
+        let cavv_algorithm = Some("2".to_string());
 
         Ok(Self {
             processing_information: ProcessingInformation {
@@ -2532,6 +2702,7 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>
                 capture: None,
                 capture_options: None,
                 payment_solution: None,
+                cavv_algorithm,
             },
             order_information: OrderInformationIncrementalAuthorization {
                 amount_details: AdditionalAmount {
diff --git a/crates/hyperswitch_connectors/src/connectors/gpayments.rs b/crates/hyperswitch_connectors/src/connectors/gpayments.rs
index 946879d8b72..945852cf7a1 100644
--- a/crates/hyperswitch_connectors/src/connectors/gpayments.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gpayments.rs
@@ -394,6 +394,8 @@ impl
                 trans_status: response.trans_status.into(),
                 authentication_value: response.authentication_value,
                 eci: response.eci,
+                challenge_cancel: None,
+                challenge_code_reason: None,
             }),
             ..data.clone()
         })
diff --git a/crates/hyperswitch_connectors/src/connectors/gpayments/transformers.rs b/crates/hyperswitch_connectors/src/connectors/gpayments/transformers.rs
index b35679bd998..11f58d278a4 100644
--- a/crates/hyperswitch_connectors/src/connectors/gpayments/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gpayments/transformers.rs
@@ -295,6 +295,10 @@ impl
                 ds_trans_id: Some(response_auth.ds_trans_id),
                 connector_metadata: None,
                 eci: None,
+                challenge_code: None,
+                challenge_cancel: None,
+                challenge_code_reason: None,
+                message_extension: None,
             });
         Ok(Self {
             response,
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera.rs b/crates/hyperswitch_connectors/src/connectors/netcetera.rs
index 36fa194ca1b..a2745dc4b08 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera.rs
@@ -220,6 +220,8 @@ impl IncomingWebhook for Netcetera {
                 .unwrap_or(common_enums::TransactionStatus::InformationOnly),
             authentication_value: webhook_body.authentication_value,
             eci: webhook_body.eci,
+            challenge_cancel: webhook_body.challenge_cancel,
+            challenge_code_reason: webhook_body.trans_status_reason,
         })
     }
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
index 7cd34ec9371..c0691c5ffdf 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
@@ -1713,15 +1713,6 @@ pub struct SplitSdkType {
     limited_ind: Option<String>,
 }
 
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct MessageExtensionAttribute {
-    id: String,
-    name: String,
-    criticality_indicator: bool,
-    data: String,
-}
-
 #[derive(Serialize, Deserialize, Debug, Clone)]
 pub enum ThreeDSReqAuthMethod {
     /// No 3DS Requestor authentication occurred (i.e. cardholder "logged in" as guest)
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
index 37238722b72..fc334d68167 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
@@ -5,7 +5,8 @@ use hyperswitch_domain_models::{
     router_data::{ConnectorAuthType, ErrorResponse},
     router_flow_types::authentication::{Authentication, PreAuthentication},
     router_request_types::authentication::{
-        AuthNFlowType, ChallengeParams, ConnectorAuthenticationRequestData, PreAuthNRequestData,
+        AuthNFlowType, ChallengeParams, ConnectorAuthenticationRequestData,
+        MessageExtensionAttribute, PreAuthNRequestData,
     },
     router_response_types::AuthenticationResponseData,
 };
@@ -164,6 +165,21 @@ impl
                     connector_metadata: None,
                     ds_trans_id: response.authentication_response.ds_trans_id,
                     eci: response.eci,
+                    challenge_code: response.three_ds_requestor_challenge_ind,
+                    challenge_cancel: response.challenge_cancel,
+                    challenge_code_reason: response.trans_status_reason,
+                    message_extension: response.message_extension.and_then(|v| {
+                        match serde_json::to_value(&v) {
+                            Ok(val) => Some(Secret::new(val)),
+                            Err(e) => {
+                                router_env::logger::error!(
+                                    "Failed to serialize message_extension: {:?}",
+                                    e
+                                );
+                                None
+                            }
+                        }
+                    }),
                 })
             }
             NetceteraAuthenticationResponse::Error(error_response) => Err(ErrorResponse {
@@ -432,8 +448,8 @@ pub struct NetceteraAuthenticationRequest {
     pub merchant: Option<netcetera_types::MerchantData>,
     pub broad_info: Option<String>,
     pub device_render_options: Option<netcetera_types::DeviceRenderingOptionsSupported>,
-    pub message_extension: Option<Vec<netcetera_types::MessageExtensionAttribute>>,
-    pub challenge_message_extension: Option<Vec<netcetera_types::MessageExtensionAttribute>>,
+    pub message_extension: Option<Vec<MessageExtensionAttribute>>,
+    pub challenge_message_extension: Option<Vec<MessageExtensionAttribute>>,
     pub browser_information: Option<netcetera_types::Browser>,
     #[serde(rename = "threeRIInd")]
     pub three_ri_ind: Option<String>,
@@ -640,6 +656,11 @@ pub struct NetceteraAuthenticationSuccessResponse {
     pub authentication_response: AuthenticationResponse,
     #[serde(rename = "base64EncodedChallengeRequest")]
     pub encoded_challenge_request: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub trans_status_reason: Option<String>,
+    #[serde(rename = "threeDSRequestorChallengeInd")]
+    pub three_ds_requestor_challenge_ind: Option<String>,
+    pub message_extension: Option<Vec<MessageExtensionAttribute>>,
 }
 
 #[derive(Debug, Deserialize, Serialize)]
@@ -708,4 +729,6 @@ pub struct ResultsResponseData {
 
     /// Optional object containing error details if any errors occurred during the process.
     pub error_details: Option<NetceteraErrorDetails>,
+    pub challenge_cancel: Option<String>,
+    pub trans_status_reason: Option<String>,
 }
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index b68ecb83f30..31833475db3 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -20,7 +20,8 @@ use hyperswitch_domain_models::{
         Authorize, Capture, CompleteAuthorize, PSync, Void,
     },
     router_request_types::{
-        BrowserInformation, PaymentsAuthorizeData, PaymentsPreProcessingData, ResponseId,
+        authentication::MessageExtensionAttribute, BrowserInformation, PaymentsAuthorizeData,
+        PaymentsPreProcessingData, ResponseId,
     },
     router_response_types::{
         MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData,
@@ -501,26 +502,10 @@ pub struct NuveiACSResponse {
     pub message_type: String,
     pub message_version: String,
     pub trans_status: Option<LiabilityShift>,
-    pub message_extension: Vec<MessageExtension>,
+    pub message_extension: Vec<MessageExtensionAttribute>,
     pub acs_signed_content: Option<serde_json::Value>,
 }
 
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MessageExtension {
-    pub name: String,
-    pub id: String,
-    pub criticality_indicator: bool,
-    pub data: MessageExtensionData,
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MessageExtensionData {
-    pub value_one: String,
-    pub value_two: String,
-}
-
 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
 pub enum LiabilityShift {
     #[serde(rename = "Y", alias = "1")]
diff --git a/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs b/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
index 7f98cf9d958..014681b7759 100644
--- a/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
+++ b/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
@@ -486,6 +486,8 @@ impl
                 trans_status: response.trans_status.into(),
                 authentication_value: response.authentication_value,
                 eci: response.eci,
+                challenge_cancel: None,
+                challenge_code_reason: None,
             }),
             ..data.clone()
         })
diff --git a/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs b/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs
index 82387266ed3..de34d423803 100644
--- a/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs
@@ -184,6 +184,10 @@ impl
                     connector_metadata: None,
                     ds_trans_id: Some(response.ds_trans_id),
                     eci: None,
+                    challenge_code: None,
+                    challenge_cancel: None,
+                    challenge_code_reason: None,
+                    message_extension: None,
                 })
             }
             ThreedsecureioAuthenticationResponse::Error(err_response) => match *err_response {
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
index 3837daae67b..2a795422519 100644
--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
@@ -485,6 +485,8 @@ impl<F, T>
                             ds_trans_id: dynamic_data.ds_trans_id,
                         }),
                     trans_status: item.response.authentication_details.trans_status,
+                    challenge_cancel: None,
+                    challenge_code_reason: None,
                 },
             }),
             ..item.data
@@ -822,6 +824,10 @@ pub struct ThreeDsAuthDetails {
     pub acs_signed_content: Option<String>,
     pub authentication_value: Option<Secret<String>>,
     pub eci: Option<String>,
+    pub challenge_code: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
+    pub message_extension: Option<common_utils::pii::SecretSerdeValue>,
 }
 
 #[derive(Debug, Serialize, Clone, Copy, Deserialize)]
@@ -990,6 +996,10 @@ impl<F, T>
                         connector_metadata: None,
                         ds_trans_id: Some(auth_response.three_ds_auth_response.ds_trans_id),
                         eci: auth_response.three_ds_auth_response.eci,
+                        challenge_code: auth_response.three_ds_auth_response.challenge_code,
+                        challenge_cancel: auth_response.three_ds_auth_response.challenge_cancel,
+                        challenge_code_reason: auth_response.three_ds_auth_response.challenge_code_reason,
+                        message_extension:  auth_response.three_ds_auth_response.message_extension,
                     },
                 })
             }
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 9aca1f867f9..058f3bfce3b 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -712,6 +712,11 @@ pub struct AuthenticationData {
     pub message_version: Option<common_utils::types::SemanticVersion>,
     pub ds_trans_id: Option<String>,
     pub created_at: time::PrimitiveDateTime,
+    pub challenge_code: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
+    pub message_extension: Option<pii::SecretSerdeValue>,
+    pub acs_trans_id: Option<String>,
     pub authentication_type: Option<common_enums::DecoupledAuthenticationType>,
 }
 
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
index 31b0e1a46ae..a26d0c7689f 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
@@ -69,6 +69,15 @@ impl AuthNFlowType {
     }
 }
 
+#[derive(Serialize, Deserialize, Debug, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct MessageExtensionAttribute {
+    pub id: String,
+    pub name: String,
+    pub criticality_indicator: bool,
+    pub data: String,
+}
+
 #[derive(Clone, Default, Debug)]
 pub struct PreAuthNRequestData {
     // card data
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs b/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
index f37af7fa6d3..4edcdb7962f 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
@@ -128,6 +128,10 @@ pub struct AuthenticationDetails {
     pub connector_metadata: Option<serde_json::Value>,
     pub ds_trans_id: Option<String>,
     pub eci: Option<String>,
+    pub challenge_code: Option<String>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
+    pub message_extension: Option<common_utils::pii::SecretSerdeValue>,
 }
 
 #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
@@ -136,6 +140,8 @@ pub struct PostAuthenticationDetails {
     pub token_details: Option<TokenDetails>,
     pub dynamic_data_details: Option<DynamicData>,
     pub trans_status: Option<common_enums::TransactionStatus>,
+    pub challenge_cancel: Option<String>,
+    pub challenge_code_reason: Option<String>,
 }
 
 #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs
index dc9d11b0323..b5181dee31e 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types.rs
@@ -3,7 +3,7 @@ pub mod fraud_check;
 pub mod revenue_recovery;
 use std::collections::HashMap;
 
-use common_utils::{request::Method, types::MinorUnit};
+use common_utils::{pii, request::Method, types::MinorUnit};
 pub use disputes::{AcceptDisputeResponse, DefendDisputeResponse, SubmitEvidenceResponse};
 
 use crate::{
@@ -91,7 +91,7 @@ pub struct TaxCalculationResponseData {
 pub struct MandateReference {
     pub connector_mandate_id: Option<String>,
     pub payment_method_id: Option<String>,
-    pub mandate_metadata: Option<common_utils::pii::SecretSerdeValue>,
+    pub mandate_metadata: Option<pii::SecretSerdeValue>,
     pub connector_mandate_request_reference_id: Option<String>,
 }
 
@@ -546,18 +546,24 @@ pub enum AuthenticationResponseData {
         connector_metadata: Option<serde_json::Value>,
         ds_trans_id: Option<String>,
         eci: Option<String>,
+        challenge_code: Option<String>,
+        challenge_cancel: Option<String>,
+        challenge_code_reason: Option<String>,
+        message_extension: Option<pii::SecretSerdeValue>,
     },
     PostAuthNResponse {
         trans_status: common_enums::TransactionStatus,
         authentication_value: Option<masking::Secret<String>>,
         eci: Option<String>,
+        challenge_cancel: Option<String>,
+        challenge_code_reason: Option<String>,
     },
 }
 
 #[derive(Debug, Clone)]
 pub struct CompleteAuthorizeRedirectResponse {
     pub params: Option<masking::Secret<String>>,
-    pub payload: Option<common_utils::pii::SecretSerdeValue>,
+    pub payload: Option<pii::SecretSerdeValue>,
 }
 
 /// Represents details of a payment method.
diff --git a/crates/hyperswitch_interfaces/src/authentication.rs b/crates/hyperswitch_interfaces/src/authentication.rs
index 6c2488767b2..cdde955e5ef 100644
--- a/crates/hyperswitch_interfaces/src/authentication.rs
+++ b/crates/hyperswitch_interfaces/src/authentication.rs
@@ -9,4 +9,8 @@ pub struct ExternalAuthenticationPayload {
     pub authentication_value: Option<masking::Secret<String>>,
     /// eci
     pub eci: Option<String>,
+    /// Indicates whether the challenge was canceled by the user or system.
+    pub challenge_cancel: Option<String>,
+    /// Reason for the challenge code, if applicable.
+    pub challenge_code_reason: Option<String>,
 }
diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs
index b6c304168c0..e1f9b02c881 100644
--- a/crates/router/src/core/authentication/utils.rs
+++ b/crates/router/src/core/authentication/utils.rs
@@ -100,6 +100,10 @@ pub async fn update_trackers<F: Clone, Req>(
                 connector_metadata,
                 ds_trans_id,
                 eci,
+                challenge_code,
+                challenge_cancel,
+                challenge_code_reason,
+                message_extension,
             } => {
                 authentication_value
                     .async_map(|auth_val| {
@@ -132,12 +136,18 @@ pub async fn update_trackers<F: Clone, Req>(
                     connector_metadata,
                     ds_trans_id,
                     eci,
+                    challenge_code,
+                    challenge_cancel,
+                    challenge_code_reason,
+                    message_extension,
                 }
             }
             AuthenticationResponseData::PostAuthNResponse {
                 trans_status,
                 authentication_value,
                 eci,
+                challenge_cancel,
+                challenge_code_reason,
             } => {
                 authentication_value
                     .async_map(|auth_val| {
@@ -160,6 +170,8 @@ pub async fn update_trackers<F: Clone, Req>(
                     ),
                     trans_status,
                     eci,
+                    challenge_cancel,
+                    challenge_code_reason,
                 }
             }
             AuthenticationResponseData::PreAuthVersionCallResponse {
@@ -284,6 +296,10 @@ pub async fn create_new_authentication(
         browser_info: None,
         email: None,
         profile_acquirer_id: None,
+        challenge_code: None,
+        challenge_cancel: None,
+        challenge_code_reason: None,
+        message_extension: None,
     };
     state
         .store
diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs
index 10df4034c92..2abdfdc8ee6 100644
--- a/crates/router/src/core/payments/types.rs
+++ b/crates/router/src/core/payments/types.rs
@@ -391,6 +391,11 @@ impl
                 message_version,
                 ds_trans_id: authentication.ds_trans_id.clone(),
                 authentication_type: authentication.authentication_type,
+                challenge_code: authentication.challenge_code.clone(),
+                challenge_cancel: authentication.challenge_cancel.clone(),
+                challenge_code_reason: authentication.challenge_code_reason.clone(),
+                message_extension: authentication.message_extension.clone(),
+                acs_trans_id: authentication.acs_trans_id.clone(),
             })
         } else {
             Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index 91d56f4de1c..a7690fc2923 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -609,6 +609,10 @@ pub async fn create_new_authentication(
         browser_info: None,
         email: None,
         profile_acquirer_id,
+        challenge_code: None,
+        challenge_cancel: None,
+        challenge_code_reason: None,
+        message_extension: None,
     };
     state
         .store
diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs
index 954e33f76b5..3f19b82d075 100644
--- a/crates/router/src/core/unified_authentication_service/utils.rs
+++ b/crates/router/src/core/unified_authentication_service/utils.rs
@@ -235,6 +235,10 @@ pub async fn external_authentication_update_trackers<F: Clone, Req>(
                         connector_metadata: authentication_details.connector_metadata,
                         ds_trans_id: authentication_details.ds_trans_id,
                         eci: authentication_details.eci,
+                        challenge_code: authentication_details.challenge_code,
+                        challenge_cancel: authentication_details.challenge_cancel,
+                        challenge_code_reason: authentication_details.challenge_code_reason,
+                        message_extension: authentication_details.message_extension,
                     },
                 )
             }
@@ -271,6 +275,8 @@ pub async fn external_authentication_update_trackers<F: Clone, Req>(
                         ),
                         trans_status,
                         eci: authentication_details.eci,
+                        challenge_cancel: authentication_details.challenge_cancel,
+                        challenge_code_reason: authentication_details.challenge_code_reason,
                     },
                 )
             }
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index cc1dc7bc506..71d13813310 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -1400,6 +1400,8 @@ async fn external_authentication_incoming_webhook_flow(
             ),
             trans_status,
             eci: authentication_details.eci,
+            challenge_cancel: authentication_details.challenge_cancel,
+            challenge_code_reason: authentication_details.challenge_code_reason,
         };
         let authentication =
             if let webhooks::ObjectReferenceId::ExternalAuthenticationID(authentication_id_type) =
diff --git a/crates/router/src/db/authentication.rs b/crates/router/src/db/authentication.rs
index cc892cc513a..74600d4284e 100644
--- a/crates/router/src/db/authentication.rs
+++ b/crates/router/src/db/authentication.rs
@@ -168,6 +168,10 @@ impl AuthenticationInterface for MockDb {
             browser_info: authentication.browser_info,
             email: authentication.email,
             profile_acquirer_id: authentication.profile_acquirer_id,
+            challenge_code: authentication.challenge_code,
+            challenge_cancel: authentication.challenge_cancel,
+            challenge_code_reason: authentication.challenge_code_reason,
+            message_extension: authentication.message_extension,
         };
         authentications.push(authentication.clone());
         Ok(authentication)
diff --git a/migrations/2025-07-25-115018_add_authn_fields_challenge_code_cancel_reason_message_extension/down.sql b/migrations/2025-07-25-115018_add_authn_fields_challenge_code_cancel_reason_message_extension/down.sql
new file mode 100644
index 00000000000..a0c12177640
--- /dev/null
+++ b/migrations/2025-07-25-115018_add_authn_fields_challenge_code_cancel_reason_message_extension/down.sql
@@ -0,0 +1,5 @@
+ALTER TABLE authentication
+    DROP COLUMN IF EXISTS challenge_code,
+    DROP COLUMN IF EXISTS challenge_cancel,
+    DROP COLUMN IF EXISTS challenge_code_reason,
+    DROP COLUMN IF EXISTS message_extension;
\ No newline at end of file
diff --git a/migrations/2025-07-25-115018_add_authn_fields_challenge_code_cancel_reason_message_extension/up.sql b/migrations/2025-07-25-115018_add_authn_fields_challenge_code_cancel_reason_message_extension/up.sql
new file mode 100644
index 00000000000..beed7efa399
--- /dev/null
+++ b/migrations/2025-07-25-115018_add_authn_fields_challenge_code_cancel_reason_message_extension/up.sql
@@ -0,0 +1,5 @@
+ALTER TABLE authentication
+    ADD COLUMN challenge_code VARCHAR NULL,
+    ADD COLUMN challenge_cancel VARCHAR NULL,
+    ADD COLUMN challenge_code_reason VARCHAR NULL,
+    ADD COLUMN message_extension JSONB NULL;
 | 
	2025-07-25T07:36:19Z | 
	## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [X] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
This PR introduces the following changes
 1. Added additional authentication fields for 3ds external authentication, the fields are as following
  - challenge_code
  - challenge_code_reason
  - challenge_cancel
  - message_extension
 2. Added additional fields for Cybersource payments request corresponding to the newly added auth fields
 3. Added additional request fields for Netcetera, and other 3ds connectors corresponding to the newly added auth fields
 
Context - Cybersource payments via Netcetera are failing for a France based acquirer in prod, the above fields are added to fix the same.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
6. `crates/router/src/configs`
7. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
### Card used for testing (mastercard with challenge flow)
5306 8899 4283 3340
### Successful 3DS challenge completion flow 
  _Tested using local hyperswitch sdk and hyperswitch backend_ 
[Test video](https://drive.google.com/file/d/1rV5mnly1WdvLk8Ff1_r16vAxBqgGJVUJ/view?usp=sharing)
Connector Request for Cybersource: 
<img width="1720" height="321" alt="Screenshot 2025-07-30 at 8 39 57 PM" src="https://github.com/user-attachments/assets/3fa4c555-7d11-4482-b232-baa8713af24c" />
> cavvAlgorithm - "02"
> paresStatus - "Y"
> challengeCode - Null (Please note - This is not supposed to be null, checking with Netcetera team since it's coming as None from Netcetera) Fix merged in [PR](https://github.com/juspay/hyperswitch/pull/8850) 
> paresStatusReason - Null (Please note - Null is not expected here,checking this with Netcetera team) Fix raised here [PR](https://github.com/juspay/hyperswitch/pull/8907) 
> challengeCancelCode - Null (Please note - Null is expected here, as challenge is not cancelled)
> networkScore - Null (Please note - Null is expected here, as card is not CartesBancaires and also since it is not production environment - messageExtension field is only available on production)
> acsTransactionId - "9187c2cb-54f8-4e70-a63b-537046c2b34d"
### 3DS challenge cancel flow
   _Tested using local hyperswitch sdk and hyperswitch backend_ 
[Test video](https://drive.google.com/file/d/1jIAtfLotxhZsroT-xYUEttUXapuRn0Sv/view?usp=sharing)
Incoming Webhook from Netcetera on cancelling challenge: 
<img width="1720" height="198" alt="Screenshot 2025-07-30 at 9 23 53 PM" src="https://github.com/user-attachments/assets/93b0eacd-676c-4d88-993b-77ef78e3da90" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [X] I formatted the code `cargo +nightly fmt --all`
- [X] I addressed lints thrown by `cargo clippy`
- [X] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
 | 
	f3c0a9bfb05af5c9c826799f0e16e9c9460870f5 | 
	
### Card used for testing (mastercard with challenge flow)
5306 8899 4283 3340
### Successful 3DS challenge completion flow 
  _Tested using local hyperswitch sdk and hyperswitch backend_ 
[Test video](https://drive.google.com/file/d/1rV5mnly1WdvLk8Ff1_r16vAxBqgGJVUJ/view?usp=sharing)
Connector Request for Cybersource: 
<img width="1720" height="321" alt="Screenshot 2025-07-30 at 8 39 57 PM" src="https://github.com/user-attachments/assets/3fa4c555-7d11-4482-b232-baa8713af24c" />
> cavvAlgorithm - "02"
> paresStatus - "Y"
> challengeCode - Null (Please note - This is not supposed to be null, checking with Netcetera team since it's coming as None from Netcetera) Fix merged in [PR](https://github.com/juspay/hyperswitch/pull/8850) 
> paresStatusReason - Null (Please note - Null is not expected here,checking this with Netcetera team) Fix raised here [PR](https://github.com/juspay/hyperswitch/pull/8907) 
> challengeCancelCode - Null (Please note - Null is expected here, as challenge is not cancelled)
> networkScore - Null (Please note - Null is expected here, as card is not CartesBancaires and also since it is not production environment - messageExtension field is only available on production)
> acsTransactionId - "9187c2cb-54f8-4e70-a63b-537046c2b34d"
### 3DS challenge cancel flow
   _Tested using local hyperswitch sdk and hyperswitch backend_ 
[Test video](https://drive.google.com/file/d/1jIAtfLotxhZsroT-xYUEttUXapuRn0Sv/view?usp=sharing)
Incoming Webhook from Netcetera on cancelling challenge: 
<img width="1720" height="198" alt="Screenshot 2025-07-30 at 9 23 53 PM" src="https://github.com/user-attachments/assets/93b0eacd-676c-4d88-993b-77ef78e3da90" />
 | 
			Subsets and Splits
				
	
				
			
				
No community queries yet
The top public SQL queries from the community will appear here once available.
