Why customers get charged twice, and how apps prevent it
Short answer: Customers get charged twice when the same payment request is sent twice: a double-click, a page refresh, a mobile connection dropping mid-request, or your server retrying after a timeout. Apps prevent it with three habits: disable the pay button after the first click, send an idempotency key with every payment request so the provider recognizes retries, and process payment webhooks only once by recording event IDs. Most duplicate-charge complaints trace to one of those missing.
"I was charged twice" is one of the most stressful support emails a small business can get, and one of the most fixable. Here's a symptom-by-symptom guide to the usual causes, with fixes your developer can apply.
How payment requests get duplicated
Every online payment involves your app asking a payment provider to create a charge or payment. If that request is sent twice and the provider can't tell the second one is a repeat, it may process both. Stripe's API documentation explains the protection it offers: idempotency, which lets you safely retry requests "without accidentally performing the same operation twice". You send a unique idempotency key with a request that creates or updates something; if a connection error occurs, you can repeat the request with the same key without risk of creating a second object.
Most mainstream payment providers offer a comparable mechanism; check yours.
Symptom: two identical charges seconds apart
Likely cause: the customer clicked "Pay" twice, or tapped it again because nothing seemed to happen.
Fix:
- Disable the button as soon as it's pressed and show a clear "Processing…" state.
- Generate one idempotency key when the checkout attempt starts, and reuse it for any repeat of that same attempt.
- Show a definite success or failure message so customers don't retry blindly.
Symptom: duplicates after "network error" messages
Likely cause: the request reached the provider and succeeded, but the response never got back to the customer's device or your server. Your code (or the customer) tried again.
Fix: This is precisely what idempotency keys are for. Stripe's docs describe how, for its v1 API, it saves the status code and body of the first request made with a given key, and retries with the same key return that saved response, so the retry doesn't create a new charge. Stripe suggests random keys such as version 4 UUIDs with enough entropy to avoid collisions, notes keys can be up to 255 characters, and advises against using sensitive data such as email addresses as keys.
Important detail: the key must identify the attempt, not just the customer. A new key for every retry defeats the purpose; the same key for different purchases would wrongly block a genuine second order.
Symptom: one charge, but the order was fulfilled twice (or emailed twice)
Likely cause: your app processed the same webhook event more than once. Stripe's webhook documentation states that endpoints might occasionally receive the same event more than once, and recommends logging the event IDs you've processed and skipping ones already logged. It also notes Stripe retries deliveries automatically (in live mode, for up to three days with exponential backoff) if your endpoint doesn't respond successfully.
Fix:
- Store each processed event ID and check it before acting.
- Return a success status quickly, before slow work; Stripe's docs recommend returning a 2xx response before complex logic that could cause a timeout, which would otherwise trigger retries.
- Make fulfilment steps themselves safe to repeat: check whether the order is already marked paid before marking it again.
Symptom: orders marked paid in the wrong sequence
Likely cause: your code assumes events arrive in order. Stripe's docs state it doesn't guarantee delivery order and warn not to use the event's timestamp to decide order or whether an event was already processed.
Fix: Track event IDs for duplicates, and when you need the current state, fetch the object (for example, the payment or invoice) from the API rather than relying on the order of events.
Symptom: duplicate charges only on mobile
Likely cause: app or browser back-and-forward behaviour, flaky connections and automatic retries in networking libraries.
Fix: Apply idempotency keys server-side for every payment-creating request, and check that any automatic retry logic reuses the original key. On the front end, handle the "back" button after payment so it shows the order status rather than a fresh checkout.
Symptom: the customer sees two charges, but one disappears
Likely cause: not a duplicate at all. Card authorizations that are later voided or replaced can briefly appear on a statement as pending.
Fix: Check your provider's dashboard before refunding. If only one payment succeeded, explain to the customer that the pending one should drop off, according to their bank's timing.
A quick audit for your developer
- Is the pay button disabled after the first click?
- Does every payment-creating API call send an idempotency key tied to the checkout attempt?
- Do automatic retries reuse that key?
- Are webhook event IDs stored and checked?
- Does the webhook handler respond quickly and do heavy work afterwards?
- Is fulfilment guarded by checking whether the order is already paid?
- Is there a test that simulates a timeout and a retry?
When a duplicate has already happened
- Confirm in the provider's dashboard whether two payments succeeded.
- Refund the duplicate promptly and tell the customer what happened in plain words.
- Note the timestamps and look at your logs to identify which cause above applies.
- Fix the cause before the next busy period.
FAQ
What is an idempotency key?
A unique value your app sends with a request so the payment provider can recognize repeats of the same request and avoid performing the operation twice.
Do I need idempotency keys if I use a hosted checkout page?
Hosted checkouts handle much of the payment step themselves, but your own server-side calls (creating sessions, refunds, subscriptions) and webhook handling still benefit from the same care.
How long does Stripe remember an idempotency key?
Stripe's docs say that for its v1 API, keys can be removed automatically once they're at least 24 hours old, and a reused key after that creates a new request.
Can webhooks cause double charges?
Webhooks report events rather than create charges, but processing the same event twice can cause double fulfilment, emails or credits. Logging event IDs prevents that.
Getting "charged twice" emails and not sure where they come from? Send us a description of your checkout and we'll help trace the duplicate.