PipRail is one TypeScript SDK for "402 Payment Required" crypto payments. It runs right here in this browser — loaded from a CDN, nothing installed. The demo below is live.
Pick what a merchant charges. PipRail builds the real x402 402 Payment Required challenge here, from your wallet address alone (no key) — then an agent reads it and prices the payment. No network calls, no keys.
click "Run the 402 loop"…
A plain HTML page pays a gated URL — the SDK and any chain library resolve from the CDN on demand.
<script type="module">
import { PipRailClient } from 'https://esm.sh/@piprail/sdk'
// In a browser, sign with the visitor's wallet (e.g. MetaMask) — never a raw key.
const client = new PipRailClient({ chain: 'base', wallet: { walletClient } })
const res = await client.fetch('https://api.example.com/paid') // 402 → pays → 200
</script>