← Back to the journal

Why Your Webhooks Keep Arriving Twice

Receiving the same event twice isn't necessarily a bug in your payment provider. The real question is whether your application can handle it safely.

On this page

Why Your Webhooks Keep Arriving Twice

Reading position1 / 10
Editorial illustration for Why Your Webhooks Keep Arriving Twice
AI-generated editorial illustration

A customer pays for an order. Your payment provider sends a webhook. Your application marks the order as paid, creates a fulfilment request and sends a confirmation email.

A few minutes later, another webhook arrives for the same payment.

The order is already paid, but the handler runs again. Another fulfilment request is created. Another email is sent.

It's tempting to blame the provider. But the webhook system might be behaving exactly as designed.

Unlike a function call inside your application, a webhook crosses a network boundary. The sender and receiver cannot always agree on whether a delivery succeeded. And even if they could, receiving an event once would not guarantee that your worker processes it once.

Let's explore how duplicate deliveries happen, why seemingly sensible fixes fail, and how to build a webhook receiver that can safely process repeated events.

1. A successful operation can look like a failed delivery

Consider this simplified handler:

app.post('/webhooks/payment', async (request, reply) => {
  const event = request.body;

  await markOrderPaid(event);
  await createShipment(event);
  await sendConfirmationEmail(event);

  return reply.code(200).send({ received: true });
});

This is deliberately incomplete: it has no signature verification, durable receipt or idempotency protection. Don't deploy it.

Suppose the three operations succeed but the connection drops before the provider receives the HTTP response. The provider has no reliable way to distinguish that outcome from a handler that never ran.

For a provider that retries unsuccessful deliveries, sending the same event again is a sensible response. Unfortunately, your handler will execute all three operations again.

Illustration 1: A lost acknowledgement creates a duplicate delivery.

Article illustration
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="245" viewBox="0 0 760 245" role="img" aria-label="Why a delivery can repeat">
<rect width="760" height="245" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="20" font-weight="600" text-anchor="start" fill="#242b25">Why a delivery can repeat</text>
<rect x="24" y="65" width="160" height="50" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="104.0" y="95.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Provider</text><rect x="300" y="65" width="160" height="50" rx="7" fill="#e6eadd" stroke="#d9ddd2"/><text x="380.0" y="95.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Receiver</text><rect x="576" y="65" width="160" height="50" rx="7" fill="#e6eadd" stroke="#d9ddd2"/><text x="656.0" y="95.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Business effect</text><line x1="184" y1="90" x2="300" y2="90" stroke="#6d7268" stroke-width="1.5"/><polygon points="300,90 292,86 292,94" fill="#6d7268"/><line x1="460" y1="90" x2="576" y2="90" stroke="#6d7268" stroke-width="1.5"/><polygon points="576,90 568,86 568,94" fill="#6d7268"/><text x="242" y="79" font-family="Arial, sans-serif" font-size="12" font-weight="400" text-anchor="middle" fill="#6d7268">Event</text><text x="518" y="79" font-family="Arial, sans-serif" font-size="12" font-weight="400" text-anchor="middle" fill="#6d7268">Commit</text><rect x="24" y="144" width="712" height="47" rx="7" fill="#fffef9" stroke="#ab4932"/><text x="380" y="173" font-family="Arial, sans-serif" font-size="15" font-weight="600" text-anchor="middle" fill="#ab4932">Acknowledgement lost — provider may resend the event</text><text x="380" y="220" font-family="Arial, sans-serif" font-size="14" font-weight="400" text-anchor="middle" fill="#6d7268">A successful operation can appear to be a failed delivery.</text>
</svg>
Download SVG

Stripe documents automatic live-mode delivery retries for up to three days, as well as manual resends. GitHub, by contrast, does not automatically redeliver failed webhooks; integrations can request redelivery themselves. Don't assume every provider has the same delivery contract. See [1] and [2].

