> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic Payments

> Infrastructure for AI agents that initiate, negotiate, and settle payments autonomously on Polygon.

Agentic payments are payments initiated and completed by autonomous software agents without human confirmation at each step. An agent can detect a payment requirement, authorize a transaction, and settle onchain in milliseconds, using predefined policies and earned balances.

Polygon provides three complementary components for agentic payment infrastructure:

<CardGroup cols={3}>
  <Card title="Polygon Agent CLI" icon="terminal" href="https://github.com/0xPolygon/polygon-agent-cli">
    End-to-end blockchain toolkit for AI agents. Wallets, token ops, swaps, onchain identity, and x402 payments in a single install.
  </Card>

  <Card title="x402 Protocol" icon="bolt" href="/payment-services/agentic-payments/x402/intro">
    HTTP-native micropayment protocol using the 402 status code. Agents pay per API call with no subscriptions required.
  </Card>

  <Card title="ERC-8004" icon="fingerprint" href="/payment-services/agentic-payments/agent-integration/erc8004">
    Onchain identity, reputation, and validation registries for autonomous agents.
  </Card>
</CardGroup>

***

## How agentic payments work

Instead of requiring a person to click "confirm", payments are executed via facilitated flows. An agent detects that an API call costs \$0.002 in USDC, confirms the payment requirement, and completes the transaction automatically, all within the HTTP request lifecycle.

This makes microtransactions, dynamic subscriptions, and per-use pricing viable for both human-facing apps and fully autonomous AI agents.

***

## Polygon Agent CLI

The Polygon Agent CLI gives AI agents everything they need to operate onchain: session-based smart contract wallets with scoped spending permissions, token operations (send, swap, bridge, deposit), ERC-8004 agent identity, and x402 micropayments. Private keys are encrypted at rest and never exposed to the agent's context.

**Install as an agent skill** (works with Claude Code, Codex, and any skills-protocol agent harness):

```bash theme={null}
npx skills add https://github.com/0xPolygon/polygon-agent-cli
```

**Or install directly:**

```bash theme={null}
npm install -g @polygonlabs/agent-cli
```

### Quickstart

```bash theme={null}
# 1. Create an EOA and get a project access key
polygon-agent setup --name "MyAgent"

# 2. Set your access key
export SEQUENCE_PROJECT_ACCESS_KEY=<access-key>

# 3. Create a wallet (opens browser for one-time approval)
polygon-agent wallet create

# 4. Fund the wallet
polygon-agent fund

# 5. Start operating
polygon-agent balances
polygon-agent send --symbol USDC --to 0x... --amount 10 --broadcast
polygon-agent swap --from USDC --to USDT --amount 5 --broadcast

# 6. Register your agent onchain
polygon-agent agent register --name "MyAgent" --broadcast
```

<Note>
  All commands are dry-run by default. Add `--broadcast` to execute.
</Note>

### What the CLI covers

| Capability                             | Commands                                               |
| -------------------------------------- | ------------------------------------------------------ |
| Session-based smart contract wallets   | `wallet create`, `wallet list`, `wallet address`       |
| Token balances and history             | `balances`                                             |
| Send, swap, bridge                     | `send`, `swap`, `fund`                                 |
| ERC-8004 agent identity and reputation | `agent register`, `agent reputation`, `agent feedback` |
| x402 micropayments                     | `x402-pay`                                             |

### Environment variables

One access key covers all three:

```bash theme={null}
export SEQUENCE_PROJECT_ACCESS_KEY=<access-key>
export SEQUENCE_INDEXER_ACCESS_KEY=$SEQUENCE_PROJECT_ACCESS_KEY
export TRAILS_API_KEY=$SEQUENCE_PROJECT_ACCESS_KEY
```

<CardGroup cols={2}>
  <Card title="GitHub: polygon-agent-cli" icon="github" href="https://github.com/0xPolygon/polygon-agent-cli">
    Full source, CLI reference, and contribution guide.
  </Card>

  <Card title="npm: @polygonlabs/agent-cli" icon="box" href="https://www.npmjs.com/package/@polygonlabs/agent-cli">
    Latest release and version history.
  </Card>
</CardGroup>

***

## x402 Protocol

x402 reuses the HTTP 402 Payment Required status code to gate API access behind onchain payments. Clients pay per request; no subscription or API key required. Polygon supports x402 on Mainnet and Amoy.

<CardGroup cols={2}>
  <Card title="Introduction" icon="book" href="/payment-services/agentic-payments/x402/intro">
    What x402 is and how Polygon's facilitators work.
  </Card>

  <Card title="Quickstart: Buyers" icon="arrow-right" href="/payment-services/agentic-payments/x402/guides/quickstart-buyers">
    Set up a wallet and make your first paid API request.
  </Card>

  <Card title="Quickstart: Sellers" icon="arrow-right" href="/payment-services/agentic-payments/x402/guides/quickstart-sellers">
    Gate an API endpoint behind x402 and accept micropayments.
  </Card>

  <Card title="How it works" icon="gear" href="/payment-services/agentic-payments/x402/guides/how-it-works">
    The full request/payment/response lifecycle.
  </Card>
</CardGroup>

### Tools

<CardGroup cols={2}>
  <Card title="x402 CLI" icon="terminal" href="/payment-services/agentic-payments/x402/tools/x402-cli">
    Command-line tool for testing x402-protected endpoints.
  </Card>

  <Card title="Autopay" icon="play" href="/payment-services/agentic-payments/x402/tools/autopay">
    Automate recurring payments to x402-gated APIs.
  </Card>
</CardGroup>

***

## ERC-8004

ERC-8004 defines an onchain trust layer for autonomous agents using three registries: Identity, Reputation, and Validation. It lets agents from different organizations discover and assess each other onchain.

<Card title="ERC-8004 on Polygon" icon="fingerprint" href="/payment-services/agentic-payments/agent-integration/erc8004">
  Contract deployments, read-only examples, and how ERC-8004 relates to A2A, MCP, and x402.
</Card>
