How It Works
From zero to revenue in four steps
PayFence sits between your API consumers and your origin server. Whether you choose proxy mode or middleware mode, the setup follows the same four-step pattern.
Connect your API origin
Tell PayFence where your API lives. Enter your origin URL in the dashboard and we'll configure the gateway. We support any HTTP endpoint — REST, GraphQL, gRPC-web, or custom protocols.
PayFence never requires access to your source code or deployment pipeline. We only need a reachable URL and optional health check path. The connection is verified in seconds with a lightweight ping.
For proxy mode, you'll also configure a shared HMAC secret so your origin can verify that requests come from PayFence. This ensures no one can reach your API by going around the gateway.
Dashboard
Origin URL
PayFence Gateway
Configured
Your API
api.yoursite.com
Plan Configuration
Define plans and quotas
Create pricing tiers in the PayFence dashboard. Each plan has a name, price, billing period, and request quota. Charge per request, per month, or per feature — whatever fits your business model.
Quotas can be hard limits (block after N requests) or soft limits (allow overages and bill accordingly). You can also define rate limits to protect against burst traffic from any single consumer.
Plans are connected to Stripe via PayFence's Stripe Connect integration. When a consumer subscribes, Stripe handles the payment and PayFence automatically provisions their API token with the correct quota.
Deploy your gateway
Choose how you want to integrate. In proxy mode, you give agents a PayFence gateway URL. Agents never see your origin. PayFence validates tokens, enforces quotas, and forwards valid requests with HMAC-signed headers.
In middleware mode, agents call your API directly at your own domain. Your server makes a single API call to PayFence's POST /v1/authorize endpoint to validate the token and check quota before processing the request.
Both modes are production-ready from day one. Proxy mode is the fastest path to launch: no code changes required. Middleware mode gives you full control over the request lifecycle.
Proxy Mode
Middleware Mode
Revenue Dashboard
Last 7 days
Earn revenue from day one
As soon as your gateway is live, agents can subscribe to your plans and start making API calls. Revenue flows directly to your Stripe account through our Connect integration — PayFence never holds your funds.
The real-time dashboard shows you everything: monthly revenue, active subscribers, request volume, and quota utilization per plan. Set up alerts for unusual traffic patterns or approaching quota limits.
Need to change pricing? Update your plans in the dashboard and existing subscribers are grandfathered or migrated based on your preference. PayFence handles proration automatically through Stripe.