Solana X402 payment protocol that enables fast, secure, and low-cost on-chain payments.
Solana-X402-Payment-Protocol is an early-stage Rust project in the AI payments / x402 ecosystem, focused on payment, x402. It currently has 1 GitHub stars and 2 forks, and sits alongside related tools like internet-court-skill, ProwlFi, aixyz.
A simple, secure payment protocol smart contract on Solana blockchain for handling escrow payments and transfers.
npm install
cargo build-bpf
# Configure Solana CLI
solana config set --url https://api.devnet.solana.com
# Airdrop SOL
solana airdrop 2
# Deploy
solana program deploy target/deploy/solana_x402_payment_protocol.so
Replace YOUR_PROGRAM_ID_HERE in client/example.ts with your deployed program ID.
npm run example
Requirements:
# Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
# Clone repository
git clone https://github.com/topsecretagent007/Solana-X402-Payment-Protocol.git
cd Solana-X402-Payment-Protocol
# Install dependencies
npm install
import { PaymentProtocolClient } from './client/payment-client';
import { Connection, Keypair, PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js';
const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
const programId = new PublicKey('YOUR_PROGRAM_ID');
const client = new PaymentProtocolClient(connection, programId);
// Initialize payment
await client.initializePayment(payer, recipient, 0.5 * LAMPORTS_PER_SOL, 'PAYMENT-001');
// Complete payment
await client.completePayment(payer, recipient, 'PAYMENT-001');
// Cancel payment
await client.cancelPayment(payer, 'PAYMENT-001');
// Get payment info
const payment = await client.getPayment(payer.publicKey, 'PAYMENT-001');
| Method | Description |
|---|---|
initializePayment(payer, recipient, amount, paymentId) |
Create a new payment |
completePayment(payer, recipient, paymentId) |
Complete and transfer funds |
cancelPayment(payer, paymentId) |
Cancel a pending payment |
getPayment(payer, paymentId) |
Get payment details |
paymentExists(payer, paymentId) |
Check if payment exists |
getPaymentStatus(payer, paymentId) |
Get payment status |
| Status | Value | Description |
|---|---|---|
| Pending | 0 | Payment created, waiting for action |
| Completed | 1 | Funds transferred to recipient |
| Cancelled | 2 | Payment cancelled, no transfer |
# Run tests
cargo test-bpf
# Build for production
cargo build-bpf --release
# Run example
npm run example
# Compile TypeScript
npm run compile
⚠️ Important: This is for educational purposes. Before production:
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
The world's first privacy layer for AI agents on Solana — stealth addresses + x402 payments. Every payment lands at a fresh, unlinkable address.
Next.js-like framework building AI Agents that are payment-native. Bootstrap your agent with A2A, MCP, x402 payments, and ERC-8004 identity.
Agent behavior that compiles
An open SDK for agentic payments. Let AI agents make payments, hold funds, and move money across chains with policy enforcement and human approval built in.
x402 payments in Rust: verify, settle, and monitor payments over HTTP 402 flows
Context-aware agentic LLM gateway & router that optimize your agentic workflows with every runs, works with any harnesses, any models, any workflows.
Production-ready x402 facilitator server.
Rust SDK for the x402 payment protocol.