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(session): Added dpa_client_id, provider to click to pay session response (#7683)

Sahkal Poddarfbc092f7b11a
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 7157a2c5a1..de2cd1b036 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7648,6 +7648,18 @@
"phone_country_code": {
"type": "string",
"nullable": true
+ },
+ "provider": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CtpServiceProvider"
+ }
+ ],
+ "nullable": true
+ },
+ "dpa_client_id": {
+ "type": "string",
+ "nullable": true
}
}
},
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 233f44930e..b1acc0a812 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -9766,6 +9766,18 @@
"phone_country_code": {
"type": "string",
"nullable": true
+ },
+ "provider": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CtpServiceProvider"
+ }
+ ],
+ "nullable": true
+ },
+ "dpa_client_id": {
+ "type": "string",
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 4e88272651..3cfadb0a57 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -8165,6 +8165,10 @@ pub struct ClickToPaySessionResponse {
#[schema(max_length = 255, value_type = Option<String>, example = "[email protected]")]
pub email: Option<Email>,
pub phone_country_code: Option<String>,
+ /// provider Eg: Visa, Mastercard
+ #[schema(value_type = Option<CtpServiceProvider>)]
+ pub provider: Option<api_enums::CtpServiceProvider>,
+ pub dpa_client_id: Option<String>,
}
#[cfg(feature = "v1")]
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 0fc75c0a77..de0969236e 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -5766,6 +5766,12 @@ placeholder="Enter Merchant Country Code"
required=true
type="Text"
+[ctp_visa.metadata.dpa_client_id]
+name="dpa_client_id"
+label="DPA Client ID"
+placeholder="Enter DPA Client ID"
+type="Text"
+
[redsys]
[[redsys.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 64b4ad1194..90c6f84579 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -4446,6 +4446,13 @@ placeholder="Enter Merchant Country Code"
required=true
type="Text"
+[ctp_visa.metadata.dpa_client_id]
+name="dpa_client_id"
+label="DPA Client ID"
+placeholder="Enter DPA Client ID"
+required=true
+type="Text"
+
[redsys]
[[redsys.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index d4dd572005..af19580676 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -5710,6 +5710,13 @@ placeholder="Enter Merchant Country Code"
required=true
type="Text"
+[ctp_visa.metadata.dpa_client_id]
+name="dpa_client_id"
+label="DPA Client ID"
+placeholder="Enter DPA Client ID"
+required=true
+type="Text"
+
[redsys]
[[redsys.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index fed1996e6d..dedba889c6 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -686,6 +686,7 @@ pub struct ClickToPayMetaData {
pub acquirer_merchant_id: String,
pub merchant_category_code: String,
pub merchant_country_code: String,
+ pub dpa_client_id: Option<String>,
}
// TODO: uncomment fields as necessary
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index c6fc064463..cd68709afa 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4218,6 +4218,12 @@ pub async fn get_session_token_for_click_to_pay(
validate_customer_details_for_click_to_pay(&customer_details)?;
+ let provider = match merchant_connector_account.connector_name.as_str() {
+ "ctp_mastercard" => Some(enums::CtpServiceProvider::Mastercard),
+ "ctp_visa" => Some(enums::CtpServiceProvider::Visa),
+ _ => None,
+ };
+
Ok(api_models::payments::SessionToken::ClickToPay(Box::new(
api_models::payments::ClickToPaySessionResponse {
dpa_id: click_to_pay_metadata.dpa_id,
@@ -4233,6 +4239,8 @@ pub async fn get_session_token_for_click_to_pay(
phone_number: customer_details.phone.clone(),
email: customer_details.email.clone(),
phone_country_code: customer_details.phone_country_code.clone(),
+ provider,
+ dpa_client_id: click_to_pay_metadata.dpa_client_id.clone(),
},
)))
}