Quickstart
PaidOnChain answers one question reliably: did this transaction really pay this address at least this much USDC? Use the free MIT library, or the hosted API if you don't want to manage RPCs.
Option A: the library (free forever)
npm install github:orja12/paidonchain
import { verifyPayment } from "paidonchain";
const r = await verifyPayment({
chain: "base", // or "arbitrum"
tx: "0x…", // the buyer's transaction hash
to: "0xYourAddress",
minAmount: "19", // USDC
});
if (r.ok) unlockOrder(); // r.paid, r.from, r.confirmations
else console.log(r.code, r.reason); // NOT_FOUND, PENDING, UNDERPAID, NO_TRANSFER, FAILED_TX
It runs in Node 18+, Cloudflare Workers, Deno and Bun, with zero dependencies.
Option B: the hosted API
# 1. get a key (100 free verifications every month)
curl -X POST https://paidonchain.alrudaini-omar.workers.dev/v1/keys
# 2. verify
curl -X POST https://paidonchain.alrudaini-omar.workers.dev/v1/verify \
-H "authorization: Bearer poc_…" -H "content-type: application/json" \
-d '{"chain":"base","tx":"0x…","to":"0xYourAddress","min_amount":"19"}'
The response is the same object as the library returns, plus billed and usage. Bad input and upstream RPC failures are never billed.
What gets checked
- The transaction succeeded (status 1).
- It has enough confirmations (default 3).
- The
Transferevents come from the real USDC contract. Fake tokens named "USDC" are ignored. - The recipient topic equals your address, and the transfers to you sum to at least
minAmount.
Your own code still decides which order a payment belongs to, and must refuse to accept the same tx twice. See Accept USDC in Next.js for the full pattern.