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(router): make `x_merchant_domain` as required value only for session call done on web (#6362)

Shankar Singh Cba6f7a817ba3
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 5546d90514..41bda6be85 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -19162,7 +19162,6 @@
"type": "object",
"required": [
"name",
- "url",
"country_code"
],
"properties": {
@@ -19172,7 +19171,8 @@
},
"url": {
"type": "string",
- "description": "Merchant domain that process payments"
+ "description": "Merchant domain that process payments, required for web payments",
+ "nullable": true
},
"country_code": {
"$ref": "#/components/schemas/CountryAlpha2"
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index a7a4b04b46..9374acb024 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -22960,7 +22960,6 @@
"type": "object",
"required": [
"name",
- "url",
"country_code"
],
"properties": {
@@ -22970,7 +22969,8 @@
},
"url": {
"type": "string",
- "description": "Merchant domain that process payments"
+ "description": "Merchant domain that process payments, required for web payments",
+ "nullable": true
},
"country_code": {
"$ref": "#/components/schemas/CountryAlpha2"
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 65d785b0ff..fd1286a555 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5504,8 +5504,8 @@ pub enum SamsungPayProtocolType {
pub struct SamsungPayMerchantPaymentInformation {
/// Merchant name, this will be displayed on the Samsung Pay screen
pub name: String,
- /// Merchant domain that process payments
- pub url: String,
+ /// Merchant domain that process payments, required for web payments
+ pub url: Option<String>,
/// Merchant country code
#[schema(value_type = CountryAlpha2, example = "US")]
pub country_code: api_enums::CountryAlpha2,
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 49b89fd562..31027bc8c5 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -550,10 +550,15 @@ fn create_samsung_pay_session_token(
message: "Failed to convert amount to string major unit for Samsung Pay".to_string(),
})?;
- let merchant_domain = header_payload
- .x_merchant_domain
- .get_required_value("samsung pay domain")
- .attach_printable("Failed to get domain for samsung pay session call")?;
+ let merchant_domain = match header_payload.x_client_platform {
+ Some(common_enums::ClientPlatform::Web) => Some(
+ header_payload
+ .x_merchant_domain
+ .get_required_value("samsung pay domain")
+ .attach_printable("Failed to get domain for samsung pay session call")?,
+ ),
+ _ => None,
+ };
let samsung_pay_wallet_details = match samsung_pay_session_token_data.data {
payment_types::SamsungPayCombinedMetadata::MerchantCredentials(