Summary
This tutorial from Bri covers the provider side of Pay.sh — how developers can add per-request monetization to their own APIs using HTTP 402 Payment Required, without building traditional billing infrastructure like accounts, OAuth, or Stripe integrations. Using the Pay CLI’s `pay server scaffold` command, she generates a gateway config file that defines free and paid endpoints, sets per-request prices, and acts as both a payment gate and an allowlist (any unlisted endpoint returns 404).
The walkthrough covers starting the Pay server locally with `pay server start`, testing a free health endpoint with plain curl, then hitting a paid endpoint first with a raw curl (returning a 402 challenge with payment instructions) and then with `pay curl` (which completes the payment handshake and returns the resource). Two advanced features get detailed coverage: split endpoints, where a single API call automatically distributes revenue across multiple recipients such as operators, affiliates, and partners; and proxy mode, where the gateway forwards authenticated requests to an upstream API while keeping the upstream credentials hidden from the paying client.
For developers building APIs intended to be consumed by AI agents — or anyone looking to monetize data or compute endpoints without a full SaaS billing layer — Pay offers a path to instant paywalling that fits naturally into the HTTP request-response model. The sandbox mode with test funds makes local development straightforward before moving to mainnet Solana payments.
📺 Source: bri · Published May 07, 2026
🏷️ Format: Tutorial Demo







