My agent's x402 retry may have paid twice. How do I check before paying again?

Look up the first payment's EIP-3009 authorization on Base: USDC's authorizationState(from, nonce) tells you whether that signed authorization was already used, and comparing its validBefore with the chain clock tells you whether it can still be used. Kertivo Check does both in one call ($0.01 in USDC on Base): send {from, nonce, validBefore} and you get authorization_used, authorization_unused_pending or authorization_unused_or_expired.

Who this is for

Why a retry can pay twice

On Base, the x402 exact scheme pays with a signed USDC authorization (EIP-3009 transferWithAuthorization). The standard client signs {from, to, value, validAfter: "0", validBefore: now + maxTimeoutSeconds, nonce} with a fresh random 32-byte nonce and sends it in the PAYMENT-SIGNATURE header (X-PAYMENT in x402 v1). The seller's facilitator then submits it on-chain.

A timeout on your side does not mean the facilitator gave up. If your agent signs again, the second signature has a new nonce, so USDC treats it as a separate payment. If both get submitted, you paid twice. The first authorization stays usable by whoever holds it until its validBefore passes.

So the safe order is: check the first authorization, then decide.

How to check (evidence)

USDC on Base keeps one flag per (from, nonce). You can read it yourself for free with an eth_call to authorizationState(address,bytes32) (selector 0xe94a0102) on 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913: 1 means the nonce is spent, 0 means it is not.

Real example, read on 2026-10-18: payer 0xfc1e…279a with nonce 0x69af0e7c…8a3c returns 1, because that authorization paid 1 USDC in transaction 0xc37cbdfa…43c1 at block 52409752. A random nonce nobody signed returns 0.

Kertivo Check reads the same flag plus the latest block time, and when the flag is set it looks for USDC's AuthorizationUsed or AuthorizationCanceled event for that nonce in the window before validBefore. Send POST https://kertivo.com/check with {from, nonce, validBefore} (flat, or inside an authorization object). The answer has settlement.reason and an authorization object with used, chainTime, validBefore and expired:

ReasonWhat it meansWhat to do
authorization_usedThe nonce is spent and its AuthorizationUsed event was found: the first payment went through.Do not pay again. The answer names the transaction that used it. If the seller never delivered, file a free claim.
authorization_canceledThe nonce was canceled on-chain (AuthorizationCanceled).Nothing moved and it can never move. Signing a new payment is safe.
authorization_spent_unconfirmedVerdict unconfirmed: the nonce is spent, but neither event turned up in the searched window (usually because validBefore was missing).It can never settle again, so retrying it cannot charge twice, but don't assume it paid. Send validBefore, or check the payment tx hash.
authorization_unused_pendingNot used yet, and validBefore is still in the future.It can still settle. Wait until validBefore passes and check again, or cancel it on-chain (see the FAQ). Signing a new payment now risks paying twice.
authorization_unused_or_expiredNever used and past validBefore.Nothing moved and it can never move. Signing a new payment is safe.
authorization_unusedNot used, but you did not send validBefore.Send validBefore too, so the answer can say whether it can still settle.

Kertivo compares validBefore with the latest Base block's timestamp, not your machine's clock.

Try it

  1. Keep the authorization. Before your client sends a payment, log from, nonce and validBefore from the signed payload. Without the nonce there is nothing to look up.
  2. Free shape test: POST https://kertivo.com/demo reads the same body and shows inputAliases: ["from+nonce->authorization"], but it always answers about its fixed demo transaction, so it does not check your nonce.
  3. Paid check: call POST /check without payment to get the 402 (Kertivo's own routes allow maxTimeoutSeconds 300, so their authorizations expire in about five minutes), then retry with payment. Copy-paste client code is at /examples.
curl -s -X POST https://kertivo.com/check \
  -H 'content-type: application/json' \
  -d '{"from":"0xYourPayer","nonce":"0xTheNonceYouSigned","validBefore":"1760000000"}'
# unpaid: 402 with the exact payment requirements; an x402 client pays and retries

You are only charged when Check answers with HTTP 200.

FAQ

How long should my agent wait before paying again?
Until the first authorization's validBefore has passed on-chain, then check once more. The standard client sets validBefore to the signing time plus the seller's maxTimeoutSeconds, which you can read in that seller's 402. It varies by seller.

Can I cancel a pending authorization instead of waiting?
Yes. Base USDC supports EIP-3009 cancelAuthorization: the payer signs a cancellation for that nonce and someone submits it on-chain, paying gas. It only works if the payment has not been submitted first. Kertivo does not do this for you.

I canceled it. Will Check say authorization_used?
It shouldn't anymore. USDC keeps one flag for "used or canceled", so the flag alone can't tell them apart, but Check now looks for the AuthorizationUsed or AuthorizationCanceled event before validBefore and answers authorization_canceled when it finds the cancellation. If you left out validBefore, you may get authorization_spent_unconfirmed instead; send it and check again.

I have the transaction hash. Do I need the nonce?
No. Send the hash as txHash instead, and Guide #1 explains the answer.

Does Kertivo stop my agent from overspending?
No. It reports what happened to a payment. Spending caps and retry policy belong in your client.

Limits