Skip to content
 
 

Latest commit

 

History

838 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pay

The missing HTTP 402 client.

Wrap curl or wget — when an API returns 402, pay detects the payment protocol, signs a transaction, and retries. The response lands on stdout as if nothing happened.

Install · Quick Start · Docs


# Without pay — you get a 402
curl https://payment-debugger.vercel.app/mpp/quote/AAPL

# With pay — it handles the 402 and you get the response
pay --sandbox curl https://payment-debugger.vercel.app/mpp/quote/AAPL

Key Features

Transparent 402 Handling

Wrap curl or wget — when an API returns 402, pay detects the payment protocol, signs the transaction, and retries. You get the response body. That's it.

Supports both live payment standards on Solana:

  • MPP — Machine Payments Protocol
  • x402 — x402 Payment Protocol

Stablecoins deployed to Solana are supported out of the box.

Touch ID, GNOME Keyring & 1Password Key Storage

Your keys never touch disk in plaintext. pay stores keypairs in:

  • macOS Keychain with Touch ID biometric protection
  • GNOME Keyring with password/fingerprint prompt on every use (Linux)
  • 1Password vault integration (cross-platform)
  • File-based fallback for CI and scripting
pay setup    # Touch ID on macOS, GNOME Keyring on Linux, or choose 1Password

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

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. Without it, pay topup and pay curl will error.

Session Budgets via TUI

Set a spending cap and expiration before making requests. The interactive TUI lets you control exactly how much you're willing to spend per session — no surprise charges.

AI-Native with MCP

pay ships with a built-in MCP server, giving AI assistants the ability to make paid API calls on your behalf.

# Run Claude Code or Codex with pay injected automatically
pay --sandbox claude
pay --sandbox codex

Sandbox Mode

Get started instantly with an ephemeral keypair auto-funded via Surfpool. No setup, no mainnet tokens needed.

# Uses public sandbox (402.surfnet.dev)
pay --sandbox curl https://payment-debugger.vercel.app/mpp/quote/AAPL

# Or use a local Surfpool instance (localhost:8899)
pay --local curl http://localhost:3402/mpp/quote/AAPL

Installation

From Source

git clone https://github.com/solana-foundation/pay.git
cd pay/rust
cargo install --path crates/cli

Linux only — install the polkit action to enable keypair auth:

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

Verify

pay --version

Quick Start

# 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://payment-debugger.vercel.app/mpp/quote/AAPL

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

Contributing

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

We welcome contributions — check open issues to get started.

License

Apache-2.0 — see LICENSE.

About

Developer Tool for Programmable Money Payments

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages