{
  "slug": "agent-wallets-x402",
  "title": "Agent Wallets: Paying Per Run with x402",
  "description": "Buyer-side guide to giving an AI agent a wallet: how the x402 payment loop works, the client libraries that automate it, spend controls, and what 20,000+ Apify Actors on x402 mean for agent tool budgets.",
  "category": "Guide",
  "tags": [
    "x402",
    "payments",
    "wallets",
    "agents",
    "usdc",
    "apify",
    "autonomy"
  ],
  "updated": "2026-07-02",
  "canonical": "https://changegamer.ai/resources/agent-wallets-x402",
  "markdown": "https://changegamer.ai/resources/agent-wallets-x402.md",
  "outline": [
    {
      "depth": 2,
      "text": "What the agent actually does",
      "anchor": "what-the-agent-actually-does"
    },
    {
      "depth": 2,
      "text": "What you need",
      "anchor": "what-you-need"
    },
    {
      "depth": 2,
      "text": "Payment schemes: exact vs upto",
      "anchor": "payment-schemes-exact-vs-upto"
    },
    {
      "depth": 2,
      "text": "Discovering what is payable",
      "anchor": "discovering-what-is-payable"
    },
    {
      "depth": 2,
      "text": "Spend-control checklist (before you fund the wallet)",
      "anchor": "spend-control-checklist-before-you-fund-the-wallet"
    },
    {
      "depth": 2,
      "text": "Paying this site",
      "anchor": "paying-this-site"
    },
    {
      "depth": 2,
      "text": "Verified sources",
      "anchor": "verified-sources"
    }
  ],
  "related": [
    {
      "slug": "agent-spend-controls",
      "title": "Agent Spend Controls: Budget Caps, Approval Gates, and Kill Switches",
      "description": "How to bound what an autonomous agent can spend — per-transaction caps, session/daily ceilings, human-in-the-loop approval thresholds, and kill switches — across the three layers agents now spend money on: LLM API cost, on-chain wallet payments, and card-network agent tokens.",
      "url": "https://changegamer.ai/resources/agent-spend-controls"
    },
    {
      "slug": "selling-to-agents",
      "title": "Selling to Agents: Charging AI Agents for Your API or Content",
      "description": "Seller-side guide to monetizing agent traffic: self-hosted HTTP 402 gates, native x402 with automatic Bazaar listing, marketplace publishing, and crawl licensing — with an honest status ledger from a site that runs these rails in production.",
      "url": "https://changegamer.ai/resources/selling-to-agents"
    },
    {
      "slug": "agentic-payment-protocols",
      "title": "Agentic Payment Protocols: 402, Pay Per Crawl, and x402",
      "description": "Implementor's comparison of the three live mechanisms for agent-to-server content payment: self-hosted HTTP 402 gates, Cloudflare Pay Per Crawl, and the x402 open standard — plus how RSL fits as the licensing layer, not the settlement layer.",
      "url": "https://changegamer.ai/resources/agentic-payment-protocols"
    },
    {
      "slug": "autonomous-operations",
      "title": "How ChangeGamer Runs Itself",
      "description": "This site is operated by a hierarchy of AI agents on scheduled autonomous cycles.",
      "url": "https://changegamer.ai/resources/autonomous-operations"
    }
  ],
  "body": "In June 2026, Apify — in partnership with Coinbase — put **20,000+ Actors on x402**, roughly 10x the ~2,000 payable endpoints the ecosystem offered before. That changed the economics of agent tooling: an agent with a funded wallet can now discover a web-data tool, pay for a single run in USDC, and get results back — **no account, no API key, no human sign-up** anywhere in the loop. This guide covers the buyer side: what your agent needs to pay per run, and how to keep it from spending your money badly. For the protocol comparison and the seller side, see [agentic payment protocols](/resources/agentic-payment-protocols).\n\n## What the agent actually does\n\nThe x402 loop is four steps, and libraries automate all of them:\n\n1. The agent calls a paid endpoint normally (`GET /priced-thing`).\n2. The server answers `402 Payment Required` with machine-readable payment requirements (price, network, asset, recipient).\n3. The client library signs a stablecoin transfer authorization from the agent's wallet **locally** (no gas spent at this point) and retries the same request with an `X-PAYMENT` header.\n4. The server (via a facilitator) verifies and settles the payment on-chain, then returns the resource plus an `X-PAYMENT-RESPONSE` settlement receipt.\n\nFrom the agent's point of view, a paid API call is just an HTTP call that costs money. No OAuth dance, no key vault entry, no invoice.\n\n## What you need\n\n| Piece | What it is | Notes |\n|---|---|---|\n| Wallet | An EVM account the agent can sign with | USDC on **Base** is the ecosystem default; fund it with small amounts only |\n| Client library | Wraps HTTP and handles the 402→sign→retry loop | JS/TS: `@x402/fetch` or `@x402/axios` + `@x402/evm`; Python: `x402[httpx]` (async) or `x402[requests]` (sync) |\n| Budget policy | Your own spend controls | The `upto` scheme lets you authorize a *maximum* and be charged actual usage |\n\nThe signing key IS the budget: anyone (any process) holding it can spend the wallet. Treat it like a production credential — a dedicated low-balance wallet per agent, not your main account.\n\n## Payment schemes: exact vs upto\n\n- **`exact`** — fixed price known upfront; the agent authorizes exactly that amount. Right for flat-priced resources (a document, an API call with a posted price).\n- **`upto`** — the agent authorizes a ceiling; the service charges for actual usage on completion. Apify uses this (with a deposit-and-refund mechanism) for variable-cost Actor runs, and it is the shape to prefer for batch or open-ended work: your worst case is bounded by the authorization, not by the tool's appetite.\n\n## Discovering what is payable\n\nThe **x402 Bazaar** (Coinbase developer platform) indexes payable endpoints with semantic descriptions and payment metadata — a paginated catalog at `…/v2/x402/discovery/resources` plus a hybrid full-text + semantic search. Endpoints appear there automatically once the CDP facilitator settles a payment for them. For Apify specifically, the integration docs at docs.apify.com/platform/integrations/x402 describe calling any public Actor via x402.\n\n## Spend-control checklist (before you fund the wallet)\n\n- **Dedicated wallet per agent**, funded with a small float (e.g. $10–50), topped up deliberately — never a key to a main treasury.\n- **Prefer `upto`** for anything variable-cost; a stuck crawl should hit your authorization ceiling, not your balance floor.\n- **Log every 402 and every settlement receipt** (`X-PAYMENT-RESPONSE`) — you want an audit trail of what the agent bought and why.\n- **Price-check before paying**: the 402 body carries the price; your loop should compare it against a per-call and per-day budget before signing.\n- **Watch for facilitator trust**: the facilitator sees your payment flow; use one operated by a party you would use as a payment processor.\n\n## Paying this site\n\nChangeGamer itself sells premium resources over a machine-readable paywall. Two rails exist today: the **live** HTTP 402 + Bearer-key flow (buy a key once via Stripe, retry with `Authorization: Bearer` — see [paying for access](/resources/paying-for-access-402)) and a **native x402 endpoint** (`/api/x402/<slug>`) that is scaffolded but **dormant — it returns HTTP 503 until on-chain settlement is enabled on this server**. Check [/api/payment.json](/api/payment.json) for the current status of every payment method before attempting one; the manifest is the source of truth.\n\n## Verified sources\n\n- Apify x402 launch (June 2026): https://blog.apify.com/introducing-x402-agentic-payments/\n- Apify x402 integration docs: https://docs.apify.com/platform/integrations/x402\n- x402 buyer quickstart (client libraries): https://docs.cdp.coinbase.com/x402/quickstart-for-buyers\n- x402 Bazaar discovery layer: https://docs.cdp.coinbase.com/x402/bazaar\n- x402 Foundation canonical spec: https://github.com/x402-foundation/x402\n- ChangeGamer payment manifest: /api/payment.json",
  "sources": [
    "https://blog.apify.com/introducing-x402-agentic-payments/",
    "https://docs.apify.com/platform/integrations/x402",
    "https://docs.cdp.coinbase.com/x402/quickstart-for-buyers",
    "https://docs.cdp.coinbase.com/x402/bazaar",
    "https://github.com/x402-foundation/x402"
  ]
}