Product Developers Blog Pricing GitHub ↗ Start building →

Monetize
any API with
machine
payments.

Open-source toolkit for accepting payments from AI agents, apps, and humans on Solana. Built on MPP. Ship a paid API in 60 seconds.

paytoll.config.ts
1// paytoll.config.ts
2import { defineConfig } from '@paytoll/sdk'
3
4export default defineConfig({
5 recipient: 'So1ana...Wa11et',
6 network: 'mainnet-beta',
7 endpoints: [
8 {
9 path: '/api/search',
10 price: '0.01',
11 currency: 'USDC',
12 mode: 'charge'
13 }
14 ]
15})
$ npx paytoll dev
Built on
Solana Stripe

How it works

PayToll wraps the Solana MPP SDK into middleware. Define endpoints, set prices, deploy. Three steps.

Install & configure

Add PayToll to any Node.js project. Define which endpoints cost money.

$ npm install @paytoll/sdk
$ npx paytoll init
Created paytoll.config.ts
Ready to configure

Add middleware

Three lines. 402 challenges, verification, fee sponsorship, receipts — all handled.

import { paytoll }
from '@paytoll/sdk'
app.use(paytoll(config))
// Every route is now gated

Ship & earn

Deploy anywhere Node runs. Monitor payments via dashboard.

$ npx paytoll dev
Server on :3000
3 endpoints gated
Dashboard on :3001

Features

Everything to turn any API into a paid service. Open source. Free forever.

Drop-in payment gating

Express, Hono, Next.js middleware. Charge mode for one-time. Session mode for streaming metered access.

// Express — gate any endpoint
import { paytoll } from '@paytoll/sdk'
app.use('/api/search', paytoll({
price: '0.01',
currency: 'USDC',
mode: 'charge'
}))

Terminal-first CLI

Scaffold, test, simulate, monitor from terminal.

$ paytoll init
$ paytoll dev
$ paytoll test
Revenue: $4.27
Sessions: 12

Real-time dashboard

Self-hosted Next.js. Revenue charts, tx feed with Solana explorer links, active sessions.

Charge & Session

One-time per call. Streaming payment channels for metered, sub-cent access. Fee sponsorship.

MIT Licensed. Free.

Entire toolkit open source. Self-host everything. No vendor lock-in. Fork it, build on it.

HTTP 402 — the way payments
were supposed to work.

Reserved since 1997, never standardized until now. PayToll implements the Solana payment method for this IETF-submitted open standard.

Agent requests

AI agent sends a standard HTTP request to your paid endpoint.

GET /api/search

402 Challenge

Server returns 402 with payment details — amount, currency, recipient.

402 Payment Required

Agent pays

Agent signs a Solana transaction. Submits proof of payment.

Authorization: Payment

Access granted

Server verifies on-chain. Returns resource with receipt.

200 OK + Receipt

Your API should
make money.

Install PayToll. Define prices. Deploy.
Agents pay you directly.

$ npm install @paytoll/sdkcopy

Blog

Thoughts on machine payments, agent economics, and building in the open.

March 23, 2026

Why HTTP 402 is finally happening — and what it means for developers

The status code reserved in 1997 for "Payment Required" was never standardized. Stripe and Tempo just changed that with MPP. Here's why it matters and how PayToll fits in.

Read post →
March 22, 2026

The agent economy needs infrastructure, not more agents

Everyone is building AI agents. Almost nobody is building the payment rails they need. We looked at 41 hackathon projects and found a massive gap.

Read post →
March 21, 2026

Building PayToll: from Solana Foundation research to open-source launch

How we went from auditing 61 Solana Foundation repos to building the first developer toolkit for machine payments. A build log.

Read post →
← Back to blog

Why HTTP 402 is finally happening — and what it means for developers

HTTP 402 Payment Required has existed since 1997. It was reserved in the original HTTP/1.1 spec with a note that said "reserved for future use." For 29 years, that future never came. Until five days ago.

