Construa sobre o xobank.
Guias para o protocolo BAPARA, xo Money API, webhooks e integrações de rails.
Cobre um agente em três passos.
Do zero a um endpoint pago em menos de dez minutos. O servidor declara o preço, o cliente paga, o facilitator liquida onchain.
Install the SDK
One package, server and client entrypoints. Works with Express, Fastify, Hono and Next.js route handlers.
pnpm add @xo/bapara-sdk # grab a sandbox wallet + testnet USDC npx bapara init --network base-sepolia
Declare a price on your route
Answer 402 with the amount, asset and facilitator. When the retry arrives with an X-Payment header, verify it and serve the response.
import { paymentRequired, verifyPayment } from '@xo/bapara-sdk/server';
app.get('/inference', async (req, res) => {
const pr = paymentRequired({
amount: '0.002', // USDC
recipient: process.env.WALLET!,
facilitator: 'https://facilitator.bankai.cash',
});
const header = req.headers['x-payment'];
if (!header) return res.status(402).json(pr);
const check = await verifyPayment(header, { expect: pr });
if (!check.ok) return res.status(402).json(pr);
res.setHeader('X-Payment-Receipt', check.receipt.encoded);
res.json({ completion: await runModel(req.body) });
});Point your agent at it
The client handles the 402 handshake automatically: sign, retry, collect the receipt. maxAmountUsdc is the hard budget for this call.
import { BaparaClient } from '@xo/bapara-sdk/client';
const client = new BaparaClient(wallet);
const res = await client.fetch('https://api.example.com/inference', {
method: 'POST',
maxAmountUsdc: 0.10,
body: JSON.stringify({ prompt: 'summarize this filing' }),
onReceipt: (r) => audit.log('settled', r.txHash),
});$ curl -i https://api.example.com/inference
HTTP/1.1 402 Payment Required # no payment attached
{"amount":"0.002","asset":"USDC","network":"base", ...}
$ npx bapara call https://api.example.com/inference --max 0.10
✓ 200 OK · settled onchain 0x…7f2e · 187ms · receipt savedx402 + budgets + AP2. Full spec, SDKs and facilitator reference.
quickstart →Programmatic access to accounts, transfers, cards and webhooks.
Provision physical and virtual cards. Freeze, top-up, PIN.
PIX, SPEI, SEPA, ACH — with idempotency, retries and receipt formats.
Signed delivery, replay windows, ordered vs unordered streams.
Run your own facilitator in Fastify + viem in <200 LOC.