Skip to content
SpendTheBits

Safety · 7 min read

Payment authorization expiry: why a signature should not live for days

By , Founder, SpendTheBits ·

In short

A signed stablecoin payment works like a cheque anyone holding it can cash, until it expires. Payment authorization expiry is the time limit written into that signature. Keep the window to a minute or two for a pay-per-call request, refuse sellers who ask for hours or days, and remember that a random nonce stops reuse but does not stop a late cash-in.

60 s
maxTimeoutSeconds in the x402 exact scheme's EVM exampleSource: GitHub (Coinbase)

When an AI agent pays an x402 seller in USDC, it usually does not send a transaction. It signs a message that lets someone else send one for it. That message carries a time window, and the window is the part most builders never look at.

The x402 specification says authorizations have explicit time windows to limit their lifetime [3]. How long that lifetime is depends on what the seller asks for and what the buyer agrees to sign. This piece explains payment authorization expiry from the standard up: the two time fields, the nonce, why a long window is a risk, and how to pick a sensible one.

A sealed envelope beside a nearly empty hourglass, illustrating payment authorization expiry.

A signature that someone else submits

EIP-3009 adds a function called transferWithAuthorization to a token. The payer signs typed data naming the from address, the to address, the value, a validAfter time, a validBefore time and a nonce [1]. Anyone who holds that signed message can then call the token contract to move the money, and they pay the gas.

This is what makes x402 feel instant for buyers. The client signs, sends the payload to the seller, and the seller or its facilitator submits it on chain. The facilitator checks the signature, the balance, and that the amount and validity window meet the seller's requirements, then simulates the transfer before settling [2].

The catch is in the phrase anyone who holds it. Until it is used or it expires, the signed message is a live instruction to move your money. It cannot be redirected to a different payee or a bigger amount. But it can be submitted later than you expected, by whoever ends up holding it.

validAfter and validBefore, in plain words

The two time fields are simple. EIP-3009 describes validAfter as the time after which the authorization is valid, and validBefore as the time before which it is valid, both in unix time [1]. Outside that window the token contract refuses the transfer.

The x402 exact scheme's EVM example shows the scale it has in mind. The seller's requirement sets maxTimeoutSeconds to 60, and the signed authorization's validAfter and validBefore sit about a minute apart [2]. The specification describes maxTimeoutSeconds as the maximum time allowed for payment completion [3].

So a pay-per-call payment is meant to be short-lived. Sign it, use it, and let it die. A window measured in seconds or minutes fits that job. A window measured in days does not fit any pay-per-call job at all.

Clocks matter here. The window is checked against the chain's block time, not the clock on your laptop or server. A machine whose clock runs fast or slow can sign a window that has already closed, or one that has not opened yet. Keep the signer's clock in sync, and log both times with every payment so a failed settlement is easy to explain.

What a long window lets go wrong

A long payment authorization expiry turns a quick purchase into a standing promise. Several things can go wrong while it sits there.

First, the seller can hold it. A seller who receives a signed payment but does not deliver can wait and submit it later, for example after you have topped the wallet back up. Second, it can leak. A payload logged by a proxy, stored in a crash report or sent to the wrong service is still spendable until its window closes. EIP-3009 also warns that someone watching the transaction pool can extract a transfer authorization [1].

Third, your situation changes. You might decide you no longer want the item, find that the seller was a scam, or move your funds. A short window means the old signature simply stops working. A long one means you are racing to cancel it.

None of these needs a clever attacker. They need only time. A short payment authorization expiry takes that time away, which is why it is the cheapest safety setting an agent builder controls. It costs nothing to set and nothing to keep, and it quietly closes the door on every one of these cases at once.

Nonces stop reuse, not delay

Every EIP-3009 authorization carries a nonce. The standard uses random 32-byte nonces, unique to the authorizer's address, rather than a counter [1]. The x402 specification adds that each authorization includes a unique 32-byte nonce to prevent replay attacks, and that EIP-3009 contracts prevent nonce reuse at the contract level [3].

That is a strong guarantee against one problem: the same signature cannot be cashed twice. It is no guarantee at all against the other problem, a single signature cashed late. The nonce is marked used only when the transfer happens. Until then it is simply waiting.

Random nonces also mean a user can create as many transactions as they want at the same time, which the standard gives as the reason for choosing them [1]. That is handy for an agent making parallel calls. It also means that ten open signatures are ten separate live payments, each bounded only by its own window.

You can at least see where a signature stands. The standard's authorizationState function returns true once a nonce has been used [1]. An agent that keeps a list of the nonces it signed can check that list against the token and spot any authorization that is still open. If one is still open long after the call finished, something did not go to plan.

Can you cancel a signed payment?

