Pay & earn/ UTILITY 1Live
Axon Gate
The seller side of Axonpay: middleware that answers unpaid requests with a price and lets paid ones through. It is the official x402 v2 server stack set up for Solana, with nothing proprietary in the path.
What it is
Axon Gate is three pieces from the x402 project wired together: a resource server (x402ResourceServer), a facilitator client (HTTPFacilitatorClient) and the Solana exact scheme (ExactSvmScheme from @x402/svm/exact/server). A framework adapter plugs it into your app.
| Framework | Package | Entry point |
|---|---|---|
| Next.js API route | @x402/next | withX402(handler, config, server) |
| Next.js, many paths | @x402/next | paymentProxy(routes, server) in proxy.ts |
| Express | @x402/express | payment middleware |
| Hono | @x402/hono | payment middleware |
You don’t have to write any of it by hand: the seller kit in the dApp generates the file from a short form (framework, route, price, network, payTo, description and facilitator). By default it points at Axonpay’s facilitator.
Route config
A protected route declares one or more offers in accepts. Each offer is a complete price tag; the client picks one it can pay.
| Field | Meaning |
|---|---|
scheme | exact: a fixed price per call, paid with one transfer. |
price | "$0.01" settles in USDC. { amount, asset } sets an exact atomic amount of any SPL mint. |
network | CAIP-2 id of the Solana cluster. |
payTo | The Solana address that receives the funds. Its token account for the mint must exist. |
maxTimeoutSeconds | How long a signed payment stays acceptable. Solana blockhashes expire after about a minute, so long windows buy nothing. |
description | Shown to buyers in the 402, the Inspector and Agent Shop. |
A mainnet server
import { x402ResourceServer } from "@x402/next";
import { HTTPFacilitatorClient } from "@x402/core/server";
import { ExactSvmScheme } from "@x402/svm/exact/server";
export const SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
const facilitator = new HTTPFacilitatorClient({ url: "https://axonpay.fun/api/facilitator" });
export const server = new x402ResourceServer(facilitator).register(
SOLANA_MAINNET,
// with an RPC URL the 402 carries a recent blockhash, saving the buyer one round trip
new ExactSvmScheme({ rpcUrl: process.env.SOLANA_RPC_URL }),
);Passing rpcUrl lets the gate embed a recent blockhash in each 402 (extra.recentBlockhash), so the buyer can sign without its own RPC round trip. With Axonpay’s facilitator, list the endpoint in the Agent Shop on mainnet before you expect payments: it settles only to listed payTo wallets, and only payments of $0.001 or more.
Protecting many paths
import { paymentProxy } from "@x402/next";
import { server, SOLANA_MAINNET } from "@/lib/x402";
const PAY_TO = process.env.AXON_PAY_TO!;
export const proxy = paymentProxy(
{
"GET /reports/*": {
accepts: [
// USDC: the default asset for a "$" price on Solana
{ scheme: "exact", price: "$0.25", network: SOLANA_MAINNET, payTo: PAY_TO },
// wrapped SOL, priced in atomic units (9 decimals): 0.0015 SOL
{
scheme: "exact",
price: { amount: "1500000", asset: "So11111111111111111111111111111111111111112" },
network: SOLANA_MAINNET,
payTo: PAY_TO,
},
],
description: "Full research report",
mimeType: "text/html",
},
},
server,
);
export const config = { matcher: ["/reports/:path*"] };paymentProxy runs before routing, so it can guard pages as well as APIs, and route keys accept a method and wildcards (GET /reports/*). The trade-off: it can’t see your handler’s status code, so a failing API behind it still charges. Prefer withX402 for APIs.
Facilitators
| Facilitator | Solana networks | Access |
|---|---|---|
| Axonpay | Mainnet, devnet | https://axonpay.fun/api/facilitator. Free. Needs an Agent Shop listing for the payTo; records receipts and builds your Axon Score. |
https://x402.org/facilitator | Devnet | Open, no key |
https://facilitator.payai.network | Mainnet, devnet | Open |
| Coinbase CDP | Mainnet | CDP API key, signed by createCdpAuthHeaders from @coinbase/x402 |
| Self-hosted | Any | @x402/svm/exact/facilitator with your own fee-payer key and RPC |
The facilitator pays the network fee and submits the transaction, but it can’t redirect the money. The buyer signed a transfer of an exact amount to the token account of your payTo; changing either would invalidate that signature. Facilitators also refuse transactions in which their own key moves funds. Switching facilitators is a one-line change to the URL.