SellSell to agents. Vauban Pay settles.
Your API answers 402 with the price. Agents pay in USDC. Vauban Pay settles each payment, pays the network fee from your credit, and keeps a cut set at creation: the greater of 2% and twice the factory's fixed settlement cost divided by your price floor (refused above 50%). With the floor of 250000 used below (USDC units, six decimals), the cut is 2%. Live on Base with real USDC, and on Base Sepolia with test money: the steps are the same.
Your server talks to Vauban Pay through the standard x402 library: new HTTPFacilitatorClient({ url }) from @x402/core, with one of the two URLs below. You need Foundry's cast, Node.js 18 or later, and a little ETH on your key on the network you pick (on Base Sepolia, from a faucet listed at docs.base.org/get-started/get-funds). The commands below use the public Base nodes; on Base, your own node is better.
curl -L https://foundry.paradigm.xyz | bash
~/.foundry/bin/foundryup
export PATH="$PATH:$HOME/.foundry/bin"
- Pick the network. Paste one of the two blocks in the shell you use for the steps below.
# Base, real USDC
export NETWORK=eip155:8453 RPC=https://mainnet.base.org
export FACILITATOR=https://pay.vauban.tech/x402-tiers-base-mainnet
export FACTORY=0xbc221E37429E9E65Ae5f925336f8660db2993F65 FEE_PAYER=0xCaE9a2E69F3EB1943d8DA19E33Ae1D1aFB8f9E52
# Base Sepolia, test money
export NETWORK=eip155:84532 RPC=https://sepolia.base.org
export FACILITATOR=https://demo.pay.vauban.tech/x402-tiers-base-sepolia
export FACTORY=0xe5158E431983271C4d983eDFD67e3012c5c0afA8 FEE_PAYER=0xe75d938C31650c6eC9c164C47777198Cc3721F3b
- Your key. This makes it in
~/.foundry/keystores/seller, asks a password, and prints its address. Send your ETH there.mkdir -p ~/.foundry/keystores
cast wallet new ~/.foundry/keystores seller
- Your payout contract. Create it on the factory with your price floor, in USDC units (six decimals). It is yours: it receives every payment and splits it. It is the
payTo of your offer.cast send $FACTORY "creer(uint256)" 250000 --rpc-url $RPC --account seller
Its address is in the receipt cast prints, under logs: the second topic of the factory's log, last 40 hex digits. Keep it as PAYOUT. To read it again later:cast receipt <transactionHash> logs --rpc-url $RPC
export PAYOUT=0x…
- Register it. One request, no account. The answer is
201 with "statut":"inscrit".curl -X POST $FACILITATOR/vendeurs/v1/inscription -H 'content-type: application/json' -d "{\"repartiteur\":\"$PAYOUT\"}"
- Credit the network fees, on your own. Send ETH from the address that created the contract to the fee payer. Each settlement debits one provision from your credit. A transfer below one provision is refused by name, and ETH sent to the fee payer is not returned. Your level is served at
$FACILITATOR/vendeurs/v1/credit/<your address>.cast send $FEE_PAYER --value 0.0003ether --rpc-url $RPC --account seller
Then post that transaction once the network reports its block as safe (too early, the route says so and you retry). One credit per seller, shared by all your payout contracts; when it runs out, settlements are refused by name.curl -X POST $FACILITATOR/vendeurs/v1/credit -H 'content-type: application/json' -d '{"vendeur":"0x…","tx":"0x…"}'
- Answer 402, let Vauban Pay settle. Your server returns an x402 v2 offer with
payTo set to your contract, and hands each payment to the standard client, which verifies it, then settles it. It serves the resource only on a settlement that names a transaction. A complete server:// seller.mjs. Once: npm i @x402/core@2.25.0 ; then: node seller.mjs (Node.js 18 or later)
// Reads NETWORK, FACILITATOR and PAYOUT (your payout contract) from the environment of step 1.
import { createServer } from "node:http";
import { HTTPFacilitatorClient } from "@x402/core/server";
import { SettleError } from "@x402/core/types";
const { NETWORK, FACILITATOR, PAYOUT } = process.env;
const USDC = {
"eip155:8453": { asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", name: "USD Coin" }, // Base
"eip155:84532": { asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", name: "USDC" }, // Base Sepolia
}[NETWORK];
if (!USDC || !FACILITATOR || !/^0x[0-9a-fA-F]{40}$/.test(PAYOUT ?? "")) throw new Error("set NETWORK, FACILITATOR and PAYOUT");
// The standard x402 client: it calls /verify and /settle on this URL.
const facilitator = new HTTPFacilitatorClient({ url: FACILITATOR, timeoutMs: 120_000 });
const offer = {
scheme: "exact", network: NETWORK,
amount: "250000", // your price in USDC units, at least your floor
asset: USDC.asset, payTo: PAYOUT,
maxTimeoutSeconds: 120, extra: { name: USDC.name, version: "2" },
};
const required = { x402Version: 2, accepts: [offer],
resource: { url: "http://127.0.0.1:8402/resource", mimeType: "application/json" } };
const b64 = (v) => Buffer.from(JSON.stringify(v)).toString("base64");
// A refusal names its reason and no transaction: the agent then knows nothing was paid.
const refuse = (res, reason) => {
const r = { success: false, errorReason: reason, transaction: "", network: NETWORK };
res.writeHead(402, { "PAYMENT-REQUIRED": b64(required), "PAYMENT-RESPONSE": b64(r) });
res.end(JSON.stringify(r));
};
createServer(async (req, res) => {
const sig = req.headers["payment-signature"];
if (!sig) { res.writeHead(402, { "PAYMENT-REQUIRED": b64(required) }); return res.end(JSON.stringify(required)); }
let payload, v;
try { payload = JSON.parse(Buffer.from(sig, "base64").toString()); } catch { return refuse(res, "invalid_payload"); }
try {
v = await facilitator.verify(payload, offer);
} catch (e) {
// Verify moves no money: the facilitator could not conclude, the agent may try again later.
res.writeHead(502); return res.end(JSON.stringify({ error: String(e) }));
}
if (v.isValid !== true) return refuse(res, v.invalidReason ?? "verify_refused");
try {
const s = await facilitator.settle(payload, offer);
if (s.success === true && s.transaction) {
res.writeHead(200, { "content-type": "application/json", "PAYMENT-RESPONSE": b64(s) });
return res.end(JSON.stringify({ hello: "paid", transaction: s.transaction }));
}
if (s.success === false && !s.transaction) return refuse(res, s.errorReason ?? "settle_refused");
res.writeHead(502); res.end(JSON.stringify({ ...s, doNotPayAgain: true })); // a transaction may exist
} catch (e) {
// A named refusal without a transaction moved nothing. A 502 or any other error may come after the payment
// was sent: never ask to pay again.
if (e instanceof SettleError && e.statusCode !== 502 && !e.transaction) return refuse(res, e.errorReason ?? "settle_refused");
res.writeHead(502); res.end(JSON.stringify({ error: String(e), doNotPayAgain: true }));
}
}).listen(8402, "127.0.0.1");
- Pay it as an agent would. Standard x402 clients pay you without any Vauban code. With ours, on Base Sepolia:
try makes a test key on your machine, pays our demo with the test USDC it gets, and prints your address; fund that address with test USDC at faucet.circle.com; then buy reads your price and pays nothing, and the same line with --consent <token> pays it. On Base, buy key new --network base makes the key to fund with USDC.npx -y @vauban-pay/mcp try --network base-sepolia
npx -y @vauban-pay/mcp buy http://127.0.0.1:8402/resource
- Collect. It books the split and sends your share to you; Vauban Pay withdraws its cut on its own, and neither withdrawal waits on the other.
cast send $PAYOUT "retirerVendeur()" --rpc-url $RPC --account seller
Measured by us on 4 November 2026 on Base Sepolia, with our own test seller: contract created, registered, credited through this route, paid by an agent and collected in about a minute and a half; the payment settled in under three seconds.
On Starknet mainnet
Agents pay you in USDC, and the network fees come from a credit you fund in STRK. With the floor of 100000 used below (USDC units, six decimals), the cut is 6.48%. Live on Starknet mainnet with USDC.
The steps take sncast, from Starknet Foundry: the account it makes for you holds your STRK and receives your share in USDC. The commands use the public node that --network mainnet picks; your own node, with --url, is better.
curl --proto '=https' --tlsv1.2 -sSf https://sh.starkup.sh | sh
Then open a new terminal, where sncast --version answers.
- Your environment. Paste this block in the shell you use for the steps below.
# Starknet mainnet, USDC
export FACILITATOR=https://pay.vauban.tech/x402-tiers-starknet-mainnet
export FACTORY=0x0165c2b685252d116a8a36ed853e8894f26b564cb4b83a274bc483a54879bf58
export FEE_PAYER=0x026e0f4c5e493494ae7102aebce364fa67d7d88910a7d74d3e956a06e4c4e520
export STRK=0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d
- Your account. This makes a Starknet account named
seller, keeps its key in ~/.starknet_accounts/, and prints its address and the fee to deploy it.sncast account create --network mainnet --name seller
Send STRK to that address, then deploy it. Keep the address as SELLER.sncast account deploy --network mainnet --name seller
export SELLER=0x…
- Your payout contract. Create it on the factory with your price floor, in USDC units, written as two numbers (the floor, then 0). It is yours: it receives every payment and splits it. It is the
payTo of your offer.sncast --account seller invoke --network mainnet --contract-address $FACTORY --function creer --calldata 100000 0
Then read its address, printed as ContractAddress(0x…), and keep it as PAYOUT:sncast call --network mainnet --contract-address $FACTORY --function repartiteur_de --calldata $SELLER 100000 0
export PAYOUT=0x…
- Register it. One request, no account. The answer is
201 with "statut":"inscrit".curl -X POST $FACILITATOR/vendeurs/v1/inscription -H 'content-type: application/json' -d "{\"repartiteur\":\"$PAYOUT\"}"
- Credit the network fees, on your own. Send STRK from your seller account to the fee payer. Each settlement debits one provision from your credit. A transfer below one provision is refused by name, and STRK sent to the fee payer is not returned. The line below sends one STRK (amounts in fri, 18 decimals).
sncast --account seller invoke --network mainnet --contract-address $STRK --function transfer --calldata $FEE_PAYER 1000000000000000000 0
Then post that transaction once Starknet reports its block as accepted on L1 (ACCEPTED_ON_L1), a few hours after the transfer (2 h 25 min on 8 November 2026); too early, the route says so and you retry. One credit per seller, shared by all your payout contracts.curl -X POST $FACILITATOR/vendeurs/v1/credit -H 'content-type: application/json' -d "{\"vendeur\":\"$SELLER\",\"tx\":\"0x…\"}"
Your credit reads at $FACILITATOR/vendeurs/v1/credit/<your address>: its field palier gives the settlements it still covers, as a range, 0, 1-10 or plus-de-10. At 0, settlements are refused by name: top it up with a new transfer, posted the same way.curl $FACILITATOR/vendeurs/v1/credit/$SELLER
- Answer 402, let Vauban Pay settle. A request without payment gets
402 and the header PAYMENT-REQUIRED: the base64 of {"x402Version":2,"accepts":[<the offer>],"resource":{"url":"<your URL>","mimeType":"application/json"}}. The offer, with payTo set to your contract and a price of at least your floor:{
"scheme": "exact",
"network": "starknet:SN_MAIN",
"amount": "100000",
"asset": "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
"payTo": "<PAYOUT>",
"maxTimeoutSeconds": 300,
"extra": { "feePayer": "0x026e0f4c5e493494ae7102aebce364fa67d7d88910a7d74d3e956a06e4c4e520" }
}
A request with the header PAYMENT-SIGNATURE carries a payment, in base64. Your server posts it, decoded, with the offer, first to verify (the answer says "isValid": true), then to settle. It serves the resource only on a settlement with "success": true that names a transaction, and returns that settlement, in base64, in the header PAYMENT-RESPONSE.POST $FACILITATOR/starknet/v1/verify
POST $FACILITATOR/starknet/v1/settle
{ "x402Version": 2, "paymentPayload": <the decoded PAYMENT-SIGNATURE>, "paymentRequirements": <the offer> }
A settlement with "success": false and no transaction moved nothing. Any other answer may have paid: never ask to pay again. - Pay it as an agent would. With ours,
@vauban-pay/mcp 0.21.0 or later (Node.js 22 or later), an agent pays it from a Starknet account it already has, deployed and holding USDC: buy key import keeps that account and reads its key from the standard input, never from an argument. Then buy reads your price and pays nothing, and the same line with --consent <token> pays it.npx -y @vauban-pay/mcp buy key import --address 0x…
npx -y @vauban-pay/mcp buy <your URL>
npx -y @vauban-pay/mcp buy <your URL> --consent <token>
- Collect. It books the split and sends your share to you; Vauban Pay withdraws its cut on its own, and neither withdrawal waits on the other.
sncast --account seller invoke --network mainnet --contract-address $PAYOUT --function retirer_vendeur
On Solana mainnet
Agents pay you in USDC, and the network fees of each settlement are covered by Vauban Pay's fee payer: nothing to fund, the cut carries that cost. With the floor of 100000 used below (USDC units, six decimals), the cut is 2.84%. Live on Solana mainnet with USDC.
Your payout account is an account of the program, derived from your key and your price: it receives every payment and splits it. The key steps take the Agave tool suite; creating the payout account and collecting are two calls to the program that no published client builds yet, so their wire contract is given, for the Solana SDK of your choice.
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
Then open a new terminal, where solana --version answers.
- Your environment. Paste this block in the shell you use for the steps below.
# Solana mainnet, USDC
export FACILITATOR=https://pay.vauban.tech/x402-solana-mainnet-tiers
export PROGRAM=95Tg5wFuE4EKxw1vVfMnyUmfqHPPS916FcYKkcXNTDiS
export USDC=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
export FEE_PAYER=6am1GDzghJGK3vFSwbr9D1WyAXZjsYSqjGxC1dXckGU
- Your key. This makes a Solana key in
seller.json and prints its address. Keep the address as SELLER. Send it some SOL: creating your payout account and collecting are transactions this key pays for, with their rent.solana-keygen new -o seller.json
solana address -k seller.json
export SELLER=<the address printed>
- Your payout account. One instruction to the program, signed by your key, with your price floor in USDC units. It creates your payout account, the program account derived from your key and that price, and its USDC vault. The address of the payout account is the
payTo of your offer; keep it as PAYOUT.program: $PROGRAM
payout account: the program address derived from ["caisse", SELLER, price as u64 little-endian]
data: [0] ++ price as u64 little-endian ++ bump of the payout account (u8)
accounts, in this order:
1. SELLER (signer, writable)
2. the payout account (writable)
3. the USDC associated token account of the payout account (writable; its vault)
4. $USDC (the mint)
5. 11111111111111111111111111111111 (System program)
6. TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA (SPL Token program)
7. ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL (Associated Token program)
The program refuses a price whose cut would be above its ceiling: at the floor used here it is accepted. - Register it. One request, no account. The answer is
201 with "statut":"inscrite".curl -X POST $FACILITATOR/vendeurs/v1/inscription -H 'content-type: application/json' -d "{\"caisse\":\"$PAYOUT\"}"
- Answer 402, let Vauban Pay settle. A request without payment gets
402 and the header PAYMENT-REQUIRED: the base64 of {"x402Version":2,"accepts":[<the offer>],"resource":{"url":"<your URL>","mimeType":"application/json"}}. The offer, with payTo set to your payout account and a price of at least your floor:{
"scheme": "exact",
"network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"amount": "100000",
"asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"payTo": "<PAYOUT>",
"maxTimeoutSeconds": 60,
"extra": { "feePayer": "6am1GDzghJGK3vFSwbr9D1WyAXZjsYSqjGxC1dXckGU" }
}
A request with the header PAYMENT-SIGNATURE carries a payment, in base64. Your server posts it, decoded, with the offer, first to verify (the answer says "isValid": true), then to settle. It serves the resource only on a settlement with "success": true that names a transaction (its signature, in base58), and returns that settlement, in base64, in the header PAYMENT-RESPONSE. The offer gives the buyer sixty seconds.POST $FACILITATOR/svm/v1/verify
POST $FACILITATOR/svm/v1/settle
{ "x402Version": 2, "paymentPayload": <the decoded PAYMENT-SIGNATURE>, "paymentRequirements": <the offer> }
A settlement with "success": false and no transaction moved nothing. Any other answer may have paid: never ask to pay again. - Pay it as an agent would. With ours,
@vauban-pay/mcp 0.21.0 or later (Node.js 22 or later), an agent pays it from a Solana key it already has, holding USDC and needing no SOL: the key file and the node it reads are given by PAY_MCP_SVM_KEYPAIR_PATH and PAY_MCP_SVM_RPC_URL. Then buy reads your price and pays nothing, and the same line with --consent <token> pays it.export PAY_MCP_SVM_KEYPAIR_PATH=<your key file>
export PAY_MCP_SVM_RPC_URL=<your node>
npx -y @vauban-pay/mcp buy <your URL>
npx -y @vauban-pay/mcp buy <your URL> --consent <token>
- Collect. One instruction to the program, sent by any key: it books the split and sends your share to your USDC account; the share always goes to you. If your USDC account does not exist yet, put the Associated Token program's create-idempotent instruction for it before this one, in the same transaction; the program does not create it. Vauban Pay withdraws its cut on its own.
program: $PROGRAM
data: [2]
accounts, in this order:
1. the payout account (writable)
2. its USDC vault (writable)
3. your USDC associated token account (writable; must exist: create it first, in the same transaction, with the Associated Token program)
4. $USDC (the mint)
5. TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA (SPL Token program)