agent-payment-x402 — for Claude Code agent-payment-x402, everything-claude-code, official, for Claude Code, ide skills, x402 protocol, non-custodial wallets, per-task budgets, spending controls, ERC-4337 smart accounts, Claude Code

Verified
v1.0.0
GitHub

About this Skill

Ideal for Autonomous Agents requiring secure and controlled payment execution for APIs, services, or other agents. agent-payment-x402 is a skill that enables AI agents to make autonomous payments using the x402 protocol and MCP tools, providing per-task budgets, spending controls, and non-custodial wallets.

Features

Enforce per-task budgets using SpendingPolicy
Implement non-custodial wallets via ERC-4337 smart accounts
Use x402 HTTP payment protocol for machine-negotiable flows
Integrate with MCP tools for seamless payment execution
Check agent wallet balance using get_balance tool
Send payments to addresses or ENS using send_payment tool

# Core Topics

affaan-m affaan-m
[116.8k]
[15188]
Updated: 3/30/2026

Agent Capability Analysis

The agent-payment-x402 skill by affaan-m is an open-source official AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for for Claude Code, x402 protocol, non-custodial wallets.

Ideal Agent Persona

Ideal for Autonomous Agents requiring secure and controlled payment execution for APIs, services, or other agents.

Core Value

Empowers agents to make autonomous payments with built-in spending controls using the x402 HTTP payment protocol and MCP tools, enabling per-task budgets, non-custodial wallets, and secure transactions without custodial risk.

Capabilities Granted for agent-payment-x402

Automating API payments with enforceable per-task budgets
Settling transactions with other agents using non-custodial wallets
Enforcing spending limits and rate limits for agent actions
Managing allowlisted recipients for secure payment transactions
Auditing payment trails with list_transactions tool

! Prerequisites & Limits

  • Requires MCP integration and agentwallet-sdk package
  • Needs orchestrator setup for spending policy configuration
  • Must pin package version to prevent supply-chain risk
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

agent-payment-x402

Install agent-payment-x402, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Agent Payment Execution (x402)

Enable AI agents to make autonomous 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.

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 automatically negotiates price, checks budget, signs a transaction, and retries — no human in the loop.

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.

json
1{ 2 "mcpServers": { 3 "agentpay": { 4 "command": "npx", 5 "args": ["agentwallet-sdk@6.0.0"] 6 } 7 } 8}

Available Tools (agent-callable)

ToolPurpose
get_balanceCheck agent wallet balance
send_paymentSend payment to address or ENS
check_spendingQuery remaining budget
list_transactionsAudit 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 escalating their own spending limits. Configure policy via set_policy in your orchestration layer or pre-task hook, never as an agent-callable tool.

Examples

Budget enforcement in an MCP client

When building an orchestrator that calls the agentpay MCP server, enforce budgets before dispatching paid tool calls.

Prerequisites: Install the package before adding the MCP config — npx without -y will prompt for confirmation in non-interactive environments, causing the server to hang: npm install -g agentwallet-sdk@6.0.0

