Skip to content

Duplicate orders, retries and idempotency: hardening checkout for automated buyers

AI agents retry when a checkout call times out. What UCP, ACP and your payment provider require, and a checklist so a retry never becomes a second order or charge.

By the ConversionVector teamUpdated 12 min read

Contents

Direct answer: AI agents retry. When a call to place an order times out, the agent can't tell whether the order went through, so it tries again, and without protection your store takes a second order and may charge the shopper twice. The protection is an idempotency key: a unique ID sent with every request that changes something, which your server stores with the result so a repeat gets the original answer instead of a new order. Both agent checkout protocols build this in. ACP, the Agentic Commerce Protocol that OpenAI and Stripe maintain, has required an Idempotency-Key header on every POST since its 2026-04-17 release. UCP, Google's protocol, sets rules for storing keys, replaying results and rejecting mismatches, and tells agents exactly when they may resend an order. Your payment provider has its own keys, with different limits. Stripe warns sellers using its agent checkout that "some agents might retry these API requests, so you must make sure that your endpoint is idempotent". The checklist below covers the key rules, the payment layer, webhooks and the order checks that stop one agent purchase becoming two.

This guide is for developers and engineering leads at mid-market retailers in the US, the UK, Europe and elsewhere who run, or are about to build, a checkout API that agents call: a UCP or ACP endpoint, a custom headless checkout or the hooks behind a hosted agent checkout. ConversionVector is not affiliated with Google, OpenAI, Stripe, Adyen, PayPal, Shopify or any company named here. This is not legal, security or financial advice.

Last verified: 1 December 2026 against the UCP specification (release v2026-08-25), the ACP specification and changelog (release 2026-04-17), the IETF Internet-Draft for the Idempotency-Key header (version 09, 21 November 2026), RFC 9110, and the idempotency documentation of Stripe, Adyen, PayPal (updated 11 August 2026) and Shopify.

Why agents retry, and why that becomes a second order

A person who clicks "Place order" and sees a spinner usually waits, or checks their email for a confirmation. An agent calling your checkout API is a program, and programs handle a timeout by trying again.

  • The response gets lost. The order may have been created, but the reply never reached the agent because of a timeout, a dropped connection or a gateway error. From the agent's side, a lost reply and a failed order look the same.
  • Your error triggers a retry. Stripe's documentation for its Agentic Commerce Suite says that if your hook endpoint returns a non-2xx status, Stripe returns a 424 to the agent, and "some agents might retry these API requests".
  • HTTP itself doesn't make POST safe to repeat. RFC 9110 defines PUT, DELETE and read-only methods as idempotent, so a client can repeat them after a communication failure. It says a client "SHOULD NOT automatically retry a request with a non-idempotent method" unless it has some way to know the repeat is safe. Order creation is a POST. The idempotency key is that way of knowing.
  • The protocol authors saw it coming. ACP's 2026-04-17 changelog says that before the change, "agents retrying failed or timed-out requests had no protocol-level guarantee of safe replay", which is why the key became mandatory.

Browsing agents, which click through your normal checkout like a person, add a familiar risk: a second press of the order button. That is the double-submit problem web teams already know. We have no published figure for how often agents cause duplicate orders, and we don't invent one. The design rule doesn't need a number: any call that can create an order or move money must be safe to receive twice.

What the agent checkout protocols require

The two protocols agree on the idea and differ in the details. If you serve both, these differences matter.

RuleUCP (release v2026-08-25)ACP (release 2026-04-17)IETF draft (version 09)
When a key is neededState-changing REST operations should support it. Over MCP, complete_checkout and cancel_checkout require oneRequired on every POST: create, update, complete and cancelEach resource documents which operations need it
Key formatAt least 128 bits of randomness, such as a UUID v4Opaque string up to 255 characters, UUID v4 recommendedDefined by the resource
Key scopePer client, per operation typePer authenticated identity and endpoint pathDefined by the resource
How long to keep itAt least 24 hours, 48 recommendedAt least 24 hoursThe resource publishes its expiry policy
Missing keyNo specific error code defined400, code idempotency_key_required400
Same key, different body409 Conflict (REST) or -32000 (MCP), don't execute422, code idempotency_conflict, not retryable422
Same key, original still runningNo separate code409, code idempotency_in_flight, with Retry-After409
Matching duplicateReturn the cached response, don't re-executeReturn the original response and status, add Idempotent-Replayed: trueTreat as a duplicate

Note the status codes. ACP follows the IETF draft, where 422 means "you reused a key with a different request" and 409 means "the first request is still being processed". UCP uses 409 for the reused key. A shared middleware that answers both protocols the same way will send at least one of them the wrong signal. The IETF document is still an Internet-Draft, not a published standard, so treat it as direction rather than a rule.

