x402 lets an API charge for a call. But facilitators only cover a handful of chains. pay402 is the ~50 lines that let your server settle the payment itself ā on any chain, including ones no facilitator supports.
The chain's own contracts verify every signature. Simulate first (invalid payments revert at zero cost), then submit and credit on receipt. Watch a payment fly:
Drag the coin all the way right to settle a pretend payment the exact way a real one flows. No wallet, no chain, no risk.
Built for Robinhood Chain (chain 4663), which no facilitator covered. Every claim links to the block explorer.
EIP-3009 transferWithAuthorization, settled with zero payer gas.
0x9b1368e4ā¦0e2918
First Permit2 settlement
Witness-pinned Permit2 via the canonical x402 proxy ā the path for any ERC-20, like $HERO, with no gasless transfer.
0xd141615eā¦22c0cf
Anchored on-chain
The milestone written on-chain as a keylessly readable public checkpoint.
token Ā· instance 14
// npm i github:walter-grace/pay402 import { settleSelf } from "pay402/settle.mjs"; // after your 402 quote + decoding the X-PAYMENT header (30 lines, see examples/): const result = await settleSelf(payment, { asset: USDG, payTo: YOUR_WALLET, maxAmountRequired: "100000", // $0.10 }); if (result.ok) deliver(result.payer, result.txHash); // ā settled on-chain