On March 18, 2026, Stripe and Tempo Labs jointly launched the Machine Payments Protocol (MPP) — an open standard that finally gives HTTP 402 a real specification. It was submitted to the IETF. Visa, Anthropic, OpenAI, Mastercard, and Shopify have already integrated. Over 100 services launched in the MPP directory on day one.

What MPP actually does

The core idea is elegant. When an AI agent (or any HTTP client) requests a resource that costs money, the server responds with 402 Payment Required and a challenge describing the payment needed — amount, currency, recipient wallet. The client fulfils the payment, retries with proof, and gets access.

Think of it as OAuth for money. Authenticate once, transact programmatically within defined limits.

There are two payment modes. Charge is one-time: pay per request, like buying a single API call. Session is streaming: open a payment channel, deposit funds upfront, and the agent consumes resources with micropayments settling continuously. Thousands of small transactions aggregate into a single on-chain settlement.

Why it matters for developers

Right now, if you want to monetize an API, you need Stripe billing, API key management, a signup flow, a dashboard for customers, webhook handlers, and probably a dozen other things. The overhead is enormous for what should be a simple operation: "give me data, I'll give you money."

MPP collapses all of that into the HTTP layer itself. No signup. No API keys. No billing portal. The payment IS the authentication. An agent with a funded wallet can use any MPP-enabled service instantly — the same way a browser fetches any public webpage.

Where PayToll fits

MPP defines the protocol. The Solana Foundation has an SDK (@solana/mpp) that implements it. But there's a gap between "here's an SDK" and "my API accepts payments." That gap is developer experience — the middleware, the CLI, the dashboard, the testing tools.

PayToll fills that gap. Three lines of code to gate any Express, Hono, or Next.js endpoint. A CLI to scaffold and test. A dashboard to monitor revenue. All open source, all free.

We think this is the beginning of a new class of web service — APIs that are paid by default, used by machines, and accessible to anyone with a wallet. No accounts. No contracts. Just HTTP and money.

← Back to blog

The agent economy needs infrastructure, not more agents

Tempo ran a hackathon last week. 41 teams built projects on MPP. We studied every single one. The pattern was striking: almost every project built an agent that pays for things. Almost nobody built the tools that let you get paid.

The demand/supply imbalance

The agent side is crowded. There are agents ordering flowers, agents doing deep research, agents trading DeFi, agents playing games with micropayments. The infrastructure side? Nearly empty.

A few projects touched infrastructure — a reverse proxy for micropayments, an API gateway wrapper, a reputation scoring system. But nobody built the "create-react-app for MPP" — the developer-first toolkit that makes it trivially easy to create a paid API.

Supply creates its own demand

Every new paid API endpoint is a new service an agent can consume. The more services available through MPP, the more useful agents become. The more useful agents become, the more demand there is for services. It's a flywheel — but right now, the supply side is stuck because the tooling doesn't exist.

What we're building

PayToll is supply-side infrastructure. We make it trivially easy to turn any existing API into a paid MPP service. Install a package, define your prices in a config file, deploy. Your API now accepts payments from any agent, app, or human with a Solana wallet.

The protocol exists. The demand is building. What's missing is the developer experience that turns "I have an API" into "agents pay to use my API." That's the entire product.

← Back to blog

Building PayToll: from Solana Foundation research to open-source launch

This is a build log. How we went from zero to shipping the first developer toolkit for machine payments on Solana.

The research phase

It started with an audit of the Solana Foundation's GitHub. All 61 repositories. We mapped every active project, identified gaps, and looked for where developer tooling was missing around their newest initiatives.

Three things jumped out. First, the MPP SDK (@solana/mpp) had just been published — 35 stars, 3 contributors, actively maintained. Second, Surfpool (their local dev environment) was their most-starred new tool at 524 stars. Third, their solana-dev-skill repo (Claude Code skill for Solana) had 403 stars, signaling a clear bet on AI-assisted development.

Finding the gap

The MPP SDK exists, but there's no developer platform around it. No middleware package. No CLI. No dashboard. No testing tools. If you want to build an MPP-enabled API today, you're reading raw SDK source code and wiring everything together yourself.

Meanwhile, Tempo's hackathon had 41 projects — overwhelmingly agent-side. The supply-side toolkit was completely missing.

