# Install

> Install the pay CLI, set up a wallet, and wire it into your AI agent.

`pay` ships as a single native binary. Pick the install path that matches your environment, then run `pay --version` to confirm.

| Resource        | Link                                                                            |
| --------------- | ------------------------------------------------------------------------------- |
| Source          | [solana-foundation/pay](https://github.com/solana-foundation/pay)               |
| Skills registry | [solana-foundation/pay-skills](https://github.com/solana-foundation/pay-skills) |
| x402 spec       | [x402.org](https://x402.org)                                                    |
| MPP spec        | [paymentauth.org](https://paymentauth.org)                                      |

## Homebrew (macOS, Linux)

```sh
brew install pay
pay --version
```

## npm / npx

The npm package downloads the right native binary for your platform and caches it under `node_modules/@solana/pay/bin/`.

```sh
npm install -g @solana/pay
pay --version
```

Skip the global install with `npx` when you want a one-shot call:

```sh
npx @solana/pay --sandbox curl https://payment-debugger.vercel.app/mpp/quote/AAPL
npx @solana/pay claude "buy me some flowers"
```

## From source

```sh
git clone https://github.com/solana-foundation/pay.git
cd pay
just install pay
pay --version
```

## First paid call

The sandbox flag generates and funds an ephemeral wallet on first use. You don't need a real account to follow along.

```sh
pay --sandbox curl https://payment-debugger.vercel.app/mpp/quote/AAPL
```

See [Global flags](/docs/toolchain/global-flags) for the difference between `--sandbox`, `--local`, and `--mainnet`.

## Wallet setup

Payment-bearing commands on mainnet (`pay curl`, `pay claude`, `pay topup`, …) auto-run `pay setup` the first time they don't find a mainnet account, so the typical path is install → first command → guided setup → done.

To set up explicitly:

```sh
pay setup
pay topup
```

`pay setup` generates a keypair, stores it in the OS secure store (Apple Keychain on macOS, GNOME Secret Service on Linux, Windows Hello on Windows), and installs MCP configuration for any detected agent client. `pay topup` opens the funding TUI — Solana Pay QR or onramp via PayPal/Venmo/Apple Pay.

See [Configuration](/docs/toolchain/configuration) for the file layout and the [`pay setup`](/docs/toolchain/commands/accounts#pay-setup) reference for every flag.

## Refresh agent integration

When `pay` is already installed but the MCP config for a new agent needs to be re-emitted:

```sh
pay setup --update
```

`--update` reinstalls MCP configs and the agent skill without creating a new account.

## Verify

```sh
pay --version
pay whoami
```

`pay whoami` prints the system user, the active mainnet account, and its non-zero stablecoin balances. On a fresh sandbox-only setup, the account row is empty until you create one.
