Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat: Passing Access token for CreateOrder , Capture , Void (#10582)

Yashasvi Kapil219dee31526b
diff --git a/Cargo.lock b/Cargo.lock
index a1002eef66..62d7ee29fb 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3789,7 +3789,7 @@ dependencies = [
[[package]]
name = "grpc-api-types"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=7f28be871568f5937975a99bde14ce47736fd81e#7f28be871568f5937975a99bde14ce47736fd81e"
+source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
dependencies = [
"axum 0.8.4",
"error-stack 0.5.0",
@@ -7448,7 +7448,7 @@ dependencies = [
[[package]]
name = "rust-grpc-client"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=7f28be871568f5937975a99bde14ce47736fd81e#7f28be871568f5937975a99bde14ce47736fd81e"
+source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
dependencies = [
"grpc-api-types",
]
@@ -10238,7 +10238,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "ucs_cards"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=7f28be871568f5937975a99bde14ce47736fd81e#7f28be871568f5937975a99bde14ce47736fd81e"
+source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
dependencies = [
"bytes 1.10.1",
"error-stack 0.4.1",
@@ -10254,7 +10254,7 @@ dependencies = [
[[package]]
name = "ucs_common_enums"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=7f28be871568f5937975a99bde14ce47736fd81e#7f28be871568f5937975a99bde14ce47736fd81e"
+source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
dependencies = [
"serde",
"strum 0.26.3",
@@ -10265,7 +10265,7 @@ dependencies = [
[[package]]
name = "ucs_common_utils"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=7f28be871568f5937975a99bde14ce47736fd81e#7f28be871568f5937975a99bde14ce47736fd81e"
+source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
dependencies = [
"anyhow",
"base64 0.21.7",
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 770bb8728d..9b056c66e7 100644
--- a/crates/external_services/Cargo.toml
+++ b/crates/external_services/Cargo.toml
@@ -69,7 +69,7 @@ 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 = "7f28be871568f5937975a99bde14ce47736fd81e", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "rust-grpc-client" }
open-feature = { version = "0.2.5", optional = true }
superposition_provider = { version = "0.88.1", optional = true }
diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml
index 32834294bf..112a98fbda 100644
--- a/crates/hyperswitch_interfaces/Cargo.toml
+++ b/crates/hyperswitch_interfaces/Cargo.toml
@@ -29,7 +29,7 @@ serde_json = "1.0.140"
strum = { version = "0.26", features = ["derive"] }
thiserror = "1.0.69"
time = "0.3.41"
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "7f28be871568f5937975a99bde14ce47736fd81e", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "rust-grpc-client" }
unified-connector-service-masking = { git = "https://github.com/juspay/hyperswitch", tag = "2025.11.24.0", package = "masking" }
tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] }
# First party crates
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 97e5ea7eeb..65ee817509 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -89,8 +89,8 @@ 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 = "7f28be871568f5937975a99bde14ce47736fd81e", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "7f28be871568f5937975a99bde14ce47736fd81e", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "ucs_cards" }
unified-connector-service-masking = { git = "https://github.com/juspay/hyperswitch", tag = "2025.11.24.0", package = "masking" }
rustc-hash = "1.1.0"
rustls = "0.22"
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index f03a4d3260..ada1fc779a 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -387,6 +387,13 @@ impl
>,
) -> Result<Self, Self::Error> {
let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;
+
+ // Populate state with access token if available (same pattern as Authorize flow)
+ let state = router_data
+ .access_token
+ .as_ref()
+ .map(ConnectorState::foreign_from);
+
Ok(Self {
request_ref_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(
@@ -395,9 +402,9 @@ impl
}),
amount: router_data.request.minor_amount.get_amount_as_i64(),
currency: currency.into(),
-
metadata: HashMap::new(),
webhook_url: None,
+ state,
})
}
}
@@ -849,8 +856,23 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
.map(payments_grpc::CaptureMethod::foreign_try_from)
.transpose()?;
+ let state = router_data
+ .access_token
+ .as_ref()
+ .map(ConnectorState::foreign_from);
+
+ let merchant_account_metadata = router_data
+ .connector_meta_data
+ .as_ref()
+ .and_then(|val| val.peek().as_object())
+ .map(|map| {
+ map.iter()
+ .filter_map(|(k, v)| v.as_str().map(|s| (k.clone(), s.to_string())))
+ .collect::<HashMap<String, String>>()
+ })
+ .unwrap_or_default();
+
Ok(Self {
- merchant_reference_payment_id: None,
transaction_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(
connector_transaction_id,
@@ -881,7 +903,8 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
capture_reference: multiple_capture_request_data.capture_reference.clone(),
},
),
- state: None,
+ state,
+ merchant_account_metadata,
})
}
}
@@ -3319,6 +3342,7 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
})?,
state,
merchant_account_metadata,
+ test_mode: router_data.test_mode,
})
}
}
@@ -3389,6 +3413,7 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons
.map(|metadata| convert_value_map_to_hashmap(&metadata.clone().expose()))
.transpose()?
.unwrap_or_default(),
+ test_mode: router_data.test_mode,
})
}
}
@@ -3462,6 +3487,21 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.currency
.map(payments_grpc::Currency::foreign_try_from)
.transpose()?;
+ let state = router_data
+ .access_token
+ .as_ref()
+ .map(ConnectorState::foreign_from);
+
+ let merchant_account_metadata = router_data
+ .connector_meta_data
+ .as_ref()
+ .and_then(|val| val.peek().as_object())
+ .map(|map| {
+ map.iter()
+ .filter_map(|(k, v)| v.as_str().map(|s| (k.clone(), s.to_string())))
+ .collect::<HashMap<String, String>>()
+ })
+ .unwrap_or_default();
Ok(Self {
request_ref_id: Some(Identifier {
@@ -3490,7 +3530,8 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.map(convert_value_map_to_hashmap)
.transpose()?
.unwrap_or_default(),
- state: None,
+ state,
+ merchant_account_metadata,
})
}
}