The stack

We chose a stack that matches the Solana developer ecosystem: TypeScript throughout, @solana/mpp as the core dependency, Surfpool for local testing, Helius for transaction indexing, Next.js for the dashboard. Everything MIT licensed.

What's next

Week 1 was the middleware and CLI. Week 2 is the dashboard. Week 3 adds Session mode support. Week 4 is docs, examples, and launch content. We're building in the open — every commit is on GitHub. Follow along.

PayToll Documentation

The open-source developer toolkit for machine payments on Solana. Everything you need to monetize any API using the Machine Payments Protocol.

Note: PayToll is in active development. The MPP spec is not yet finalized — APIs and wire formats are subject to change. Follow our GitHub for updates.

Overview

PayToll is a TypeScript toolkit that wraps the Solana Foundation's @solana/mpp SDK into production-ready middleware, CLI tools, and a monitoring dashboard. It enables any Node.js API to accept payments from AI agents, applications, and humans using the HTTP 402 Payment Required flow.

Architecture

// PayToll Architecture

┌─────────────────────────────────────────┐
│           Your API Server               │
│                                         │
│  ┌─────────────┐  ┌─────────────────┐  │
│  │  PayToll    │  │  Your Handlers  │  │
│  │  Middleware  │→ │  (business      │  │
│  │             │  │   logic)        │  │
│  └──────┬──────┘  └─────────────────┘  │
│         │                               │
│  ┌──────▼──────┐                        │
│  │  @solana/   │                        │
│  │  mpp SDK    │                        │
│  └──────┬──────┘                        │
│         │                               │
└─────────┼───────────────────────────────┘
          │
    ┌─────▼─────┐
    │  Solana   │
    │  Network  │
    └───────────┘

Key Concepts

ConceptDescription
ChargeOne-time payment per request. Client pays, gets access to a single response. Best for discrete API calls.
SessionStreaming payment channel. Client deposits funds upfront, consumes resources with micropayments. Best for metered/streaming access.
402 ChallengeServer response describing what payment is needed — amount, currency, recipient. The client fulfils this to get access.
CredentialProof of payment sent by the client in the Authorization header. Contains the signed Solana transaction.
ReceiptServer response header confirming payment was verified and access is granted.
Fee SponsorshipServer pays Solana transaction fees on behalf of the client. Client only pays the transfer amount.

Quickstart

Get a paid API running locally in under 5 minutes.

Prerequisites

  • Node.js 20+
  • A Solana wallet (for receiving payments)
  • Surfpool (for local testing) — curl -fsSL https://run.surfpool.run | sh

Step 1: Install

$ npm install @paytoll/sdk
$ npx paytoll init

This creates a paytoll.config.ts file in your project root.

Step 2: Configure

// paytoll.config.ts
import { defineConfig } from '@paytoll/sdk'

export default defineConfig({
  recipient: 'YOUR_SOLANA_WALLET_ADDRESS',
  network: 'devnet',
  endpoints: [
    {
      path: '/api/search',
      price: '0.01',
      currency: 'USDC',
      mode: 'charge'
    }
  ]
})

Step 3: Add middleware

// server.ts
import express from 'express'
import { paytoll } from '@paytoll/sdk/express'
import config from './paytoll.config'

const app = express()
app.use(paytoll(config))

app.get('/api/search', (req, res) => {
  // This only runs after payment is verified
  res.json({ results: ['result1', 'result2'] })
})

app.listen(3000)

Step 4: Test locally

# Terminal 1: Start Surfpool
$ surfpool start

# Terminal 2: Start your server
$ npx paytoll dev

# Terminal 3: Test with built-in client
$ npx paytoll test /api/search

Configuration Reference

OptionTypeDefaultDescription
recipientstringSolana wallet address for receiving payments (required)
networkstring'devnet''devnet' | 'mainnet-beta'
endpointsarray[]Array of endpoint configurations
feePayerstring?Base58 keypair for fee sponsorship (optional)
rpcUrlstring?autoCustom Solana RPC endpoint
secretKeystring?autoHMAC key for signing 402 challenges