A useful mental model is to design for at-least-once processing wherever repeated delivery or execution is possible. This is not a guarantee that every webhook will eventually arrive: retry windows expire, endpoints can remain unavailable and events can be missed. Reconciliation is still necessary.

2. An event ID is not necessarily a business operation ID

There are three different identities worth tracking.

IdentityExamplePurpose
Delivery identifierProvider delivery referenceCorrelate delivery attempts according to provider semantics
Event identifierevt_123Identify a particular event
Business operation identifierfulfil-order-456Prevent repeating an intended business effect

A provider may reuse its delivery identifier on redelivery. Another provider may expose a separate attempt identifier. Consult its contract rather than inventing a universal rule.

For Stripe snapshot events, recording event.id helps identify repeated deliveries of the same event. However, distinct event objects can also describe the same underlying resource transition [1].

Suppose both of these notifications reach your integration:

const events = [
  {
    id: 'evt_001',
    type: 'payment_intent.succeeded',
    data: { object: { id: 'pi_123' } }
  },
  {
    id: 'evt_002',
    type: 'payment_intent.succeeded',
    data: { object: { id: 'pi_123' } }
  }
];

The event IDs differ, but both refer to the same successful PaymentIntent. If your business rule is to fulfil an order only once, preventing repeated event IDs is not enough.

Deduplicate the receipt using the event ID, then enforce the business rule using a separate durable operation key. Include provider account, environment and tenant scope where necessary.

Don't blindly deduplicate every event by object ID and event type, either. A subscription may legitimately be updated many times. Whether two notifications are interchangeable depends on the business transition, not merely their type.

Illustration 2: Two levels of deduplication.

Article illustration
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="240" viewBox="0 0 760 240" role="img" aria-label="Event identity vs. business identity">
<rect width="760" height="240" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="20" font-weight="600" text-anchor="start" fill="#242b25">Event identity vs. business identity</text>
<rect x="24" y="65" width="170" height="48" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="109.0" y="94.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Event evt_001</text><rect x="24" y="130" width="170" height="48" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="109.0" y="159.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Event evt_002</text><rect x="290" y="65" width="170" height="48" rx="7" fill="#e6eadd" stroke="#d9ddd2"/><text x="375.0" y="94.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Receipt 1</text><rect x="290" y="130" width="170" height="48" rx="7" fill="#e6eadd" stroke="#d9ddd2"/><text x="375.0" y="159.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Receipt 2</text><line x1="194" y1="89" x2="290" y2="89" stroke="#6d7268" stroke-width="1.5"/><polygon points="290,89 282,85 282,93" fill="#6d7268"/><line x1="194" y1="154" x2="290" y2="154" stroke="#6d7268" stroke-width="1.5"/><polygon points="290,154 282,150 282,158" fill="#6d7268"/><path d="M460 89 H500 V122 H550 M460 154 H500 V122" fill="none" stroke="#6d7268" stroke-width="1.5"/><polygon points="550,122 542,118 542,126" fill="#6d7268"/><rect x="550" y="98" width="186" height="48" rx="7" fill="#e6eadd" stroke="#242b25"/><text x="643.0" y="127.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">One fulfilment</text><text x="380" y="211" font-family="Arial, sans-serif" font-size="14" font-weight="400" text-anchor="middle" fill="#6d7268">Different event IDs can refer to the same business operation.</text>
</svg>
Download SVG

3. Checking whether an event exists is not the same as claiming it

A common first attempt looks like this:

const existing = await events.findOne({ _id: event.id });

if (existing) return;

await processEvent(event);
await events.insertOne({ _id: event.id });

What happens if two webhook requests arrive concurrently?

Both can finish the database lookup before either inserts its record. Both see an empty result. Both perform the business operation.

Adding a unique index to the final insert doesn't undo an email or shipment that was already created.

Reversing the order doesn't fully fix it either. If we insert a processed marker first and then crash before performing the work, a retry might skip an operation that never happened.

