Accept payments from AI agents

No merchant fees. No signup. Return a 402, get paid.

Your API is getting hit by agents. They're rate limited. They'd pay to get through. PixelPay lets them.

01How it works

Three steps. No PixelPay account required on your side.

Agent hits your rate limit
GET /api/data?q=acme // Agent gets rate limited on your API
You return a 402 with payment instructions
HTTP/1.1 402 Payment Required Content-Type: application/json { "error": "payment_required", "pixelpay": { "endpoint": "https://api.pixelpay.dev/v1/pay", "to": "your-merchant-id", "amount": 0.005, "memo": "priority/data?q=acme" } }
Agent pays and retries
POST https://api.pixelpay.dev/v1/pay {"to": "your-merchant-id", "amount": 0.005, "memo": "priority/data?q=acme"} // Response: {"ok": true, "id": "tx_9k2f"}
Agent retries with payment proof
GET /api/data?q=acme X-PixelPay-Tx: tx_9k2f // You verify the transaction, serve the request

02The 402

HTTP 402 Payment Required has been in the spec since HTTP/1.1. It was "reserved for future use." This is that use.

The response body must be self-contained. The agent has never heard of you. It needs everything in one JSON object:

endpoint

The exact URL to POST the payment to. Always https://api.pixelpay.dev/v1/pay

to

Your merchant ID. This is where the money goes.

amount

How much to pay, in USD. You set the price.

memo

What the payment is for. Use it to identify the request when verifying.

The agent already has a PixelPay API key — its developer configured that. Your 402 just tells it where to send the payment.

03Copy-paste templates

Drop these into your existing error responses.

Rate limit bypass

Agent pays to skip the queue when you're overloaded.

{ "error": "rate_limited", "retry_after": 60, "pixelpay": { "endpoint": "https://api.pixelpay.dev/v1/pay", "to": "your-merchant-id", "amount": 0.005, "memo": "priority/queue-skip" } }

Paywall / content access

Agent pays to read a specific piece of content.

{ "error": "payment_required", "resource": "/articles/8821", "pixelpay": { "endpoint": "https://api.pixelpay.dev/v1/pay", "to": "your-merchant-id", "amount": 0.01, "memo": "article/id=8821" } }

Spam gate

Tiny payment as proof of legitimate intent. Replaces CAPTCHAs.

{ "error": "verification_required", "pixelpay": { "endpoint": "https://api.pixelpay.dev/v1/pay", "to": "your-merchant-id", "amount": 0.0001, "memo": "access/gate" } }

Premium API tier

Higher-quality results or faster processing for a fee.

{ "error": "premium_required", "free_result": "...", "pixelpay": { "endpoint": "https://api.pixelpay.dev/v1/pay", "to": "your-merchant-id", "amount": 0.02, "memo": "premium/enhanced-results" } }

04Verify payments

When the agent retries with a transaction ID, verify it before serving the request.

// Agent sends: GET /api/data?q=acme X-PixelPay-Tx: tx_9k2f // You verify: GET https://api.pixelpay.dev/v1/tx/tx_9k2f // Response: { "ok": true, "id": "tx_9k2f", "to": "your-merchant-id", "amount": 0.005, "memo": "priority/data?q=acme", "paid": true }

Check that to matches your merchant ID, amount meets your price, and paid is true. Then serve the request.

No merchant account needed

Register a merchant ID. Payments accumulate. Withdraw anytime. No paperwork.

No fees on your side

Zero merchant fees. The agent's developer paid the $1 top-up fee. You receive the full amount.

You set the price

The amount in your 402 response is your price. No negotiation, no tiers.

05Drop-in libraries

One-line middleware for every major framework. Works alongside your existing CAPTCHA — agents get the PixelPay path, humans get the CAPTCHA.

Express / Node.js

import { pixelpay } from '@pixelpay/express'; app.use(pixelpay({ merchantId: 'your-merchant-id', amount: 0.005, fallback: 'captcha' // humans get CAPTCHA, agents get 402 }));

FastAPI / Python

from pixelpay import PixelPayMiddleware app.add_middleware(PixelPayMiddleware, merchant_id="your-merchant-id", amount=0.005, fallback="captcha" )

Rails

# config/application.rb config.middleware.use PixelPay::Middleware, merchant_id: 'your-merchant-id', amount: 0.005, fallback: :captcha

Go

import "github.com/pixelpay/go-pixelpay" mux.Use(pixelpay.Middleware(pixelpay.Config{ MerchantID: "your-merchant-id", Amount: 0.005, Fallback: "captcha", }))

How fallback works

The middleware detects whether the request is from an agent or a human browser. Agents get a 402 with payment instructions. Humans get your existing CAPTCHA or login flow. Both paths coexist — you don't have to choose.

Agent request

No cookies, no browser headers → return 402 with pixelpay object. Agent pays and retries.

Human request

Browser detected → fall through to your existing CAPTCHA, login, or paywall. Nothing changes for human users.

06Why accept PixelPay

01

Monetize agent traffic

Agents are already hitting your API. Right now that's a cost. PixelPay turns it into revenue.

02

Replace CAPTCHAs

Agents can't solve CAPTCHAs but they can pay. A $0.0001 gate filters bots without blocking legitimate agents.

03

Protect your IP

Payment creates a contract. Content accessed via PixelPay is licensed, not scraped. Your IP becomes enforceable.

04

Fund your infrastructure

Agent traffic is growing. Priority access fees fund the scaling you need to handle it.