Introduction

PayGate is the open protocol for autonomous AI-to-API micro-payments on the Stellar network. It enables AI agents and developers to pay for API access programmatically using the x402 protocol and USDC stablecoin — with zero manual intervention.

The Problem

The modern API economy is designed for humans. When an autonomous AI agent needs access to a premium API, it encounters a hard wall:

  • It cannot hold a credit card or bank account.
  • It cannot sign up for a SaaS subscription.
  • It cannot store and rotate API keys safely.

A human developer must manually intervene — entering billing details, generating API keys, and hardcoding secrets into the agent. This breaks the autonomy of AI.

The Solution

PayGate implements the HTTP 402 Payment Required standard to create a native, machine-readable payment layer for APIs:

  1. An AI agent calls a PayGate-protected API endpoint.
  2. PayGate responds with 402 Payment Required and a signed invoice in the x402 header.
  3. The agent reads the invoice, constructs a USDC micro-transaction on Stellar, and retries the request.
  4. PayGate verifies the payment on-chain and forwards the request to the developer's backend.

Who Is This For?

API Developers

Turn any backend URL into a monetized, publicly-discoverable API in minutes. No billing infrastructure, no API key management. Register your endpoint, set a price per call in USDC, and PayGate handles the rest.

AI Agent Builders

Give your agents access to premium data sources with a single line of code. The @x402/fetch SDK wraps the native fetch API and handles the entire payment negotiation transparently.