Your agent's payment timed out. Retry without paying twice
Why a blind retry of a payment can charge twice, what HTTP idempotency says, and how a one-time nonce and a status check help after a timeout.
An agent pays for a request, and the reply never arrives. The connection dropped, or a timeout fired. From the agent's side there is no way to tell whether the payment went through. The obvious move, ask for a fresh price and sign again, is the one move that can pay twice.
What HTTP says about retries
RFC 9110 calls a request method idempotent when several identical requests have the same intended effect on the server as one. Of the methods it defines, PUT, DELETE and the safe methods, such as GET, are idempotent. If the connection fails before the response arrives, HTTP permits the client to repeat an idempotent request. The response and incidental side effects can differ.
For everything else the RFC is direct: a client should not automatically retry a non-idempotent request unless it knows the request is idempotent anyway, or can detect that the original was never applied. A payment is the textbook non-idempotent request, even when, as with x402, it rides on a GET that HTTP clients consider safe to repeat. What keeps a repeat safe is the payment itself, not the method.
Same signature or a fresh one
With x402 on EVM chains, a payment is usually an EIP-3009 transfer authorization, and that changes the picture.
- Resending the same signed payment cannot pay twice. The authorization carries a random 32-byte nonce, and the token contract records each nonce as used. If the first copy settled, the second is refused, because the token will not accept a nonce it has already recorded.
- Signing a fresh one is a new payment. If the payer signs another authorization with a fresh nonce, both authorizations can settle. If the first payment also settled, the agent has now paid twice.
Keep the original signed payment for a retry. Its payer and nonce limit that authorization to one successful transfer. The resource's own work may still need separate duplicate-request handling.
Pending is not failed
The x402 spec has a word for the uncertain middle: settlement_pending. A facilitator may return it when the settlement transaction was broadcast but its confirmation could not be established. The spec marks it as non-terminal: the transaction may still confirm. A response with that reason must carry the broadcast transaction hash and the network, so the caller can check the chain before deciding whether to retry.
HTTP has a matching status. 202 Accepted means the request was accepted for processing, but processing has not finished. The RFC calls it intentionally noncommittal.
How Cleave Protocol's gas top-up answers
Cleave Protocol's gas top-up is paid over x402, and it uses both signals:
- It answers 200 with a
PAYMENT-RESPONSEheader when the payment is settled and a stored facilitator response exists. - It answers 202 when settlement is pending, unknown, or recorded without a stored response. The payment response then has
success: falseand anerrorReasonsuch assettlement_pending. - Both answers carry a
requestIdfor tracking.
On a 202, the documented next step is to send the same payment again while its offer is live, or to track the requestId. A new request with the query and no payment is a new order. If a signed payment comes back 402 because the offer can no longer be paid, track the order as g:<pay>:<orderHash>, with the paying chain id from the request and orderHash from the requirements' extra, before asking for a new offer.
There is also a guard for agents that sign again anyway. A new payment with the same payer, paying chain, amount, recipient and delivery chain is refused with 400 invalid_param, reason duplicate_order, while the earlier payment's settlement is unresolved, or within 10 minutes after that payment. The refused payment is not sent for settlement. After that window, an earlier order may still be unfinished, so check its status before paying again.
A retry policy that holds up
- On a timeout, keep the signed payment. Do not discard it.
- If the answer is unknown, resend that exact payment while its offer is live, or ask for the status.
- If a hash came back, look it up on chain before doing anything else.
- Before signing a replacement, verify that the first transfer did not settle and that its authorization can no longer execute. Check the order and the token's on-chain records. If the nonce was used for the transfer, track that payment. If the outcome is still unknown, keep the original authorization and do not sign a replacement.
The same rule applies to swap plans. A plan still in flight that is sent twice can pay twice, so track it before sending it again.
Ask for the status, not a new price. The response codes and tracking steps are on the x402 gas top-up docs page.