Agentic commerceN-0328 Nov 202611 min read

A timeout is not a decline: following one agent payment whose outcome is unknown

An agent's payment reaches the shop and is paid, but the reply is lost. The agent marks it unknown and checks status, while paying again is blocked to avoid a double charge.

An agent sends a payment request and waits. Twenty seconds later its HTTP client gives up. Three seconds after that, the card issuer approves the payment. The merchant has an order, the payment provider has a charge, the cardholder has less available credit, and the agent has an error message that says nothing about any of it.

What the agent does next decides whether the shopper pays once or twice. A person at a checkout page would wait, refresh, or look for a confirmation email. An agent built on a large language model (LLM) reads a tool error as a problem to solve, and the nearest solutions are to try again, try differently, or try elsewhere. Each of those can create a second payment.

My claim is that the third outcome, unknown, needs its own state, its own rules and its own owner: the harness, the deterministic code around the model. I follow one payment through the lost response, the wrong reactions, the recovery and the reconciliation.

The payment I will follow

The case is constructed for this article. A shopper asks her agent for a one-way rail ticket from Vienna to Munich on Friday 4 December 2026. The agent finds it at a ticket reseller, merchant A, for €64.90, and she approves. Merchant B sells the same ticket for €67.40; that matters later.

The agent platform runs the model and the harness and keeps a ledger of what the shopper approved. Merchant A exposes an Agentic Commerce Protocol (ACP) checkout, and its payment service provider (PSP) behaves as Stripe’s API v1 is documented to.

Thing Value Held by
Approved intent int_5521, €64.90, merchant A, attempt 1 Platform ledger
Checkout session cs_8f31 Merchant A
Idempotency key, platform to merchant K1 = b7c1f0a2-6f3e-4d8a-9c55-0e2a41d7a901 Platform, merchant A
Idempotency key, merchant to PSP cs_8f31-1 Merchant A, PSP
Payment at the PSP pi_A1 PSP
Order ord_7731 Merchant A

An idempotency key is a value the client sends so that the server can recognize a repeat and return the first result without redoing the work. There is one per hop.

The request that leaves, and the response that never arrives

At 09:14:00 UTC the harness sends the completion call. The listing is illustrative: header names and path come from the ACP agentic checkout RFC, the body is cut down.

Platform to merchant A, 09:14:00
POST /checkout_sessions/cs_8f31/complete HTTP/1.1
Host: merchant-a.example
Authorization: Bearer <platform token>
Content-Type: application/json
API-Version: 2026-04-17
Idempotency-Key: b7c1f0a2-6f3e-4d8a-9c55-0e2a41d7a901
Request-Id: req_01

{
  "payment_data": {
    "handler_id": "card_tokenized",
    "instrument": { "type": "card", "credential": { "type": "spt", "token": "spt_123" } }
  }
}

Request-Id names this one HTTP attempt. Idempotency-Key names the operation, and must stay the same across every attempt at it; ACP has required it on every POST since its 2026-04-17 release. Merchant A then calls its PSP with key cs_8f31-1, derived from the session and an attempt counter rather than generated fresh per call. Stripe’s low-level error guide names both strategies, a random UUID or a key derived “from a user-attached object, like the ID of a shopping cart”. The choice looks minor. It decides a failure further on.

The harness has a 20-second timeout, and the issuer is slow that morning. Figure 1 shows the order of events.

sequenceDiagram
  participant H as Platform harness
  participant M as Merchant A
  participant P as PSP
  participant I as Issuer
  H->>M: POST complete, key K1
  M->>P: POST payment_intents, key cs_8f31-1
  P->>I: authorization request, 64.90 EUR
  Note over H: second 20, client timeout, connection closed
  I-->>P: approved at second 23
  P-->>M: 200 succeeded, pi_A1
  Note over M: stores ord_7731 and the response under K1
  M--xH: 200 completed, not delivered
Figure 1 The payment succeeds three seconds after the platform stopped listening, so the only records of success are on the merchant’s side.

At 09:14:24 issuer, PSP and merchant agree that the payment succeeded. The platform holds an intent, one call sent with K1, and no response. Only the platform is uncertain, and only it is about to act. The problem is to bring its record into line with the others without sending anything that changes theirs.

