Charged Twice, Delivered Twice: What "Exactly Once" Protects

RedHub AI Editorialupdated November 5, 20266 min read

A payment tray at a dry cleaner's holds two identical stacks of coins for one shirt, lit red.
Jump to a section8

"Exactly once" protects against one payment doing its work twice: a card charged a second time, access granted twice, one sale recorded as two orders. Duplicate charge idempotency is the property that stops it. A step is idempotent when a repeat of the same request or the same notification changes nothing the second time. Repeats are normal. Processors can send the same notification more than once, and your own server can retry a request it never heard back from.

TL;DR: A step that runs twice for one payment is as broken as a step that never runs. Repeats come from two places: the processor resending a notification to your server, and your server retrying a charge request after a timeout. Guard the first by recording which events you have already handled, ideally with a database rule that refuses a second copy. Guard the second with an idempotency key, where your provider supports one. Idempotency is part of what "handled" means, not a polish item.

Where the second copy comes from

Notifications coming in. Stripe's webhook documentation says plainly that an endpoint might occasionally receive the same event more than once, and suggests logging the event IDs you have processed so you can skip repeats. Its Checkout fulfillment guide goes further. It warns that your fulfillment function might be called multiple times, possibly concurrently, for the same checkout session. Retries are deliberate. Losing a notification because your server was briefly down would be worse than sending it twice.

Requests going out. The other direction catches people too. Your server asks the processor to create a charge, the connection drops before the answer comes back, and your code retries. Did the first one go through? Without a guard, you cannot tell, and the retry may charge again. Stripe's API documentation describes idempotency keys for this. You send a unique key with a create request, and a retry with the same key returns the first result instead of performing the operation twice.

The exact retry schedule, key format and guarantees differ by provider and change over time. Check your provider's current docs. The shape does not change: your system will hear about some payments twice, and it needs a rule for the second time.

Running twice is not extra safety

It is tempting to read "it ran twice" as harmless, like a backup copy. For a step that moves money or grants something, that is backwards. A second charge on the customer's card is a charge they did not agree to. A second grant, in a system that counts seats, is two licenses for one purchase. A second order row means your sales figures are wrong in a way nobody notices until the numbers fail to match the processor's.

Never fires, fires twice: one class of bug

Never firesFires twice
Customer paid, got nothingCustomer paid once, was charged or granted twice
Ticket: "I paid and nothing happened"Ticket: "I was charged twice" or "why do I have two orders?"
No trigger, nothing listeningA trigger with no memory of having already acted
Fails for an ordinary customer with nobody attackingFails for an ordinary customer with nobody attacking

These look like opposite problems. They fail the same customer in the same way: an honest person on an ordinary day. A build that checks "does the notification arrive" and stops has checked half of what handled means.

What "safe to run twice" looks like

Before a step acts on a payment notification, it checks whether it has already handled that exact event, using the ID the processor sends with it. If it has, it does nothing more and still replies with success, so the processor stops retrying. If it has not, it does the work and records the ID.

There is a catch in "check, then act." Two copies arriving at the same moment can both pass the check before either one records anything. Stripe's "possibly concurrently" warning is about exactly this. The sturdier version lets the database enforce it: a unique rule on the event ID, or on the order's payment ID, so the second insert fails instead of creating a duplicate. That is usually a small change to a step that already exists, not a rebuild.

Not affiliated: RedHub is not affiliated with or endorsed by Stripe or any other provider. The Stripe guidance here is paraphrased from its public documentation as read in November 2026. Event IDs, idempotency keys and retry rules work differently at different processors, so check yours before building against them.

Testing it without reading the code

Ask of every step that reacts to a payment notification: if this exact notification arrived twice in a row, what would happen the second time? Then ask your AI builder one sentence: "Does this step check whether it has already processed this payment event, and what stops two copies arriving at once from both getting through?" A clear answer is what you want. "It should be fine" is a guess.

Some providers let you resend a test event to your own server, from a dashboard or a command-line tool. That lets you watch the second-time behavior instead of reasoning about it. Check what yours supports.

How the Money Path Teardown grades a repeat

In the Money Path Teardown, the fourth question on every step is runs_twice_safely, answered yes, no or can't find. Yes means running it again changes nothing. On a step the processor's event triggers, where the browser does not decide the amount, a no reads NOT HANDLED, with the reason that it would do its work twice if it ran twice. A can't find is scored as unsafe, so it reads NOT HANDLED too. The Dashboard counts these separately as steps that would do their work twice.

Two limits are worth knowing. The sheet ranks a redirect-triggered step, or one where the browser decides the amount, as TAKEN ON TRUST before it looks at the runs-twice answer. So a redirect step that also runs twice shows only as TAKEN ON TRUST, and you should still fix the repeat. And it reads back what you tell it. It does not resend anything or connect to your account.

More in this guide

Frequently asked questions

What is idempotency, in plain terms?

A step is idempotent when doing it again with the same input changes nothing. For a payment step, that means a repeated notification about a charge that already happened does not charge again, grant again, or record a second order, and a retried charge request with the same idempotency key does not create a second charge.

Why would the same payment notification arrive more than once?

Processors retry notifications they do not think were received, for example when your server replies slowly or with an error. Stripe's webhook documentation states that an endpoint might occasionally receive the same event more than once. Other providers describe their own rules, so check your provider's documentation for the exact conditions.

What causes a duplicate charge, as opposed to a duplicate order?

A common cause is a charge request retried after a timeout, when the first attempt went through. Providers that support idempotency keys let you send a unique key with the request, so a retry with the same key returns the original result instead of charging again. Check whether and how your provider supports this.

Is a step that fires twice as bad as one that never fires?

Both fail an ordinary customer on an ordinary day with nobody attacking anything. One does nothing for them. The other does too much. Neither is a step you can call handled.

How do I make a step safe to run twice?

Record the ID of each payment event you handle, and before acting, check whether that ID is already recorded. Because two copies can arrive at the same moment, let the database refuse a duplicate with a unique rule on that ID instead of relying on the check alone. This is usually a small addition, not a rebuild.

How it decides
Diagram of the Money-Path Teardown: ten payment steps, a worst-answer resolution rule, and a sample reading PATH BREAKS.

The gate this post refers to, drawn from the tool’s own logic. See the tool.