Drop our x402.js script tag on any page. Every API call from that page becomes pay-per-call USDC on Base 8453. Hive collects 5 bps + per-call receipt fee. The merchant keeps the rest.
<!-- Drop this into <head> --> <script src="https://thehiveryiq.com/cdn/x402.js" data-merchant="0xYourBaseAddress" data-paths="/api/*" data-price-usd="0.01"></script>
That's it. Every fetch() call to a path matching /api/* from this page is now 402-gated. When your backend returns a 402, x402.js triggers a pay flow, settles via Hive's verifier, and retries the original request with an access token.
// Your backend (already done — Hive provides /v1/x402/proof/submit) // 1. Browser calls /api/expensive-thing // 2. Backend returns 402 with: {nonce, amount_usd, recipient, chain, asset} // 3. x402.js prompts the user (or hands off to your CFG.onPay) // 4. Wallet signs USDC transfer on Base 8453 // 5. x402.js POSTs proof to Hive: {nonce, payer, chain, tx_hash} // 6. Hive returns {access_token, expires_in_seconds} // 7. x402.js retries the original request with X-Hive-Access: <token> // 8. Backend serves the response — you keep 99.5% of the money.
No frontend needed. Three terminal commands and you've completed a full 402 → proof → access cycle against Hive's live production endpoint.
Step 1 — Get a 402 quote
curl -s https://hivemorph.onrender.com/v1/x402/quote \
-H 'Content-Type: application/json' \
-d '{"resource":"premium-receipt","amount_usd":0.01}'
# returns: {"nonce":"...", "amount_usd":0.01, "recipient":"0x15184...436E", "chain":"base-8453", "asset":"USDC"}
Step 2 — Send USDC on Base 8453
# From any wallet (Coinbase Wallet, Rabby, Metamask + Base RPC): # Send 0.01 USDC to 0x15184Bf50B3d3F52b60434f8942b7D52F2eB436E # USDC contract on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 # Save the tx_hash from your wallet.
Step 3 — Submit proof, get access token
curl -s -X POST https://hivemorph.onrender.com/v1/x402/proof/submit \
-H 'Content-Type: application/json' \
-d '{
"nonce":"<from step 1>",
"tx_hash":"<from step 2>",
"payer":"<your wallet address>",
"chain":"base-8453"
}'
# returns: {"access_token":"...", "expires_in_seconds":3600, "receipt_id":"..."}
The returned access_token is your gate to the paid resource. The receipt_id is your proof-of-payment, independently verifiable at /verify/ by anyone.
Production integrators register an onPay handler that turns the quote into a real wallet signature.
window.HiveX402.onPay = async (quote) => { // quote: {amount_usd, merchant, chain, asset, nonce, recipient} const tx = await wallet.sendUSDC({ to: quote.recipient, amount: quote.amount_usd, chain: 'base-8453' }); return { tx_hash: tx.hash, payer: wallet.address, nonce: quote.nonce }; };
0.05% on settlement value. On a $0.01 call we collect $0.000005.
Per signed call receipt. Anchored to Base 8453. Tamper-evident.
No platform fee. No monthly. No exclusivity. Bring your own wallet.
| Cost on a $0.01 call | Stripe | Coinbase Commerce | Hive x402 |
|---|---|---|---|
| Per-tx fee | $0.30 fixed + 2.9% | 1.0% | 5 bps + $0.0001 |
| Effective on $0.01 | $0.3029 | $0.0001 (subsidized) | $0.000105 |
| Settlement rail | Card networks | USDC on Base/Polygon | USDC on Base 8453 |
| Per-call signed receipt | No | No | ML-DSA-65 + Ed25519 |
| Drop-in (no backend rewrite) | No | No | Yes — one script tag |
Once you install, your wallet address is the merchant key. Track call volume, paid passes, and revenue at /v1/x402/stats (public JSON). Hive's clip is netted automatically — you receive your share at settlement.