The important distinction is between received and processed. We need a durable receipt that can remain pending until the business effect is committed.

MongoDB provides atomic single-document writes and uniqueness constraints [3]. That makes it a useful foundation for a webhook inbox: a collection of verified events waiting to be processed.

4. Verify, persist, then acknowledge

A webhook endpoint should do as little work as possible before acknowledging a delivery, but it must not acknowledge work that it cannot recover.

The following example uses Fastify, the Stripe Node.js SDK and MongoDB. It assumes one Stripe account, one environment and snapshot events. Multi-account deployments must namespace keys and validate their account context.

Install the dependencies:

npm install fastify stripe mongodb

Use an ES module project ("type": "module" in package.json) and configure MONGODB_URI, STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET using your environment or secret manager. Use a replica set or sharded deployment for the transaction example later in the article.

// server.js
import Fastify from 'fastify';
import Stripe from 'stripe';
import { MongoClient } from 'mongodb';

const app = Fastify({ logger: true });
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const client = new MongoClient(process.env.MONGODB_URI);
await client.connect();
const db = client.db('shop');
const inbox = db.collection('webhookInbox');

await inbox.createIndex({ status: 1, receivedAt: 1 });

await app.register(async function webhookRoutes(scope) {
  scope.removeContentTypeParser('application/json');
  scope.addContentTypeParser(
    'application/json',
    { parseAs: 'buffer' },
    (request, body, done) => done(null, body)
  );

  scope.post('/webhooks/stripe', {
    bodyLimit: 1024 * 1024
  }, async (request, reply) => {
    let event;
    try {
      event = stripe.webhooks.constructEvent(
        request.body,
        request.headers['stripe-signature'],
        process.env.STRIPE_WEBHOOK_SECRET
      );
    } catch {
      return reply.code(400).send({ error: 'Invalid signature' });
    }

    if (event.type !== 'payment_intent.succeeded') {
      return reply.code(200).send({ received: true });
    }

    try {
      await inbox.updateOne(
        { _id: `stripe-${event.id}` },
        { $setOnInsert: {
          type: event.type,
          paymentIntentId: event.data.object.id,
          status: 'pending',
          receivedAt: new Date()
        } },
        { upsert: true, writeConcern: { w: 'majority' } }
      );
    } catch (error) {
      request.log.error({ err: error }, 'Inbox write failed');
      return reply.code(503).send({ error: 'Receipt unavailable' });
    }

    return reply.code(200).send({ received: true });
  });
});

await app.listen({ port: 3000, host: '0.0.0.0' });

Why keep the original request bytes? Stripe's SDK verifies the signature against the raw payload. Parsing and reserializing JSON can change those bytes. Fastify's scoped content-type parser lets us preserve the buffer without changing how unrelated routes parse JSON [1, 4].

The built-in MongoDB _id index prevents two records with the same key. $setOnInsert leaves an existing receipt unchanged. A concurrent write conflict can produce an error; returning a non-2xx response in that case is conservative and permits recovery through provider retry or reconciliation.

Notice what we do not do: start an untracked promise and immediately return 200. Once the provider receives that response, it may have no reason to resend the event. If the process crashes, unpersisted work disappears.

The stored inbox record is enough for a worker to recover. This example keeps only the fields needed by the worker rather than storing the entire payment payload. For other integrations, preserve whatever verified data is required for reliable replay, with appropriate access controls and retention.

The endpoint is intentionally scoped to a known account and mode. In production, validate expected event context and configuration, reject misrouted events, rotate secrets carefully, keep clocks synchronized and use HTTPS. Never treat signature verification as a substitute for checking that the event belongs to an expected business resource.

Illustration 3: The durable receipt boundary.

