
Using HTTP 402 Payment Required as a signal, complete pay-per-use/volume access with stablecoins (USDC) for APIs, web pages, and AI agents.
Simple, fast, and secure HTTP 402 payment protocol implementation
Flexible pricing, upgrade anytime, pay-as-you-go
fetch(endpoint, { method })
.then(r => r.status === 402 ? r.json() : r)
.then(async meta => {
// meta: { amount: 0.25, token: 'USDC', chain: 'BNB', to: '0x...' }
await wallet.pay(meta);
return fetch(endpoint, { method });
})
.then(r => r.json())
.then(data => console.log('OK', data));