Menu

How a Duplicate Debit Almost Reached Our Customers, and the Webhook Pattern That Prevents It
📰

How a Duplicate Debit Almost Reached Our Customers, and the Webhook Pattern That Prevents It

DEV Community: dotnet·Ricardo Ferreira·10 days ago
#5KXcFDbk
#devtodotnet#devto#dev#stripe#event
Long article (1911 words) — no AI summary yet.
Reading 0:00
15s threshold

I work on backend systems for banks in Brazil. This article starts with a real incident from my time at a Brazilian bank, where I worked on credit pipelines and direct debit processing. It then shows the same problem in a small .NET 8 webhook endpoint you can run yourself.

The incident

We received a CNAB file, the bank file format used in Brazil. While we were processing it, a timeout happened. The processing ran twice. We had two records for the same debits, and nothing in the code treated them as duplicates.

We noticed the problem when a duplicate debit arrived almost at the edge of the customer's account. The debit was already being sent to the customer. We had an event flagged by Dynatrace, a network service interruption. We went hunting for problems in the system in general, and that is when we caught some duplicate debits.

There was no financial loss.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.