Three further details are worth building in from the start:

  • How "the same request" is decided. UCP compares a SHA-256 hash of the raw body bytes, the same digest carried in a signed request's Content-Digest header, so any byte change counts as a different request. ACP compares the JSON by meaning: key order and 1.0 versus 1 don't matter, but array order does, and null is different from a missing field because null means "clear this field".
  • When an agent may resend an order. UCP's checkout specification is precise. If the agent gets no reply to Complete Checkout, it should first read the checkout's current state, backing off between attempts and stopping at the checkout's expiry. Only if that still doesn't show whether the order was placed may it resend the identical request with the same key, and it must not use a new key. A genuinely new attempt, after the checkout returns to ready_for_complete, must use a fresh key.
  • Server errors and storage failures. ACP says responses with a 5xx status must not be cached against the key, so a retry after a server error is processed as a fresh request. UCP says that if your key store fails, fail closed and reject the request with a 503 rather than risk running it twice.

UCP's cart capability adds one more rule: when an agent turns a cart into a checkout and an incomplete checkout already exists for that cart, you return the existing checkout rather than creating another. Our guides to Google's Universal Commerce Protocol and the protocol comparison explain the wider design, and native vs embedded checkout covers which UCP route puts this work on your side.

The payment layer has its own keys

Your checkout endpoint being idempotent isn't enough if the payment call behind it isn't. Each provider handles keys differently:

ProviderHow you send the keyLimits and behaviour
StripeIdempotency-Key header, accepted on all API v1 POST requestsUp to 255 characters, V4 UUIDs suggested. Keys can be pruned once they are at least 24 hours old. Stripe compares the parameters of a repeat with the original and returns an error if they differ. It saves the result once the request starts running, including 500 errors
Adyenidempotency-key header on POST requestsUp to 64 characters, UUID recommended. Keys are valid for 7 to 14 days at company-account level and aren't checked across regional endpoints. A transient-error: true response header means you can retry with the same key
PayPalPayPal-Request-Id header on REST POST callsNot every API supports it, and storage time varies by API. Without the header, PayPal processes a repeat as a new request. Two simultaneous requests with the same ID may see the second one fail
Shopify (Admin API, for apps)An idempotency key field or the @idempotent directive on supported GraphQL mutationsAccepted on requests that process card payments, create subscription billing attempts or capture revenue details

Two pieces of Stripe guidance translate well to any provider. First, derive the payment key from something tied to the purchase, such as the cart or checkout session ID, which Stripe describes as a straightforward way to protect against double submissions, and keep one payment attempt per cart or session. Second, don't put personal data in the key: Stripe advises against using email addresses or other personal identifiers. Our guides to US payments and agent checkout, Adyen and PayPal cover the agent-specific payment products.

If your checkout uses Stripe's hosted agent checkout, the protocol side is Stripe's, but the hooks are yours. Our Stripe Agentic Commerce Suite guide explains where each hook sits.

Webhooks arrive more than once too

Many duplicate orders start after the payment, when the "payment succeeded" event creates the order in your back office. Stripe's webhook documentation says endpoints "might occasionally receive the same event more than once", recommends logging the event IDs you've processed and skipping repeats, and says Stripe retries delivery for up to three days in live mode. UCP's order webhooks carry a Webhook-Id header with a unique event identifier for the same reason.

If an event creates an order, books stock or sends something to your warehouse, record the event ID in the same database transaction as the change, and ignore any event you have already handled.

The idempotency and order-validation checklist

Work through this with whoever owns your checkout code. Every item comes from the specifications and provider documents above, except where it says it is our recommendation.

AreaWhat good looks likeSource
Key on every writeCreate, update, complete and cancel calls carry a key. On ACP, reject a POST without one with a 400ACP §6.1, UCP REST and MCP bindings
Key stored with the resultThe key, a fingerprint of the request and the response are saved in the same database transaction as the orderACP §6.8 (recommended)
Matching repeatReturns the stored response, with no second order, charge or stock reservationUCP, ACP §6.3
Changed body, same keyRejected, with the status code your protocol expects (UCP 409, ACP 422)UCP, ACP §6.4
Concurrent repeatOnly one runs. The other waits or gets ACP's 409 with Retry-AfterACP §6.4
Server errorsA 5xx isn't cached against the keyACP §6.5
Key store failureFail closed (503), don't processUCP Replay Protection
RetentionAt least 24 hours. UCP recommends 48, and your payment provider may keep keys longerUCP, ACP §6.6, Adyen
Payment callCarries its own key derived from the checkout session, never from personal dataStripe
WebhooksEvent IDs are logged and repeats skippedStripe, UCP
One order per checkoutThe database refuses a second order for the same checkout session or cartOur recommendation, consistent with UCP's cart rule
Final validationPrice, stock, delivery charge and tax are recalculated on the server at completion, never taken from the agent's requestOur recommendation

The last row is order validation rather than idempotency, but it belongs here. A retried or replayed request can carry a price that was right an hour ago. Recalculate at completion and send the agent the corrected totals. Our price mismatch guide explains why a disagreement between page, feed and checkout costs you the sale, and agentic commerce fraud covers the deliberate version of the same problem.

How to test it

