Note · · Mandate checklist (in Spanish) · Español

Validate the mandate before paying an x402

In x402 you pay per call: the server answers 402 with the amount, the asset, the network and the wallet that gets paid, and the agent signs. If there is a mandate that limits what that agent may pay, that is the moment to check it, between the 402 and the signature.

In a public thread about Link spending limits for agents, the questions to @link were asked by Marcelo Switach, the author of this note, from his account @ai_evolve_all. The official Link account replied twice. In the first reply it said it does not currently document a per-agent authorization record with a merchant-specific aggregate cap, delegation expiry, a named approver and a rule that makes that record the final word in a dispute, and that “an approved, in-limit purchase is generally treated as authorized”. What happens when it goes wrong depends on the merchant, refund and dispute rules, the payment rail and the applicable agreements.

In the second reply, about a signed mandate like the one in Mandato AR, it was direct: “You could validate the mandate in your own authorization layer before initiating the x402 payment, but Link wouldn’t independently verify or enforce it”. Validation stays with whoever runs the agent.

What to validate before signing

  1. Signature. The mandate is signed by whoever authorizes it and the signature verifies with their key.
  2. Expiry. The expiry date has not passed.
  3. URL allowlist. The URL to be paid is on the mandate list. If it is not, not even the first request goes out.
  4. Cap against the real 402 amount. Compare the amount of the accepts[] entry that will be paid, not a price estimated in advance. If the 402 asks for more, reject before signing.
  5. Network and payTo. The 402 network is the mandate network and the wallet that gets paid is one of the authorized ones (Mandato AR does not check this yet).

If a single check fails, the agent does not sign. There is nothing to reverse because the payment never left.

How Mandato AR does it

Mandato AR is an open prototype, MIT licensed, Base Sepolia (testnet) only and not audited. Its buyer runs the checks in that order: it verifies the signature (demo HMAC or ed25519) and the expiry, matches the URL against the allowlist, reads the 402, picks the accepts[] entry on the mandate network and compares its amount with budgetUsdc (payAndFetch.ts). The README states that the cap is per payment and that an estimated price never replaces the real amount.

The LupaRiel endpoint

/api/mandate/scope does not check the real 402. It takes a Mandato AR mandate, the URL and a proposed price (plus spend so far, if passed) and evaluates that price against the mandate. It returns six checks: schema, signature, expiry, network, allowed resource and budget. It does not read the amount or the payTo of the 402 that will be paid, so comparing the cap with the real amount stays with the agent. It costs 0.02 USDC per call over x402 on Base. It is informational: it does not create, sign or block payments.

The tests that check should pass (replay, concurrent captures, terms that change, verify before settle) are in the mandate test checklist.

What is missing

  • payTo in the mandate. The Mandato AR v0.1 mandate has no list of authorized wallets, so today the buyer checks the network but not the wallet that gets paid.
  • Cumulative cap. The buyer does not add up spend. The v0.2 schema defines a daily cap, but the caller has to pass the day’s spend.
  • Same network in both pieces. The scope endpoint only accepts Base (eip155:8453) and the Mandato AR demo runs on Base Sepolia, so a demo mandate comes back with networkMatch false.
  • Link does not verify it. Link said it would not independently verify or enforce an external signed mandate like this one. That other rails do not read it either is our inference, not something Link said. A signed receipt for each verification would help explain later what was authorized.
  • Audit. All of this is testnet and unaudited code. It is not fit for real funds.

Sources