typescript
1import { Client } from "@modelcontextprotocol/sdk/client/index.js"; 2import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; 3 4async function main() { 5 // 1. Validate credentials before constructing the transport. 6 // A missing key must fail immediately — never let the subprocess start without auth. 7 const walletKey = process.env.WALLET_PRIVATE_KEY; 8 if (!walletKey) { 9 throw new Error("WALLET_PRIVATE_KEY is not set — refusing to start payment server"); 10 } 11 12 // Connect to the agentpay MCP server via stdio transport. 13 // Whitelist only the env vars the server needs — never forward all of process.env 14 // to a third-party subprocess that manages private keys. 15 const transport = new StdioClientTransport({ 16 command: "npx", 17 args: ["agentwallet-sdk@6.0.0"], 18 env: { 19 PATH: process.env.PATH ?? "", 20 NODE_ENV: process.env.NODE_ENV ?? "production", 21 WALLET_PRIVATE_KEY: walletKey, 22 }, 23 }); 24 const agentpay = new Client({ name: "orchestrator", version: "1.0.0" }); 25 await agentpay.connect(transport); 26 27 // 2. Set spending policy before delegating to the agent. 28 // Always verify success — a silent failure means no controls are active. 29 const policyResult = await agentpay.callTool({ 30 name: "set_policy", 31 arguments: { 32 per_task_budget: 0.50, 33 per_session_budget: 5.00, 34 allowlisted_recipients: ["api.example.com"], 35 }, 36 }); 37 if (policyResult.isError) { 38 throw new Error( 39 `Failed to set spending policy — do not delegate: ${JSON.stringify(policyResult.content)}` 40 ); 41 } 42 43 // 3. Use preToolCheck before any paid action 44 await preToolCheck(agentpay, 0.01); 45} 46 47// Pre-tool hook: fail-closed budget enforcement with four distinct error paths. 48async function preToolCheck(agentpay: Client, apiCost: number): Promise<void> { 49 // Path 1: Reject invalid input (NaN/Infinity bypass the < comparison) 50 if (!Number.isFinite(apiCost) || apiCost < 0) { 51 throw new Error(`Invalid apiCost: ${apiCost} — action blocked`); 52 } 53 54 // Path 2: Transport/connectivity failure 55 let result; 56 try { 57 result = await agentpay.callTool({ name: "check_spending" }); 58 } catch (err) { 59 throw new Error(`Payment service unreachable — action blocked: ${err}`); 60 } 61 62 // Path 3: Tool returned an error (e.g., auth failure, wallet not initialised) 63 if (result.isError) { 64 throw new Error( 65 `check_spending failed — action blocked: ${JSON.stringify(result.content)}` 66 ); 67 } 68 69 // Path 4: Parse and validate the response shape 70 let remaining: number; 71 try { 72 const parsed = JSON.parse( 73 (result.content as Array<{ text: string }>)[0].text 74 ); 75 if (!Number.isFinite(parsed?.remaining)) { 76 throw new TypeError("missing or non-finite 'remaining' field"); 77 } 78 remaining = parsed.remaining; 79 } catch (err) { 80 throw new Error( 81 `check_spending returned unexpected format — action blocked: ${err}` 82 ); 83 } 84 85 // Path 5: Budget exceeded 86 if (remaining < apiCost) { 87 throw new Error( 88 `Budget exceeded: need $${apiCost} but only $${remaining} remaining` 89 ); 90 } 91} 92 93main().catch((err) => { 94 console.error(err); 95 process.exitCode = 1; 96});

Best Practices

  • Set budgets before delegation: When spawning sub-agents, attach a SpendingPolicy via your orchestration layer. Never give an agent unlimited spend.
  • Pin your dependencies: Always specify an exact version in your MCP config (e.g., agentwallet-sdk@6.0.0). Verify package integrity before deploying to production.
  • Audit trails: Use list_transactions in post-task hooks to log what was spent and why.
  • Fail closed: If the payment tool is unreachable, block the paid action — don't fall back to unmetered access.
  • Pair with security-review: Payment tools are high-privilege. Apply the same scrutiny as shell access.
  • Test with testnets first: Use Base Sepolia for development; switch to Base mainnet for production.

Production Reference

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is agent-payment-x402?

Ideal for Autonomous Agents requiring secure and controlled payment execution for APIs, services, or other agents. agent-payment-x402 is a skill that enables AI agents to make autonomous payments using the x402 protocol and MCP tools, providing per-task budgets, spending controls, and non-custodial wallets.

How do I install agent-payment-x402?

Run the command: npx killer-skills add affaan-m/everything-claude-code/agent-payment-x402. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for agent-payment-x402?

Key use cases include: Automating API payments with enforceable per-task budgets, Settling transactions with other agents using non-custodial wallets, Enforcing spending limits and rate limits for agent actions, Managing allowlisted recipients for secure payment transactions, Auditing payment trails with list_transactions tool.

Which IDEs are compatible with agent-payment-x402?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for agent-payment-x402?

Requires MCP integration and agentwallet-sdk package. Needs orchestrator setup for spending policy configuration. Must pin package version to prevent supply-chain risk.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add affaan-m/everything-claude-code/agent-payment-x402. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use agent-payment-x402 immediately in the current project.

Related Skills

Looking for an alternative to agent-payment-x402 or another official skill for your workflow? Explore these related open-source skills.

View All

flags

Logo of facebook
facebook

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

243.6k
0
Developer

extract-errors

Logo of facebook
facebook

Use when adding new error messages to React, or seeing unknown error code warnings.

243.6k
0
Developer

fix

Logo of facebook
facebook

Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.

243.6k
0
Developer

flow

Logo of facebook
facebook

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

243.6k
0
Developer