The simplest way to monetize your APIs using the x402 protocol on Solana. Zero fees, instant settlements, one line of code.
Contract Address (CA): FDgSegoxrdpsct21YVeAbC9dWeTwTxA8Cceeh8BPpump
Payless is a serverless payment platform built on the x402 protocol. It lets developers monetize any API with crypto payments in minutesโno accounts, no subscriptions, no complexity.
๐ Multi-Chain Support: Solana, BSC (Binance Smart Chain), Ethereum, with Polygon coming soon!
Perfect for:
- ๐ค AI Agent APIs - Let agents pay for your services autonomously
- ๐ฐ Micropayments - Accept payments as low as $0.01
- โก Instant Settlement - Money in your wallet in 2 seconds
- ๐ Serverless APIs - Deploy anywhere (Vercel, AWS, Netlify)
- ๐ Multi-Chain - Users choose their preferred blockchain
- ๐ฐ Zero Protocol Fees - Keep 100% of your revenue
- โก Instant Settlement - Money in your wallet in 2 seconds
- ๐ Privacy First - No accounts, emails, or OAuth required
- ๐ Multi-Chain Support - Solana + BSC + Ethereum (Polygon coming soon!)
- ๐ Serverless Ready - Deploy to Vercel, Netlify, or AWS Lambda
- ๐ค Perfect for AI Agents - Autonomous payments without human intervention
- ๐ Built-in Analytics - Track payments, revenue, and API usage
- ๐ Webhook Support - Real-time payment notifications
- Node.js 18+ installed
- Wallet addresses for supported chains:
- Solana: Phantom, Solflare, etc.
- BSC: MetaMask, Trust Wallet, Binance Wallet
- Ethereum: MetaMask, Coinbase Wallet, etc.
- (Optional) x402 facilitator endpoint
- Clone the repository
git clone https://github.com/Payless2025/PayLess.git
cd payless- Install dependencies
npm install- Configure environment variables
cp .env.example .envEdit .env and add your Solana wallet address:
# Solana wallet address (base58 format)
WALLET_ADDRESS=YourSolanaWalletAddressHere1111111111111111
FACILITATOR_URL=https://facilitator.x402.org
NETWORK=mainnet-beta
RPC_URL=https://api.mainnet-beta.solana.com
USDC_MINT=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
# Enable demo payments (set to 'true' for playground/testing)
ENABLE_DEMO_PAYMENTS=true- Run development server
npm run dev- Open your browser
http://localhost:3000
It's as simple as wrapping your handler with withX402Payment:
import { NextRequest, NextResponse } from 'next/server';
import { withX402Payment } from '@/lib/x402/middleware';
async function handler(req: NextRequest) {
// Your API logic here
const result = await yourBusinessLogic(req);
return NextResponse.json({ result });
}
// Add payment requirement - that's it!
export const POST = withX402Payment(handler, "0.01");Edit lib/x402/config.ts:
export const ENDPOINT_PRICING: EndpointConfig = {
'/api/ai/chat': '0.05', // $0.05 per request
'/api/ai/image': '0.10', // $0.10 per request
'/api/data/weather': '0.01', // $0.01 per request
'/api/your-endpoint': '0.25', // Add your custom pricing
};import { makePaymentRequest } from '@/lib/x402/client';
// The SDK handles payment automatically
const response = await makePaymentRequest(
'/api/ai/chat',
{
method: 'POST',
body: JSON.stringify({ message: 'Hello!' })
},
walletAddress, // Your wallet
recipientAddress, // Merchant wallet
'0.05' // Payment amount
);
const data = await response.json();
console.log(data);payless/
โโโ app/
โ โโโ api/ # API endpoints with x402 payment
โ โ โโโ ai/
โ โ โ โโโ chat/ # AI chat endpoint ($0.05)
โ โ โ โโโ image/ # AI image generation ($0.10)
โ โ โโโ data/
โ โ โ โโโ weather/ # Weather data ($0.01)
โ โ โ โโโ stock/ # Stock data ($0.02)
โ โ โโโ premium/
โ โ โ โโโ content/ # Premium content ($1.00)
โ โ โโโ health/ # Health check (free)
โ โ โโโ info/ # API info (free)
โ โโโ playground/ # Interactive API playground
โ โโโ globals.css # Global styles
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Landing page
โโโ components/ # React components
โ โโโ Hero.tsx # Hero section
โ โโโ Features.tsx # Features grid
โ โโโ CodeExample.tsx # Code examples
โ โโโ UseCases.tsx # Use case cards
โ โโโ Footer.tsx # Footer
โโโ lib/
โ โโโ x402/ # x402 protocol implementation
โ โโโ types.ts # TypeScript types
โ โโโ config.ts # Configuration
โ โโโ middleware.ts # Payment middleware
โ โโโ client.ts # Client utilities
โโโ package.json
โโโ tsconfig.json
โโโ tailwind.config.js
โโโ next.config.js
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/info |
GET | API information and pricing |
| Endpoint | Method | Price | Description |
|---|---|---|---|
/api/ai/chat |
POST | $0.05 | AI chat completion |
/api/ai/image |
POST | $0.10 | AI image generation |
/api/data/weather |
GET | $0.01 | Weather data |
/api/data/stock |
GET | $0.02 | Stock market data |
/api/premium/content |
GET | $1.00 | Premium content access |
Visit /playground to test all endpoints interactively:
npm run dev
# Open http://localhost:3000/playgroundThe playground allows you to:
- Test all API endpoints
- See payment flow in action (demo mode)
- Inspect request/response payloads
- Understand x402 protocol behavior
- Push to GitHub
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/yourusername/payless.git
git push -u origin main- Deploy to Vercel
npm install -g vercel
vercel- Set environment variables in Vercel Dashboard
WALLET_ADDRESS- Your Solana wallet addressFACILITATOR_URL- Facilitator endpointNETWORK- Solana network (mainnet-beta, devnet)RPC_URL- Solana RPC endpointUSDC_MINT- USDC SPL token mint address
npm install -g netlify-cli
netlify deploy --prodUse Serverless Framework or AWS SAM.
- Enable real facilitator verification (not demo mode)
- Set up proper RPC endpoints for your network
- Implement rate limiting
- Add request validation
- Set up monitoring and logging
- Use HTTPS only
- Implement webhook verification for payment confirmations
- Add CORS restrictions
- Enable API key authentication for sensitive endpoints (optional)
Never commit these to version control:
WALLET_ADDRESS- Keep privateRPC_URL- Use secure providers- Private keys should NEVER be in your code
- Ethereum Support - How to accept Ethereum payments
- Webhooks - Real-time payment notifications
- Multi-Chain Guide - Complete multi-chain integration
- API Configuration - Configure your API
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub Issues: Report a bug
- Documentation: Read the docs
- Community: Join Discord
- Built with x402 Protocol
- Powered by Next.js
- Styled with Tailwind CSS
- Icons by Lucide
| Feature | What You Get |
|---|---|
| โก Lightning Setup | One line of code, < 5 minutes to production |
| ๐ฏ Keep 100% | Zero protocol fees. Every dollar is yours |
| ๐ True Serverless | Deploy anywhere - Vercel, AWS, Netlify |
| ๐ Fully Open Source | MIT license. Fork, modify, own it |
| ๐ฏ Any Use Case | Monetize any API or service, no restrictions |
| ๐ Built-in Playground | Test all endpoints without writing code |
| ๐ Privacy First | No accounts, emails, or OAuth required |
| ๐ค AI Agent Ready | Perfect for autonomous payments |
| ๐ต True Micropayments | Accept payments as low as $0.01 USDC |
| โก Instant Settlement | Money in your wallet in 2 seconds |
The simplest, most developer-friendly way to monetize APIs with crypto. Zero fees, zero complexity, zero compromises.
Built with โค๏ธ by the Payless Team
๐ GitHub | ๐ฆ X/Twitter | ๐ Documentation
โญ Star this repo if you find it useful!