Spend7

x402 spend limits and payment risk checks

Payment negotiated over HTTP 402: the server quotes what it wants, the client pays and retries the request with a signed payment payload.

Introduced by Coinbase in 2025 as an open HTTP payment scheme.

How authorisation works

The resource server answers with 402 Payment Required and a payment-requirements object naming a scheme, a network, an asset, a pay-to address and a maximum amount. The client signs an authorization for that amount and resends the request with an X-PAYMENT header; a facilitator verifies and settles it.

Flag67/ 100

$95.00, research-agent-01 to Example Data API, on x402.

Authorized above the quoted maximum, on the exact scheme+45
Amount is far above this agent's normal+22
Ruleset 2026.08.2 · recorded before settlement

What Spend7 can verify

  • The authorized amount against the maxAmountRequired the server actually quoted
  • The settlement asset and network against the ones the quote named
  • Whether the pay-to address has ever been paid by this account before
  • Whether the authorization nonce has already been seen (replay)
  • Whether the quote's timeout window has expired before settlement

What goes wrong on this rail

  • !An agent signs for the quoted ceiling rather than the price, and overpays silently
  • !A substituted pay-to address routes the settlement to a different counterparty
  • !A retry loop re-signs the same purchase repeatedly because the resource keeps 402ing
  • !Settlement on an unintended network or in an unintended asset

Checking a x402 payment

The rail block is what unlocks the protocol checks. Without it the payment still scores on caps, amount anomaly, velocity and merchant history, but no rail defect can be detected, because nothing was sent to detect it against.

bash
curl -s https://spend7.com/api/v1/risk-check \
  -H 'Authorization: Bearer sp7_live_…' \
  -H 'Content-Type: application/json' \
  -d '{
    "intent": {
      "agentId": "research-agent-01",
      "amountMinor": 4200,
      "currency": "USD",
      "merchantId": "api.example-data.com",
      "category": "data_api",
      "rail": "x402",
      "x402": {
        "maxAmountRequiredMinor": 5000,
        "authorizedAmountMinor": 4200,
        "network": "base",
        "asset": "USDC",
        "payTo": "0x1234abcd…",
        "nonce": "0x9f3c…",
        "maxTimeoutSeconds": 60,
        "quoteAgeSeconds": 4,
        "scheme": "exact"
      }
    }
  }'

Questions

How do I set a spend limit for x402?
Configure an agent-scoped or merchant-scoped cap against the agentId your payment client sends, then call the risk check before each settlement. The cap is enforced the same way on every rail; x402 only adds the protocol checks on top.
What is the most common x402 mistake?
Signing an authorization for the quoted maxAmountRequired rather than the price. On the exact scheme the facilitator may settle the whole authorized amount, so the agent overpays silently. Send both maxAmountRequiredMinor and authorizedAmountMinor and the check catches it. An authorization above the quote is a decisive deny, and one sitting exactly on the ceiling raises the score.
Can Spend7 detect a replayed x402 authorization?
Yes, when you send the nonce. Spend7 keeps the nonces it has seen for your account over 30 days and denies a repeat. Without a nonce field there is nothing to compare, and the check scores on the other signals.
Does Spend7 settle the payment?
No. It never holds a credential and never moves money. It scores the intent; your client or your facilitator settles, or does not.

Protocol reference: x402 protocol. Spend7 is not affiliated with the protocol’s authors; it consumes the fields the protocol defines.