solana-foundation/pay

CLI for Agentic payments (x402, MPP, AP2).

What it solves

It provides a payment layer for HTTP that allows users and AI agents to pay for API access using stablecoins on the Solana blockchain. It specifically solves the problem of handling "402 Payment Required" HTTP responses, automating the payment challenge-response cycle so that requests can proceed without manual payment setup for every API.

How it works

pay acts as a wrapper for CLI tools (like curl) or AI agents (like Claude Code or Codex). When an API returns a 402 error, the tool detects the payment protocol (MPP or x402), prepares a stablecoin transaction, and requests authorization from a local wallet. Once the user signs the transaction via biometrics (Touch ID, Windows Hello, etc.) or a backend wallet, the payment proof is sent back to the API to complete the request.

Who it’s for

  • Developers who want to integrate paid APIs into their CLI workflows.
  • AI Agent operators who need their agents to make paid API calls without sharing private keys or granting unlimited spending credentials.
  • API providers who want to implement standardized machine-to-machine payment protocols.

Highlights

  • AI-Native Integration: Includes a built-in Model Context Protocol (MCP) server to let AI assistants request paid API calls.
  • Biometric Security: Uses local OS authentication (Touch ID, Windows Hello, GNOME Keyring) to authorize payments.
  • Protocol Support: Supports both the Machine Payments Protocol (MPP) and the x402 Payment Protocol.
  • Permission Control: Allows unattended agents to operate under strict YAML-defined payment permissions (e.g., max payment limits and allowed origins).
  • Debugging Tools: Features an embedded local web UI to visualize payment challenge-response cycles as sequence diagrams.

Related