The paid web, searchable.
Every API and MCP tool paid through Rail402 lands in the Bazaar. Agents find what they need in plain words and pay per call on Stellar, without an account anywhere.
APIs make you sign up before you can ask.
An API is a service your code can ask for something: the weather, a translation, a picture. Most want an account, a credit card and a secret key first. For an AI agent that needs one answer right now, that doesn't work.
With Rail402 the API just names its price, and your code pays for that one answer.
Today
With Rail402
Ask, pay, get the answer. In one round trip.
The web has had a "402 Payment Required" code since 1997 that nobody could use. x402 is the open standard that does. Rail402 is the facilitator in the middle: it checks the payment, sends it to Stellar and pays the fee.
- The buyer signs once. Change the amount or the receiver and the signature breaks.
- The money goes straight from buyer to seller. Rail402 never holds it.
- Every refusal comes back with a clear code and a reason.
Money that moves as fast as the request.
Paying a tenth of a cent only makes sense if the payment is fast and almost free. On Stellar it's final in about five seconds, in USDC, a digital dollar, and the network fee is a tiny fraction of a cent that Rail402 pays for you.
Networks and assets →Made for Stellar, not ported to it.
A payment is a Soroban token transfer. The buyer signs one authorization that names the token, the receiver and the amount, and nothing else can be changed without breaking it. Rail402 puts it on the ledger from its own accounts and pays the fee.
- Classic G… wallets and C… smart accounts both pay. A smart account runs its own checks.
- Circle USDC by default, or any SEP-41 token, with 6, 7 or 18 decimals.
- A pool of channel accounts settles many payments side by side.
Two ways to charge.
Use exact when you know the price up front. Use upto when you only know it after the work is done.
Like a price tag
One request, one fixed price. The buyer pays exactly that, and gets the answer.
e.g. a weather report, a translationLike a taxi meter
The buyer agrees to a maximum. The seller charges what was used. A contract on Stellar makes going over impossible.
e.g. AI tokens, rows of data, seconds of computeWe wrote upto for Stellar.
x402 started with fixed prices. Rail402 wrote the Stellar version of upto, the metered scheme: the specification, the Soroban contract that enforces it, and the code for buyers, sellers and facilitators. It is proposed to the x402 project upstream.
- The buyer signs a cap and a deadline. The contract checks the amount is between zero and the cap.
- Each signature settles once and expires with the payment window. The unused part never leaves the wallet.
- The contract has no admin, can't be changed and stores nothing. Its source is verified on chain.
testnet contract CBTVKCHL…TU7U · source verified
Charge for your API with one middleware.
Keep your server as it is. Add the stock @x402/express middleware, point it at Rail402 and name a price in dollars. Each call is paid in USDC, straight to your Stellar address.
- No accounts or billing to build. A request without payment gets a 402.
- Describe the route once and the Bazaar lists it after the first sale.
- MCP tools too: charge per tool call with the stock @x402/mcp.
const facilitator = new HTTPFacilitatorClient({ url: "https://testnet.rail402.dev" });const server = new x402ResourceServer(facilitator) .register("stellar:testnet", new ExactStellarScheme()) .registerExtension(bazaarResourceServerExtension); app.use(paymentMiddleware({ "GET /weather": { accepts: { scheme: "exact", price: "$0.01", network: "stellar:testnet", payTo }, description: "Current weather for a city", }, }, server));
Make one sale, and you're on the shelf.
The Bazaar is a catalog of every API and MCP tool paid through Rail402. A listing appears by itself after its first payment, and agents search it in plain words.
- Only the seller who got paid can change a listing.
- Search by meaning, price, network or type.
- Off chain: listing costs no extra transaction.
Ask in your own words. Get the right tool.
Bazaar search mixes keywords with meaning, so a question finds the right tool even when it uses different words than the listing. We test it on 500 listings and 202 questions, and publish the scores.
- Better than keyword search alone on every score.
- Filters always hold: 0 results over your price, network or type.
- About 5 ms per search. Any drop in quality fails our build.
Give your agent pocket money.
Add the Rail402 MCP server to Claude, Cursor or any MCP app. Your agent searches the Bazaar, pays for the tool it needs and keeps the receipt, even for tools it was never told about.
- Caps per call and per day, checked before anything is signed.
- On mainnet it pays only verified sellers, and asks you before its first payment.
- The wallet key stays in a file. The model never sees it.
Give every agent a wallet with rules.
An agent can pay from a plain key, or from a smart account with a budget written into it. Then the account itself refuses anything over the limit, so even a leaked agent key can't spend more than you allowed.
- Payments inside the budget settle as usual.
- A payment over what's left is refused, and nothing moves.
- The agent's key can't switch to a rule without the budget.
Works with OpenZeppelin smart accounts. Our budget policy is an example in the repository, proven by tests on testnet.
Smart accounts and budgets →Try it in your browser. No install.
The Playground makes a test wallet for you with free test USDC on Stellar's testnet. Make a real payment and watch every message, signature and transaction, from the 402 to the receipt.
Every x402 payment on Stellar, in one place.
The Explorer shows x402 payments on mainnet and testnet: who paid whom, how much, with which scheme and through which facilitator. Paste a transaction hash and see the whole payment.
- Every ledger is checked against its own hashes before it is shown.
- The Ecosystem Report counts payments across facilitators.
- Anyone can rebuild it from public ledgers. Nothing to take on trust.
We never touch the money. You can check.
USDC moves from buyer to seller in one Stellar transaction, and Rail402 only pays the fee. Every payment has a public transaction hash you can check on Stellar yourself.
- Published threat model and operational tests
- Recorded test runs with real transaction hashes
- Every refusal has a stable error code you can look up
Every "no" comes with a reason.
When Rail402 refuses something, it never just says "error". Each code has a fixed name, an HTTP status, a plain reason and a flag that says whether trying again can work. Tests pin all of them, so your code can rely on them.
- Branch on the code. Show the reason to people.
- A reason can never be empty.
- A code never changes without a changelog entry.
invalid_exact_stellar_payload_facilitator_is_payer
Use ours, or run your own.
The same facilitator runs in three ways. Your sellers and buyers don't notice the difference: they only see a URL.
Point at our URL
Nothing to run. Free on testnet; mainnet with an API key.
https://testnet.rail402.dev https://mainnet.rail402.dev
Your own server
One command builds the image, funds a testnet sponsor and starts Postgres and the service.
$ ./deploy/docker.sh
Inside your app
Import the facilitator into your own Node server. No network hop.
$ npm i @rail402.dev/facilitator
Whichever you pick, you get
Turn testnet and mainnet on or off, and list the tokens you take. USDC is the default.
Fees, rate limits and per-key quotas are settings, never fixed in the code.
If a mainnet setting is missing or unsafe, the service refuses to start instead of guessing.
Secret keys are read from files on your machine, not pasted into settings or logs.
Built-in health, readiness and metrics pages for your monitoring.
Everything ships on npm.
Open source under Apache-2.0, version 0.5.7. Take one package, or the whole rail.
stellar · search · safe-fetch · store-postgres · x402-index
Pick your side of the payment.
Live on Stellar mainnet, free on testnet. Use our hosted facilitator or run your own: nothing depends on us.
Sell an API
Add one middleware, name a price, get paid per call.
$ npm i @x402/express @x402/stellarSeller quickstart →
Pay as a buyer or agent
Find and pay any listing from your terminal or code.
$ npm i -g @rail402.dev/cli $ rail402 purchase "current weather"CLI and SDK →
Give your agent a wallet
Add the MCP server to Claude, Cursor or any MCP app.
$ npm i -g @rail402.dev/mcpMCP server →
Ask. Pay. Get the answer.
Start on testnet for free, then switch to mainnet when you're ready.