Make any API endpoint paid
APISettle uses the standard HTTP 402 Payment Required status code to turn any endpoint into a paid service. No SDK required — just REST.
export default async function handler(req, res) {
const token = req.headers['x-settlement-token']
if (!token) {
// No payment — return 402 with a quote
const quote = await createQuote({ service_id: SVC, quote_amount: '500000' })
return res.status(402).json({ quote_token: quote.quote_token })
}
// Payment present — redeem and deliver
const { status } = await redeemSettlement(req.headers['x-settlement-id'], token)
if (status !== 'redeemed') return res.status(402).json({ error: 'payment_failed' })
return res.json({ data: 'your paid response' })
} Standard HTTP 402 — callers know they need to pay. Agents, bots, and CLIs handle it automatically.
Sub-second settlement — on-chain USDC transfers on Solana, confirmed before the response returns.
No SDK required — plain fetch() or curl. Works with any language or framework.
How it works
Every payment follows the same three-step cycle. This pattern is the same whether you're charging for an API call, a bot interaction, or a long-running job.
- 1 Quote — Your service creates a payment request specifying amount, terms, and expiry. Returns a signed quote token.
- 2 Settle — The buyer submits the quote token to APISettle. Payment settles on-chain in under a second.
- 3 Redeem — Your service redeems the settlement token to confirm payment. One-time use, atomic, replay-proof.
Get started
See the quickstart guide to get your first payment working in five minutes, or the API reference for complete endpoint documentation.