Forkable x402 facilitator and server for receiving CASH payments on Solana
x402-cash-facilitator is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 1 GitHub stars and 0 forks.
A forkable code sample for x402 facilitators to receive CASH payments on Solana.
This project includes:
PAYMENT-SIGNATURE headerCASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH)# Clone the repo
git clone <your-fork-url>
cd x402-cash-facilitator
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your wallet keys and addresses
# Run both facilitator + server
npm run dev
# Start the facilitator (port 4402)
npm run dev:facilitator
# Start the API server (port 3000)
npm run dev:server
Copy .env.example to .env and fill in:
| Variable | Description |
|---|---|
SOLANA_RPC_URL |
Solana RPC endpoint (default: devnet) |
SOLANA_NETWORK |
solana-devnet or solana for mainnet |
FACILITATOR_PRIVATE_KEY |
Base58 private key for the facilitator wallet (pays gas) |
RESOURCE_WALLET_ADDRESS |
Wallet address that receives CASH payments |
FACILITATOR_PORT |
Facilitator service port (default: 4402) |
SERVER_PORT |
API server port (default: 3000) |
CASH_MINT |
CASH token mint address |
PAYMENT_AMOUNT |
Price per request in atomic units (1000000 = 1 CASH) |
| Method | Path | Auth | Description |
|---|---|---|---|
GET |
/api/health |
None | Health check |
GET |
/api/premium-data |
CASH payment | Returns premium data after payment |
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/fee-payer |
Returns the facilitator's fee payer address |
POST |
/verify |
Verify a CASH payment transaction |
POST |
/settle |
Settle a payment on-chain |
# Check the server is running
curl http://localhost:3000/api/health
# Hit the protected endpoint (returns 402 with payment requirements)
curl -i http://localhost:3000/api/premium-data
To make a paid request, use an x402 client that handles the 402 flow automatically:
import { createX402Client } from "x402-solana";
const client = createX402Client({
wallet: yourWalletAdapter,
network: "solana-devnet",
});
const response = await client.fetch("http://localhost:3000/api/premium-data");
const data = await response.json();
Production-ready x402 facilitator server.
Rust SDK for the x402 payment protocol.
Accept payments from AI agents. Open-source. Your data, your domain, your rules. Free forever.
A production-ready payment settlement service for the x402 protocol. Built with Elysia and Node.js, it verifies cryptographic payment signatures and settles transactions on-chain for EVM, SVM (Solana), and Starknet networks.
Golang implementation of an x402 payment facilitator
x402 payment facilitator — verifies and settles EIP-3009 USDC micropayments on Base, Arbitrum, and Ethereum.