// The developer toolkit for payment-gated APIs on Aptos
> Scaffold. Configure. Deploy. Earn.
// FEATURES
> What you get
Pay-Per-Request APIs
Gate any API endpoint behind USDC micropayments. No subscriptions, no API keys, no middlemen.
CLI Toolkit
Scaffold, inspect, and pay x402 endpoints from your terminal. One command to start building.
Aptos + USDC
Low-fee, high-speed payments on Aptos blockchain. USDC stablecoin for predictable pricing.
Instant Scaffolding
npx buildx402 my-app creates a production-ready Next.js app with payment middleware wired up.
Wallet Generation
Generate Aptos Ed25519 wallets from the CLI. No external tools or browser extensions needed.
Endpoint Inspection
Probe any x402 endpoint to see payment requirements, pricing, and network details before paying.
// HOW_IT_WORKS
> Four steps to earning
$ npx buildx402 my-app
> Scaffolds a Next.js project with x402 payment middleware pre-configured.
$ npx buildx402 wallet create
> Generates an Aptos Ed25519 wallet. Fund it with testnet USDC via the faucet.
$ vercel deploy
> Ship to production. Your API endpoints are now payment-gated.
$ npx buildx402 inspect <url>
> Every request pays you USDC. Inspect and monitor endpoints in real time.
// CODE_EXAMPLE
> It's just middleware
Any route you build becomes a paid endpoint. Add it to the config, set your price, and the middleware handles the rest — payment verification, 402 responses, and USDC collection. No payment logic in your API code.
// middleware.ts — gate any route, set any priceimport { paymentProxy } from "@rvk_rishikesh/next";const paymentRoutes = {// A fortune endpoint — 0.01 USDC per request"api/fortune": {accepts: [{ scheme: "exact", price: "0.01", ...opts }],},// A premium data feed — 0.50 USDC per request"api/data": {accepts: [{ scheme: "exact", price: "0.50", ...opts }],},// An AI inference endpoint — 1.00 USDC per call"api/generate": {accepts: [{ scheme: "exact", price: "1.00", ...opts }],},};// That's it. The middleware intercepts requests,// returns 402 until paid, then forwards to your API.export async function middleware(request) {return await proxy(request);}
> Your API routes stay clean — just return data.
> The middleware handles 402 negotiation, payment verification, and USDC settlement.
> Add a route. Set a price. Ship it.
// CLI_DEMO