Build for business

Build with AI

Give an AI coding agent everything it needs to build on USD.NET - llms-full.txt, a ready prompt and the rules that matter.

These docs are written to be read by AI agents as well as people. Point yours at them and it can build a working integration.

FileWhat it is
usd.net/docs/llms.txtIndex of every page, with a one-line description
usd.net/docs/llms-full.txtEvery page in full, as one Markdown file
usd.net/docs/md/<page>.mdAny single page as Markdown, e.g. /docs/md/business/api.md
usd.net/sdk/usdnet.mjsThe server SDK, readable source
usd.net/sdk/connect.jsThe browser SDK, readable source

A prompt to start with

Paste into your agent
Read https://usd.net/docs/llms-full.txt, then the "Build for business" pages.
We are integrating USD.NET into our app (<describe it: a card-pack game, a marketplace…>).
Use the server SDK https://usd.net/sdk/usdnet.mjs (download it into our repo) and connect.js in the browser.
Build: a "Connect with USD.NET" button that asks for a mandate (perTx <x>, daily <y>, days 30, read: true),
a server route that saves the user's address only after checking usd.mandate(address),
charges with ids derived from our order ids, payouts for refunds/sell-backs with ids derived from what they pay for,
and a webhook route that verifies usdnet-signature against the raw body and is idempotent on event.id.
Use testnet (USDNET_NETWORK=testnet) until I say otherwise. Never log or expose USDNET_SERVER_KEY.

Rules to put in your agent's instructions

CLAUDE.md / AGENTS.md
## USD.NET
- Server SDK: ./lib/usdnet.mjs (from https://usd.net/sdk/usdnet.mjs). Docs: https://usd.net/docs/llms-full.txt
- USDNET_SERVER_KEY is a secret: server only, never in client bundles, logs or error messages.
- Every charge and payout gets a deterministic id from our own records (order_<id>, refund_<id>, buyback_<card>); never random, so retries are safe.
- A charge or payout is done only when the returned tx has status "final". "failed" carries `error`.
- Trust the address a browser sends only after `usd.mandate(address)` (or the mandate.created webhook) confirms it.
- Webhooks: verify with USDNet.verifyWebhook on the raw body; dedupe on event.id; answer 2xx fast.
- Amounts are strings with up to 6 decimals ("4.99"). Never use floats for money.
- 403 from charge = no mandate or a limit reached → ask the user to reconnect. 402 = top up.