The timeout carries no information about the payment: “Restoring connectivity doesn’t tell you whether the original request succeeded,” in Stripe’s words, and a 5xx is equally “indeterminate”.

Three moves that turn one payment into two

The model is handed an error. The Model Context Protocol (MCP) tools specification (2026-07-28) describes tool execution errors as “actionable feedback that language models can use to self-correct and retry with adjusted parameters”. Its example is an invalid departure date. For a date, right. For a payment already with the issuer, there is nothing to correct.

A new key. The model calls the tool again and the wrapper generates a new UUID. If the agent also opened a new checkout session, nothing connects the attempts: new session, new key at the merchant, new derived key at the PSP. The issuer approves both, and the card holds €129.80 for one seat. Even against the same session, the idempotency layer matches on the key, and the key is different.

Another merchant. The agent concludes merchant A is broken and buys the ticket at merchant B for €67.40. The shopper holds two tickets and €132.30 in charges. The merchants share no key space, no session and no PSP. Only the platform sees both purchases before they happen.

How often do models do this? A September 2026 preprint, “Where Does Exactly-Once Live?”, graded 25,930 episodes across nine models. When a read-back could reveal the outcome, frontier models duplicated a write in 0.5% of episodes; with the request still in flight, in 56%, and they reported success in 90% of the episodes where they had duplicated. Retries that reused the original key produced no duplicates in 432 late-commit cases. In RetryBench (October 2026), rewording a key parameter’s description moved one model from reusing the valid key in 39 of 40 decisions to 10 of 40. Both are preprints on synthetic tasks. A control that depends on wording is still weak, which is why I would take the key out of the model’s hands.

The unknown state and who owns it

The platform needs a record that can say “sent, outcome not known” and restricts what may happen while it says so. Figure 2 shows the states of the ledger row for int_5521.

stateDiagram-v2
  state "Approved" as approved
  state "Sent" as sent
  state "Unknown" as unknown
  state "Confirmed" as confirmed
  state "Declined" as declined
  state "Reversing" as reversing
  state "Reversed" as reversed
  state "Needs review" as review
  [*] --> approved
  approved --> sent: complete call sent with K1
  sent --> confirmed: 200 with order
  sent --> declined: definite refusal
  sent --> unknown: timeout or 5xx or 409
  unknown --> unknown: same request with K1
  unknown --> confirmed: status read shows order
  unknown --> declined: status read shows refusal
  unknown --> reversing: deadline passed
  reversing --> reversed: merchant confirms cancel
  reversing --> confirmed: order appears late
  reversing --> review: no confirmation
  declined --> approved: shopper approves again
  confirmed --> [*]
  reversed --> [*]
Figure 2 Unknown is a state with its own exits, and none of them is a new payment call with a new key.

The rules attached to the states are the design:

State Allowed Forbidden
Approved One completion call with K1 A second intent for the same purchase
Unknown Status read; the identical request with K1 A new key, a new session, another merchant
Confirmed Report the order to the shopper Any further payment call
Declined Ask the shopper again; a new attempt number A silent retry
Reversing Cancel by the original reference A new purchase before the reversal is confirmed

The harness writes the row to sent before the request leaves, or a process that dies in between restarts and sends a “first” call that is in fact a second. ACRFence (March 2026) describes restoring an agent from a checkpoint taken before an irreversible call as a route to duplicate payments.

The model is told the outcome as a normal result, with no error flag and nothing that invites a fix. The listing is illustrative; the envelope follows the MCP tools specification.

Tool result given to the model at 09:14:20
{
  "resultType": "complete",
  "isError": false,
  "content": [{ "type": "text", "text": "{\"outcome\":\"unknown\", ...}" }],
  "structuredContent": {
    "outcome": "unknown",
    "intent_id": "int_5521",
    "retry_allowed": false,
    "new_purchase_allowed": false,
    "resolution": { "owner": "harness", "deadline": "2026-11-30T09:29:20Z" },
    "say_to_user": "The payment is being confirmed. Do not pay again."
  }
}

The key is absent on purpose, so the model cannot copy or invent one. The two allowed flags are advice; enforcement is in the harness, which refuses a payment call for a row in unknown and refuses a second intent for the same purchase.

