# Agent payment x402

> Agent payment x402 is an open-source agent skill for finance and payments. Lets an AI agent make x402 payments within per-task budgets and spending policies. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/agent-payment-x402
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 66
- **License:** MIT
- **Skill name:** agent-payment-x402
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [finance and payments](https://ai-powered.com/categories/finance-and-payments)
- **Listing updated:** 2026-12-01

## About

This skill guides an agent toward paying for HTTP 402-gated APIs and services without a custodial wallet. It lays out which integration path fits the target network: an MCP payment server backed by agentwallet-sdk for Base, OKX Agent Payments Protocol for X Layer, or upstream x402 client packages for Solana and EVM networks. It also covers the seller side, where an API charges agents using upstream middleware for Express, Hono, Next.js, Fastify, FastAPI or Go.

The guidance centers on spending controls. Budgets, allowlisted recipients and rate limits are set by the orchestrator before delegation, and the agent's payment calls are expected to fail closed if the budget check cannot run. The examples validate the server's payment requirements against network, asset, recipient and amount limits before any signature is created, and they require explicit user confirmation before paid requests are made.

It also includes operational notes for sellers, such as checking that a Solana recipient's associated token account exists and guarding payment authorizations against replay with a shared claim store. Expect to supply your own wallet keys, RPC access, a facilitator choice and a Redis or similar store for replay protection. Package versions are pinned in the examples.

## When your agent uses it

> Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk, X Layer through OKX Payments / OKX Agent Payments Protocol, and Solana plus multi-network EVM through the upstream x402 packages with facilitator-based settlement. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/agent-payment-x402)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/agent-payment-x402)

## Features

- **Per-task and session budgets:** Caps spending per agent action and across a whole session, enforced before any payment is signed.
- **Non-custodial wallet setup:** Describes keeping signing keys with the orchestrator and holding funds in the agent's own accounts.
- **Multi-network buyer client:** Shows wrapping an HTTP client so it pays x402 challenges on Base, Solana and other EVM networks.
- **Payment requirement filtering:** Filters server challenges by network, token, recipient and amount so out-of-policy requests are refused.
- **Seller replay protection:** Explains claiming each payment authorization once so a handler does not run repeatedly for one payment.
- **Facilitator selection guidance:** Compares self-hosted, testnet and hosted facilitators for settlement and notes their mainnet limits.

## Good for

- Let my agent pay per call for a paid data API within a fixed daily budget
- Set up an MCP payment server so an agent can check its balance and send payments
- Charge agents per request for my Express endpoint using x402 middleware
- Check that a Solana recipient has the USDC token account needed to receive x402 payments
- Audit what an agent spent during a task using a transaction list

## Install

### Claude Code

This skill ships in the `rea-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath
```

Or copy only this skill to `~/.claude/skills/agent-payment-x402`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/agent-payment-x402 &&
cp -R "$tmp/.agents/skills/agent-payment-x402" ~/.claude/skills/agent-payment-x402 &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/agent-payment-x402` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/agent-payment-x402` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/agent-payment-x402 &&
cp -R "$tmp/.agents/skills/agent-payment-x402" ~/.agents/skills/agent-payment-x402 &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/agent-payment-x402` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/agent-payment-x402` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/agent-payment-x402 &&
cp -R "$tmp/.agents/skills/agent-payment-x402" ~/.cursor/skills/agent-payment-x402 &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/agent-payment-x402` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/agent-payment-x402
```

Or copy the folder to `~/.gemini/skills/agent-payment-x402` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/agent-payment-x402`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/agent-payment-x402 &&
cp -R "$tmp/.agents/skills/agent-payment-x402" ~/.copilot/skills/agent-payment-x402 &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/agent-payment-x402` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git
```

Then copy `REA_Skill/.agents/skills/agent-payment-x402` into your agent's skills folder as `agent-payment-x402`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does the skill include scripts I can run directly?

No, the skill has no scripts. It contains instructions and code examples that you adapt into your own project.

### Which networks does Agent payment x402 cover?

It covers Base through agentwallet-sdk, X Layer through OKX Payments, and Solana plus EVM networks through the upstream x402 packages. Coverage of each facilitator should be confirmed before production use.

### Can the agent raise its own spending limit?

The skill says no. The orchestrator sets the policy before delegation, and the policy is not exposed as a tool the agent can call.

### Which package versions does Agent payment x402 use?

It pins versions such as agentwallet-sdk@6.0.0 and @x402/fetch@2.22.0 and recommends pinning in production.

### How do I install Agent payment x402 in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/agent-payment-x402 to use it in all your projects, or to .claude/skills/agent-payment-x402 in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

### Does Agent payment x402 run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Agent payment x402?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Agent payment x402?

The closest alternatives to Agent payment x402 are Accept agent payments, Pay via agent wallet, Agent wallet policy, Trust wallet MCP and Use agent wallet.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Accept agent payments](https://ai-powered.com/skills/accept-agent-payments): Accept agent payments is an open-source agent skill for finance and payments.
- [Pay via agent wallet](https://ai-powered.com/skills/pay-via-agent-wallet): Pay via agent wallet is an open-source agent skill for finance and payments.
- [Agent wallet policy](https://ai-powered.com/skills/agent-wallet-policy): Agent wallet policy is an open-source agent skill for finance and payments.
- [Trust wallet MCP](https://ai-powered.com/skills/trust-wallet-mcp): Trust wallet MCP is an open-source agent skill for finance and payments.
- [Use agent wallet](https://ai-powered.com/skills/use-agent-wallet): Use agent wallet is an open-source agent skill for finance and payments.
- [Fund agent wallet](https://ai-powered.com/skills/fund-agent-wallet): Fund agent wallet is an open-source agent skill for finance and payments.
- [Use developer controlled wallets](https://ai-powered.com/skills/use-developer-controlled-wallets): Use developer controlled wallets is an open-source agent skill for finance and payments.
- [Tinyplace agent](https://ai-powered.com/skills/tinyplace-agent): Tinyplace agent is an open-source agent skill for finance and payments.

---
Source: https://ai-powered.com/skills/agent-payment-x402
