
Agent Payment X402
Wire x402 HTTP payments into AI agents with per-task budgets, policy gates, and non-custodial wallets on Base or X Layer.
Overview
agent-payment-x402 is an agent skill most often used in Build (also Operate) that adds policy-gated x402 payments and non-custodial wallets for paying or charging via agent MCP tools.
Install
npx skills add https://github.com/affaan-m/everything-claude-code --skill agent-payment-x402What is this skill?
- Decision tree: buyer on Base vs X Layer vs seller SDKs in TypeScript or Go
- MCP payment server pattern with agentwallet-sdk and strict spending policy
- Pairs with cost-aware LLM pipelines and security review for spend and auth
- Non-custodial wallet flows via x402 protocol semantics
- Documents deprecated okx-x402-payment alias toward onchainos-skills
Adoption & trust: 3.4k installs on skills.sh; 210k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent can call paid APIs but has no standardized HTTP 402 settlement, spending caps, or safe non-custodial wallet integration.
Who is it for?
Solo builders shipping agent products that must autonomously pay micro-amounts for APIs or accept x402 from other agents on supported chains.
Skip if: Static SaaS with only human checkout, teams avoiding on-chain settlement, or products with no need for machine-initiated payments.
When should I use this skill?
Your agent needs to pay for an API call, purchase a service, settle with another agent, enforce per-task spending limits, or manage a non-custodial wallet.
What do I get? / Deliverables
You choose a chain-specific buyer or seller path, connect MCP or SDK hooks, and run agents that pay within per-task budgets instead of ad-hoc keys in prompts.
- Chosen buyer or seller integration path documented in the repo
- MCP payment server or SDK middleware configuration
- Per-task spending policy specification for agent runs
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Payment MCP and SDK integration is built when the agent product gains paid API access—not at idea or pure marketing launch. x402 clients, agentwallet-sdk, and OKX Agent Payments are external service integrations rather than UI or generic PM docs.
Where it fits
Connect agentwallet-sdk as an MCP server so each tool call respects a per-task USDC budget on Base.
Expose OKX Agent Payments on X Layer so your coding agent can settle external data API invoices automatically.
Run security-review alongside payment wiring before enabling mainnet wallets in production agents.
Adjust spending policies and chain routing after you see real 402 failures or cost spikes in agent logs.
How it compares
Agent-side x402 integration skill—not a hosted payment processor dashboard or a generic Stripe human checkout plugin.
Common Questions / FAQ
Who is agent-payment-x402 for?
Indie agent builders integrating x402 buyers on Base or X Layer, or exposing paid APIs to other agents with OKX seller SDK patterns.
When should I use agent-payment-x402?
In Build while wiring MCP payment servers and SDKs; in Operate when tuning spending policies, chains, and wallet safety after launch.
Is agent-payment-x402 safe to install?
Payment skills touch funds and secrets—read SKILL.md carefully and use the Security Audits panel on this page; do not skip security-review for production wallets.
SKILL.md
READMESKILL.md - Agent Payment X402
# Agent Payment Execution (x402) Enable AI agents to make policy-gated payments with built-in spending controls. Uses the x402 HTTP payment protocol and MCP tools so agents can pay for external services, APIs, or other agents without custodial risk. ## When to Use Use when: your agent needs to pay for an API call, purchase a service, settle with another agent, enforce per-task spending limits, or manage a non-custodial wallet. Pairs naturally with cost-aware-llm-pipeline and security-review skills. ## Decision Tree Choose the integration path based on whether your agent is buying access to a paid API or charging others for one: | Need | Recommended path | |------|------------------| | Agent pays a 402-gated API on Base or another agentwallet-supported chain | Use `agentwallet-sdk` as an MCP payment server with strict spending policy | | Agent pays a 402-gated API on X Layer | Use OKX Agent Payments Protocol from `okx/onchainos-skills`; `okx-x402-payment` is a deprecated legacy alias | | TypeScript API charges agents | Use OKX Payments TypeScript seller SDK docs for Express, Hono, Fastify, or Next.js | | Go API charges agents | Use OKX Payments Go seller SDK docs for Gin, Echo, or `net/http` | | Rust API charges agents | Use OKX Payments Rust seller SDK docs for Axum | | Java API charges agents | Use OKX Payments Java seller SDK docs for Spring Boot 2/3, Java EE, or Jakarta | | Python API charges agents | Check the current OKX Payments repository before implementation; a Python seller guide may not be available | ## Supported Networks - `agentwallet-sdk`: use the package docs to confirm current network coverage before production. Base Sepolia is the safest development default; Base mainnet is the production path called out by the original skill. - OKX Payments / X Layer: current seller docs target X Layer (`eip155:196`) and USDT0 settlement. Fetch current SDK docs before generating production code because payment packages and facilitator behavior can change quickly. ## How It Works ### x402 Protocol x402 extends HTTP 402 (Payment Required) into a machine-negotiable flow. When a server returns `402`, the agent's payment tool negotiates price, checks budget, signs a transaction, and retries only inside the policy and confirmation boundary set by the orchestrator. ### Spending Controls Every payment tool call enforces a `SpendingPolicy`: - **Per-task budget** — max spend for a single agent action - **Per-session budget** — cumulative limit across an entire session - **Allowlisted recipients** — restrict which addresses/services the agent can pay - **Rate limits** — max transactions per minute/hour ### Non-Custodial Wallets Agents hold their own keys via ERC-4337 smart accounts. The orchestrator sets policy before delegation; the agent can only spend within bounds. No pooled funds, no custodial risk. ## MCP Integration The payment layer exposes standard MCP tools that slot into any Claude Code or agent harness setup. > **Security note**: Always pin the package version. This tool manages private keys — unpinned `npx` installs introduce supply-chain risk. ### Option A: agentwallet-sdk (Base / multi-chain) ```json { "mcpServers": { "agentpay": { "command": "npx", "args": ["agentwallet-sdk@6.0.0"] } } } ``` ### Available Tools (agent-callable) | Tool | Purpose | |------|---------| | `get_balance` | Check agent wallet balance | | `send_payment` | Send payment to address or ENS | | `check_spending` | Query remaining budget | | `list_transactions` | Audit trail of all payments | > **Note**: Spending policy is set by the **orchestrator** before delegating to the agent — not by the agent itself. This prevents agents from escal