Article illustration
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="280" viewBox="0 0 760 280" role="img" aria-label="The durable receipt boundary">
<rect width="760" height="280" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="20" font-weight="600" text-anchor="start" fill="#242b25">The durable receipt boundary</text>
<rect x="24" y="75" width="160" height="55" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="104.0" y="107.5" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Verify signature</text><rect x="250" y="75" width="200" height="55" rx="7" fill="#e6eadd" stroke="#242b25"/><text x="350.0" y="107.5" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Persist inbox receipt</text><rect x="516" y="75" width="220" height="55" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="626.0" y="107.5" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Return HTTP 200</text><line x1="184" y1="102" x2="250" y2="102" stroke="#6d7268" stroke-width="1.5"/><polygon points="250,102 242,98 242,106" fill="#6d7268"/><line x1="450" y1="102" x2="516" y2="102" stroke="#6d7268" stroke-width="1.5"/><polygon points="516,102 508,98 508,106" fill="#6d7268"/><line x1="350" y1="130" x2="350" y2="174" stroke="#6d7268" stroke-width="1.5"/><polygon points="350,174 346,166 354,166" fill="#6d7268"/><rect x="250" y="174" width="200" height="50" rx="7" fill="#e6eadd" stroke="#d9ddd2"/><text x="350.0" y="204.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Recoverable worker</text><text x="380" y="255" font-family="Arial, sans-serif" font-size="14" font-weight="400" text-anchor="middle" fill="#6d7268">Acknowledge only after the event is durably recorded.</text><text x="350" y="62" font-family="Arial, sans-serif" font-size="13" font-weight="400" text-anchor="middle" fill="#ab4932">Durability boundary</text>
</svg>
Download SVG

5. Make the business operation safe to repeat

Let's say our worker consumes pending inbox records. Each order already contains the expected PaymentIntent ID, currency and amount, established when the payment was created on the server.

We want to mark a matching order paid, create one fulfilment instruction and mark the webhook processed. Those database changes should either all commit or all fail.

Here is the central worker function. It uses Stripe to retrieve authoritative payment information before entering the database transaction. Network calls are deliberately outside the transaction because the MongoDB driver may retry a transaction callback.

// process-payment.js
export async function processPayment({ client, db, stripe, receiptId }) {
  const inbox = db.collection('webhookInbox');
  const orders = db.collection('orders');
  const outbox = db.collection('fulfilmentOutbox');

  const receipt = await inbox.findOne({ _id: receiptId });
  if (!receipt || receipt.status !== 'pending') return;

  const payment = await stripe.paymentIntents.retrieve(
    receipt.paymentIntentId
  );

  if (payment.status !== 'succeeded') {
    throw new Error('Payment not confirmed');
  }

  await client.withSession(async session => {
    await session.withTransaction(async () => {
      const current = await inbox.findOne(
        { _id: receiptId }, { session }
      );
      if (!current || current.status !== 'pending') return;

      const order = await orders.findOne(
        { paymentIntentId: payment.id }, { session }
      );

      if (!order || order.currency !== payment.currency ||
          order.amount !== payment.amount_received) {
        throw new Error('Payment does not match expected order');
      }

      if (order.status === 'awaiting_payment') {
        const result = await orders.updateOne(
          { _id: order._id, status: 'awaiting_payment' },
          { $set: { status: 'paid', paidAt: new Date() } },
          { session }
        );
        if (result.modifiedCount !== 1) {
          throw new Error('Order transition failed');
        }

        await outbox.updateOne(
          { _id: `fulfil-${order._id}` },
          { $setOnInsert: {
            orderId: order._id,
            status: 'pending',
            createdAt: new Date()
          } },
          { upsert: true, session }
        );
      } else if (order.status !== 'paid') {
        throw new Error('Unexpected order state; reconcile');
      }

      await inbox.updateOne(
        { _id: receiptId, status: 'pending' },
        { $set: { status: 'processed', processedAt: new Date() } },
        { session }
      );
    }, { writeConcern: { w: 'majority' } });
  });
}

