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(router): Add Confirm-Intent API contract changes for split payments (v2) (#9469)

Anurag Thakur46090ea06d44
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 973b3391e2..523732de9e 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -19036,6 +19036,14 @@
"payment_method_data": {
"$ref": "#/components/schemas/PaymentMethodDataRequest"
},
+ "split_payment_method_data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SplitPaymentMethodDataRequest"
+ },
+ "description": "The payment instrument data to be used for the payment in case of split payments",
+ "nullable": true
+ },
"payment_method_type": {
"$ref": "#/components/schemas/PaymentMethod"
},
@@ -24982,6 +24990,25 @@
"created"
]
},
+ "SplitPaymentMethodDataRequest": {
+ "type": "object",
+ "required": [
+ "payment_method_data",
+ "payment_method_type",
+ "payment_method_subtype"
+ ],
+ "properties": {
+ "payment_method_data": {
+ "$ref": "#/components/schemas/PaymentMethodData"
+ },
+ "payment_method_type": {
+ "$ref": "#/components/schemas/PaymentMethod"
+ },
+ "payment_method_subtype": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ }
+ }
+ },
"SplitPaymentsRequest": {
"oneOf": [
{
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 7f397d6c60..fa21426a44 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2659,6 +2659,16 @@ pub struct PaymentMethodDataRequest {
pub billing: Option<Address>,
}
+#[cfg(feature = "v2")]
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct SplitPaymentMethodDataRequest {
+ pub payment_method_data: PaymentMethodData,
+ #[schema(value_type = PaymentMethod)]
+ pub payment_method_type: api_enums::PaymentMethod,
+ #[schema(value_type = PaymentMethodType)]
+ pub payment_method_subtype: api_enums::PaymentMethodType,
+}
+
/// The payment method information provided for making a payment
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)]
pub struct RecordAttemptPaymentMethodDataRequest {
@@ -5812,6 +5822,9 @@ pub struct PaymentsConfirmIntentRequest {
/// The payment instrument data to be used for the payment
pub payment_method_data: PaymentMethodDataRequest,
+ /// The payment instrument data to be used for the payment in case of split payments
+ pub split_payment_method_data: Option<Vec<SplitPaymentMethodDataRequest>>,
+
/// The payment method type to be used for the payment. This should match with the `payment_method_data` provided
#[schema(value_type = PaymentMethod, example = "card")]
pub payment_method_type: api_enums::PaymentMethod,
@@ -6133,6 +6146,7 @@ impl From<&PaymentsRequest> for PaymentsConfirmIntentRequest {
payment_token: None,
merchant_connector_details: request.merchant_connector_details.clone(),
return_raw_connector_response: request.return_raw_connector_response,
+ split_payment_method_data: None,
}
}
}
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index eb172cf0cf..6ea50cb85f 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -435,6 +435,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PhoneDetails,
api_models::payments::PaymentMethodData,
api_models::payments::PaymentMethodDataRequest,
+ api_models::payments::SplitPaymentMethodDataRequest,
api_models::payments::MandateType,
api_models::payments::MandateAmountData,
api_models::payments::Card,