Skip to content

solana-foundation/pay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

814 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 Solana transaction, and retries. The response lands on stdout as if nothing happened.

Install · Quick Start · Docs


# Just like curl, but it handles 402s
pay --dev curl https://api.example.com/data

# Works with wget too
pay --dev wget https://api.example.com/report.csv

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

SOL and SPL tokens (USDC, USDT, etc.) 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 claude
pay codex

Dev Mode

Spin up a local environment with an ephemeral keypair auto-funded via Surfpool. No mainnet tokens needed.

pay --dev curl http://localhost:8080/data

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://api.example.com/data

# 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

Stars

Watchers

Forks

Packages