Skip to main content
This page is not the way to start. It documents the partner-bridge route, which needs a repository you do not have access to and a registry entry only we can add. If you are here to charge AI agents for your own API or site, use the self-serve path below — you never need us, and it takes about five minutes.

Start here instead

Everything below is self-serve at dash.aifinpay.io — no repository, no approval, no contract:
  1. Sign in with an email link and create a service.
  2. Give it a payout address (a standard 0x… EVM address; settlement is on Polygon today).
  3. On the Gateway page, pick a slug and enter your upstream URL. Your paid endpoint is live immediately at https://gateway.aifinpay.io/{your-slug}/… — that is the URL you hand to agents.
  4. Lock your origin so agents cannot bypass the paywall. Read Hosted Gateway before you do — the rule differs for an API and for a site with human readers, and using the API rule on a website will 403 your readers and drop you out of search.
That is the whole thing. Hosted Gateway walks through it with no code at all; SDK middleware is the alternative if you would rather keep traffic on your own domain and verify receipts yourself.

The partner-bridge route (requires us)

The rest of this page covers standing a thin x402 bridge in front of an API and listing it in the AiFinPay provider registry. It needs a pull request to a private repository and a registry entry we add by hand, so it is only relevant if you have already spoken to us about a registry listing. It is not a self-service path and should not be attempted as one.

Config-only

Front any JSON HTTP API by editing a .env file. No bridge code to fork or maintain — the generic bridge is fully env-driven.

Non-custodial & token-free

Per-call revenue settles straight to a wallet you own. No token to buy, no contract to sign, no KYC, no revenue-share bookkeeping.

What you need

You do not need crypto integration in your existing stack, a wallet for your end users (your customers are AI agents that bring their own keypair via the AiFinPay SDK), or a compliance/KYC process — settlement is non-custodial and happens on-chain in the splitter contract.

Fast path — config only, no code

If your upstream is a normal JSON HTTP API, use the env-driven _generic-x402-bridge and scaffold a config in one command. No bridge code is written or edited.
1

Scaffold a provider config

Run scripts/new-provider.mjs with your three knobs and identity flags:
This writes examples/mybrand-x402-bridge/.env and examples/mybrand-x402-bridge/README.md, and prints the services.json registry entry to paste. The script derives PRICE_WEI (native POL) and PRICE_USDC_UNITS / PRICE_USDT_UNITS (6-decimal stables) from your --price-usd.
2

Add your upstream API key

Open the generated .env and fill in the one secret the scaffold leaves blank:
Optionally set BRIDGE_MERCHANT_WALLET to your own payout wallet — by default the scaffold points it at the AiFinPay treasury Safe.
3

Run the generic bridge with your config

The bridge code lives in _generic-x402-bridge; you point it at your scaffolded .env:
Put it behind nginx / Caddy / fly.io / Railway / wherever — it’s a plain HTTP service, no special infra.
4

Register on the marketplace

Paste the printed registry entry into oracle-financial-hub-59/backend/services.json. Once your bridge answers GET /.well-known/x402.json, the provider pinger marks it live and it becomes auto-selectable via /api/registry/best.
A manual fork path exists for upstreams that need custom request shaping, but the config-only path above is recommended for any standard JSON API.

The three knobs

Everything provider-specific is one of three env vars. The 402 challenge, on-chain verification, replay protection, rate limiting, and splitter integration are identical for every provider.

Auth styles

UPSTREAM_AUTH_STYLE selects how UPSTREAM_API_KEY is attached when forwarding:

Optional knobs

The on-chain split

Every successful call generates exactly one Payment event on the verified B2BSplitter contract at 0xE34Fc0E6694821c600Fa0955C0F74720ea6d8440. You keep 98.99%; the protocol fee is 1.00%.
You don’t deploy or upgrade any contract, and you don’t sign a partner agreement on-chain. The 1% protocol fee is structural — every payMatic call routes through the splitter, and the split is hard-coded by the Gnosis Safe owner. Agents can also pay in USDC/USDT via the standard x402 (ERC-3009) facilitator path; the same 98.99 / 1.00 / 0.01 split applies.
If your upstream returns 5xx, the bridge returns 502 to the agent and does not consume their payment — the order stays replayable, so the agent can retry for free with the same transaction. You never get paid for an upstream failure, and the agent never pays for one.

The services.json registry entry

new-provider.mjs prints the entry to paste into services.json"services":
Once merged and redeployed, agents discover you through:
  • The on-chain Payment events (the canonical source)
  • The aggregated /api/dashboard endpoint
  • The merchant lookup at /api/partner/:wallet
  • Automatic selection via /api/registry/best

What you get for the 1% fee

Pre-built SDKs

Agents pay you through the Python (aifinpay-agent), Node (@aifinpay/agent), and MCP (@aifinpay/mcp) surfaces — no work on your side.

Discovery

Appearance on the /api/dashboard and aifinpay.io marketplace pages.

Trusted identity

Agents carry on-chain AgentPassport identity you can trust without running your own KYC.

Multi-scheme facilitator

A canonical x402 facilitator translates between AiFinPay-native, Coinbase-x402, and (future) generic schemes — agents written for any of these can pay you.
You do not pay for agent onboarding (handled in the SDK) or network fees (paid by the agent submitting the transaction).

Production checklist

The scaffolded .env is for development. Before driving real volume:
  • Set REDIS_URL to share order/transaction state across instances (empty falls back to in-memory).
  • Use a hardware-secured wallet or a Safe for BRIDGE_MERCHANT_WALLET — don’t reuse a CI/CD-rotated EOA.
  • Move your upstream API key to a secret manager; the .env file is for development only.
  • Rate-limit by Polygon address at the application layer — the bundled express-rate-limit is per-IP, intended as anti-spam for the 402 challenge step.
  • Monitor your Payment events (or the dashboard). A merchant wallet missing receipts means an agent paid but the bridge didn’t deliver — that’s a refund case.
Questions or pilot scoping: open an issue at github.com/AiFinPay/sdk/issues.