Gasless
x402 settlement costs the payer no gas. The facilitator submits the transaction.
Replace fetch. Any 402 under the cap settles in USDG and the response comes back. Over the cap, the user gets one prompt.
$ npm i @payhole/sdk
The same signature as fetch, with one extra option. A 402 comes back, the pocket signs and settles it, the request is retried, and your code gets the 200. Under the cap none of that reaches you.
import { payholeFetch } from "@payhole/sdk"; // Same signature as fetch. One extra option. const res = await payholeFetch("https://api.example.com/report", { method: "POST", body: JSON.stringify({ q: "usdg volume" }), cap: "0.50" // max USDG for this call }); // 402 → signed → settled → 200 console.log(res.headers.get("payment-response")); console.log(await res.json());
Agents get the same pocket through their own session key, each with its own cap. Revoke one and the rest keep working.
# A session key for an agent, capped at 5 USDG $ payhole key create --name research --cap 5 created 0x9c1e…4a2f cap 5.00 USDG # Pocket, keys, spend $ payhole status pocket 24.88 USDG keys research 0.12 / 5.00 sinkhole on # Pay one URL from a key $ payhole pay https://example.com/article --key research
x402 settlement costs the payer no gas. The facilitator submits the transaction.
One address per origin, derived from the seed. A service sees its own and nothing else.
The cap is enforced by the pocket contract on chain, not by the client asking nicely.
Kill one agent's key without touching the pocket or any other key.