Endpoint Configuration

OptionTypeDescription
pathstringURL path to gate (e.g. '/api/search')
pricestringAmount to charge (e.g. '0.01' for 1 cent)
currencystring'USDC' | 'SOL' | SPL token mint address
modestring'charge' (one-time) | 'session' (streaming)
meterstring?For session mode: meter name (e.g. 'api_calls')

Charge Mode

Charge mode implements one-time payments. Each request requires a separate payment. The flow is:

Client → GET /api/search
Server → 402 { amount: "0.01", currency: "USDC", recipient: "..." }
Client → [signs Solana tx, sends USDC]
Client → GET /api/search + Authorization: Payment [credential]
Server → [verifies tx on-chain] → 200 { results: [...] }

Session Mode

Session mode implements streaming payment channels using voucher-based micropayments. The client opens a channel with a deposit, then sends updated vouchers with each request. The cumulative amount increases monotonically.

Client → GET /api/stream
Server → 402 { mode: "session", deposit: "1.00", pricing: {...} }
Client → [opens channel, deposits 1.00 USDC]
Client → GET /api/stream + Authorization: Payment [voucher: 0.01]
Server → 200 { data: "chunk 1" }
Client → GET /api/stream + Authorization: Payment [voucher: 0.02]
Server → 200 { data: "chunk 2" }
...
Client → POST /close-session
Server → [settles on-chain with final voucher]

Security Model

PayToll's security model builds on Solana's cryptographic guarantees.

  • Replay protection: Each transaction signature can only be used once. PayToll tracks consumed signatures to prevent replay attacks.
  • HMAC challenges: 402 challenges are signed with an HMAC secret key. Clients cannot forge or modify challenges.
  • On-chain verification: Every payment is verified on the Solana blockchain before access is granted. No trust assumptions.
  • Transaction simulation: Transactions are simulated before broadcast to prevent wasted fees from invalid payments.
  • Session nonces: Voucher-based sessions use monotonic counters that prevent double-spending within a channel.

CLI Commands

CommandDescription
paytoll initCreate a paytoll.config.ts file in the current directory
paytoll devStart dev server with Surfpool integration + dashboard
paytoll test [path]Simulate an agent payment against an endpoint
paytoll statusShow revenue, active sessions, endpoint health
paytoll buildBuild for production deployment

Examples

Working example servers you can clone and run immediately.

Weather API

A simple Express server that charges 0.01 USDC per weather lookup.

// examples/weather/server.ts
import express from 'express'
import { paytoll } from '@paytoll/sdk/express'

const app = express()

app.use('/api/weather', paytoll({
  price: '0.01',
  currency: 'USDC',
  mode: 'charge'
}))

app.get('/api/weather/:city', async (req, res) => {
  const data = await fetchWeather(req.params.city)
  res.json(data)
})

app.listen(3000)

AI Inference

Session-mode endpoint for metered AI model access — pay per token.

// examples/inference/server.ts
app.use('/api/generate', paytoll({
  price: '0.001',
  currency: 'USDC',
  mode: 'session',
  meter: 'tokens'
}))

MCP Tool Monetization

Wrap any MCP server tool with PayToll to charge per tool call.

// examples/mcp-tool/server.ts
// Gate MCP tool calls via MPP's JSON-RPC transport
app.use('/mcp', paytoll({
  price: '0.05',
  currency: 'USDC',
  mode: 'charge'
}))

Free. Open source.
No catch.

PayToll is a free, MIT-licensed developer tool. No paid tiers. No platform fees. No transaction cuts. Everything is yours.

$0
forever · no limits · MIT license
  • Full SDK & Express/Hono middleware
  • CLI tools — init, dev, test, status
  • Real on-chain Solana payment verification
  • Charge mode (one-time) & Session mode (streaming)
  • SOL and USDC support
  • Unlimited endpoints & transaction volume
  • Fee sponsorship (server pays gas)
  • Replay protection & HMAC challenge signing
  • Full source code on GitHub
  • Community support via GitHub Issues
Start building →
$ npm install @paytoll/sdk copy