An open API service indexing awesome lists of open source software.

https://github.com/solana-foundation/pay

Developer Tool for Programmable Money Payments
https://github.com/solana-foundation/pay

Last synced: about 1 month ago
JSON representation

Developer Tool for Programmable Money Payments

Awesome Lists containing this project

README

          

# pay

**The missing payment layer for HTTP. `pay` handles x402 and MPP payment challenges with user-authorized stablecoin signing.**

Wrap your CLI (`curl`, `claude`, `codex`, etc.) -- when a stablecoin-gated API returns 402, `pay` detects the payment protocol, prepares the stablecoin transaction, asks the local wallet to authorize and sign it, then retries with the payment proof.

[Install](#installation) Β· [Quick Start](#quick-start) Β· [Docs](https://docs.solanapay.com)

---

```sh
# Without pay β€” you get a 402
curl https://debugger.pay.sh/mpp/quote/AAPL

# With pay -- it handles the 402 challenge and returns the response
pay --sandbox curl https://debugger.pay.sh/mpp/quote/AAPL
```

## Key Features

### πŸ’΅ Transparent 402 Handling

Wrap your CLI (`curl`, `claude`, `codex`, etc.) -- when an API returns 402, `pay` detects the payment protocol, prepares the stablecoin transaction, asks the local wallet to authorize and sign it, then retries with the payment proof.

Supports both live payment standards on Solana:
- **[MPP](https://paymentauth.org/draft-solana-charge-00.html/)** β€” Machine Payments Protocol
- **[x402](https://x402.org/)** β€” x402 Payment Protocol

Stablecoins deployed to Solana are supported out of the box.

### πŸ—ΊοΈ Skills β€” Discover Paid APIs

Browse, search, and install catalogs of paid API providers directly from the CLI.

```sh
pay skills search "gemini" # find providers by keyword
pay skills endpoints stableenrich # list all endpoints for a service
pay skills add org/catalog # add a provider source (GitHub or URL)
pay skills update # refresh the local cache
```

### πŸ€– AI-Native with MCP

`pay` ships with a built-in [MCP](https://modelcontextprotocol.io/) server, letting AI assistants request paid API calls through the same local wallet-approval flow.

```sh
# Run Claude Code or Codex with pay injected into the agent session
pay --sandbox claude
pay --sandbox codex
```

### πŸ› οΈ Payment debugging and simulations

`pay` ships with an embedded Payment Debugger β€” a local web UI that visualizes every 402 challenge-response cycle as a sequence diagram. See exactly which headers were sent, which protocol was used (MPP or x402), and where things went wrong.

Everything runs locally β€” no data leaves your machine.

```sh
# Start a gateway with the debugger on any API spec
pay server start --debugger spec.yml

# Or run the bundled demo (sandbox + debugger + sample endpoints)
pay server demo
```

A [public debugger](https://debugger.pay.sh) is also available.

### πŸ” Secure Key Storage

Your keys never touch disk in plaintext. `pay` stores keypairs in secure local credential stores:

- **macOS Keychain** with optional Touch ID biometric prompt (macOS)
- **Windows Credential Manager** with optional Windows Hello prompt (Windows)
- **GNOME Keyring** via Secret Service / polkit prompt (Linux)
- **1Password** vault via `op` CLI β€” auth handled by 1Password itself (cross-platform)
- **File-based** keypair for CI and scripting

For protected accounts, payment signing requires local user approval, such as Touch ID on macOS. The biometric/password prompt is controlled per-account by the `auth_required` setting -- defaults to `true` on mainnet, `false` elsewhere.

```sh
pay setup # Touch ID on macOS, Windows Hello on Windows, GNOME Keyring on Linux, or choose 1Password
```

## Installation

### Prebuilt Binaries

```sh
brew install pay
```

### From Source

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

### Verify

```sh
pay --version
```

## Quick Start

```sh
# 1. Generate a keypair (Touch ID protected on macOS)
pay setup

# 2. Make a paid API call (--sandbox uses an ephemeral funded keypair)
pay --sandbox curl https://debugger.pay.sh/mpp/quote/AAPL

# 3. Or let your AI agent handle it
pay --sandbox claude
```

## Contributing

```sh
cd rust
just build # release binary
just test # all tests
just lint # clippy (warnings = errors)
```

We welcome contributions β€” check [open issues](https://github.com/solana-foundation/pay/issues) to get started.

## Troubleshooting

### Linux: `pay topup` or `pay curl` errors with "auth failed"

GNOME Keyring auth uses polkit, which requires a one-time setup step:

```sh
sudo cp rust/config/polkit/sh.pay.unlock-keypair.policy /usr/share/polkit-1/actions/
```

This grants `pay` the right to prompt for your password or fingerprint before accessing the keypair.

## License

MIT β€” see [LICENSE](./LICENSE).

Subject to the foregoing, the Terms of Service available at [solana.com/tos](https://solana.com/tos)