How can unique request IDs prevent duplicate orders when an automation retries?

A person checking a laptop beside a parcel and scanner

Key points

  1. Reuse the same identifier when retrying the same business operation, with the receiver checking whether it was processed.
  2. A duplicate check at the start is not enough: each side-effecting step needs an explicit protection mechanism.
  3. Test timeouts, concurrent arrivals and partial completion before enabling automatic retries.

Does a missing success response mean the order was not created?

Not necessarily. The receiving system may have created the order while its response failed to arrive. Sending the same request again as new work can create a second order. First define what counts as the same operation, give it a stable identifier, and have the receiver protect retries against duplication.

This is idempotency: retrying an operation without repeating the same side effect. AWS explains the relationship between retries and side effects; suitability still depends on your actual interface. AWS: making retries safe.

How should you choose a unique request ID?

Define the business boundary first. For example, “first creation of a particular source order” is one operation; a later, confirmed additional purchase is another and must not be blocked accidentally. This is a workflow example, not a real customer case.

  • Create a new ID for a new operation; reuse it for retries of that operation.
  • Maintain a traceable link to the source, operation type and version.
  • Do not put email addresses, phone numbers or other personal data directly into the ID.
  • Do not generate a different random ID on every retry.

Stripe documents idempotency keys for recognising retries and warns against sensitive data in keys. This is a platform example, not a claim that every tool offers the same feature. Stripe: idempotent requests.

A hand holding a scanner over a barcode slip beside a parcel

Why can “search for the order first” still create duplicates?

Two requests may arrive almost simultaneously, both find no existing order, then each create one. Ask the technical owner whether the receiver uses an atomic deduplication record, uniqueness constraint or officially supported idempotency interface, rather than separate read-then-write steps.

AWS discusses recording the request identifier consistently with the associated changes. This is an engineering requirement; a spreadsheet search followed by adding a row cannot be assumed to provide equivalent protection merely from its step names. AWS: identifiers and consistent handling.

Does order deduplication also prevent duplicate emails and dispatches?

Not necessarily. Creating an order, sending a confirmation email and notifying a warehouse may be separate steps. One order does not prove that downstream notifications ran only once. List each externally consequential step and record its own operation identifier, state and result reference.

“Not started”, “in progress”, “completed” and “manual review required” can be an internal design starting point, but labels alone provide no protection. Reuse completed results according to actual system rules. Where completion is uncertain, verify before resending. These are proposed controls, not claims about an existing implementation.

How should you handle retention periods and changed content?

Check your platform’s key lifetime, parameter checks, error handling and concurrency limits rather than copying another platform’s settings. For example, Stripe API v1 documents that keys may be pruned after at least 24 hours; reuse after pruning can create a new request, while changed parameters with the same key produce an error. API versions also differ. Stripe: version and retention limits.

Your business deduplication record may therefore need to cover a longer order-processing cycle, with its owner deciding retention arrangements. Requests with changed products or quantities should follow an explicit change process, not silently reuse an old key to alter the original operation.

What should you test before enabling automatic retries?

Use a test environment that cannot actually charge, email or dispatch, and verify each scenario below. This is a test checklist, not a report of completed tests.

  1. The same key and content arriving sequentially.
  2. The same key and content arriving concurrently.
  3. The receiver completing work before the response times out.
  4. Order creation succeeding while a downstream step fails.
  5. The same key with different content.
  6. A retry after the platform’s retention period.

Record order counts, downstream execution counts, result references and cases requiring manual handling. Keep a manual review gate until protection is established; a “successful” workflow status is not evidence that duplication was avoided.

Frequently asked questions

Is a new UUID safer for every retry?

No. Reuse the original ID for the same operation; a new ID may be treated as new work. A genuinely new operation should receive a new ID. AWS: retries and identifiers.

Can the customer’s name and date be the unique ID?

That is not recommended. One person can place different orders on the same day, and names are personal data; use an identifier that distinguishes operations without sensitive content.

Does idempotency guarantee that the entire workflow runs exactly once forever?

No single key establishes that guarantee. Check platform limits, concurrency and every downstream side effect separately.

Can you resend a dispatch notification immediately after a timeout?

Do not assume it was not sent. Verify the downstream result, then retry through a validated protection mechanism; refer uncertain cases for manual review.

Do all platforms remember keys permanently?

No. Retention and versions differ. For example, Stripe API v1 documents possible pruning after at least 24 hours; design around actual platform documentation and your business cycle. Stripe limitations.

About the author: This article was written by the HKONE team. HKONE is a Hong Kong digital marketing and AI automation company providing social media management, website design, AI customer service and GEO / SEO for SMEs. Where this article mentions platform fees or policies, the platform's official information takes precedence.

Tell us about your business first. Then decide.

The consultation is free. We will understand your situation before recommending a plan and a quote.