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

fix(ucs): Paysafe Apple Pay predecrypt + gift card bridge fixes (#13163)

Tushar Shukla12fd469f444a
diff --git a/Cargo.lock b/Cargo.lock
index 7225daf17e..fb9d55be6b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2264,7 +2264,7 @@ dependencies = [
[[package]]
name = "config_patch_derive"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.07.07.2#138c16e1c473cdfc0f74a685a00bde7c6e9a5f21"
+source = "git+https://github.com/juspay/connector-service?tag=2026.07.08.1#e90e5a7b1c121c543511ee571bb579b676c393d1"
dependencies = [
"proc-macro2",
"quote",
@@ -3982,7 +3982,7 @@ checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57"
[[package]]
name = "grpc-api-types"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.07.07.2#138c16e1c473cdfc0f74a685a00bde7c6e9a5f21"
+source = "git+https://github.com/juspay/connector-service?tag=2026.07.08.1#e90e5a7b1c121c543511ee571bb579b676c393d1"
dependencies = [
"axum 0.8.4",
"bytes 1.10.1",
@@ -8178,7 +8178,7 @@ dependencies = [
[[package]]
name = "rust-grpc-client"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.07.07.2#138c16e1c473cdfc0f74a685a00bde7c6e9a5f21"
+source = "git+https://github.com/juspay/connector-service?tag=2026.07.08.1#e90e5a7b1c121c543511ee571bb579b676c393d1"
dependencies = [
"grpc-api-types",
]
@@ -11012,7 +11012,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "ucs_cards"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.07.07.2#138c16e1c473cdfc0f74a685a00bde7c6e9a5f21"
+source = "git+https://github.com/juspay/connector-service?tag=2026.07.08.1#e90e5a7b1c121c543511ee571bb579b676c393d1"
dependencies = [
"bytes 1.10.1",
"error-stack 0.4.1",
@@ -11028,7 +11028,7 @@ dependencies = [
[[package]]
name = "ucs_common_enums"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.07.07.2#138c16e1c473cdfc0f74a685a00bde7c6e9a5f21"
+source = "git+https://github.com/juspay/connector-service?tag=2026.07.08.1#e90e5a7b1c121c543511ee571bb579b676c393d1"
dependencies = [
"serde",
"strum 0.26.3",
@@ -11039,7 +11039,7 @@ dependencies = [
[[package]]
name = "ucs_common_utils"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.07.07.2#138c16e1c473cdfc0f74a685a00bde7c6e9a5f21"
+source = "git+https://github.com/juspay/connector-service?tag=2026.07.08.1#e90e5a7b1c121c543511ee571bb579b676c393d1"
dependencies = [
"anyhow",
"base64 0.21.7",
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 23b969138c..7f0c1f09db 100644
--- a/crates/external_services/Cargo.toml
+++ b/crates/external_services/Cargo.toml
@@ -82,7 +82,7 @@ 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", tag = "2026.07.07.2", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.07.08.1", package = "rust-grpc-client" }
open-feature = { version = "0.2.5", optional = true }
superposition_provider = { version = "0.114.0", optional = true}
superposition_types = "0.114.0"
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 0a2715a407..15b55d04d4 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -602,24 +602,26 @@ impl UnifiedConnectorServiceClient {
*request.metadata_mut() = metadata;
- self.payment_method_authentication_service_client
- .clone()
- .authenticate(request)
- .await
- .map_err(|error| {
- error_stack::Report::new(UnifiedConnectorServiceError::from_grpc_error(
- &error,
- &connector_name,
- ))
- })
- .inspect_err(|error| {
- logger::error!(
- grpc_error=?error,
- method="payment_authenticate",
- connector_name=?connector_name,
- "UCS payment authenticate gRPC call failed"
- )
- })
+ Box::pin(
+ self.payment_method_authentication_service_client
+ .clone()
+ .authenticate(request),
+ )
+ .await
+ .map_err(|error| {
+ error_stack::Report::new(UnifiedConnectorServiceError::from_grpc_error(
+ &error,
+ &connector_name,
+ ))
+ })
+ .inspect_err(|error| {
+ logger::error!(
+ grpc_error=?error,
+ method="payment_authenticate",
+ connector_name=?connector_name,
+ "UCS payment authenticate gRPC call failed"
+ )
+ })
}
/// Performs Session token create
diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml
index e125a87101..ed42ce6a73 100644
--- a/crates/hyperswitch_interfaces/Cargo.toml
+++ b/crates/hyperswitch_interfaces/Cargo.toml
@@ -33,7 +33,7 @@ time = "0.3.41"
tonic = "0.14"
url = { version = "2.5.4", features = ["serde"] }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.07.07.2", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.07.08.1", package = "rust-grpc-client" }
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 b207e0b5e0..7e06b0734e 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -91,8 +91,8 @@ 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", tag = "2026.07.07.2", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", tag = "2026.07.07.2", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.07.08.1", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", tag = "2026.07.08.1", package = "ucs_cards" }
rustc-hash = "1.1.0"
rustls = "0.22"
rustls-pemfile = "2"
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index f398372fac..bf03ae9b6d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5458,7 +5458,19 @@ where
F: Send + Clone + Sync,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
- if is_operation_confirm(operation)
+ // The wallet predecrypt must run whenever this call will reach the connector:
+ // the standalone Confirm operation, and equally a one-shot PaymentCreate with
+ // confirm=true (which otherwise ships the still-encrypted wallet token to the
+ // connector tokenization step).
+ let is_confirm_operation = is_operation_confirm(operation)
+ || matches!(
+ (
+ format!("{operation:?}").as_str(),
+ payment_data.get_payment_attempt().confirm,
+ ),
+ ("PaymentCreate", true)
+ );
+ if is_confirm_operation
&& payment_data.get_payment_attempt().payment_method
== Some(storage_enums::PaymentMethod::Wallet)
&& payment_data.get_payment_method_data().is_some()
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 2c5b71d67e..788d9f75ef 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3766,16 +3766,31 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(
_ => Ok((None, None)),
}?;
- // For stateless redirect pay-later PMs (e.g. Affirm BNPL), the redirect-completion
- // request carries no payment_method_data and there is no stored card/token, so the
- // match above resolves to None. Reconstruct the PaymentMethodData from the persisted
- // payment_method_type so downstream flows (e.g. UCS CompleteAuthorize) still receive a
- // payment_method and can run the transaction-create leg with the checkout_token.
+ // Stateless redirect payment methods (Affirm BNPL, Skrill wallet, Interac
+ // e-Transfer, paysafecard gift card) carry no payment_method_data and vault no
+ // token, so the match above resolves to None on the redirect-completion leg.
+ // Reconstruct the empty-shell PaymentMethodData from the persisted
+ // payment_method_type so downstream router_data (e.g. UCS CompleteAuthorize) — and
+ // thus every connector — receives a payment_method and can settle the handle.
let payment_method =
payment_method.or_else(|| match payment_data.payment_attempt.payment_method_type {
Some(storage_enums::PaymentMethodType::Affirm) => Some(
domain::PaymentMethodData::PayLater(domain::PayLaterData::AffirmRedirect {}),
),
+ Some(storage_enums::PaymentMethodType::Skrill) => {
+ Some(domain::PaymentMethodData::Wallet(
+ domain::WalletData::Skrill(Box::new(domain::SkrillData {})),
+ ))
+ }
+ Some(storage_enums::PaymentMethodType::Interac) => Some(
+ domain::PaymentMethodData::BankRedirect(domain::BankRedirectData::Interac {
+ country: None,
+ email: None,
+ }),
+ ),
+ Some(storage_enums::PaymentMethodType::PaySafeCard) => Some(
+ domain::PaymentMethodData::GiftCard(Box::new(domain::GiftCardData::PaySafeCard {})),
+ ),
_ => None,
});
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index ea54093686..2f18ed4b2f 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1298,31 +1298,45 @@ pub fn build_unified_connector_service_payment_method(
}),
hyperswitch_domain_models::payment_method_data::WalletData::ApplePay(
apple_pay_wallet_data
- ) => {
- let apple_pay_payment_data = get_apple_pay_payment_data(
- &apple_pay_wallet_data.payment_data,
- payment_method_token,
- );
+ ) => match payment_method_token {
+ // A connector token minted by the PaymentMethodToken pre-step (e.g. a
+ // Paysafe payment handle) supersedes the wallet payload: the settle
+ // leg must reference the handle, not re-send the PKPaymentToken.
+ // Mirrors the Card arm above.
+ Some(PaymentMethodToken::Token(token)) => {
+ let token_payment_method = payments_grpc::TokenPaymentMethodType {
+ token: Some(token.clone()),
+ };
+ Ok(payments_grpc::PaymentMethod {
+ payment_method: Some(PaymentMethod::Token(token_payment_method)),
+ })
+ }
+ _ => {
+ let apple_pay_payment_data = get_apple_pay_payment_data(
+ &apple_pay_wallet_data.payment_data,
+ payment_method_token,
+ );
- let payment_data =
- payments_grpc::apple_wallet::payment_data::PaymentData::foreign_try_from(
- &apple_pay_payment_data,
- )?;
+ let payment_data =
+ payments_grpc::apple_wallet::payment_data::PaymentData::foreign_try_from(
+ &apple_pay_payment_data,
+ )?;
- Ok(payments_grpc::PaymentMethod {
- payment_method: Some(PaymentMethod::ApplePaySdk(payments_grpc::AppleWallet {
- payment_data: Some(payments_grpc::apple_wallet::PaymentData {
- payment_data: Some(payment_data),
- }),
- payment_method: Some(payments_grpc::apple_wallet::PaymentMethod {
- display_name: apple_pay_wallet_data.payment_method.display_name,
- network: apple_pay_wallet_data.payment_method.network,
- r#type: apple_pay_wallet_data.payment_method.pm_type,
- }),
- transaction_identifier: apple_pay_wallet_data.transaction_identifier,
- })),
- })
- }
+ Ok(payments_grpc::PaymentMethod {
+ payment_method: Some(PaymentMethod::ApplePaySdk(payments_grpc::AppleWallet {
+ payment_data: Some(payments_grpc::apple_wallet::PaymentData {
+ payment_data: Some(payment_data),
+ }),
+ payment_method: Some(payments_grpc::apple_wallet::PaymentMethod {
+ display_name: apple_pay_wallet_data.payment_method.display_name,
+ network: apple_pay_wallet_data.payment_method.network,
+ r#type: apple_pay_wallet_data.payment_method.pm_type,
+ }),
+ transaction_identifier: apple_pay_wallet_data.transaction_identifier,
+ })),
+ })
+ }
+ },
hyperswitch_domain_models::payment_method_data::WalletData::GooglePay(
google_pay_wallet_data,
) => {
@@ -1453,6 +1467,13 @@ pub fn build_unified_connector_service_payment_method(
)),
})
}
+ hyperswitch_domain_models::payment_method_data::WalletData::Skrill(_) => {
+ Ok(payments_grpc::PaymentMethod {
+ payment_method: Some(PaymentMethod::SkrillRedirect(
+ payments_grpc::SkrillRedirectWallet {},
+ )),
+ })
+ }
_ => Err(UnifiedConnectorServiceError::NotImplemented(format!(
"Unimplemented payment method subtype: {payment_method_type:?}"
))
@@ -1695,6 +1716,21 @@ pub fn build_unified_connector_service_payment_method(
.into()),
}
}
+ hyperswitch_domain_models::payment_method_data::PaymentMethodData::GiftCard(
+ gift_card_data,
+ ) => match *gift_card_data {
+ hyperswitch_domain_models::payment_method_data::GiftCardData::PaySafeCard {} => {
+ Ok(payments_grpc::PaymentMethod {
+ payment_method: Some(PaymentMethod::PaySafeCard(
+ payments_grpc::PaySafeCard {},
+ )),
+ })
+ }
+ _ => Err(UnifiedConnectorServiceError::NotImplemented(format!(
+ "Unimplemented payment method subtype: {payment_method_type:?}"
+ ))
+ .into()),
+ },
_ => Err(UnifiedConnectorServiceError::NotImplemented(format!(
"Unimplemented payment method: {payment_method_data:?}"
))
diff --git a/crates/router/src/core/unified_connector_service/connector_config.rs b/crates/router/src/core/unified_connector_service/connector_config.rs
index 0e8603f652..efdd36ba88 100644
--- a/crates/router/src/core/unified_connector_service/connector_config.rs
+++ b/crates/router/src/core/unified_connector_service/connector_config.rs
@@ -76,8 +76,10 @@ pub struct PaysafeMetadata {
}
/// Paysafe payment method details for account_id configuration.
-/// Contains card and ACH account IDs grouped by currency.
-/// This struct is compatible with the UCS Paysafe connector expectations.
+/// Contains per-currency account IDs for card, ACH, Apple Pay, Interac,
+/// Skrill and paysafecard.
+/// This struct is compatible with the UCS Paysafe connector expectations
+/// (proto `PaysafePaymentMethodDetails` in the UCS `PaysafeConfig`).
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaysafePaymentMethodDetails {
// UCS proto map fields — must always be present in serialized JSON (not Option)
@@ -87,6 +89,18 @@ pub struct PaysafePaymentMethodDetails {
/// ACH account IDs by currency
#[serde(default)]
pub ach: HashMap<Currency, PaysafeAchAccountId>,
+ /// Dedicated Apple Pay processing accounts (encrypt/decrypt) by currency
+ #[serde(default)]
+ pub apple_pay: HashMap<Currency, PaysafeApplePayAccountId>,
+ /// Interac e-Transfer account IDs by currency
+ #[serde(default)]
+ pub interac: HashMap<Currency, PaysafeRedirectAccountId>,
+ /// Skrill wallet account IDs by currency
+ #[serde(default)]
+ pub skrill: HashMap<Currency, PaysafeRedirectAccountId>,
+ /// paysafecard account IDs by currency
+ #[serde(default)]
+ pub pay_safe_card: HashMap<Currency, PaysafeRedirectAccountId>,
}
/// Paysafe card account ID configuration for a specific currency
@@ -108,6 +122,29 @@ pub struct PaysafeAchAccountId {
pub account_id: Option<Secret<String>>,
}
+/// Paysafe dedicated Apple Pay processing account for a specific currency,
+/// split by token flow (encrypted PKPaymentToken vs decrypted token).
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct PaysafeApplePayAccountId {
+ /// Account ID for the encrypted-token flow
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub encrypt: Option<Secret<String>>,
+ /// Account ID for the decrypted-token flow
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub decrypt: Option<Secret<String>>,
+}
+
+/// Paysafe redirect-APM processing account (Interac, Skrill, paysafecard)
+/// for a specific currency. Mirrors the native hyperswitch Paysafe connector's
+/// `RedirectAccountId` (metadata key `three_ds`) so the same MCA metadata is
+/// portable between the native and UCS paths.
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct PaysafeRedirectAccountId {
+ /// Processing account ID (native metadata key: `three_ds`)
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub three_ds: Option<Secret<String>>,
+}
+
#[derive(Debug, serde::Deserialize)]
pub struct PeachpaymentsMetadata {
client_merchant_reference_id: Secret<String>,
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index c8e1dee776..d59dfb3cdb 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -735,7 +735,17 @@ impl
statement_descriptor_name: None,
statement_descriptor_suffix: None,
order_details: vec![],
- connector_feature_data: None,
+ // Forward the connector metadata stored at Authorize (which holds the
+ // Paysafe paymentHandleToken) so CompleteAuthorize can settle the handle.
+ // Mirrors the PSync request builder.
+ connector_feature_data: router_data
+ .request
+ .connector_meta
+ .as_ref()
+ .map(serde_json::to_string)
+ .transpose()
+ .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
+ .map(|s| s.into()),
enable_partial_authorization: None,
payment_channel: None,
billing_descriptor: None,
@@ -1193,6 +1203,7 @@ impl
connector_feature_data: None,
capture_method: capture_method.map(|capture_method| capture_method.into()),
webhook_url: None,
+ domain_data: None,
})
}
}
@@ -3482,6 +3493,7 @@ impl transformers::ForeignTryFrom<common_enums::PaymentMethodType>
common_enums::PaymentMethodType::RevolutPay => Ok(Self::RevolutPay),
common_enums::PaymentMethodType::NetworkToken => Ok(Self::NetworkToken),
common_enums::PaymentMethodType::OpenBanking => Ok(Self::OpenBanking),
+ common_enums::PaymentMethodType::Skrill => Ok(Self::Skrill),
_ => Err(
UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
"Payment Method Type not yet supported".to_string(),