Recovery: read first, then repeat exactly

A GET cannot cause a payment under any implementation. A repeated POST is safe only if the server’s idempotency layer works as specified. So the harness reads first. Figure 3 shows the recovery.

sequenceDiagram
  participant L as Model
  participant H as Platform harness
  participant M as Merchant A
  H-->>L: result, outcome unknown, no retry
  Note over H: ledger row int_5521 is unknown
  H->>M: GET checkout_sessions cs_8f31 at second 22
  M-->>H: 200, status in_progress
  H->>M: GET checkout_sessions cs_8f31 at second 26
  M-->>H: 200, status completed, order ord_7731
  Note over H: ledger row is confirmed
  H-->>L: result, purchase confirmed, ord_7731
Figure 3 Recovery uses only requests that cannot create a second payment, a read of the session and, if needed, the identical request with the same key.

I would read at gaps of 2, 4, 8, 16 and 32 seconds, then once a minute, and stop 15 minutes after the timeout, far inside the 24-hour key lifetime at both hops.

If a read is not conclusive, say the session still shows ready_for_payment, the harness may send the identical request again, same body, same K1. All three possible answers are safe. If the first request is still running, ACP specifies a 409:

Same key while the first request is in flight
HTTP/1.1 409 Conflict
Content-Type: application/json
Retry-After: 2

{
  "type": "invalid_request",
  "code": "idempotency_in_flight",
  "message": "A request with this Idempotency-Key is currently being processed"
}

The row stays unknown and the harness waits. Stripe’s guide gives the same instruction for its own 409 and adds the sentence that sums up this article: “A new key can start a second operation.” If the first request finished, the merchant replays the stored response with Idempotent-Replayed: true, and the RFC says servers “MUST NOT re-execute side effects (e.g., payment capture, inventory reservation) on replay”. If it never arrived, the repeat is the first attempt. And if the body differs in any field, the merchant returns 422 idempotency_conflict, permanently. So the harness stores the exact request body in the ledger and resends it byte for byte, and never asks the model to rebuild it.

The Universal Commerce Protocol (UCP) is the only agentic protocol I read that writes this procedure down. Its 2026-08-25 checkout specification says a platform without a response “SHOULD use Get Checkout with bounded backoff”, may then resend “the identical original Complete Checkout request again with the same idempotency key”, and “MUST NOT use a new idempotency key for that retry.”

How Stripe, Adyen, PayPal, ACP, the IETF draft and AP2 treat a repeated key
Provider or spec Same key, first request finished Same key, first still running Key lifetime
Stripe API v1 Saved status and body, 5xx included 409, idempotency_key_in_use At least 24 hours
Adyen The first response 422 or 409, error code 704 7 to 14 days
PayPal Latest status of the earlier request Not stated on the page Set per API
ACP RFC Original response, Idempotent-Replayed: true; 5xx not stored 409 idempotency_in_flight At least 24 hours
IETF draft -09 A response consistent with the first 409 Resource should publish it

UCP adds a complete_in_progress status and forbids starting a new completion during it. Shopify’s error reference says of checkout_completion_timeout: “Retry with the same idempotency key.”

The Agent Payments Protocol (AP2) approaches from the other side. Its v0.2 specification says shopping agents “MUST NOT present any subsequent open Payment or Checkout Mandates without receiving a rejection receipt from the previous one”, which forbids the second-merchant move. But it has no idempotency, timeout or status-query provisions, so an agent with no receipt is blocked and has no defined way to ask.

The same failure arriving as a 5xx, and the second hop

Now the issuer approves in time and the PSP returns pi_A1, but merchant A fails while writing the order and answers 500. The harness repeats the request with K1, and two documented behaviours differ. Stripe stores the result once execution begins and replays it, “including 500 errors”. The ACP RFC says the opposite for merchants: “A retry with the same key after a 5xx MUST be processed as a fresh request.”

So under ACP the correct client behaviour makes the merchant run the completion a second time, and whether that charges the card again depends on the key the merchant sends its PSP. With the derived cs_8f31-1, the PSP recognizes the call and returns the first payment. With a random key per call, the issuer sees a second authorization, although every party followed its specification. Idempotency at the first hop does not carry to the second by itself.