Create a unique index on orders.paymentIntentId before accepting traffic, assuming every order in this example has one assigned PaymentIntent. If your real model allows missing values or several payment attempts, design a suitable partial index or separate payment mapping.

All order payment paths must obey the same invariant: a paid order and its fulfilment instruction are recorded together. Existing legacy paid orders may require a migration or reconciliation before relying on that invariant. A cancelled or refunded order must not silently return to the paid state.

Even if two distinct webhook events refer to the same payment, the conditional state transition and deterministic outbox key prevent a second fulfilment instruction. MongoDB transactions provide the atomic boundary [5]. Conflicting transactions may fail or be retried; the job must be able to run again safely.

Why not simply use a BullMQ job ID?

A queue is useful for scheduling work and controlling concurrency. For example, a dispatcher can enqueue a receipt using its durable identifier:

await queue.add('process-payment', { receiptId }, {
  jobId: receiptId,
  attempts: 5,
  backoff: { type: 'exponential', delay: 1000 }
});

BullMQ custom job IDs suppress duplicate additions while the existing job remains in that queue. Removing the job removes that protection [6]. The example receipt IDs contain no colon, which BullMQ reserves as a separator.

The inbox remains the source of pending work. Run a recovery scanner that revisits pending receipts, including ones whose queue submission failed. It must inspect existing jobs: an exhausted failed job may require an explicit retry or operator intervention rather than another add() with the same ID. Rate-limit scans, bound attempts and quarantine permanent mismatches. This dispatcher and its failure policy are intentionally not implemented in the short example.

Illustration 4: One transaction, one durable business effect.

Article illustration
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="290" viewBox="0 0 760 290" role="img" aria-label="Atomic business processing">
<rect width="760" height="290" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="20" font-weight="600" text-anchor="start" fill="#242b25">Atomic business processing</text>
<rect x="24" y="100" width="160" height="55" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="104.0" y="132.5" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Pending receipt</text><line x1="184" y1="127" x2="238" y2="127" stroke="#6d7268" stroke-width="1.5"/><polygon points="238,127 230,123 230,131" fill="#6d7268"/><rect x="238" y="63" width="498" height="170" rx="7" fill="#e6eadd" stroke="#242b25"/><text x="487" y="90" font-family="Arial, sans-serif" font-size="17" font-weight="600" text-anchor="middle" fill="#242b25">One database transaction</text><rect x="254" y="110" width="146" height="54" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="327.0" y="142.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Mark order paid</text><rect x="414" y="110" width="146" height="54" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="487.0" y="142.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Create outbox</text><rect x="574" y="110" width="146" height="54" rx="7" fill="#fffef9" stroke="#d9ddd2"/><text x="647.0" y="142.0" font-family="Arial, sans-serif" font-size="14" font-weight="600" text-anchor="middle" fill="#242b25">Mark processed</text><text x="487" y="204" font-family="Arial, sans-serif" font-size="15" font-weight="600" text-anchor="middle" fill="#242b25">Commit all changes or none</text><text x="380" y="265" font-family="Arial, sans-serif" font-size="14" font-weight="400" text-anchor="middle" fill="#ab4932">External calls happen outside this transaction.</text>
</svg>
Download SVG

6. External side effects need their own idempotency protection

The transaction above doesn't send an email or call a shipping API. It records the intention to fulfil the order in an outbox.

Why go to that trouble?

Because a database transaction cannot roll back an external HTTP request. If a shipping provider creates a shipment and the worker crashes before saving the response, another worker may try to create the shipment again.

When an external provider explicitly supports idempotency, use a stable key representing the outbox operation. The exact API varies; the following is pseudocode, not a real shipping SDK contract:

const result = await shippingProvider.createShipment(
  { orderId: entry.orderId },
  { idempotencyKey: entry._id }
);

await outbox.updateOne(
  { _id: entry._id },
  { $set: { status: 'sent', shipmentId: result.id } }
);

