Agents & x402

Machine-to-machine payments for AI agents over the x402 (HTTP 402) protocol - non-custodial, gasless via the default relayer, settled on-chain.

What is x402?

x402 is the open standard for payments over HTTP: a server responds 402 Payment Required with a payment demand, the client pays, and the request proceeds. U.CASH runs three 402 rails at agents.u.cash - sell API access, content, or compute by the call, and let AI agents pay you without accounts or invoices:

  • Detect - the buyer pays your wallet on-chain; settlement is auto-detected (or instant by hash submission)
  • Redirect - cards and fiat through the seller's own Stripe
  • x402 gasless - the buyer signs an off-chain USDC transfer authorization (USDC on Base today); the platform relayer submits it on-chain, so stock x402 clients settle instantly and gasless

Selling through x402

  1. Create a resource - a priced endpoint (fixed price, or pay-what-you-want) with your terms
  2. Share the door - every resource gets a shareable page (agents.u.cash/r/<id>) that agents (or humans) can pay to open
  3. Get settled - payments settle to your wallet on-chain; per-resource settlement webhooks (the res_ flow) deliver to your agent webhook endpoint

Stock x402 clients work out of the box: the default-on relayer pays gas on the buyer's behalf and appends the ERC-8021 builder-code suffix at settlement, so buyers pay gasless and sellers still settle on-chain.

Buying through x402

Point your agent at any x402 resource. The SDKs handle the handshake:

npm install @ucash/agents
pip install agents-u-cash
door = view_door(res_id)            # price and terms, JSON or HTML
pay(door["payTo"])                  # pay, auto-settle on-chain
verify(challenge_id, tx_hash)       # or settle manually with proof

Sell-side helpers (create_resource, create_challenge, get_settlements) are in the same packages; the zero-dependency Python client runs on Python 3.7+. Full reference at agents.u.cash.

Credits and fees

  • Seller-side rail costs (relayer gas) are billed from your platform credit balance, plus a service fee on each settled sale - see Credits & Top-up
  • Buyers pay only the resource price
  • Everything remains non-custodial: the platform never holds buyer or seller funds

In the console

The AI Agents area links (or promotes) your account for agent operation: an agent API key with rotate, your agent-enabled resources, settlement and earnings totals, and the Gasless Relayer toggle - leave it on and stock x402 clients settle instantly; each relayed settlement bills gas plus a 21% premium from your credit balance. Agent settlement webhooks are configured separately under Account → Agent Webhook.

UCP discovery and sessions

Every merchant domain also speaks the Universal Checkout Protocol for machine clients:

  • /.well-known/ucp - the UCP profile (capabilities, payment handlers, signing key)
  • /catalog.json / /catalog.txt - your checkouts as schema.org Product catalog
  • ?rest=checkout-sessions - create, get, complete, and cancel multi-item mixed-currency checkout sessions, with signed responses

Paid doors open a UCP session scoped to the payment - fulfillment endpoints verify entitlement server-side without their own auth. Agent settlement notifications use the same signed-webhook scheme as payments (see Webhooks).

Design documents

The design reasoning behind the agent rails, written for implementers and reviewers:

  • VISION - what machine payments are for
  • USE-CASES - the sell and buy journeys the API serves
  • ARCHITECTURE - rails, settlement flows, and the exact (x402) scheme
  • ROADMAP - what has shipped and what is next
  • RISKS - the money-transmitter non-custody argument, per flow

The vendor-neutral protocol spec lives at 402.onl.