The 5xx sequence, step by step

Figure 4 follows the 5xx case with a derived downstream key.

sequenceDiagram
  participant H as Platform harness
  participant M as Merchant A
  participant P as PSP
  H->>M: POST complete, key K1
  M->>P: POST payment_intents, key cs_8f31-1
  P-->>M: 200 succeeded, pi_A1
  Note over M: order write fails
  M-->>H: 500, nothing stored under K1
  H->>M: POST complete, key K1 again
  Note over M: processed as a fresh request
  M->>P: POST payment_intents, key cs_8f31-1
  P-->>M: 200 succeeded, pi_A1, replayed
  M-->>H: 200 completed, ord_7731
Figure 4 After a 5xx an ACP merchant runs the completion again, and only a stable downstream key turns the second PSP call into a replay.

The RFC’s rule is defensible: a cached 500 is a dead end, and Stripe notes that after incident recovery “The cached response doesn’t change”. Re-execution lets the operation heal. The price is that every step of the merchant’s completion handler must itself be idempotent, which the RFC does not say in those words.

Where the key should come from

A random key per call protects one path: the same process retrying the same HTTP request. An agent has others: the model reissues the call with different arguments, the harness restarts from a checkpoint, an orchestrator hands the task to a second agent. What they share is the shopper’s approval, so I would compute the key from it, in the harness:

K = base64url( HMAC-SHA256( platform_secret, intent_id || ":" || attempt ) )

attempt increases only on the transition from declined back to approved in Figure 2. The keyed hash keeps the value unguessable; at 43 characters it fits Adyen’s 64 and the 255 of Stripe and ACP. Where a binding demands a UUID, as Google’s UCP binding for MCP does, 122 bits of the hash can be laid out in UUID form, my suggestion rather than anything the documents describe.

A random key generated once and stored on the ledger row also works, wherever every retry path goes through the ledger. Derivation covers a path that bypasses it, at the cost of a secret to rotate.

No key covers merchant B. That needs a second approved intent, and the component that records intents can refuse it while the first is unknown or reversing. That refusal is the only control here that stops the two-ticket outcome.

Reconciliation, and what happens at the deadline

For what the reads miss, each party reconciles against the party below it. ACP merchants send signed order events: one for a row in unknown confirms it, one for a row in reversing goes to a person. Merchant A matches PSP payments to orders through metadata, and an orphan payment either gets its order or its money back.

If 15 minutes pass with every read showing in_progress, the row moves to reversing. The platform holds no reference the network knows, so it asks merchant A to cancel and waits for a definite answer. At the PSP, a Stripe PaymentIntent can be cancelled before it succeeds, and refunded after. Adyen’s technical cancel addresses a payment by the merchant’s own reference when the PSP reference was lost, and gives a timeout as the example. Until a reversal is confirmed, the shopper is not offered the ticket at merchant B.

Where this design stops

Key lifetimes are shorter than intents. Stripe may remove a key after 24 hours, and ACP treats a key reused after its window as a new request. A same-key retry on day two is a new payment, which is why the deadline is minutes and the ledger, not the key, carries deduplication beyond a day.

A status read can be honest and still unhelpful. in_progress is undefined in the ACP RFC. A session may sit in it past my deadline, and the platform then reverses a payment that would have succeeded. I accept that: a reversed good payment costs a repeat approval, a duplicated one costs a dispute.

The key does not travel end to end. Whether the merchant derives its PSP key from the session is invisible to the platform, and no protocol lets the platform require it.

Cross-merchant protection lives only in the platform. A second agent platform, or the shopper buying the ticket herself, is outside it.

One payment, one record that admits it does not know

The ticket payment went wrong at no single point. The issuer was slow, the client was impatient, and every party’s records were correct. Each duplicate came from a component that treated silence or an error code as a refusal and acted on it. The same reasoning applies to any irreversible tool call, and a merchant’s checkout has to meet it from the other side.

The caveat is the one from the 5xx case. Idempotency is specified hop by hop, by documents that disagree on whether a server error is remembered. Before trusting a same-key retry across a chain, check each hop: what it stores, for how long, and what it sends downstream when it runs twice.

Sources

Work with me

Working on this problem? I’m glad to compare notes.

Tell me about the problem