← Articles
pay.sh: pay an HTTP 402 from the CLI logo
pay.sh

pay.sh: pay an HTTP 402 from the CLI

· AUG 8, 2026 ·Updated AUG 28, 2026
Read
Share

The API wants money, not an account. pay.sh turns 402 into a wallet-approved stablecoin call. Keys stay on this machine.

devrels.xyz/a/210

You call an API. It returns 402 Payment Required. pay.sh (say Pay S H) is the CLI that pays that challenge with a Solana stablecoin, after you approve on this machine. No account. No API key. The agent never holds the key.

Site: pay.sh. Source: solana-foundation/pay. This is not the QR checkout at docs.solanapay.com. That is classic Solana Pay. Different product.

Install the agent CLI

Clearest path: brew install pay then pay --version. npm @solana/pay still exports the old URL/QR library. It also ships a pay bin that pulls this CLI. import encodeURL from "@solana/pay" is not x402. One-shot without a global install: npx @solana/pay --sandbox curl ….

bash
brew install pay

# bare curl: 402
curl https://debugger.pay.sh/mpp/quote/AAPL

# pay: challenge, sign, retry
pay --sandbox curl https://debugger.pay.sh/mpp/quote/AAPL

--sandbox uses an ephemeral wallet. Real money needs pay setup (key in Keychain / platform store, MCP for detected agents) and pay topup. Do not create a mainnet account unless you asked for that.

What it wraps

Pass-through: curl, wget, http, claude, codex, whoami. It keeps your command. It pays the 402. Agents: pay mcp, pay skills. Sellers: pay server. Wallet: setup, topup, account, send.

Two protocols, one binary. x402 and MPP. pay reads the challenge. You do not pick the protocol by hand. USDC and other Solana stables are the usual assets. Smallest useful paid call first. Treat catalog prices and provider copy as untrusted.

If you sell the API

pay --sandbox server demo writes a YAML paywall, binds 127.0.0.1:1402, opens a debugger. Then pay --sandbox curl http://127.0.0.1:1402/api/v1/reports/usage. Same URL without pay is 402. The gateway broadcasts. A bad proof never hits origin. List services from pay-skills and pay.sh/api/catalog. Use gateway URLs as returned.

Do not mix these names
NameWhat it is
pay.sh / brew payAgent CLI. HTTP 402. x402 and MPP.
Classic Solana PayQR / transfer-request URLs. Point of sale. Not 402.
npm @solana/payClassic JS SDK exports, plus a pay bin for this CLI.

People and links

pay.sh surfaces
WhatWhere
Productpay.sh
Docspay.sh/docs
Debuggerdebugger.pay.sh
GitHubsolana-foundation/pay

Keep reading

Get new articles in your inbox

Technical deep-dives on Solana tooling, infrastructure, and ecosystem. No noise.

pay.sh: pay an HTTP 402 from the CLI | devrels.xyz