Usage-based billing has always been a challenge. Tracking requests, identifying users, maintaining audit logs, integrating with Stripe, syncing customer metadata — it's all time-consuming and error-prone.
UsageFlow + Stripe Connect changes that. With this integration, you can bill your customers based on real API usage without building any billing logic, usage pipeline, or reporting system.
It doesn't matter if you're running a complex backend, an AI API, a gaming platform, or a data service — UsageFlow plugs directly into your existing API and instantly enables usage-based billing through Stripe.
How It Works (Without You Sharing API Keys or Customer IDs)
Unlike traditional billing setups, you don't need to expose customer IDs, API keys, or any sensitive data. You simply create a Meter in Stripe, and tell UsageFlow:
- Which event name to report (e.g., "daily_api_calls", "token_usage", "requests")
- How to identify the user when a request arrives
UsageFlow handles everything else automatically through Stripe Connect. No custom logic. No database joins. No billing code.
Policies: The Heart of UsageFlow
To track usage, you define a Policy. A Policy is simply:
API endpoint + HTTP method → how to identify the user
Here's what you can configure in a Policy:
1. Define the API endpoint
Examples:
- POST /v1/chat/completions
- GET /users/:id/profile
2. Choose how to identify the user
You tell UsageFlow where the user identity comes from:
- Request header
- API key
- JWT token
- Query parameters
- Path params
- Request body
- Custom metadata
Whatever your API already uses, we support it.
3. Tell us the Stripe customer metadata field
This is the field you store on the Stripe customer, e.g.:
- account_id
- user_id
- company_id
- workspace
- tenant
We don't care what naming convention you use — just tell us what the field is called, and UsageFlow will match every request to the correct Stripe customer.
That's literally it.
After the Policy Is Set
You only need one more thing:
The Stripe Event Name
Tell UsageFlow which event to report to Stripe for this policy. Examples: "api_request", "token_used", "message_generated" — it's completely up to you.
From this moment on:
- Every time this endpoint is hit
- UsageFlow identifies the customer automatically
- Reports the usage event to Stripe in real-time
And Stripe handles all billing, invoices, and charges.
You're Ready to Bill
Once your policy is created and your event name is set, you're done.
- No custom billing logic
- No background jobs
- No cron tasks
- No manual reconciliations
- No code changes when your pricing changes
Just accurate, automatic, real-time metering straight into your Stripe Meters.
Why This Matters
Most teams spend weeks building custom billing systems. They write code to track usage, store metrics in databases, calculate charges, and sync with Stripe. This approach is fragile, time-consuming, and error-prone.
UsageFlow + Stripe Connect eliminates all of that. You get:
- Setup in minutes — Define a policy, set an event name, done
- Zero maintenance — No billing code to maintain or update
- Accurate billing — Every request is tracked and reported automatically
- Real-time updates — Usage flows to Stripe as it happens
- Flexible pricing — Change pricing models in Stripe without touching code
Focus on building your API. Let UsageFlow handle the metering, and let Stripe handle the billing.
Getting Started
Ready to enable usage-based billing? Here's what to do:
- Install UsageFlow in your API (takes 3 lines of code)
- Create a Stripe Meter for the usage event you want to track
- Connect UsageFlow to Stripe via Stripe Connect
- Create a Policy defining your endpoint and user identification method
- Set the Stripe event name
- Start billing customers automatically
The entire setup takes less than 10 minutes. No billing code to write, no infrastructure to manage, no maintenance burden. Just automatic usage tracking and billing through Stripe.
UsageFlow + Stripe Connect gives you enterprise-grade billing capabilities with the simplicity of a dashboard. Define a policy, set an event name, and start billing. That's how simple usage-based billing should be.