Issue:
Bug: [REFACTOR] : Add feature metadata in payments response



 Currently we are adding feature metadata in the Payment Response. We'll incrementally populate the fields

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
 Add feature_metadata in the payments response for revenue recovery in v2. Also added it in the open api spec


### 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 Org and MA and MCA in v2
- Create a payment in v2
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_xwf1Kn6sgcq34ih9HHPa' \
--header 'Authorization: api-key=dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--data-raw '{
    "amount_details": {
        "order_amount": 100,
        "currency": "USD"
    },
    "capture_method": "manual",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Dough"
        },
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "first_name": "John",
            "last_name": "Dough",
            "city": "Karwar",
            "zip": "581301",
            "state": "Karnataka"
        },
        "email": "example@example.com"
    }
}'
```
- Confirm the payment
```
Request 
curl --location 'http://localhost:8080/v2/payments/12345_pay_019813ec28f073d38d5fe2d117a0a660/confirm-intent' \
--header 'x-client-secret: cs_019813ec291571039181693bb212e6dd' \
--header 'x-profile-id: pro_xwf1Kn6sgcq34ih9HHPa' \
--header 'Authorization: api-key=dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "25",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit"
}'
```
- Feature Metadata would be present 
```
Response

{
    "id": "12345_pay_019813ec28f073d38d5fe2d117a0a660",
    "status": "failed",
    "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": null
    },
    "customer_id": null,
    "connector": "stripe",
    "created": "2025-07-16T15:48:20.872Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": null,
    "connector_reference_id": null,
    "merchant_connector_id": "mca_to621nCh9AUHtzEEgQWp",
    "browser_info": null,
    "error": {
        "code": "No error code",
        "message": "No error message",
        "unified_code": null,
        "unified_message": null,
        "network_advice_code": null,
        "network_decline_code": null,
        "network_error_message": 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
}
```
## 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


Testing:
- Create a Org and MA and MCA in v2
- Create a payment in v2
```
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_xwf1Kn6sgcq34ih9HHPa' \
--header 'Authorization: api-key=dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--data-raw '{
    "amount_details": {
        "order_amount": 100,
        "currency": "USD"
    },
    "capture_method": "manual",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Dough"
        },
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "first_name": "John",
            "last_name": "Dough",
            "city": "Karwar",
            "zip": "581301",
            "state": "Karnataka"
        },
        "email": "example@example.com"
    }
}'
```
- Confirm the payment
```
Request 
curl --location 'http://localhost:8080/v2/payments/12345_pay_019813ec28f073d38d5fe2d117a0a660/confirm-intent' \
--header 'x-client-secret: cs_019813ec291571039181693bb212e6dd' \
--header 'x-profile-id: pro_xwf1Kn6sgcq34ih9HHPa' \
--header 'Authorization: api-key=dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "25",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit"
}'
```
- Feature Metadata would be present 
```
Response

{
    "id": "12345_pay_019813ec28f073d38d5fe2d117a0a660",
    "status": "failed",
    "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": null
    },
    "customer_id": null,
    "connector": "stripe",
    "created": "2025-07-16T15:48:20.872Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": null,
    "connector_reference_id": null,
    "merchant_connector_id": "mca_to621nCh9AUHtzEEgQWp",
    "browser_info": null,
    "error": {
        "code": "No error code",
        "message": "No error message",
        "unified_code": null,
        "unified_message": null,
        "network_advice_code": null,
        "network_decline_code": null,
        "network_error_message": 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
}
```

Patch:
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f3d7d9b675c..cef094a98d5 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5808,6 +5808,9 @@ pub struct PaymentsResponse {
     /// Stringified connector raw response body. Only returned if `return_raw_connector_response` is true
     #[schema(value_type = Option<String>)]
     pub raw_connector_response: Option<Secret<String>>,
+
+    /// Additional data that might be required by hyperswitch based on the additional features.
+    pub feature_metadata: Option<FeatureMetadata>,
 }
 
 #[cfg(feature = "v2")]
@@ -7823,13 +7826,13 @@ pub struct FeatureMetadata {
     /// Recurring payment details required for apple pay Merchant Token
     pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
     /// revenue recovery data for payment intent
-    pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
+    pub revenue_recovery: Option<PaymentRevenueRecoveryMetadata>,
 }
 
 #[cfg(feature = "v2")]
 impl FeatureMetadata {
     pub fn get_retry_count(&self) -> Option<u16> {
-        self.payment_revenue_recovery_metadata
+        self.revenue_recovery
             .as_ref()
             .map(|metadata| metadata.total_retry_count)
     }
@@ -7842,7 +7845,7 @@ impl FeatureMetadata {
             redirect_response: self.redirect_response,
             search_tags: self.search_tags,
             apple_pay_recurring_details: self.apple_pay_recurring_details,
-            payment_revenue_recovery_metadata: Some(payment_revenue_recovery_metadata),
+            revenue_recovery: Some(payment_revenue_recovery_metadata),
         }
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index 35f619334c3..fd24c3d9f4b 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -145,7 +145,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
             redirect_response,
             search_tags,
             apple_pay_recurring_details,
-            payment_revenue_recovery_metadata,
+            revenue_recovery: payment_revenue_recovery_metadata,
         } = from;
 
         Self {
@@ -172,8 +172,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
             search_tags,
             apple_pay_recurring_details: apple_pay_recurring_details
                 .map(|value| value.convert_back()),
-            payment_revenue_recovery_metadata: payment_revenue_recovery_metadata
-                .map(|value| value.convert_back()),
+            revenue_recovery: payment_revenue_recovery_metadata.map(|value| value.convert_back()),
         }
     }
 }
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 1df3b6ef293..6785e429984 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1989,6 +1989,7 @@ where
             is_iframe_redirection_enabled: None,
             merchant_reference_id: payment_intent.merchant_reference_id.clone(),
             raw_connector_response,
+            feature_metadata: None,
         };
 
         Ok(services::ApplicationResponse::JsonWithHeaders((
@@ -2089,6 +2090,7 @@ 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,
         };
 
         Ok(services::ApplicationResponse::JsonWithHeaders((
@@ -5215,7 +5217,7 @@ impl ForeignFrom<&diesel_models::types::FeatureMetadata> for api_models::payment
             .clone()
             .map(api_models::payments::RedirectResponse::foreign_from);
         Self {
-            payment_revenue_recovery_metadata: revenue_recovery,
+            revenue_recovery,
             apple_pay_recurring_details: apple_pay_details,
             redirect_response: redirect_res,
             search_tags: feature_metadata.search_tags.clone(),