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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(payouts): add terminal NotPermitted payout status (#13524)
Siddhesh Kulthecc6cfec6bb32
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex d782b9bdd4..e3942e1d2c 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -21378,6 +21378,7 @@"payout_cancelled","payout_expired","payout_reversed",+ "payout_not_permitted","invoice_paid","surcharge_payment_succeeded","surcharge_refund_succeeded"@@ -37042,6 +37043,7 @@"reversed","pending","ineligible",+ "not_permitted","requires_creation","requires_confirmation","requires_payout_method_data",diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 6c29cec9cf..3aba11f495 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -14464,6 +14464,7 @@"payout_cancelled","payout_expired","payout_reversed",+ "payout_not_permitted","invoice_paid","surcharge_payment_succeeded","surcharge_refund_succeeded"@@ -26715,6 +26716,7 @@"reversed","pending","ineligible",+ "not_permitted","requires_creation","requires_confirmation","requires_payout_method_data",diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex f5bbdacb8e..6b1af90d5f 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -1911,6 +1911,7 @@ impl EventClass {EventType::PayoutCancelled,EventType::PayoutExpired,EventType::PayoutReversed,+ EventType::PayoutNotPermitted,]),Self::Subscriptions => HashSet::from([EventType::InvoicePaid]),}@@ -1972,6 +1973,8 @@ pub enum EventType {PayoutExpired,#[cfg(feature = "payouts")]PayoutReversed,+ #[cfg(feature = "payouts")]+ PayoutNotPermitted,InvoicePaid,SurchargePaymentSucceeded,SurchargeRefundSucceeded,@@ -8860,7 +8863,15 @@ pub enum PayoutStatus {Expired,Reversed,Pending,+ /// Non-terminal: the payout method/payee was found ineligible, but the payout+ /// is not conclusively closed. This status is intentionally NOT terminal and+ /// emits no outgoing webhook (see `From<PayoutStatus> for Option<EventType>`).Ineligible,+ /// Terminal: the payout was conclusively refused by the processor (e.g. a+ /// Verification-of-Payee "no match" / "could not verify" result). Unlike+ /// [`PayoutStatus::Ineligible`], this is a final failure state — it counts as a+ /// payout failure and triggers a `payout_failed` outgoing webhook to the merchant.+ NotPermitted,#[default]RequiresCreation,RequiresConfirmation,@@ -8873,7 +8884,7 @@ impl PayoutStatus {pub fn is_payout_failure(&self) -> bool {matches!(self,- Self::Failed | Self::Cancelled | Self::Expired | Self::Ineligible+ Self::Failed | Self::Cancelled | Self::Expired | Self::Ineligible | Self::NotPermitted)}@@ -8884,7 +8895,12 @@ impl PayoutStatus {pub fn is_terminal_status(&self) -> bool {matches!(self,- Self::Success | Self::Failed | Self::Cancelled | Self::Expired | Self::Reversed+ Self::Success+ | Self::Failed+ | Self::Cancelled+ | Self::Expired+ | Self::Reversed+ | Self::NotPermitted)}}diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rsindex 4cb22599c6..29863caffa 100644--- a/crates/common_enums/src/transformers.rs+++ b/crates/common_enums/src/transformers.rs@@ -2192,6 +2192,9 @@ impl From<PayoutStatus> for Option<EventType> {PayoutStatus::Initiated => Some(EventType::PayoutInitiated),PayoutStatus::Expired => Some(EventType::PayoutExpired),PayoutStatus::Reversed => Some(EventType::PayoutReversed),+ // Terminal refusal (e.g. VoP no-match) Contrast with `Ineligible` below,+ // which is non-terminal and intentionally emits no webhook.+ PayoutStatus::NotPermitted => Some(EventType::PayoutNotPermitted),PayoutStatus::Ineligible| PayoutStatus::Pending| PayoutStatus::RequiresCreationdiff --git a/crates/router/src/compatibility/stripe/webhooks.rs b/crates/router/src/compatibility/stripe/webhooks.rsindex 860fcfc279..11d9d008d5 100644--- a/crates/router/src/compatibility/stripe/webhooks.rs+++ b/crates/router/src/compatibility/stripe/webhooks.rs@@ -149,7 +149,9 @@ impl From<common_enums::PayoutStatus> for StripePayoutStatus {fn from(status: common_enums::PayoutStatus) -> Self {match status {common_enums::PayoutStatus::Success => Self::PayoutSuccess,- common_enums::PayoutStatus::Failed => Self::PayoutFailure,+ common_enums::PayoutStatus::Failed | common_enums::PayoutStatus::NotPermitted => {+ Self::PayoutFailure+ }common_enums::PayoutStatus::Cancelled => Self::PayoutCancelled,common_enums::PayoutStatus::Initiated => Self::PayoutInitiated,common_enums::PayoutStatus::Expired => Self::PayoutExpired,@@ -305,6 +307,9 @@ fn get_stripe_event_type(event_type: api_models::enums::EventType) -> &'static sapi_models::enums::EventType::PayoutProcessing => "payout.created",api_models::enums::EventType::PayoutExpired => "payout.failed",api_models::enums::EventType::PayoutReversed => "payout.reconciliation_completed",+ // Stripe has no distinct "not permitted" payout event; a terminal refusal is+ // reported to stripe-compat consumers as a failure.+ api_models::enums::EventType::PayoutNotPermitted => "payout.failed",api_models::enums::EventType::InvoicePaid => "invoice.paid",}}diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rsindex 42511561b5..aceeadfc21 100644--- a/crates/router/src/core/payouts.rs+++ b/crates/router/src/core/payouts.rs@@ -447,6 +447,7 @@ pub async fn payouts_confirm_core(storage_enums::PayoutStatus::Failed,storage_enums::PayoutStatus::Pending,storage_enums::PayoutStatus::Ineligible,+ storage_enums::PayoutStatus::NotPermitted,storage_enums::PayoutStatus::RequiresFulfillment,storage_enums::PayoutStatus::RequiresVendorAccountCreation,],diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rsindex 9e829c4556..699e493240 100644--- a/crates/router/src/core/payouts/helpers.rs+++ b/crates/router/src/core/payouts/helpers.rs@@ -1359,6 +1359,7 @@ pub fn is_payout_err_state(status: api_enums::PayoutStatus) -> bool {api_enums::PayoutStatus::Cancelled| api_enums::PayoutStatus::Failed| api_enums::PayoutStatus::Ineligible+ | api_enums::PayoutStatus::NotPermitted)}diff --git a/crates/router/src/core/payouts/retry.rs b/crates/router/src/core/payouts/retry.rsindex dc57dbe0c2..d8a5310e87 100644--- a/crates/router/src/core/payouts/retry.rs+++ b/crates/router/src/core/payouts/retry.rs@@ -348,6 +348,7 @@ impl GsmValidation for PayoutData {| common_enums::PayoutStatus::Reversed| common_enums::PayoutStatus::Expired| common_enums::PayoutStatus::Ineligible+ | common_enums::PayoutStatus::NotPermitted| common_enums::PayoutStatus::RequiresCreation| common_enums::PayoutStatus::RequiresPayoutMethodData| common_enums::PayoutStatus::RequiresVendorAccountCreationdiff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex 41d77352b7..f5b1253d72 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -6972,6 +6972,7 @@ impl transformers::ForeignTryFrom<payments_grpc::payout_enums::PayoutStatus>payments_grpc::payout_enums::PayoutStatus::Reversed => Ok(Self::Reversed),payments_grpc::payout_enums::PayoutStatus::Pending => Ok(Self::Pending),payments_grpc::payout_enums::PayoutStatus::Ineligible => Ok(Self::Ineligible),+ // #TODO: map grpc PayoutStatus::NotPermitted -> Self::NotPermitted once UCS version is bumpedpayments_grpc::payout_enums::PayoutStatus::RequiresCreation => {Ok(Self::RequiresCreation)}diff --git a/migrations/2026-07-29-120000_add_not_permitted_to_payout_status/down.sql b/migrations/2026-07-29-120000_add_not_permitted_to_payout_status/down.sqlnew file mode 100644index 0000000000..f88262ebf4--- /dev/null+++ b/migrations/2026-07-29-120000_add_not_permitted_to_payout_status/down.sql@@ -0,0 +1,3 @@+-- Postgres does not support removing a value from an enum type without+-- recreating it; this is a no-op to keep the migration reversible in form.+SELECT 1;diff --git a/migrations/2026-07-29-120000_add_not_permitted_to_payout_status/up.sql b/migrations/2026-07-29-120000_add_not_permitted_to_payout_status/up.sqlnew file mode 100644index 0000000000..99908f0574--- /dev/null+++ b/migrations/2026-07-29-120000_add_not_permitted_to_payout_status/up.sql@@ -0,0 +1,7 @@+-- Add the terminal `not_permitted` payout status (e.g. Verification-of-Payee+-- refusal). Distinct from the non-terminal `ineligible`.+ALTER TYPE "PayoutStatus" ADD VALUE IF NOT EXISTS 'not_permitted';++-- Outgoing webhook event for the above status. Emitted instead of+-- `payout_failed` so the refusal is explicit to merchants.+ALTER TYPE "EventType" ADD VALUE IF NOT EXISTS 'payout_not_permitted';