Record every Stripe event ID in a ledger table with a unique constraint, skip IDs you have already processed, and send an idempotency key with each write to QuickBooks or your CRM. In a new two-system sync this is part of Smplfy’s $1,500–$6,000 build; added to an existing sync, it is a fixed scope from $1,500.
How do I stop a Stripe to QuickBooks or CRM sync from double-processing retried or out-of-order webhooks?
Why Stripe sends the same event twice, or in the wrong order
Stripe treats any webhook your endpoint does not acknowledge with a 2xx response as failed and retries it, in live mode for up to three days with increasing gaps. If your handler writes to QuickBooks and then times out or crashes before responding, Stripe sends the event again and your code writes it again. Stripe’s webhook documentation also says plainly that it does not guarantee delivery order and that an endpoint can receive the same event more than once.
That gives three separate problems, and each needs its own fix:
- Retries: the same event ID arrives two or more times.
- Out-of-order delivery:
invoice.paidarrives beforeinvoice.finalized, or an oldercustomer.subscription.updatedarrives after a newer one and overwrites it. - Replays: someone resends events by hand from the Stripe dashboard or CLI after an outage, and every one of them is a repeat.
This page is about processing each event exactly once. Data that arrives before the record it belongs to is a related problem with its own fix, a holding queue; here we only cover the parts that overlap.
The three pieces that make a sync idempotent
1. A ledger table keyed on the event ID
Every Stripe event carries an ID that starts with evt_. Before doing any work, insert it into a ledger table where event_id has a unique constraint; if the insert fails because the ID exists, the event is a repeat. The database enforces this, so two copies arriving within the same second still cannot both get through.
| Column | What it holds |
|---|---|
event_id |
Stripe evt_ ID, unique |
event_type |
For example invoice.paid |
stripe_object_id |
The in_, ch_ or cus_ ID the event is about |
status |
received, processing, done or failed |
attempts |
How many times the handler has run |
downstream_id |
QuickBooks payment ID or CRM record ID that was written |
last_error |
The error text from the last failed attempt |
Respond to Stripe with a 200 as soon as the row is written, then do the slow work in a background job. Most retries come from handlers that call QuickBooks before responding, so this alone removes most duplicates.
2. An idempotency key on every downstream write
The ledger protects against Stripe repeating itself. It does not protect against your own job retrying after QuickBooks accepted a write but the response was lost. For that, each downstream write needs a key derived from the Stripe object: QuickBooks Online’s API accepts a requestid parameter for this, Salesforce can upsert on an external ID field holding the Stripe ID, and HubSpot can store the Stripe ID in a custom property set to require unique values.
When your own code calls Stripe, the same rule applies in reverse: send an Idempotency-Key header, as described in Stripe’s documentation on idempotent requests.
3. Re-fetch the object instead of trusting the event
Out-of-order delivery stops mattering when the handler ignores the event payload’s snapshot and fetches the current invoice, charge or subscription from the Stripe API. The handler then writes the state as it is now, not as it was when the event fired. An older event arriving late fetches the same current state and changes nothing.
Worked example: an invoice paid twice in QuickBooks
A subscription renews. Stripe emits invoice.finalized (event A) and, a few seconds later, invoice.paid (event B) for invoice in_123. The sync should create one QuickBooks invoice, one QuickBooks payment, and move the HubSpot deal to paid.
| Step | What arrives | Without a ledger | With ledger, keys and re-fetch |
|---|---|---|---|
| 1 | Event B (invoice.paid) arrives first |
Payment created against an invoice that does not exist yet; job errors | Ledger row written; re-fetch shows in_123 is paid; invoice created, then payment, each with its own requestid |
| 2 | Event A (invoice.finalized) arrives |
Second invoice created | Re-fetch shows invoice already exists by Stripe ID; nothing written; row marked done |
| 3 | Event B retried because step 1 took too long | Second payment recorded; books overstate revenue | Insert fails on unique event_id; return 200; nothing written |
| 4 | Ops replays the last 24 hours after an outage | Every payment duplicated | Every replayed ID is already done; skipped |
Without the ledger, one renewal produces two invoices and two payments in QuickBooks. With it, the books show one of each no matter how many times Stripe sends the events.
Replays and the failures nobody plans for
Replays should run through the same handler, never a separate script, so they get the same checks. Rows marked failed are the replay queue: fix the cause, then reset them to received and let the job pick them up.
- Stuck in `processing`: a job crashed mid-write. Treat rows stuck longer than a set time as retryable, and rely on the downstream key to stop a second write.
- Partial writes: the QuickBooks invoice was created but the payment failed. Track each downstream write separately so a retry finishes only the missing part.
- Refunds and disputes:
charge.refundedmust reverse the right QuickBooks payment, which is whydownstream_idis stored. - Expired QuickBooks tokens: writes fail for hours. Events pile up as
failedand replay cleanly once someone reconnects. - Rate limits: a replay of thousands of events hits API limits. Throttle the job rather than the webhook endpoint.
Which approach fits your sync
| Approach | Stops retries | Stops order problems | Safe to replay | Typical cost |
|---|---|---|---|---|
| No-code recipe with no dedupe step | No | No | No | Low monthly fee |
| No-code recipe with a lookup-before-create step | Mostly | No | Partly | Low, plus hours maintaining it |
| Custom handler with ledger table | Yes | Partly | Yes | Fixed scope from $1,500 |
| Ledger, downstream keys and re-fetch | Yes | Yes | Yes | Part of a $1,500–$6,000 two-system sync |
A no-code tool is fine if you see a few dozen payments a month and someone reconciles QuickBooks against Stripe weekly anyway. A custom build earns its cost when duplicates reach the books, refunds are common, or more than one system depends on the same events. If you have had one duplicate in a year, fix it by hand and do not hire anyone yet.
We build these handlers in code with logging on every event and a written runbook for replays. One example is a Stripe-to-Salesforce and Google Sheets finance sync that has run for two years with minimal maintenance.
Frequently asked questions
Is checking the Stripe event ID enough to prevent duplicates?
It stops Stripe retries and replays, which are most duplicates. It does not stop your own background job from writing twice if QuickBooks accepted a request but the response was lost. For that you also need an idempotency key or a unique Stripe ID on the downstream record.
How long does Stripe keep retrying a failed webhook?
In live mode, Stripe retries undelivered webhooks for up to three days with increasing gaps between attempts. Your ledger should keep event IDs at least that long, and longer if you might replay older events by hand.
Should I sort Stripe events by their created timestamp to fix ordering?
Comparing timestamps helps, but events created in the same second cannot be ordered reliably. Re-fetching the current object from the Stripe API before writing is simpler and handles every ordering case, at the cost of one extra API call per event.
What does it cost to add this to a sync we already have?
Smplfy retrofits a ledger, downstream keys and replay handling as a fixed scope from $1,500, or at $85 an hour. The price rises with the number of event types handled and whether existing duplicates need cleaning up in QuickBooks or the CRM first.
What if the first project doesn’t work out?
The first project has a fixed scope, and you read a written scope before committing to anything. A retainer starts only if you choose one. Charlie scopes every project and makes the architecture calls, and Smplfy’s own engineers build it.
Want us to check your sync for double-processing?
We’ll send a free short written scope or take a 20-minute call. Have ready which systems Stripe feeds, roughly how many payments a month you process, and where duplicates have shown up so far. Start a conversation.