Getting Started
Get Soldi running on your site in under 10 minutes.
Prerequisites
- Node.js 20+
- A deployed website (Next.js, Express, or Hono)
Step 1: Sign up
Create your account at dashboard.soldi.dev. You'll get an API key during onboarding.
Step 2: Install
npm install @soldidev/middlewareStep 3: Add middleware
For Next.js, create middleware.ts in your project root:
import { createSoldi } from "@soldidev/middleware/next";
export const middleware = createSoldi({
apiKey: process.env.SOLDI_API_KEY!,
defaultPrice: 0.005,
});
export const config = {
matcher: ["/blog/:path*", "/premium/:path*"],
};Step 4: Set your API key
SOLDI_API_KEY=sk_live_your_key_hereStep 5: Deploy and test
Deploy your site, then go to your dashboard and click "Send test agent request" in Settings. If you see a 402 response, Soldi is working.
How it works
- An AI agent requests a page on your site
- Soldi detects it's an agent (not a human)
- Returns a
402 Payment Requiredresponse with payment options - Agent pays via x402 (USDC) or Stripe (card)
- Content is served. You earn money.
- Human visitors see your normal site — no paywall, no changes.