Skip to content

solana-foundation/pay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

826 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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://402-demo-api.vercel.app/mpp/quote/AAPL

# With pay — it handles the 402 and you get the response
pay --dev curl https://402-demo-api.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 & 1Password Key Storage

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

  • macOS Keychain with Touch ID biometric protection
  • 1Password vault integration (cross-platform)
  • File-based fallback for CI and scripting
pay setup --backend keychain    # Touch ID protected
pay setup --backend 1password   # Cross-platform vault

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 --dev claude
pay --dev codex

Dev Mode

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

# Uses public devnet (402.surfnet.dev) by default
pay --dev curl https://402-demo-api.vercel.app/mpp/quote/AAPL

# Or use a local Surfpool instance
pay --dev --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

Verify

pay --version

Quick Start

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

# 2. Make a paid API call (--dev uses an ephemeral funded keypair)
pay --dev curl https://402-demo-api.vercel.app/

# 3. Or let your AI agent handle it
pay --dev 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

A new standard for decentralized payments.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors