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(payments_list): handle same payment/attempt ids for different merchants (#6917)

Apoorv Dixit2e472e3fee0c
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index fe64136b74..786cbe75a4 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -831,10 +831,11 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
let conn = connection::pg_connection_read(self).await.switch()?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
+ .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
.inner_join(
payment_attempt_schema::table.on(pa_dsl::attempt_id.eq(pi_dsl::active_attempt_id)),
)
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pa_dsl::merchant_id.eq(merchant_id.to_owned())) // Ensure merchant_ids match, as different merchants can share payment/attempt IDs.
.into_boxed();
query = match constraints {