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(payments): add support for installment payment options in payment intent (#11340)

Ayush Anandfb4518a57cce
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 27e04748ec..cd358cba38 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -13059,6 +13059,13 @@
}
}
},
+ "BillingFrequency": {
+ "type": "string",
+ "description": "Billing frequency for a card installment plan",
+ "enum": [
+ "month"
+ ]
+ },
"BlikBankRedirectAdditionalData": {
"type": "object",
"properties": {
@@ -20877,6 +20884,50 @@
"connected"
]
},
+ "InstallmentOption": {
+ "type": "object",
+ "description": "Installment options grouped by payment method",
+ "required": [
+ "payment_method",
+ "installments"
+ ],
+ "properties": {
+ "payment_method": {
+ "$ref": "#/components/schemas/PaymentMethod"
+ },
+ "installments": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOptionData"
+ },
+ "description": "List of available installment configurations"
+ }
+ }
+ },
+ "InstallmentOptionData": {
+ "type": "object",
+ "description": "A single installment plan option accepted in request payloads",
+ "required": [
+ "number_of_installments",
+ "billing_frequency",
+ "interest_rate"
+ ],
+ "properties": {
+ "number_of_installments": {
+ "type": "string",
+ "format": "binary",
+ "description": "Number of installments (e.g., [3, 6, 12])"
+ },
+ "billing_frequency": {
+ "$ref": "#/components/schemas/BillingFrequency"
+ },
+ "interest_rate": {
+ "type": "number",
+ "format": "double",
+ "description": "Interest rate applied per installment as a percentage"
+ }
+ }
+ },
"IntentStatus": {
"type": "string",
"description": "Represents the overall status of a payment intent.\nThe status transitions through various states depending on the payment method, confirmation, capture method, and any subsequent actions (like customer authentication or manual capture).",
@@ -27617,7 +27668,8 @@
"normal",
"new_mandate",
"setup_mandate",
- "recurring_mandate"
+ "recurring_mandate",
+ "installment"
]
},
"PaymentsCancelPostCaptureRequest": {
@@ -28234,6 +28286,14 @@
}
],
"nullable": true
+ },
+ "installment_options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOption"
+ },
+ "description": "Installment payment options grouped by payment method. When provided, the payment is treated as an installment payment.",
+ "nullable": true
}
}
},
@@ -28762,6 +28822,14 @@
}
],
"nullable": true
+ },
+ "installment_options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOption"
+ },
+ "description": "Installment payment options grouped by payment method. When provided, the payment is treated as an installment payment.",
+ "nullable": true
}
}
},
@@ -29482,6 +29550,14 @@
}
],
"nullable": true
+ },
+ "installment_options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOption"
+ },
+ "description": "Installment payment options associated with this payment, grouped by payment method",
+ "nullable": true
}
}
},
@@ -30363,6 +30439,14 @@
}
],
"nullable": true
+ },
+ "installment_options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOption"
+ },
+ "description": "Installment payment options grouped by payment method. When provided, the payment is treated as an installment payment.",
+ "nullable": true
}
},
"additionalProperties": false
@@ -31109,6 +31193,14 @@
}
],
"nullable": true
+ },
+ "installment_options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOption"
+ },
+ "description": "Installment payment options associated with this payment, grouped by payment method",
+ "nullable": true
}
}
},
@@ -31795,6 +31887,14 @@
}
],
"nullable": true
+ },
+ "installment_options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InstallmentOption"
+ },
+ "description": "Installment payment options grouped by payment method. When provided, the payment is treated as an installment payment.",
+ "nullable": true
}
}
},
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 8f0d93efa5..fe59e4937b 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -22150,7 +22150,8 @@
"normal",
"new_mandate",
"setup_mandate",
- "recurring_mandate"
+ "recurring_mandate",
+ "installment"
]
},
"PaymentsCancelRequest": {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 1689077b21..42eff0efbf 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1559,6 +1559,10 @@ pub struct PaymentsRequest {
#[schema(value_type = Option<PartnerMerchantIdentifierDetails>)]
pub partner_merchant_identifier_details:
Option<common_types::payments::PartnerMerchantIdentifierDetails>,
+
+ /// Installment payment options grouped by payment method. When provided, the payment is treated as an installment payment.
+ #[schema(value_type = Option<Vec<InstallmentOption>>)]
+ pub installment_options: Option<Vec<common_types::payments::InstallmentOption>>,
}
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
@@ -1762,6 +1766,34 @@ impl PaymentsRequest {
Ok(())
}
+
+ pub fn validate_installment_options(
+ &self,
+ ) -> common_utils::errors::CustomResult<(), ValidationError> {
+ if let Some(installment_options) = &self.installment_options {
+ installment_options
+ .iter()
+ .try_fold(HashSet::new(), |mut seen, opt| {
+ opt.payment_method
+ .supports_installments()
+ .then_some(())
+ .ok_or_else(|| ValidationError::InvalidValue {
+ message:
+ "installment_options is only supported for payment method card."
+ .to_string(),
+ })?;
+ seen.insert(opt.payment_method)
+ .then_some(seen)
+ .ok_or_else(|| ValidationError::InvalidValue {
+ message: format!(
+ "duplicate payment_method '{}' in installment_options.",
+ opt.payment_method
+ ),
+ })
+ })?;
+ }
+ Ok(())
+ }
}
#[cfg(feature = "v1")]
@@ -7651,6 +7683,10 @@ pub struct PaymentsResponse {
/// Tokenization details of the payment method data
pub payment_method_tokenization_details: Option<PaymentMethodTokenizationDetails>,
+
+ /// Installment payment options associated with this payment, grouped by payment method
+ #[schema(value_type = Option<Vec<InstallmentOption>>)]
+ pub installment_options: Option<Vec<common_types::payments::InstallmentOption>>,
}
#[cfg(feature = "v1")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 63d98faa1e..979ac88af0 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2596,6 +2596,27 @@ impl PaymentMethod {
}
}
+ pub fn supports_installments(&self) -> bool {
+ match self {
+ Self::Card => true,
+ Self::CardRedirect
+ | Self::PayLater
+ | Self::Wallet
+ | Self::BankRedirect
+ | Self::BankTransfer
+ | Self::Crypto
+ | Self::BankDebit
+ | Self::Reward
+ | Self::RealTimePayment
+ | Self::Upi
+ | Self::Voucher
+ | Self::GiftCard
+ | Self::OpenBanking
+ | Self::MobilePayment
+ | Self::NetworkToken => false,
+ }
+ }
+
pub fn is_additional_payment_method_data_sensitive(&self) -> bool {
match self {
Self::BankTransfer | Self::BankRedirect => true,
@@ -2788,6 +2809,7 @@ pub enum PaymentType {
NewMandate,
SetupMandate,
RecurringMandate,
+ Installment,
}
/// SCA Exemptions types available for authentication
diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rs
index ae24b5ffda..192a9cebdf 100644
--- a/crates/common_types/src/payments.rs
+++ b/crates/common_types/src/payments.rs
@@ -1,6 +1,6 @@
//! Payment related types
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
use common_enums::enums;
use common_utils::{
@@ -1241,6 +1241,101 @@ pub struct NetworkTransactionIdAndDecryptedWalletTokenDetails {
pub token_source: Option<TokenSource>,
}
+/// Billing frequency for a card installment plan
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]
+#[serde(rename_all = "snake_case")]
+pub enum BillingFrequency {
+ /// Monthly billing
+ Month,
+}
+
+/// A non-empty list of installment counts where each value is >= 2 and all values are unique.
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq)]
+#[serde(try_from = "Vec<u8>", into = "Vec<u8>")]
+pub struct InstallmentCounts(Vec<u8>);
+
+impl InstallmentCounts {
+ fn validate_not_empty(counts: &[u8]) -> std::result::Result<(), errors::ValidationError> {
+ (!counts.is_empty())
+ .then_some(())
+ .ok_or_else(|| errors::ValidationError::InvalidValue {
+ message: "number_of_installments must not be empty.".to_string(),
+ })
+ }
+
+ fn validate_values(counts: &[u8]) -> std::result::Result<(), errors::ValidationError> {
+ counts
+ .iter()
+ .try_fold(HashSet::new(), |mut seen, &n| {
+ (n >= 1)
+ .then_some(())
+ .ok_or_else(|| errors::ValidationError::InvalidValue {
+ message: "each value in number_of_installments must be at least 1."
+ .to_string(),
+ })?;
+ seen.insert(n).then_some(seen).ok_or_else(|| {
+ errors::ValidationError::InvalidValue {
+ message: "number_of_installments must contain unique values.".to_string(),
+ }
+ })
+ })
+ .map(|_| ())
+ }
+}
+
+impl TryFrom<Vec<u8>> for InstallmentCounts {
+ type Error = errors::ValidationError;
+
+ fn try_from(counts: Vec<u8>) -> std::result::Result<Self, Self::Error> {
+ Self::validate_not_empty(&counts)?;
+ Self::validate_values(&counts)?;
+ Ok(Self(counts))
+ }
+}
+
+impl From<InstallmentCounts> for Vec<u8> {
+ fn from(c: InstallmentCounts) -> Self {
+ c.0
+ }
+}
+
+/// A single installment plan option accepted in request payloads
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq)]
+pub struct InstallmentOptionData {
+ /// Number of installments (e.g., [3, 6, 12])
+ #[schema(value_type = Vec<u8>)]
+ pub number_of_installments: InstallmentCounts,
+ /// Billing frequency for each installment cycle
+ pub billing_frequency: BillingFrequency,
+ /// Interest rate applied per installment as a percentage
+ pub interest_rate: f64,
+}
+
+/// Installment options grouped by payment method
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq)]
+pub struct InstallmentOption {
+ /// Payment method for which these installment plans apply (e.g., "card")
+ #[schema(value_type = PaymentMethod)]
+ pub payment_method: common_enums::PaymentMethod,
+ /// List of available installment configurations
+ pub installments: Vec<InstallmentOptionData>,
+}
+
+/// A list of installment options stored as a single JSONB column value.
+#[derive(
+ Debug,
+ Clone,
+ serde::Serialize,
+ serde::Deserialize,
+ ToSchema,
+ PartialEq,
+ FromSqlRow,
+ AsExpression,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct InstallmentOptions(pub Vec<InstallmentOption>);
+impl_to_sql_from_sql_json!(InstallmentOptions);
+
#[derive(
Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq, SmithyModel,
)]
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index da3e640255..0bebbe1a30 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -87,6 +87,7 @@ pub struct PaymentIntent {
pub partner_merchant_identifier_details:
Option<common_types::payments::PartnerMerchantIdentifierDetails>,
pub state_metadata: Option<PaymentIntentStateMetadata>,
+ pub installment_options: Option<common_types::payments::InstallmentOptions>,
pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,
pub billing_address: Option<Encryption>,
pub shipping_address: Option<Encryption>,
@@ -197,6 +198,7 @@ pub struct PaymentIntent {
pub partner_merchant_identifier_details:
Option<common_types::payments::PartnerMerchantIdentifierDetails>,
pub state_metadata: Option<PaymentIntentStateMetadata>,
+ pub installment_options: Option<common_types::payments::InstallmentOptions>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]
@@ -411,6 +413,7 @@ pub struct PaymentIntentNew {
pub active_attempts_group_id: Option<common_utils::id_type::GlobalAttemptGroupId>,
pub active_attempt_id_type: Option<common_enums::ActiveAttemptIDType>,
pub state_metadata: Option<PaymentIntentStateMetadata>,
+ pub installment_options: Option<common_types::payments::InstallmentOptions>,
}
#[cfg(feature = "v1")]
@@ -501,6 +504,7 @@ pub struct PaymentIntentNew {
pub partner_merchant_identifier_details:
Option<common_types::payments::PartnerMerchantIdentifierDetails>,
pub state_metadata: Option<PaymentIntentStateMetadata>,
+ pub installment_options: Option<common_types::payments::InstallmentOptions>,
}
#[cfg(feature = "v2")]
@@ -678,6 +682,7 @@ pub struct PaymentIntentUpdateFields {
pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>,
pub enable_overcapture: Option<common_types::primitive_wrappers::EnableOvercaptureBool>,
pub shipping_cost: Option<MinorUnit>,
+ pub installment_options: Option<common_types::payments::InstallmentOptions>,
}
// TODO: uncomment fields as necessary
@@ -860,6 +865,7 @@ impl PaymentIntentUpdateInternal {
tokenization: None,
partner_merchant_identifier_details: source.partner_merchant_identifier_details,
state_metadata,
+ installment_options: source.installment_options,
}
}
}
@@ -919,6 +925,7 @@ pub struct PaymentIntentUpdateInternal {
pub enable_overcapture: Option<common_types::primitive_wrappers::EnableOvercaptureBool>,
pub shipping_cost: Option<MinorUnit>,
pub state_metadata: Option<PaymentIntentStateMetadata>,
+ pub installment_options: Option<common_types::payments::InstallmentOptions>,
}
#[cfg(feature = "v1")]
@@ -1058,6 +1065,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
currency: None,
status: None,
state_metadata: None,
+ installment_options: None,
amount_captured: None,
customer_id: None,
return_url: None,
@@ -1156,6 +1164,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
enable_partial_authorization: None,
enable_overcapture: None,
shipping_cost: None,
+ installment_options: None,
},
PaymentIntentUpdate::Update(value) => Self {
amount: Some(value.amount),
@@ -1209,6 +1218,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
enable_overcapture: value.enable_overcapture,
shipping_cost: value.shipping_cost,
state_metadata: None,
+ installment_options: value.installment_options,
},
PaymentIntentUpdate::PaymentCreateUpdate {
return_url,
@@ -1261,6 +1271,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1318,6 +1329,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1375,6 +1387,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1440,6 +1453,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1496,6 +1510,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1553,6 +1568,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1609,6 +1625,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1665,6 +1682,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1720,6 +1738,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1772,6 +1791,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1826,6 +1846,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1880,6 +1901,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1932,6 +1954,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
@@ -1989,6 +2012,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
payment_channel: None,
feature_metadata: None,
state_metadata: None,
+ installment_options: None,
tax_status: None,
discount_amount: None,
order_date: None,
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 0bd01ee32e..15fb6dc90e 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1253,6 +1253,7 @@ diesel::table! {
tokenization -> Nullable<Varchar>,
partner_merchant_identifier_details -> Nullable<Jsonb>,
state_metadata -> Nullable<Jsonb>,
+ installment_options -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index cac33aa297..59420fb288 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1190,6 +1190,7 @@ diesel::table! {
tokenization -> Nullable<Varchar>,
partner_merchant_identifier_details -> Nullable<Jsonb>,
state_metadata -> Nullable<Jsonb>,
+ installment_options -> Nullable<Jsonb>,
#[max_length = 64]
merchant_reference_id -> Nullable<Varchar>,
billing_address -> Nullable<Bytea>,
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 58efc13516..d7460df9e5 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -141,6 +141,7 @@ pub struct PaymentIntent {
pub partner_merchant_identifier_details:
Option<common_types::payments::PartnerMerchantIdentifierDetails>,
pub state_metadata: Option<common_types::payments::PaymentIntentStateMetadata>,
+ pub installment_options: Option<Vec<common_types::payments::InstallmentOption>>,
}
impl PaymentIntent {
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index c9442d2656..da186a3c23 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -266,6 +266,7 @@ pub struct PaymentIntentUpdateFields {
pub enable_partial_authorization: Option<primitive_wrappers::EnablePartialAuthorizationBool>,
pub enable_overcapture: Option<primitive_wrappers::EnableOvercaptureBool>,
pub shipping_cost: Option<MinorUnit>,
+ pub installment_options: Option<Vec<common_types::payments::InstallmentOption>>,
}
#[cfg(feature = "v1")]
@@ -485,6 +486,7 @@ pub struct PaymentIntentUpdateInternal {
pub enable_overcapture: Option<primitive_wrappers::EnableOvercaptureBool>,
pub shipping_cost: Option<MinorUnit>,
pub state_metadata: Option<common_types::payments::PaymentIntentStateMetadata>,
+ pub installment_options: Option<Vec<common_types::payments::InstallmentOption>>,
}
// This conversion is used in the `update_payment_intent` function
@@ -1059,6 +1061,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
order_date: value.order_date,
shipping_amount_tax: value.shipping_amount_tax,
duty_amount: value.duty_amount,
+ installment_options: value.installment_options,
..Default::default()
},
PaymentIntentUpdate::PaymentCreateUpdate {
@@ -1266,6 +1269,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
enable_partial_authorization: None,
enable_overcapture: None,
shipping_cost: None,
+ installment_options: None,
},
}
}
@@ -1369,6 +1373,9 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {
enable_partial_authorization: value.enable_partial_authorization,
enable_overcapture: value.enable_overcapture,
shipping_cost: value.shipping_cost,
+ installment_options: value
+ .installment_options
+ .map(common_types::payments::InstallmentOptions),
}))
}
PaymentIntentUpdate::PaymentCreateUpdate {
@@ -1540,6 +1547,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
enable_overcapture,
shipping_cost,
state_metadata,
+ installment_options,
} = value;
Self {
amount,
@@ -1592,6 +1600,8 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
enable_overcapture,
shipping_cost,
state_metadata,
+ installment_options: installment_options
+ .map(common_types::payments::InstallmentOptions),
}
}
}
@@ -2081,6 +2091,7 @@ impl behaviour::Conversion for PaymentIntent {
tokenization: None,
partner_merchant_identifier_details: None,
state_metadata: None,
+ installment_options: None,
})
}
async fn convert_back(
@@ -2344,6 +2355,7 @@ impl behaviour::Conversion for PaymentIntent {
active_attempt_id_type: Some(self.active_attempt_id_type),
active_attempts_group_id: self.active_attempts_group_id,
state_metadata: None,
+ installment_options: None,
})
}
}
@@ -2432,6 +2444,9 @@ impl behaviour::Conversion for PaymentIntent {
tokenization: self.tokenization,
partner_merchant_identifier_details: self.partner_merchant_identifier_details,
state_metadata: self.state_metadata,
+ installment_options: self
+ .installment_options
+ .map(common_types::payments::InstallmentOptions),
})
}
@@ -2547,6 +2562,7 @@ impl behaviour::Conversion for PaymentIntent {
partner_merchant_identifier_details: storage_model
.partner_merchant_identifier_details,
state_metadata: storage_model.state_metadata,
+ installment_options: storage_model.installment_options.map(|o| o.0),
})
}
.await
@@ -2633,6 +2649,9 @@ impl behaviour::Conversion for PaymentIntent {
tokenization: self.tokenization,
partner_merchant_identifier_details: self.partner_merchant_identifier_details,
state_metadata: self.state_metadata,
+ installment_options: self
+ .installment_options
+ .map(common_types::payments::InstallmentOptions),
})
}
}
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 73c94472ae..0885bd6cf4 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -301,6 +301,9 @@ Never share your secret api keys. Keep them guarded and secure.
common_types::payments::PartnerMerchantIdentifierDetails,
common_types::payments::PartnerApplicationDetails,
common_types::payments::MerchantApplicationDetails,
+ common_types::payments::InstallmentOption,
+ common_types::payments::InstallmentOptionData,
+ common_types::payments::BillingFrequency,
common_types::connector_webhook_configuration::WebhookSetupCapabilities,
common_types::connector_webhook_configuration::WebhookConfigType,
common_types::payments::PaymentIntentStateMetadata,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index fc6362f97c..34ed86c942 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4442,6 +4442,7 @@ mod tests {
billing_descriptor: None,
partner_merchant_identifier_details: None,
state_metadata: None,
+ installment_options: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());
@@ -4532,6 +4533,7 @@ mod tests {
tokenization: None,
partner_merchant_identifier_details: None,
state_metadata: None,
+ installment_options: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())
@@ -4620,6 +4622,7 @@ mod tests {
billing_descriptor: None,
partner_merchant_identifier_details: None,
state_metadata: None,
+ installment_options: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 3cba1ce92a..da5ba76fae 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -2577,6 +2577,10 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.enable_partial_authorization,
enable_overcapture: payment_data.payment_intent.enable_overcapture,
shipping_cost: None,
+ installment_options: payment_data
+ .payment_intent
+ .installment_options
+ .clone(),
})),
&m_key_store,
storage_scheme,
@@ -2667,6 +2671,11 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentDat
})
.attach_printable("Invalid straight through routing rules format")?;
+ request.validate_installment_options().map_err(|err| {
+ let message = format!("invalid installment options: {err}");
+ err.change_context(errors::ApiErrorResponse::InvalidRequestData { message })
+ })?;
+
Ok((
Box::new(self),
operations::ValidateResult {
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 88037512b3..092f663551 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1158,6 +1158,11 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentDat
},
)?;
+ request.validate_installment_options().map_err(|err| {
+ let message = format!("invalid installment options: {err}");
+ err.change_context(errors::ApiErrorResponse::InvalidRequestData { message })
+ })?;
+
if request.confirm.unwrap_or(false) {
helpers::validate_pm_or_token_given(
&request.payment_method,
@@ -1783,6 +1788,7 @@ impl PaymentCreate {
.partner_merchant_identifier_details
.clone(),
state_metadata: None,
+ installment_options: request.installment_options.clone(),
})
}
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index d01b2197a5..5d902b6fe7 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -1062,6 +1062,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.enable_partial_authorization,
enable_overcapture: payment_data.payment_intent.enable_overcapture,
shipping_cost,
+ installment_options: payment_data.payment_intent.installment_options,
})),
key_store,
storage_scheme,
@@ -1164,6 +1165,11 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentDat
})
.attach_printable("Invalid straight through routing rules format")?;
+ request.validate_installment_options().map_err(|err| {
+ let message = format!("invalid installment options: {err}");
+ err.change_context(errors::ApiErrorResponse::InvalidRequestData { message })
+ })?;
+
Ok((
Box::new(self),
operations::ValidateResult {
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 719d21919f..9f82cb2cbe 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -4136,6 +4136,7 @@ where
billing_descriptor: payment_intent.billing_descriptor,
partner_merchant_identifier_details: payment_intent.partner_merchant_identifier_details,
payment_method_tokenization_details,
+ installment_options: payment_intent.installment_options,
};
services::ApplicationResponse::JsonWithHeaders((payments_response, headers))
@@ -4450,6 +4451,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
billing_descriptor: pi.billing_descriptor,
partner_merchant_identifier_details: pi.partner_merchant_identifier_details,
payment_method_tokenization_details: None,
+ installment_options: pi.installment_options,
}
}
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 4422216b38..57cc4346c2 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -1529,6 +1529,7 @@ mod tests {
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
+ installment_options: None,
state_metadata: None,
};
let content =
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 59a7a15903..2261a2d3bb 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -2365,7 +2365,8 @@ where
match req.payment_type.unwrap_or_default() {
api_models::enums::PaymentType::Normal
| api_models::enums::PaymentType::RecurringMandate
- | api_models::enums::PaymentType::NewMandate => {
+ | api_models::enums::PaymentType::NewMandate
+ | api_models::enums::PaymentType::Installment => {
payments::payments_core::<
api_types::Authorize,
payment_types::PaymentsResponse,
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index b4458a08b4..9bb00a8e33 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -299,6 +299,7 @@ pub async fn generate_sample_data(
tokenization: None,
partner_merchant_identifier_details: None,
state_metadata: None,
+ installment_options: None,
};
let (connector_transaction_id, processor_transaction_data) =
ConnectorTransactionId::form_id_and_data(attempt_id.clone());
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 361b70b96f..0919421a33 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -480,6 +480,7 @@ async fn payments_create_core() {
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
+ installment_options: None,
state_metadata: None,
};
let expected_response =
@@ -779,6 +780,7 @@ async fn payments_create_core_adyen_no_redirect() {
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
+ installment_options: None,
state_metadata: None,
},
vec![],
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 6f7f436e82..652aaadc5f 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -240,6 +240,7 @@ async fn payments_create_core() {
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
+ installment_options: None,
state_metadata: None,
};
@@ -548,6 +549,7 @@ async fn payments_create_core_adyen_no_redirect() {
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
+ installment_options: None,
state_metadata: None,
},
vec![],
diff --git a/migrations/2026-02-18-000000_add_installment_options_to_payment_intent/down.sql b/migrations/2026-02-18-000000_add_installment_options_to_payment_intent/down.sql
new file mode 100644
index 0000000000..5d2a879aaf
--- /dev/null
+++ b/migrations/2026-02-18-000000_add_installment_options_to_payment_intent/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent
+DROP COLUMN IF EXISTS installment_options;
diff --git a/migrations/2026-02-18-000000_add_installment_options_to_payment_intent/up.sql b/migrations/2026-02-18-000000_add_installment_options_to_payment_intent/up.sql
new file mode 100644
index 0000000000..26dd4d5845
--- /dev/null
+++ b/migrations/2026-02-18-000000_add_installment_options_to_payment_intent/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent
+ADD COLUMN IF NOT EXISTS installment_options JSONB NULL;