Why API Keys & Subscriptions Are Broken
Before we understand PayGate, we need to understand the problem it solves. Imagine you're building an app that needs weather data. Here's what the old world looks like:
You find a Weather API you want
Great! They charge $0.001 per call
Sign up, verify your email, fill a form
Just to try it once
Enter your credit card
They require a $10/month minimum
Get an API key — store it securely
Hope it never leaks or expires
Track usage manually
Hope you don't exceed your plan
Do this 20x for 20 different APIs
For every service your app needs
x402 — The HTTP Status Code That Was Forgotten
Here's something wild: the HTTP specification has had a 402 Payment Required status code since 1999. It was designed for exactly this use case — paying for internet resources on-demand. But it was never used because there was no internet-native money yet.
How x402 Works — Request/Response Flow
Client → GET /api/x/weather-london
Normal request, no payment yet
Server → 402 Payment Required
X-Payment-Required: {"amount":"0.001", "currency":"USDC", "dest":"G...wallet"}
Client signs a Stellar micropayment
Wallet creates a transaction for exactly $0.001 USDC
Client → GET /api/x/weather-london
X-Payment: {"signature":"abc123..."}
Server → 200 OK + weather data
Payment verified, request proxied, developer earns USDC
Why Stellar? Why USDC?
For API micropayments to work, the money layer needs to be fast, cheap, and stable. Here's why PayGate chose Stellar and USDC specifically:
~5 second finality
Stellar settles transactions in under 5 seconds. Ethereum takes minutes. You can't make an API wait that long.
Near-zero fees
Each Stellar transaction costs $0.0000001. Paying $0.001 for an API call doesn't work if the gas fee is $0.01.
USDC — Stable value
Developers earn in USDC (USD Coin), not volatile crypto. $0.001 today is $0.001 tomorrow.
Soroban smart contracts
Stellar's Soroban smart contract platform verifies each payment on-chain, making the entire flow trustless.
🌐 What is a Stellar wallet?
A Stellar wallet is like your bank account on the blockchain — but you own the private key (no bank involved). It's identified by a public address like GBZXN7PIRZGNMHGA7.... When you connect your wallet to PayGate, we can see your address but we never have access to your private key. You sign transactions locally on your device.
PayGate — The Middleware That Connects Everything
Building all of the above from scratch would take months. PayGate is a hosted proxy that handles the entire x402 flow for you. Think of it as a smart gateway that sits in front of any existing API.
Architecture Overview
Payment Interception
PayGate intercepts every request, checks for a valid x402 payment signature before forwarding.
On-chain Verification
The Stellar transaction is verified against our Soroban smart contract in real time.
Instant Earnings
USDC goes directly to the developer's Stellar wallet. No escrow, no delays.
How to List Your API on PayGate
You already have an API. Maybe it's a weather endpoint, a data aggregator, or an AI model. Here's how you turn it into a paid service in under 5 minutes — no code changes needed.
Connect Your Stellar Wallet
Click "Get Started" on the top right. You'll be asked to sign a challenge message with your Stellar wallet. This proves you own the wallet address — we never store your private key.
Register Your API Endpoint
In your dashboard, click "New API". Fill in a name, description, your existing API's URL, and the price you want to charge per call in USDC.
Name: Weather API London URL: https://your-backend.com/weather Price: 0.001 USDC per call Visibility: Public
Get Your Paywalled Endpoint
PayGate instantly generates a public endpoint for you. Share this URL — it's the one callers will use. Every request through it will require a valid Stellar micropayment.
https://paygate.app/api/x/weather-london
Start Earning USDC
That's it! Every time someone calls your endpoint with a valid x402 payment, the USDC is sent to your Stellar wallet instantly. Check your dashboard for real-time analytics and earnings.
How to Call a Paid API
Whether you're building an app or an AI agent, consuming a PayGate API requires just two things: an x402-compatible client and a funded Stellar wallet. No signup. No API key. Pay only for what you use.
Try It Live — No Setup Needed
Go to the Marketplace and click "Try in Playground" on any API. Our playground environment has a pre-funded test wallet — you can see the full x402 payment flow happen in real time with zero setup.
Fund Your Stellar Wallet
For production use, you need a Stellar wallet funded with USDC on testnet. You can get free testnet USDC using Stellar's Friendbot, or use real USDC on mainnet.
# Fund your testnet wallet (free) curl "https://friendbot-testnet.stellar.org?addr=YOUR_WALLET_ADDRESS"
Install the x402 Client
Use the open-source x402 client SDK. It wraps your standard fetch() calls and automatically handles the 402 payment negotiation in the background.
npm install x402-fetch
import { wrapFetch } from 'x402-fetch';
import { Keypair } from '@stellar/stellar-sdk';
// Your Stellar wallet keypair
const keypair = Keypair.fromSecret('YOUR_SECRET_KEY');
const fetch402 = wrapFetch(fetch, keypair);
// Make a normal API call — payment happens automatically
const res = await fetch402('https://paygate.app/api/x/weather-london');
const data = await res.json();
console.log(data); // { temp: 18, condition: "Cloudy" }Behind the Scenes
Here's what happens automatically when you call fetch402():
- Your client sends a normal GET request
- PayGate responds with 402 + payment details
- The x402 client builds a $0.001 USDC Stellar transaction
- Signs it with your wallet's private key (locally — never sent to us)
- Retries the request with the payment signature in the header
- PayGate verifies the signature on Stellar's blockchain
- Your request is proxied to the real API
- You receive the response data instantly
The Full Picture in 6 Bullets
API keys and subscriptions are a broken model for the agentic internet
The x402 protocol revives HTTP 402 as a machine-readable payment standard
Stellar is the ideal money rail — fast, cheap, and supports stable USDC
PayGate is a hosted proxy that wraps any existing API with x402 payments
Developers list their API, set a price, and earn USDC per call — no code changes
Callers use the x402-fetch SDK to pay micropayments automatically with any wallet
Ready to Try It?
Explore the live marketplace to see real APIs in action, or connect your wallet and list your first API — it takes 5 minutes.