Charge per API call in USDC — with a receipt your buyer can verify.
A runnable, deploy-ready kit that puts an x402 paywall and a tamper-evident receipt in front of any endpoint. The packages are free MIT — this sells you the wired-up assembly and the afternoon you'd spend integrating them.
Runs free on testnet out of the box · Base mainnet via Coinbase CDP · no token · npx-runnable demo
verify-before-act: genuine → verified=true received bytes match the attested hash AND signer — safe to act tampered byte → verified=false HASH MISMATCH — do not act forged signer → verified=false bad recover — do not act ✓ Act on genuine. Refuse tampered + forged. This is verify-before-act.
Payment rails move the money. ForeSeal proves the bytes.
x402, Payman, Skyfire and the rest all sign the payment or the identity. None signs the data response — so an agent can pay perfectly and still act on tampered bytes. This kit closes that gap.
"Did money move?"
USDC settles per call. The payment is proven — but not what was delivered.
"Who is paying?"
KYA/agent identity proves the payer. Still nothing about the bytes returned.
"Are these the exact bytes?"
An EIP-712 receipt over the response body. The buyer verifies offline, before acting.
What's in the kit
-
src/server.tsA gateway that turns any upstream URL into a paid, attested endpoint with one
trustMiddleware({…})call. -
src/verify-before-act.tsAn offline sign→verify demo (no wallet, no network) — accepts genuine bytes, refuses tampered + forged.
-
src/example-upstream.tsA self-contained example API so it boots standalone. Swap in your own by changing one line.
-
README.md + DEPLOY.mdWrap your own API, set your payout, go live on Base mainnet, deploy to Render / Railway / Fly.
-
LICENSE.mdCommercial, single-purchaser. The npm dependencies keep their own MIT licenses.
-
verified, end-to-endTested on Base Sepolia and Base mainnet (USDC, Coinbase CDP facilitator).
Three steps
Wrap your endpoint
The rail does the rest
Unpaid calls get a 402 with USDC terms. On payment, your bytes return stamped with an EIP-712 receipt over the exact response.
The buyer verifies before acting
What the receipt proves — and doesn't
The bytes are authentic and unaltered, signed by the attester you pinned. Tamper-evident, signer-pinned, recomputable.
That the data is correct. That's provenance, not truth — "these are genuinely the bytes the seller signed," not "this number is right."
Questions
Aren't the packages free?
@foreseal/gate and @payperbyte/sdk are MIT on npm. You can wire them yourself. This kit is the assembly, a working example, and the walkthrough — it sells you the afternoon, not the libraries.Does it work on real Base mainnet?
Do I need a token or an account?
What stack?
tsx. Node 20.6+. Solana isn't covered — it's EVM/USDC (Base by default, any eip155: chain).What's the license?
Ship a paid, verifiable API today.
Wired up, deploy-ready, honest about what it proves. npx @foreseal/demo to see it first.