Use a sandbox or test mode with test payment details. Never test duplicate handling against live payments.

  1. Send the same request twice. The second response should match the first, and only one order and one payment should exist.
  2. Reuse the key with a changed body, for example a different quantity. You should get your protocol's conflict response, and nothing should change.
  3. Send two identical requests at once. Only one should run.
  4. Cut the connection mid-request. Use a proxy or a short client timeout so the order completes but the reply never arrives, then retry with the same key. You should get the original order back.
  5. Replay a webhook. Your payment provider's test tools can resend an event. The second delivery should change nothing.
  6. Run an agent end to end. Our simulated agent purchase guide has a safe script that stops before payment, and agent checkout friction covers the rest of the checkout.

Add steps 1 to 5 to your automated tests, so a later release can't quietly remove the protection.

What our score can and can't see

The Agent Conversion Score never logs in, enters payment details or places an order, so it can't tell you whether your checkout handles a retry safely. None of the 49 checks in specification v0.6 measures idempotency, and the Agent Commerce Index has no data on duplicate orders. What the score does tell you is whether this guide applies: TRX-04, TRX-05 and TRX-06 look for a UCP business profile, ACP discovery or a product feed, and an advertised MCP endpoint, and TRX-10 tests whether an agent can reach your checkout at all.

For a deeper test of the purchase path, our Simulated Agent Buyer runs scripted agent purchases. Our Hosted Agent Layer, currently on a waitlist, is planned to include a checkout proxy: UCP checkout-session endpoints that call your existing cart and checkout.

Common mistakes

  • Generating a new key for every retry. The key must be created once per operation and reused on each attempt, including after a process restart. Stripe's error handling guide says to generate and persist the key for the operation and supply it to every attempt.
  • Checking the key but not the body. Without a fingerprint, a reused key with a different basket returns the wrong order.
  • Storing the key after the work is done. If the order commits and the key doesn't, the next retry creates a second order. Commit both together.
  • Caching failures. Under ACP, a 5xx must not be stored, so the retry gets a real second attempt.
  • Making the payment idempotent but not the order. One charge with two orders still means two shipments and a refund.
  • Forgetting downstream systems. ERP, warehouse and email integrations triggered by an order event need the same "seen this event already" check.
  • Assuming the platform covers everything. Hosted agent checkouts handle the protocol. Your hooks, webhooks and integrations are still yours.

What to watch next

  • The IETF Idempotency-Key draft. If it becomes an RFC, expect protocols and providers to converge on its status codes.
  • New UCP and ACP releases. Both repositories change often, and unreleased changes on their main branches aren't in this guide.
  • Agent vendors publishing their retry behaviour, such as timeouts and backoff. We will update this guide when they do.

If you'd like help hardening a checkout for agent buyers, get in touch. The quickest first step is the free Agent Conversion Score, and our page on agent conversion explains how we think about the whole journey.

Sources

Method

Protocol rules come from the released versions named above (UCP v2026-08-25 and ACP 2026-04-17), read from each project's repository on 1 December 2026, not from unreleased changes on their main branches. Provider behaviour and quotations come from each company's own documentation, read the same day. Items marked as our recommendation are ours, not a protocol or provider requirement. We ran no new scan for this guide and the Agent Commerce Index contains no data on duplicate orders, so no figures from it are used. This is not legal, security or financial advice.

Questions

What is an idempotency key?
A unique string the caller sends with a request that changes something, such as creating an order or taking a payment. The server stores the key with the result. If the same request arrives again with the same key, the server returns the stored result instead of doing the work twice. Stripe, Adyen, PayPal and Shopify all support some form of it, and both main agent checkout protocols, UCP and ACP, define one for checkout calls.
Why do AI shopping agents create duplicate orders?
Because they retry. When a call to place an order times out or the connection drops, the agent can't tell whether the order went through. Stripe's Agentic Commerce Suite documentation warns that "some agents might retry these API requests, so you must make sure that your endpoint is idempotent". Without idempotency, the retry is processed as a new order and may be charged again.
Do UCP and ACP require idempotency keys?
Yes, with differences. ACP (release 2026-04-17) requires an Idempotency-Key header on every POST and tells servers to reject a request without one. UCP (release v2026-08-25) says state-changing REST operations should support idempotency, requires the key on complete and cancel calls over MCP, and sets server rules: keep keys for at least 24 hours (48 recommended), return the cached response for a matching duplicate and reject a mismatched one.
Which HTTP status code should a reused idempotency key return?
It depends on the protocol. ACP and the IETF draft for the Idempotency-Key header use 422 when a key is reused with a different body and 409 when the original request is still being processed. UCP uses 409 for a key reused with a different body. If you serve both protocols, map the codes per protocol rather than sharing one response.
If my platform runs agent checkout for me, do I still need to worry?
Less, but not zero. Where Shopify, Stripe or another provider hosts the agent checkout, it handles the protocol side. You still own the parts it calls: Stripe's hooks must be idempotent, webhooks can arrive more than once, and your order system, ERP and fulfilment integrations must not turn one agent order into two shipments.
Does the free Agent Conversion Score test for duplicate orders?
No. The score never places an order, so it can't see what happens on a retry. It checks whether agents can reach your basket and checkout (TRX-10) and whether you publish UCP, ACP or MCP endpoints (TRX-04 to TRX-06), which tells you whether this guide applies to you.

Published . Last updated . More in Agent checkout and the guide library.