Sell an API
app.get("/weather",
paywall({ ledger, price: USDC(0.01),
payTo: "weather-api.near", asset: "usdc.near" }),
(req, res) => res.json(getWeather(req)));
Buy from any API
const fetchPaid = createPayingFetch({
ledger, vault: "marketing.acme.near",
acceptAssets: ["usdc.near"],
});
// 402 → pay through the wallet → retry.
const res = await fetchPaid("https://api.example/weather");