Sometimes. EIP-3009 lists a cancelAuthorization function, described simply as an attempt to cancel an authorization [1]. It sits in the optional part of the standard, so not every token that supports transfers by signature has to support cancelling them [1].

Even where it exists, cancelling is a race. You have to send a transaction, with gas, before the holder submits the original. If they are watching for exactly that, they may win. Expiry needs no action at all. It is the only protection that works while you are asleep.

Compare this with EIP-2612 permits, which grant an allowance rather than a single transfer. The permit standard lets an owner limit validity by setting a deadline in the near future, and notes that a deadline set to the maximum value creates a permit that effectively never expires [4]. It also points out that a relayer can simply choose not to submit a permit it was given [4]. Our explainer on token approvals covers that side.

Picking a sensible window

For pay-per-call requests, set validBefore close to the moment you sign, plus the seller's stated timeout. A minute or two covers network delays without leaving a signature lying around. If a seller's requirement asks for an hour or more for a simple call, treat that as a warning sign, not a setting to accept.

Agents should enforce a ceiling in code. Pick a maximum lifetime, compare it with the seller's maxTimeoutSeconds before signing, and refuse anything longer. A seller with a genuine need for a long window can explain it, and a person can decide.

Never sign a fresh authorization just because the first outcome was unclear. The x402 docs say that after a payment signature is sent and the result is unknown, a client should not automatically authorize a second payment [5]. A short window is what makes waiting safe: the first signature either settles soon or stops working. For a fuller walk-through of the signing standard, see our EIP-3009 explainer.

How SpendTheBits handles the window

SpendTheBits treats a long-lived authorization as a red flag in two places. Before an AI agent's request reaches its owner, SpendTheBits checks it for a payment authorization that stays valid too long, along with a new seller, a price outlier, a changed payout address, a lookalike web address and a duplicate. The owner chooses whether such a request is shown to them or blocked.

Those budget rules are cooperative: they apply when the agent checks a payment with SpendTheBits first, and an agent that skips the check is limited only by the USDC at its own address. The free public scanner on the SpendTheBits site reads a seller's payment request without paying or signing, and lists a long-lived authorization among its reasons for a careful or high risk verdict.

For builders, SpendTheBits runs public test sellers on test networks, including one that asks for an hour-long authorization, so you can confirm your agent refuses it. They never settle a payment. When you pay an x402 link yourself from the app, the device signs the EIP-3009 authorization. More on agent setups is on the agents page.

SpendTheBits Pay an agent endpoint screen showing the price, the payee address and a quote countdown
Paying an x402 link: the price, the payee and how long the quote lasts.

In the app · 3 steps

Pay an x402 link with a short-lived signature

Paying an x402 link from the app shows the price, the payee and the quote's time limit before you sign.

  1. Paste the link and get a quote

    Open Pay an agent endpoint, paste the URL and fetch a fresh quote. Check the price, the network and who it pays.

    The Pay an agent endpoint screen in SpendTheBits with the price, payee and quote countdown
  2. See what you bought

    Purchases lists each paid call, so you can match it to what you expected.

    The x402 purchases list in SpendTheBits
  3. Give agents their own budget

    An agent signs with its own key and spends only the USDC you put at its address.

    The Agent budgets screen in SpendTheBits

Hold your own keys, keep the yield, skip the middleman.

SpendTheBits is a fully non-custodial wallet for 13 chains, free on iOS and Android.

Frequently asked

It is the unix time before which a signed transfer authorization is valid. After it passes, the token contract refuses to execute the authorization [1].

No. A nonce stops the same authorization being used twice. Only the expiry time stops a single unused authorization from being submitted late.

About as long as the request needs. The x402 exact scheme's example uses a 60 second timeout [2], and a window of a minute or two suits most pay-per-call requests.

Only if the token supports the optional cancelAuthorization function, and only before the authorization is used [1]. Cancelling costs gas and can lose a race, so a short expiry is the better protection.

Sources

  1. 1.ERC-3009: Transfer With Authorization · Ethereum Improvement Proposals · accessed 2026-11-12
  2. 2.Scheme: exact on EVM · GitHub (Coinbase) · accessed 2026-11-12
  3. 3.x402 specification v2 · GitHub (Coinbase) · accessed 2026-11-12
  4. 4.ERC-2612: Permit Extension for EIP-20 Signed Approvals · Ethereum Improvement Proposals · accessed 2026-11-12
  5. 5.Client / Server - x402 · x402 Docs · accessed 2026-11-12

This article is educational and reflects observed data and public sources on the date shown. It is not financial, legal or tax advice. Digital assets can lose value; yields shown are observed, not promised.

STB Weekly, every tuesday

The short version of pieces like this one, plus what moved in AI in finance and agent payments. What you get

Product updates and release notes. No price calls, no spam, unsubscribe in one click. We email you once to confirm before anything else is sent.