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(connector): [truelayer] Payout benificiary reference validation (#13422)

Nithin Nf8d6296de16f
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index f2b40fd104..3dee3cb514 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -36041,6 +36041,14 @@
"example": "It's my first payout request",
"nullable": true
},
+ "billing_descriptor": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutsBillingDescriptor"
+ }
+ ],
+ "nullable": true
+ },
"entity_type": {
"allOf": [
{
@@ -36351,6 +36359,14 @@
"example": "It's my first payout request",
"nullable": true
},
+ "billing_descriptor": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutsBillingDescriptor"
+ }
+ ],
+ "nullable": true
+ },
"entity_type": {
"$ref": "#/components/schemas/PayoutEntityType"
},
@@ -37119,6 +37135,14 @@
"example": "It's my first payout request",
"nullable": true
},
+ "billing_descriptor": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutsBillingDescriptor"
+ }
+ ],
+ "nullable": true
+ },
"entity_type": {
"allOf": [
{
@@ -37227,6 +37251,22 @@
}
}
},
+ "PayoutsBillingDescriptor": {
+ "type": "object",
+ "description": "Billing descriptor information for a payout.",
+ "properties": {
+ "reference": {
+ "type": "string",
+ "description": "Reference displayed on the beneficiary's bank statement.",
+ "nullable": true
+ },
+ "statement_descriptor": {
+ "type": "string",
+ "description": "Statement descriptor displayed for the payout.",
+ "nullable": true
+ }
+ }
+ },
"PayoutsCreateRequest": {
"type": "object",
"required": [
@@ -37359,6 +37399,14 @@
"example": "It's my first payout request",
"nullable": true
},
+ "billing_descriptor": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutsBillingDescriptor"
+ }
+ ],
+ "nullable": true
+ },
"entity_type": {
"allOf": [
{
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index b835e38c1a..51686913c9 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -25800,6 +25800,14 @@
"example": "It's my first payout request",
"nullable": true
},
+ "billing_descriptor": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutsBillingDescriptor"
+ }
+ ],
+ "nullable": true
+ },
"entity_type": {
"allOf": [
{
@@ -26041,6 +26049,14 @@
"example": "It's my first payout request",
"nullable": true
},
+ "billing_descriptor": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutsBillingDescriptor"
+ }
+ ],
+ "nullable": true
+ },
"entity_type": {
"$ref": "#/components/schemas/PayoutEntityType"
},
@@ -26651,6 +26667,22 @@
"bank_redirect"
]
},
+ "PayoutsBillingDescriptor": {
+ "type": "object",
+ "description": "Billing descriptor information for a payout.",
+ "properties": {
+ "reference": {
+ "type": "string",
+ "description": "Reference displayed on the beneficiary's bank statement.",
+ "nullable": true
+ },
+ "statement_descriptor": {
+ "type": "string",
+ "description": "Statement descriptor displayed for the payout.",
+ "nullable": true
+ }
+ }
+ },
"Paypal": {
"type": "object",
"required": [
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 31a44e04ec..7ac0f4a4af 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -2,6 +2,7 @@ use std::collections::HashMap;
use cards::CardNumber;
use common_enums::CardNetwork;
+use common_types::payouts::PayoutsBillingDescriptor;
#[cfg(feature = "v2")]
use common_utils::types::BrowserInformation;
use common_utils::{
@@ -147,6 +148,10 @@ pub struct PayoutCreateRequest {
#[schema(example = "It's my first payout request", value_type = Option<String>)]
pub description: Option<String>,
+ /// Billing descriptor information for the payout. The reference is displayed on the beneficiary's bank statement.
+ #[schema(value_type = Option<PayoutsBillingDescriptor>)]
+ pub billing_descriptor: Option<PayoutsBillingDescriptor>,
+
/// Type of entity to whom the payout is being carried out to, select from the given list of options
#[schema(value_type = Option<PayoutEntityType>, example = "Individual")]
pub entity_type: Option<api_enums::PayoutEntityType>,
@@ -831,6 +836,10 @@ pub struct PayoutCreateResponse {
#[schema(example = "It's my first payout request", value_type = Option<String>)]
pub description: Option<String>,
+ /// Billing descriptor information for the payout
+ #[schema(value_type = Option<PayoutsBillingDescriptor>)]
+ pub billing_descriptor: Option<PayoutsBillingDescriptor>,
+
/// Type of entity to whom the payout is being carried out to
#[schema(value_type = PayoutEntityType, example = "Individual")]
pub entity_type: api_enums::PayoutEntityType,
diff --git a/crates/common_types/src/lib.rs b/crates/common_types/src/lib.rs
index fde491ee14..5de755ac55 100644
--- a/crates/common_types/src/lib.rs
+++ b/crates/common_types/src/lib.rs
@@ -7,6 +7,7 @@ pub mod customers;
pub mod domain;
pub mod payment_methods;
pub mod payments;
+pub mod payouts;
/// types that are wrappers around primitive types
pub mod primitive_wrappers;
pub mod refunds;
diff --git a/crates/common_types/src/payouts.rs b/crates/common_types/src/payouts.rs
new file mode 100644
index 0000000000..52527a1e08
--- /dev/null
+++ b/crates/common_types/src/payouts.rs
@@ -0,0 +1,20 @@
+//! Payout related types.
+
+use common_utils::impl_to_sql_from_sql_json;
+use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};
+use serde::{Deserialize, Serialize};
+use utoipa::ToSchema;
+
+/// Billing descriptor information for a payout.
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct PayoutsBillingDescriptor {
+ /// Reference displayed on the beneficiary's bank statement.
+ pub reference: Option<String>,
+ /// Statement descriptor displayed for the payout.
+ pub statement_descriptor: Option<String>,
+}
+
+impl_to_sql_from_sql_json!(PayoutsBillingDescriptor);
diff --git a/crates/diesel_models/src/payouts.rs b/crates/diesel_models/src/payouts.rs
index 5211637a44..ffd738b400 100644
--- a/crates/diesel_models/src/payouts.rs
+++ b/crates/diesel_models/src/payouts.rs
@@ -40,6 +40,7 @@ pub struct Payouts {
pub organization_id: Option<common_utils::id_type::OrganizationId>,
pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,
pub created_by: Option<String>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
#[derive(
@@ -84,6 +85,7 @@ pub struct PayoutsNew {
pub organization_id: Option<common_utils::id_type::OrganizationId>,
pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,
pub created_by: Option<String>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -104,6 +106,7 @@ pub enum PayoutsUpdate {
payout_type: Option<storage_enums::PayoutType>,
address_id: Option<String>,
customer_id: Option<common_utils::id_type::CustomerId>,
+ billing_descriptor: Option<Box<common_types::payouts::PayoutsBillingDescriptor>>,
},
PayoutMethodIdUpdate {
payout_method_id: String,
@@ -144,6 +147,7 @@ pub struct PayoutsUpdateInternal {
pub payout_type: Option<common_enums::PayoutType>,
pub address_id: Option<String>,
pub customer_id: Option<common_utils::id_type::CustomerId>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
impl Default for PayoutsUpdateInternal {
@@ -167,6 +171,7 @@ impl Default for PayoutsUpdateInternal {
payout_type: None,
address_id: None,
customer_id: None,
+ billing_descriptor: None,
}
}
}
@@ -190,6 +195,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
payout_type,
address_id,
customer_id,
+ billing_descriptor,
} => Self {
amount: Some(amount),
destination_currency: Some(destination_currency),
@@ -206,6 +212,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
payout_type,
address_id,
customer_id,
+ billing_descriptor: billing_descriptor.map(|descriptor| *descriptor),
..Default::default()
},
PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self {
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index ba6b6a02a9..b3224b511a 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1590,6 +1590,7 @@ diesel::table! {
processor_merchant_id -> Nullable<Varchar>,
#[max_length = 255]
created_by -> Nullable<Varchar>,
+ billing_descriptor -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index d705f234fa..6007546543 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1531,6 +1531,7 @@ diesel::table! {
processor_merchant_id -> Nullable<Varchar>,
#[max_length = 255]
created_by -> Nullable<Varchar>,
+ billing_descriptor -> Nullable<Jsonb>,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs b/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
index f14388f19b..aeb834c9c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
@@ -342,6 +342,12 @@ pub struct TruelayerPayoutRequest {
amount_in_minor: MinorUnit,
currency: api_models::enums::Currency,
beneficiary: TruelayerBeneficiary,
+ metadata: Option<TruelayerPayoutMetadata>,
+}
+
+#[derive(Debug, Serialize, Deserialize, PartialEq)]
+pub struct TruelayerPayoutMetadata {
+ reference_id: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, PartialEq)]
@@ -376,18 +382,34 @@ impl TryFrom<&TruelayerRouterData<&PayoutsRouterData<PoFulfill>>> for TruelayerP
fn try_from(
item: &TruelayerRouterData<&PayoutsRouterData<PoFulfill>>,
) -> Result<Self, Self::Error> {
+ let reference = item
+ .router_data
+ .request
+ .billing_descriptor
+ .as_ref()
+ .and_then(|descriptor| descriptor.reference.as_ref())
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "billing_descriptor.reference",
+ })?;
+
+ validate_fps_payout_reference(reference)?;
+
+ let metadata = Some(TruelayerPayoutMetadata {
+ reference_id: Some(item.router_data.connector_request_reference_id.clone()),
+ });
+
match item.router_data.get_payout_method_data()? {
PayoutMethodData::BankTransfer(BankTransfer::OpenBanking(open_banking_data)) => {
- let metadata = TruelayerMetadata::try_from(&item.router_data.connector_meta_data)?;
+ let truelayer_metadata =
+ TruelayerMetadata::try_from(&item.router_data.connector_meta_data)?;
Ok(Self {
- merchant_account_id: metadata.merchant_account_id,
+ merchant_account_id: truelayer_metadata.merchant_account_id,
+ metadata,
amount_in_minor: item.amount,
currency: item.router_data.request.destination_currency,
beneficiary: TruelayerBeneficiary {
_type: TruelayerBeneficiaryType::ExternalAccount,
- reference: normalize_connector_request_reference_id(
- &item.router_data.connector_request_reference_id.clone(),
- ),
+ reference: reference.clone(),
account_holder_name: Some(open_banking_data.account_holder_name),
account_identifier: Some(TruelayerAccountIdentifier {
_type: "iban".to_string(),
@@ -399,16 +421,16 @@ impl TryFrom<&TruelayerRouterData<&PayoutsRouterData<PoFulfill>>> for TruelayerP
})
}
PayoutMethodData::Passthrough(passthrough_data) => {
- let metadata = TruelayerMetadata::try_from(&item.router_data.connector_meta_data)?;
+ let truelayer_metadata =
+ TruelayerMetadata::try_from(&item.router_data.connector_meta_data)?;
Ok(Self {
- merchant_account_id: metadata.merchant_account_id,
+ merchant_account_id: truelayer_metadata.merchant_account_id,
amount_in_minor: item.amount,
+ metadata,
currency: item.router_data.request.destination_currency,
beneficiary: TruelayerBeneficiary {
_type: TruelayerBeneficiaryType::PaymentSource,
- reference: normalize_connector_request_reference_id(
- &item.router_data.connector_request_reference_id.clone(),
- ),
+ reference: reference.clone(),
account_holder_name: None,
account_identifier: None,
user_id: passthrough_data.psp_customer_id,
@@ -424,6 +446,25 @@ impl TryFrom<&TruelayerRouterData<&PayoutsRouterData<PoFulfill>>> for TruelayerP
}
}
+#[cfg(feature = "payouts")]
+fn validate_fps_payout_reference(
+ reference: &str,
+) -> Result<(), error_stack::Report<errors::ConnectorError>> {
+ let has_valid_length = !reference.is_empty() && reference.len() <= 18;
+ let has_valid_characters = reference
+ .chars()
+ .all(|character| character.is_ascii_alphanumeric() || matches!(character, '-' | '.'));
+
+ if has_valid_length && has_valid_characters {
+ Ok(())
+ } else {
+ Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "billing_descriptor.reference , expected to be alphanumeric, hyphen, or period and length between 1 and 18 characters for truelayer",
+ }
+ .into())
+ }
+}
+
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct TruelayerPayoutResponse {
id: String,
@@ -661,13 +702,6 @@ pub fn generate_tl_signature(
}
}
-fn normalize_connector_request_reference_id(reference_id: &str) -> String {
- reference_id
- .chars()
- .map(|c| if c == '_' { '-' } else { c })
- .collect()
-}
-
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TruelayerPayoutsWebhookEvent {
diff --git a/crates/hyperswitch_domain_models/src/payouts/payouts.rs b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
index ce5fd0edd2..a94475c8d3 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
@@ -129,6 +129,7 @@ pub struct Payouts {
pub organization_id: Option<id_type::OrganizationId>,
pub processor_merchant_id: Option<id_type::MerchantId>,
pub created_by: Option<common_utils::types::CreatedBy>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -160,6 +161,7 @@ pub struct PayoutsNew {
pub organization_id: Option<id_type::OrganizationId>,
pub processor_merchant_id: Option<id_type::MerchantId>,
pub created_by: Option<common_utils::types::CreatedBy>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -180,6 +182,7 @@ pub enum PayoutsUpdate {
payout_type: Option<storage_enums::PayoutType>,
address_id: Option<String>,
customer_id: Option<id_type::CustomerId>,
+ billing_descriptor: Option<Box<common_types::payouts::PayoutsBillingDescriptor>>,
},
PayoutMethodIdUpdate {
payout_method_id: String,
@@ -217,6 +220,7 @@ pub struct PayoutsUpdateInternal {
pub payout_type: Option<common_enums::PayoutType>,
pub address_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
impl From<PayoutsUpdate> for PayoutsUpdateInternal {
@@ -238,6 +242,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
payout_type,
address_id,
customer_id,
+ billing_descriptor,
} => Self {
amount: Some(amount),
destination_currency: Some(destination_currency),
@@ -254,6 +259,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
payout_type,
address_id,
customer_id,
+ billing_descriptor: billing_descriptor.map(|descriptor| *descriptor),
..Default::default()
},
PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self {
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index a377fbc93e..6cb24e0340 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -1755,6 +1755,7 @@ pub struct PayoutsData {
pub payout_connector_metadata: Option<pii::SecretSerdeValue>,
pub additional_payout_method_data: Option<payout_method_utils::AdditionalPayoutMethodData>,
pub source_bank_data: Option<api_models::payouts::BankTransfer>,
+ pub billing_descriptor: Option<common_types::payouts::PayoutsBillingDescriptor>,
}
#[derive(Debug, Default, Clone, Serialize)]
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 58932b9892..f9ee43dd70 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -860,6 +860,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::NetworkTokenResponse,
api_models::payments::Address,
api_models::payments::BankCodeResponse,
+ common_types::payouts::PayoutsBillingDescriptor,
api_models::payouts::CardPayout,
api_models::payouts::Wallet,
api_models::payouts::Paypal,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 87d0be95d5..213f6e7327 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -762,6 +762,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::CollectionActions,
api_models::payments::ProtestRules,
api_models::payments::PeachpaymentsCardOnFileTransactionType,
+ common_types::payouts::PayoutsBillingDescriptor,
api_models::payouts::CardPayout,
api_models::payouts::Wallet,
api_models::payouts::Paypal,
diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs
index 9c247f0008..4d2cb37e4e 100644
--- a/crates/router/src/core/errors/utils.rs
+++ b/crates/router/src/core/errors/utils.rs
@@ -523,6 +523,9 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
config: config.to_string(),
}
}
+ errors::ConnectorError::InvalidDataFormat { field_name } => {
+ errors::ApiErrorResponse::InvalidDataValue { field_name }
+ }
_ => errors::ApiErrorResponse::InternalServerError,
};
err.change_context(error)
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 9f77b92af2..42511561b5 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -2977,6 +2977,7 @@ pub async fn response_handler(
business_country: payout_attempt.business_country,
business_label: payout_attempt.business_label,
description: payouts.description.to_owned(),
+ billing_descriptor: payouts.billing_descriptor.to_owned(),
entity_type: payouts.entity_type.to_owned(),
recurring: payouts.recurring,
metadata: payouts.metadata.clone(),
@@ -3144,6 +3145,7 @@ pub async fn payout_create_db_entries(
destination_currency: currency,
source_currency: currency,
description: req.description.to_owned(),
+ billing_descriptor: req.billing_descriptor.to_owned(),
recurring: req.recurring.unwrap_or(false),
auto_fulfill: req.auto_fulfill.unwrap_or(false),
return_url: req.return_url.to_owned(),
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index d0817b29ff..9e829c4556 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -1463,6 +1463,11 @@ pub async fn update_payouts_and_payout_attempt(
.to_owned()
.clone()
.or(payouts.description.clone()),
+ billing_descriptor: req
+ .billing_descriptor
+ .to_owned()
+ .or(payouts.billing_descriptor.clone())
+ .map(Box::new),
recurring: req.recurring.to_owned().unwrap_or(payouts.recurring),
auto_fulfill: req.auto_fulfill.to_owned().unwrap_or(payouts.auto_fulfill),
return_url: req
diff --git a/crates/router/src/core/payouts/transformers.rs b/crates/router/src/core/payouts/transformers.rs
index a849a4fc58..1bf423f7f3 100644
--- a/crates/router/src/core/payouts/transformers.rs
+++ b/crates/router/src/core/payouts/transformers.rs
@@ -81,6 +81,7 @@ impl
business_country: payout_attempt.business_country,
business_label: payout_attempt.business_label,
description: payout.description,
+ billing_descriptor: payout.billing_descriptor,
entity_type: payout.entity_type,
recurring: payout.recurring,
metadata: payout.metadata,
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 804b0c50c3..4704bdb7b9 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -306,6 +306,7 @@ pub async fn construct_payout_router_data<'a, F>(
payout_connector_metadata: payout_attempt.payout_connector_metadata.to_owned(),
additional_payout_method_data: payout_attempt.additional_payout_method_data.to_owned(),
source_bank_data: payout_data.source_bank_data.clone(),
+ billing_descriptor: payouts.billing_descriptor.clone(),
},
response: Ok(types::PayoutsResponseData::default()),
access_token: None,
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index f833541f77..9f1ed5d383 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -483,6 +483,7 @@ pub trait ConnectorActions: Connector {
payout_connector_metadata: None,
additional_payout_method_data: None,
source_bank_data: None,
+ billing_descriptor: None,
},
payment_info,
)
diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs
index c8188f15f1..cbff36e679 100644
--- a/crates/storage_impl/src/payouts/payouts.rs
+++ b/crates/storage_impl/src/payouts/payouts.rs
@@ -108,6 +108,7 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
organization_id: new.organization_id.clone(),
processor_merchant_id: new.processor_merchant_id.clone(),
created_by: new.created_by.clone(),
+ billing_descriptor: new.billing_descriptor.clone(),
};
let mut query_gen_conn = pg_connection_write(self).await?;
@@ -982,6 +983,7 @@ impl DataModelExt for Payouts {
organization_id: self.organization_id,
processor_merchant_id: self.processor_merchant_id,
created_by: self.created_by.map(|created_by| created_by.to_string()),
+ billing_descriptor: self.billing_descriptor,
}
}
@@ -1016,6 +1018,7 @@ impl DataModelExt for Payouts {
created_by: storage_model
.created_by
.and_then(|created_by| created_by.parse::<common_utils::types::CreatedBy>().ok()),
+ billing_descriptor: storage_model.billing_descriptor,
}
}
}
@@ -1051,6 +1054,7 @@ impl DataModelExt for PayoutsNew {
organization_id: self.organization_id,
processor_merchant_id: self.processor_merchant_id,
created_by: self.created_by.map(|created_by| created_by.to_string()),
+ billing_descriptor: self.billing_descriptor,
}
}
@@ -1085,6 +1089,7 @@ impl DataModelExt for PayoutsNew {
created_by: storage_model
.created_by
.and_then(|created_by| created_by.parse::<common_utils::types::CreatedBy>().ok()),
+ billing_descriptor: storage_model.billing_descriptor,
}
}
}
@@ -1108,6 +1113,7 @@ impl DataModelExt for PayoutsUpdate {
payout_type,
address_id,
customer_id,
+ billing_descriptor,
} => DieselPayoutsUpdate::Update {
amount,
destination_currency,
@@ -1124,6 +1130,7 @@ impl DataModelExt for PayoutsUpdate {
payout_type,
address_id,
customer_id,
+ billing_descriptor,
},
Self::PayoutMethodIdUpdate { payout_method_id } => {
DieselPayoutsUpdate::PayoutMethodIdUpdate { payout_method_id }
diff --git a/migrations/2026-07-22-000001_add_billing_descriptor_to_payouts/down.sql b/migrations/2026-07-22-000001_add_billing_descriptor_to_payouts/down.sql
new file mode 100644
index 0000000000..65663f3d89
--- /dev/null
+++ b/migrations/2026-07-22-000001_add_billing_descriptor_to_payouts/down.sql
@@ -0,0 +1,2 @@
+ALTER TABLE payouts
+DROP COLUMN IF EXISTS billing_descriptor;
diff --git a/migrations/2026-07-22-000001_add_billing_descriptor_to_payouts/up.sql b/migrations/2026-07-22-000001_add_billing_descriptor_to_payouts/up.sql
new file mode 100644
index 0000000000..47c6ca1de0
--- /dev/null
+++ b/migrations/2026-07-22-000001_add_billing_descriptor_to_payouts/up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE payouts
+ADD COLUMN IF NOT EXISTS billing_descriptor JSONB;