Persist the request parameters and reuse them on retries. A random key generated on each attempt defeats the purpose. Stripe's outgoing API idempotency feature is a documented example of provider-side support, including limits on key retention [7]. It is separate from webhook receipt deduplication.

A real outbox dispatcher needs a recoverable claim or lease, bounded retries, and handling for uncertain outcomes. A lease expiring can permit overlapping execution, so it is not a replacement for external idempotency. If the external system has no deduplication contract, you may need to query by a stable business reference or reconcile manually rather than blindly retrying an uncertain operation.

No small code snippet can guarantee exactly-once delivery across independent systems. Aim for a business effect that is applied once within the boundaries you control, and a documented recovery procedure outside those boundaries.

7. Duplicate events are only half the problem

Webhooks can also arrive out of order. A subscription cancellation may arrive before a delayed notification about an earlier update.

This handler is risky:

await subscriptions.updateOne(
  { providerId: event.data.object.id },
  { $set: { status: event.data.object.status } }
);

A stale event could overwrite a more recent state. Recording processed event IDs doesn't help, because both events have different IDs.

If a provider supplies a trustworthy monotonically increasing resource revision, use it in an atomic update condition. Otherwise, retrieve the current authoritative resource and reconcile local state using domain-specific transitions. Serialize or coordinate concurrent reconciliation for the same resource where appropriate; even two current-state API reads can complete out of order.

Stripe does not promise event delivery ordering. Its snapshot event timestamps have second-level resolution and should not be treated as a reliable ordering or deduplication mechanism [1].

Treat a webhook as a notification that something changed, not always as the final word on the state of that resource.

8. Test the failures that happy-path examples miss

Sending a single valid webhook in a local development environment tells us very little about reliability. Try these scenarios in a test environment:

TestExpected outcome
Same signed event delivered concurrentlyOne durable receipt
Different event IDs for the same paymentOne paid transition and fulfilment instruction
Crash after inbox write, before responseRedelivery can be acknowledged; pending work survives
Crash during database transactionEither all changes commit or none do
Crash after transaction commitsReprocessing does not recreate fulfilment
Database unavailable on receiptNon-2xx; recovery via provider policy or reconciliation
Invalid signature or modified bodyRejected before persistence
Out-of-order eventsNo invalid backward transition
External success with lost responseStable idempotency key or reconciliation
Queue retries exhaustedVisible failure with controlled operator recovery

Use provider test tools, including the Stripe CLI, for signed delivery tests. Use a replica-set test database for transaction tests. Inject deliberate process termination at the boundaries rather than merely throwing an exception inside a handler.

Track receipt count, duplicate count, processing lag, permanent failures, pending inbox age and outbox age. Log provider event identifiers and internal operation identifiers so that operators can connect attempts without logging secrets or unnecessary personal data.

A retention policy matters too. Deleting old receipts too early allows delayed replays to appear new. Keep receipt identities for at least the replay horizon relevant to your integration, subject to data protection requirements. Keep durable business invariants independently of receipt retention. Reconcile missing events against the provider's authoritative API.

Final thoughts

The most interesting question about a webhook is not whether the sender can deliver it exactly once.

It's whether your application can receive it twice without doing the wrong thing.

Separate receiving an event from processing it. Keep a durable receipt. Use atomic business transitions. Give external operations stable identities. And make uncertain outcomes visible instead of pretending that another retry always fixes them.

Duplicate webhooks are a normal engineering condition to plan for, not necessarily an incident to eliminate.

If a second delivery can create a second shipment, the problem isn't the second webhook. It's the assumption that there would only ever be one.

THE CONVERSATION

Comments

Add your perspective ↓

Questions, useful examples and different approaches are welcome. Keep the discussion thoughtful and on topic.

Loading comments…

    Add your perspective

    All comments are reviewed before publication. Your name and comment will be public after approval; your email stays private and is used for account access or moderation, not a mailing list.

    Checking sign-in…