Gateways Overview
PayWeave Gateways are reverse proxies that add MPP payment gating to any upstream API - no code changes required.
Agent → PayWeave Gateway → Your API
(402 check) (upstream)When to use Gateways
Gateways are ideal when you already have a running API and want to monetize it without touching the codebase. They work with any HTTP service - REST APIs, GraphQL endpoints, legacy services, or third-party APIs you are reselling.
Gateways vs Apps vs Functions
| Apps | Gateways | Functions | |
|---|---|---|---|
| Code changes | Middleware per route | None | Write handler code |
| Pricing config | In code | Dashboard UI | Dashboard UI |
| Dynamic pricing | Per-request (function) | Per-endpoint | Per-handler |
| Latency | In-process | +1 hop (proxy) | Managed (edge) |
| Custom logic | Full control | None | Full control |
| Infrastructure | You manage | You manage upstream | Fully managed |
Key concepts
Gateway - A reverse proxy configuration pointing to one upstream base URL.
Endpoint - A path within the gateway with its own pricing, methods, and routing rules.
Upstream - The target API that receives proxied requests after payment verification.
Path matching - How gateway routes map to upstream paths. Supports exact match and wildcard mode.
Creating a Gateway
From the dashboard, navigate to Gateways → Create Gateway. You will configure:
| Field | Required | Description |
|---|---|---|
| Name | Yes | A human-readable label for the gateway |
| Upstream URL | Yes | Base URL of your API (e.g. https://api.example.com) |
| Authentication | No | How PayWeave authenticates with your upstream (none, header, query, basic) |
How the proxy works
When a caller sends a request to a Gateway endpoint:
1. PayWeave checks for a valid payment credential in the Authorization header. If missing, it responds with 402 Payment Required including the endpoint price and MPP instructions.
2. The caller submits payment on Tempo and retries with Authorization: Payment <credential>.
3. PayWeave verifies the payment, then proxies the request to your upstream URL with the configured authentication credentials.
4. The upstream response is returned to the caller with a Payment-Receipt header attached.
Gateway URLs
Each gateway receives a unique URL in the format:
https://gw.payweave.com/<gateway-id>/<endpoint-path>Callers use this URL instead of your upstream directly. The upstream URL is never exposed to callers, and all authentication credentials stay server-side.
PayWeave