OpenPay - x402 Protocol
OPNx402
Self-hosted Facilitator for x402 on Solana
Overview
MIT Licensed
Open-source, MIT-licensed facilitator implementing the x402 payment protocol on Solana, built as a Next.js Edge API for speed, scale, and easy deploys.
OPNx402 is a clean production-ready facilitator that exposes the core x402 operations (health, supported, verify, settle) over HTTP. It is designed for self-hosting and integrates cleanly with apps that speak x402 on Solana.
Integrate
Integrate with our hosted x402 facilitator endpoint to start accepting payments without self-hosting:
Facilitator Endpoint
https://x402.openpay.networkUse this endpoint in your x402-compatible application to handle payment verification and settlement through our managed infrastructure.
Features
- Edge Runtime: Runs on Next.js Edge for low-latency, global performance
- x402 on Solana: Implements the facilitator flow for Solana payments
- TypeScript-first: Strong types and clear error responses
- CORS controls: Restrict origins via environment configuration
- Production ready: Clear deploy path on Vercel or any Node/Edge host
- MIT Licensed: Fully open-source for commercial and personal use
Quick Start
1. Install dependencies:
npm install2. Create .env.local:
SOLANA_PRIVATE_KEY=your_solana_private_key_here
FACILITATOR_NETWORKS=devnet,mainnet-beta
ALLOWED_ORIGINS=https://yourdomain.com,http://localhost:30003. Run locally:
npm run dev4. Build & start:
npm run build
npm startAPI Endpoints
All endpoints are served under /api.
Health
GET /api/health
Returns service status and supported networks
Supported Payment Kinds
GET /api/supported
Returns available payment kinds and fee payer data
Verify
POST /api/verify
Validates a proposed payment payload against facilitator requirements
Request body example:
{
"paymentPayload": { "...": "..." },
"paymentRequirements": { "...": "..." }
}Settle
POST /api/settle
Settles a previously verified transaction
Request body example:
{
"paymentPayload": { "...": "..." },
"paymentRequirements": { "...": "..." }
}Security
- Store SOLANA_PRIVATE_KEY securely (Vercel/hosted secrets)
- Set strict ALLOWED_ORIGINS for CORS
- Enforce HTTPS in production
- Add observability and rate limiting as needed
License
MIT © OpenPay — see LICENSE for details.