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
- Agents that paid an x402 endpoint, got a timeout or an error back, and are about to sign a second payment.
- Builders adding retry logic to an x402 client who want "check, then pay again" instead of "pay again and hope".
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:
| Reason | What it means | What to do |
|---|---|---|
authorization_used | The 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_canceled | The nonce was canceled on-chain (AuthorizationCanceled). | Nothing moved and it can never move. Signing a new payment is safe. |
authorization_spent_unconfirmed | Verdict 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_pending | Not 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_expired | Never used and past validBefore. | Nothing moved and it can never move. Signing a new payment is safe. |
authorization_unused | Not 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
- Keep the authorization. Before your client sends a payment, log
from,nonceandvalidBeforefrom the signed payload. Without the nonce there is nothing to look up. - Free shape test:
POST https://kertivo.com/demoreads the same body and showsinputAliases: ["from+nonce->authorization"], but it always answers about its fixed demo transaction, so it does not check your nonce. - Paid check: call
POST /checkwithout payment to get the 402 (Kertivo's own routes allowmaxTimeoutSeconds300, 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
- Base mainnet and native USDC only.
- Only works for authorizations whose
fromandnonceyou kept. - Telling used from canceled needs
validBefore(Check searches the window before it); without it a spent nonce can come backauthorization_spent_unconfirmed. - On-chain data cannot show whether the seller delivered.
- Kertivo holds no funds and does not arbitrate disputes. It reports evidence.