Bug: Nexixpay MIT & order_id fix



1. We should use same order id of max length 18 among multiple payment calls made to nexi for an order.
2. Capture and Cancel calls for manual MITs are failing as we don't store connector_metadata in nexi mandate response.
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index 2cf30de8edf..ff8dbad6424 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -29,7 +29,6 @@ use hyperswitch_domain_models::{
 };
 use hyperswitch_interfaces::{consts::NO_ERROR_CODE, errors};
 use masking::{ExposeInterface, Secret};
-use rand::distributions::{Alphanumeric, DistString};
 use serde::{Deserialize, Serialize};
 use strum::Display;
 
@@ -43,10 +42,6 @@ use crate::{
     },
 };
 
-fn get_random_string() -> String {
-    Alphanumeric.sample_string(&mut rand::thread_rng(), MAX_ORDER_ID_LENGTH)
-}
-
 #[derive(Clone, Copy, Debug)]
 enum AddressKind {
     Billing,
@@ -541,6 +536,28 @@ pub fn get_error_response(
     }
 }
 
+fn get_nexi_order_id(payment_id: &str) -> CustomResult<String, errors::ConnectorError> {
+    if payment_id.len() > MAX_ORDER_ID_LENGTH {
+        if payment_id.starts_with("pay_") {
+            Ok(payment_id
+                .chars()
+                .take(MAX_ORDER_ID_LENGTH)
+                .collect::<String>())
+        } else {
+            Err(error_stack::Report::from(
+                errors::ConnectorError::MaxFieldLengthViolated {
+                    field_name: "payment_id".to_string(),
+                    connector: "Nexixpay".to_string(),
+                    max_length: MAX_ORDER_ID_LENGTH,
+                    received_length: payment_id.len(),
+                },
+            ))
+        }
+    } else {
+        Ok(payment_id.to_string())
+    }
+}
+
 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct ThreeDSAuthData {
@@ -714,22 +731,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsAuthorizeRouterData>> for NexixpayPaym
     fn try_from(
         item: &NexixpayRouterData<&PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
-        let order_id = if item.router_data.payment_id.len() > MAX_ORDER_ID_LENGTH {
-            if item.router_data.payment_id.starts_with("pay_") {
-                get_random_string()
-            } else {
-                return Err(error_stack::Report::from(
-                    errors::ConnectorError::MaxFieldLengthViolated {
-                        field_name: "payment_id".to_string(),
-                        connector: "Nexixpay".to_string(),
-                        max_length: MAX_ORDER_ID_LENGTH,
-                        received_length: item.router_data.payment_id.len(),
-                    },
-                ));
-            }
-        } else {
-            item.router_data.payment_id.clone()
-        };
+        let order_id = get_nexi_order_id(&item.router_data.payment_id)?;
 
         let billing_address = get_validated_billing_address(item.router_data)?;
         let shipping_address = get_validated_shipping_address(item.router_data)?;
@@ -1124,6 +1126,22 @@ impl<F>
             NexixpayPaymentsResponse::MandateResponse(ref mandate_response) => {
                 let status =
                     AttemptStatus::from(mandate_response.operation.operation_result.clone());
+                let is_auto_capture = item.data.request.is_auto_capture()?;
+                let operation_id = mandate_response.operation.operation_id.clone();
+                let connector_metadata = Some(serde_json::json!(NexixpayConnectorMetaData {
+                    three_d_s_auth_result: None,
+                    three_d_s_auth_response: None,
+                    authorization_operation_id: Some(operation_id.clone()),
+                    cancel_operation_id: None,
+                    capture_operation_id: {
+                        if is_auto_capture {
+                            Some(operation_id)
+                        } else {
+                            None
+                        }
+                    },
+                    psync_flow: NexixpayPaymentIntent::Authorize
+                }));
                 match status {
                     AttemptStatus::Failure => {
                         let response = Err(get_error_response(
@@ -1143,7 +1161,7 @@ impl<F>
                             ),
                             redirection_data: Box::new(None),
                             mandate_reference: Box::new(None),
-                            connector_metadata: None,
+                            connector_metadata,
                             network_txn_id: None,
                             connector_response_reference_id: Some(
                                 mandate_response.operation.order_id.clone(),
@@ -1318,22 +1336,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsCompleteAuthorizeRouterData>>
             )?;
         let capture_type = get_nexixpay_capture_type(item.router_data.request.capture_method)?;
 
-        let order_id = if item.router_data.payment_id.len() > MAX_ORDER_ID_LENGTH {
-            if item.router_data.payment_id.starts_with("pay_") {
-                get_random_string()
-            } else {
-                return Err(error_stack::Report::from(
-                    errors::ConnectorError::MaxFieldLengthViolated {
-                        field_name: "payment_id".to_string(),
-                        connector: "Nexixpay".to_string(),
-                        max_length: MAX_ORDER_ID_LENGTH,
-                        received_length: item.router_data.payment_id.len(),
-                    },
-                ));
-            }
-        } else {
-            item.router_data.payment_id.clone()
-        };
+        let order_id = get_nexi_order_id(&item.router_data.payment_id)?;
         let amount = item.amount.clone();
 
         let billing_address = get_validated_billing_address(item.router_data)?;

## 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 -->
Use same order_id or max length 18 for all payment calls associated with an merchant order. 
We need to store connector_metadata in case of MIT payments also so that MIT payments can be manually captured or cancelled later.

### 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)?
-->
Curls for testing with response:

Payments create:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_n5vnntb0V5gRjNMdwTnPXweumExJV6vYon3lVNzW2BoA3F4S4V0PXDHK3lW7gWHh' \
--data-raw '{
    "amount": 3545,
    "currency": "EUR",
    
    "profile_id":"pro_QEwjCvFhpcLC2azRNZEf",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "4111 1111 1111 1111",
            "card_exp_month": "03",
            "card_exp_year": "30",
            "card_cvc": "737"
        }
    },

    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "setup_future_usage": "off_session", 
    "customer": {
        "id": "customerssh",
        "name": "John Doe",
        "email": "customerssh@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "country": "BR",
            "zip": "94122",
            "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": "BR",
            "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": 3545,
            "account_name": "transaction_processing"
        }
    ],
    "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": "online",
          "accepted_at":"1963-05-03T04:07:52.723Z",
          "online": {
            "ip_address":"127.0.0.1",
            "user_agent": "amet irure esse"
          }
    },
    
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "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   
}'
```

Response:
```
{"payment_id":"pay_cfn9IZqdJU58r5Hc5A8T","merchant_id":"merchant_1759144749","status":"requires_customer_action","amount":3545,"net_amount":3545,"shipping_cost":null,"amount_capturable":3545,"amount_received":null,"connector":"nexixpay","client_secret":"pay_cfn9IZqdJU58r5Hc5A8T_secret_SXeMcpBgyEL2zoVijZ9E","created":"2025-10-01T12:45:53.600Z","currency":"EUR","customer_id":"customerssh","customer":{"id":"customerssh","name":"John Doe","email":"customerssh@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":"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":"30","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":"token_nVp5RBRCLCFnQQH82Y5F","shipping":{"address":{"city":"San Fransico","country":"BR","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":"BR","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":3545,"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":"customerssh@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_cfn9IZqdJU58r5Hc5A8T/merchant_1759144749/pay_cfn9IZqdJU58r5Hc5A8T_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":"customerssh","created_at":1759322753,"expires":1759326353,"secret":"epk_dfc71e93bf654eaabccbfcbcf83fa3e0"},"manual_retry_allowed":null,"connector_transaction_id":"pay_cfn9IZqdJU58r5","frm_message":null,"metadata":null,"connector_metadata":{"apple_pay":null,"airwallex":null,"noon":{"order_category":"pay"},"braintree":null,"adyen":null},"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_cfn9IZqdJU58r5","payment_link":null,"profile_id":"pro_QEwjCvFhpcLC2azRNZEf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_lJPT4aN2CbXmgSAFDmCT","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-10-01T13:00:53.600Z","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_AHMtQP8Qp9y1L8wy2hNi","network_transaction_id":null,"payment_method_status":"inactive","updated":"2025-10-01T12:45:56.426Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"request_extended_authorization":null,"capture_before":null,"merchant_order_reference_id":"test_ord","order_tax_amount":null,"connector_mandate_id":"qAhdJaa3HvEeMxexwg","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,"enable_overcapture":null,"is_overcapture_enabled":null,"network_details":null}
```
Payments retrieve Response:
```
{"payment_id":"pay_cfn9IZqdJU58r5Hc5A8T","merchant_id":"merchant_1759144749","status":"succeeded","amount":3545,"net_amount":3545,"shipping_cost":null,"amount_capturable":0,"amount_received":3545,"connector":"nexixpay","client_secret":"pay_cfn9IZqdJU58r5Hc5A8T_secret_SXeMcpBgyEL2zoVijZ9E","created":"2025-10-01T12:45:53.600Z","currency":"EUR","customer_id":"customerssh","customer":{"id":"customerssh","name":"John Doe","email":"customerssh@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"attempts":[{"attempt_id":"pay_cfn9IZqdJU58r5Hc5A8T_1","status":"charged","amount":3545,"order_tax_amount":null,"currency":"EUR","connector":"nexixpay","error_message":null,"payment_method":"card","connector_transaction_id":"pay_cfn9IZqdJU58r5","capture_method":"automatic","authentication_type":"three_ds","created_at":"2025-10-01T12:45:53.601Z","modified_at":"2025-10-01T12:46:51.867Z","cancellation_reason":null,"mandate_id":null,"error_code":null,"payment_token":"token_nVp5RBRCLCFnQQH82Y5F","connector_metadata":{"psyncFlow":"Authorize","cancelOperationId":null,"threeDSAuthResult":{"authenticationValue":"AAkBBzglVwAAAA3Zl4J0dQAAAAA="},"captureOperationId":"804610282286352749","threeDSAuthResponse":"notneeded","authorizationOperationId":"804610282286352749"},"payment_experience":null,"payment_method_type":"credit","reference_id":"pay_cfn9IZqdJU58r5","unified_code":null,"unified_message":null,"client_source":null,"client_version":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":"30","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":"token_nVp5RBRCLCFnQQH82Y5F","shipping":{"address":{"city":"San Fransico","country":"BR","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":"BR","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":3545,"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":"customerssh@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":null,"connector_transaction_id":"pay_cfn9IZqdJU58r5","frm_message":null,"metadata":null,"connector_metadata":{"apple_pay":null,"airwallex":null,"noon":{"order_category":"pay"},"braintree":null,"adyen":null},"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_cfn9IZqdJU58r5","payment_link":null,"profile_id":"pro_QEwjCvFhpcLC2azRNZEf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_lJPT4aN2CbXmgSAFDmCT","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-10-01T13:00:53.600Z","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_AHMtQP8Qp9y1L8wy2hNi","network_transaction_id":null,"payment_method_status":"active","updated":"2025-10-01T12:46:51.868Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"request_extended_authorization":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,"enable_overcapture":null,"is_overcapture_enabled":null,"network_details":null}
```
MIT call:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_n5vnntb0V5gRjNMdwTnPXweumExJV6vYon3lVNzW2BoA3F4S4V0PXDHK3lW7gWHh' \
--data '{
    "amount": 3545,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "customerssh",
    "capture_method": "manual",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_AHMtQP8Qp9y1L8wy2hNi"
    },
    "off_session": true
}'
```

Response:
```
{"payment_id":"pay_qBDBW4zQXKiwHnhTRX0Q","merchant_id":"merchant_1759144749","status":"requires_capture","amount":3545,"net_amount":3545,"shipping_cost":null,"amount_capturable":3545,"amount_received":null,"connector":"nexixpay","client_secret":"pay_qBDBW4zQXKiwHnhTRX0Q_secret_yvNWTrkL2gCyNEJGNa29","created":"2025-10-01T12:49:57.717Z","currency":"EUR","customer_id":"customerssh","customer":{"id":"customerssh","name":"John Doe","email":"customerssh@gmail.com","phone":"9999999999","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":"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":"30","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"customerssh@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":"customerssh","created_at":1759322997,"expires":1759326597,"secret":"epk_f372c1555499482683008ee1d2de5fe9"},"manual_retry_allowed":null,"connector_transaction_id":"pay_qBDBW4zQXKiwHn","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_qBDBW4zQXKiwHn","payment_link":null,"profile_id":"pro_QEwjCvFhpcLC2azRNZEf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_lJPT4aN2CbXmgSAFDmCT","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-10-01T13:04:57.717Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_AHMtQP8Qp9y1L8wy2hNi","network_transaction_id":null,"payment_method_status":"active","updated":"2025-10-01T12:49:59.679Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"request_extended_authorization":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"qAhdJaa3HvEeMxexwg","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,"enable_overcapture":null,"is_overcapture_enabled":null,"network_details":null}
```
Cancel Call:
```
curl --location 'http://localhost:8080/payments/pay_qBDBW4zQXKiwHnhTRX0Q/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_n5vnntb0V5gRjNMdwTnPXweumExJV6vYon3lVNzW2BoA3F4S4V0PXDHK3lW7gWHh' \
--data '{
  "cancellation_reason": "requested_by_customer"
}'
```
Response:
```
{"payment_id":"pay_qBDBW4zQXKiwHnhTRX0Q","merchant_id":"merchant_1759144749","status":"processing","amount":3545,"net_amount":3545,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"nexixpay","client_secret":"pay_qBDBW4zQXKiwHnhTRX0Q_secret_yvNWTrkL2gCyNEJGNa29","created":"2025-10-01T12:49:57.717Z","currency":"EUR","customer_id":"customerssh","customer":{"id":"customerssh","name":"John Doe","email":"customerssh@gmail.com","phone":"9999999999","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":"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":"30","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":{"address":{"city":"San Fransico","country":"BR","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"}},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"customerssh@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":"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":null,"connector_transaction_id":"pay_qBDBW4zQXKiwHn","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_qBDBW4zQXKiwHn","payment_link":null,"profile_id":"pro_QEwjCvFhpcLC2azRNZEf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_lJPT4aN2CbXmgSAFDmCT","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-10-01T13:04:57.717Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_AHMtQP8Qp9y1L8wy2hNi","network_transaction_id":null,"payment_method_status":null,"updated":"2025-10-01T12:51:38.055Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"request_extended_authorization":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,"enable_overcapture":null,"is_overcapture_enabled":null,"network_details":null}
```
Payments retrieve Response:
```
{"payment_id":"pay_qBDBW4zQXKiwHnhTRX0Q","merchant_id":"merchant_1759144749","status":"cancelled","amount":3545,"net_amount":3545,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"nexixpay","client_secret":"pay_qBDBW4zQXKiwHnhTRX0Q_secret_yvNWTrkL2gCyNEJGNa29","created":"2025-10-01T12:49:57.717Z","currency":"EUR","customer_id":"customerssh","customer":{"id":"customerssh","name":"John Doe","email":"customerssh@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"attempts":[{"attempt_id":"pay_qBDBW4zQXKiwHnhTRX0Q_1","status":"pending","amount":3545,"order_tax_amount":null,"currency":"EUR","connector":"nexixpay","error_message":null,"payment_method":"card","connector_transaction_id":"pay_qBDBW4zQXKiwHn","capture_method":"manual","authentication_type":"no_three_ds","created_at":"2025-10-01T12:49:57.717Z","modified_at":"2025-10-01T12:51:38.055Z","cancellation_reason":"requested_by_customer","mandate_id":null,"error_code":null,"payment_token":null,"connector_metadata":{"psyncFlow":"Cancel","cancelOperationId":"6dc6af6b-37b9-4aa6-8bf1-0d52ae064e8d","threeDSAuthResult":null,"captureOperationId":null,"threeDSAuthResponse":null,"authorizationOperationId":"486536903848752749"},"payment_experience":null,"payment_method_type":"credit","reference_id":"pay_qBDBW4zQXKiwHn","unified_code":null,"unified_message":null,"client_source":null,"client_version":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":"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":"30","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":{"address":{"city":"San Fransico","country":"BR","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"}},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"customerssh@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":"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":null,"connector_transaction_id":"pay_qBDBW4zQXKiwHn","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_qBDBW4zQXKiwHn","payment_link":null,"profile_id":"pro_QEwjCvFhpcLC2azRNZEf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_lJPT4aN2CbXmgSAFDmCT","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-10-01T13:04:57.717Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_AHMtQP8Qp9y1L8wy2hNi","network_transaction_id":null,"payment_method_status":"active","updated":"2025-10-01T12:52:35.250Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"request_extended_authorization":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"CEivq9z9Q2r87ktZQG","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,"enable_overcapture":null,"is_overcapture_enabled":null,"network_details":null}
```


Authorize call
<img width="1728" height="474" alt="image" src="https://github.com/user-attachments/assets/f58993b2-549f-4d70-9230-03dd03895b3c" />
Complete authorize call:
<img width="1728" height="474" alt="image" src="https://github.com/user-attachments/assets/c9245cf3-1714-4b6a-8bca-c836c819f821" />

## 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
