Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Quickstart — Free API to Paid in 10 Minutes

Turn any existing Express API into an x402-gated, USDC-paid endpoint using the Orchus facilitator. No payment processor accounts. USDC goes straight to your wallet.

What you need: an existing Node.js API, a Solana wallet


Step 1 — Get a Solana Wallet (2 min)

  1. Go to phantom.app → Download → Install
  2. Create new wallet → save your seed phrase
  3. Copy your wallet address (looks like BqVq3uwK1Lo4qVwmrNscWvyHAghPJcmmEck5961kaNCG)

This is where your USDC payments will land.


Step 2 — Get USDC on Solana

You need USDC on Solana mainnet. Buy it on any exchange (Coinbase, Binance) or swap via Jupiter.


Step 3 — Install x402 Packages

npm install @x402/express @x402/svm @x402/core

Step 4 — Add Payment Middleware

Before (your existing server):
import express from 'express';
const app = express();
 
app.get('/data', (req, res) => {
  res.json({ result: 'your data here' });
});
 
app.listen(3000);
After (add the highlighted lines only):
import express from 'express';
 
// --- ADD THESE ---
import { paymentMiddleware, x402ResourceServer } from '@x402/express';
import { ExactSvmScheme } from '@x402/svm/exact/server';
import { HTTPFacilitatorClient } from '@x402/core/server';
 
const facilitator = new HTTPFacilitatorClient({
  url: 'https://x402.agentstrail.ai',  // Orchus facilitator — already live
});
 
const resourceServer = new x402ResourceServer(facilitator)
  .register('solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', new ExactSvmScheme());
 
app.use(paymentMiddleware({
  'GET /data': {
    accepts: [{
      scheme:  'exact',
      price:   '$0.01',
      network: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
      payTo:   'YOUR_WALLET_ADDRESS',           // from Step 1
      asset:   'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
    }],
  },
}, resourceServer));
// --- END ---
 
// Your existing route — unchanged
app.get('/data', (req, res) => {
  res.json({ result: 'your data here' });
});
 
app.listen(3000);

Step 5 — Restart and Test

node server.js
curl http://localhost:3000/data
# Expected: HTTP 402 Payment Required ✅

Your API is now x402-gated.


Step 6 — Register on Orchus

  1. Go to discover.agentstrail.ai/onboard
  2. Scroll to Submit Your Endpoint
  3. Paste your public API URL
  4. Click Submit

Orchus probes your endpoint, verifies the 402 response, and lists your API in the Library. AI agents will start discovering and paying for it.


Step 7 — Watch USDC Arrive

Every call:

  • Client pays $0.01 USDC automatically
  • x402.agentstrail.ai verifies + settles on Solana
  • USDC lands directly in your wallet

Check earnings at discover.agentstrail.ai/seller


Reference

ItemValue
Facilitator URLhttps://x402.agentstrail.ai
Network IDsolana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
USDC mintEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v