How Events Flow to Billing
The complete flow from events to invoices:- Events → Usage data transmitted to Flexprice
- Features → Define what you’re tracking and how to aggregate
- Plans → Set pricing for features
- Subscriptions → Connect customers to plans
- Invoices → Automatic billing based on usage
Prerequisites
- A metered feature created and configured
- Events being transmitted and validated
- A customer created in Flexprice
Step 1: Create a Pricing Plan
Navigate to Plans
- Log into your Flexprice dashboard
- In the left sidebar, go to Product catalog → Plans
- Click New plan
Configure the Plan
- Name: Give your plan a descriptive name (e.g., “Basic Plan”, “Pro Plan”)
- Lookup key: A unique identifier for the plan in API calls
- Description: Optional description of what the plan includes
Add Your Feature
- On the Charges step, click Add charge and choose Usage
- In Metered feature, select your metered feature
- Configure the pricing:
- Currency and Billing period: how the charge is billed (e.g., USD, monthly)
- Billing model: Flat fee for a price per unit
- Amount: Set the price per unit (e.g., $1 per credit)
- For free usage before billing starts, use the Tiered billing model, set Tier mode to Slab, and price the first tier at 0. The default mode, Volume, bills the whole quantity at one rate, so once usage passes the first tier, the free units are billed too.
- Feature: Model Usage
- Billing model: Flat fee
- Amount: $1.00 per credit

Advanced Pricing Options
Tiered (tier mode Slab: each band at its own rate):- First 1000 credits: $1.00 each
- Next 1000 credits: $0.80 each
- Additional credits: $0.60 each
- 1000 credits for $800 (effective $0.80 per credit)
- One rate for the whole quantity, chosen by the total. With the tiers above, 1500 credits are all billed at $0.80 each.
Save the Plan
Click Next through the remaining steps, then click Create plan to create your pricing plan.Step 2: Assign Plan to Customer
In the dashboard, subscriptions are called contracts.Create Subscription
- Go to Customers in the left sidebar
- Find and click on your customer
- Click Create contract
- In Plan, select the plan you just created
- Set when the contract Starts
- Click Next through the remaining steps, then click Create contract on the Review step

Verify Subscription
After creating the contract, it appears in the Contracts card on the customer’s page. Open it to see:- Status: Active
- Plan name, billing period, and currency
- The upcoming invoice and the date it will be billed
Step 3: Monitor Usage and Billing
Check Upcoming Invoices
- Open the contract from the customer’s page, or from Contracts in the left sidebar
- The Overview tab opens with the Upcoming invoice: a preview of the next invoice with:
- Usage quantities from your events
- Calculated amounts based on your pricing
- The billing period of each charge

Understanding the Billing
- Description: The charge’s name, with its billing period underneath
- Quantity: Total usage aggregated from your events
- Unit price: The price per unit from your plan
- Amount: Calculated based on your pricing plan
Real-World Example
Let’s walk through a complete example:1. Feature Configuration
- Feature Name: Model Usage
- Event Name:
model.usage - Aggregation: Sum of
credits - Usage Reset: Periodic (monthly)
2. Events Transmitted
3. Plan Configuration
- Plan Name: Basic Plan
- Feature: Model Usage
- Pricing: $1.00 per credit
- Free Tier: 10 credits per month
4. Billing Calculation
- Total Usage: 5 + 3 = 8 credits
- Free Credits: 10 (no charge for first 10)
- Billable Credits: 0 (8 < 10, so no charge)
- Amount: $0.00
5. If More Usage Occurs
If the customer uses 15 credits total:- Total Usage: 15 credits
- Free Credits: 10
- Billable Credits: 5
- Amount: $5.00
Advanced Billing Scenarios
Multiple Features
You can add multiple metered features to a single plan: Plan: Pro Plan- Model Usage: $1.00 per credit
- API Calls: $0.01 per call
- Storage: $0.10 per GB
- 50 credits consumed
- 1000 API calls
- 5 GB storage
Tiered Pricing
Plan: Enterprise Plan- Model Usage:
- First 1000 credits: $0.80 each
- Next 1000 credits: $0.60 each
- Additional: $0.40 each
- First 1000: $800
- Next 1000: $600
- Additional 500: $200
- Total: $1600
Monitoring and Analytics
Usage Trends
- Go to Customers and open the customer
- Open the Analytics tab, then pick the feature and date range
- View usage over time to identify patterns
Billing Analytics
- Go to Billing → Invoices
- View historical invoices and revenue
- Analyze customer usage patterns
Common Billing Issues
1. No Charges Appearing
Possible Causes:- Feature not added to plan
- Customer not subscribed to plan
- Usage below free tier
- Wrong billing period
- Verify feature is in the plan
- Check subscription status
- Review free tier settings
- Confirm billing cycle dates
2. Wrong Amounts
Possible Causes:- Incorrect pricing configuration
- Wrong aggregation values
- Billing period mismatch
- Review plan pricing settings
- Check event aggregation
- Verify billing cycle alignment
3. Unexpected Charges
Possible Causes:- Events transmitted to wrong customer
- Incorrect usage reset setting
- Duplicate events
- Verify external_customer_id
- Check Usage Reset configuration
- Review event history for duplicates
Best Practices
1. Test Billing Setup
Before going live:- Create a test customer
- Transmit a few test events
- Verify charges appear correctly
- Check invoice calculations
2. Monitor Usage Patterns
Regularly check:- Usage trends and spikes
- Customer behavior patterns
- Revenue impact of pricing changes
3. Set Up Alerts
Consider alerts for:- Unusual usage spikes
- Failed billing attempts
- Revenue thresholds
4. Document Pricing
Keep clear documentation of:- Feature pricing structure
- Free tier limits
- Billing cycle details
- Customer-specific overrides
Pricing Strategies
Usage-Based Pricing
Pros:- Aligns cost with value
- Scales automatically
- Fair for customers
- Revenue can be unpredictable
- Complex to forecast
Tiered Pricing
Pros:- Encourages higher usage
- Predictable revenue at scale
- Rewards loyal customers
- More complex to configure
- Can be confusing for customers
Hybrid Models
Combine multiple pricing approaches:- Base subscription fee
- Usage-based charges
- Volume discounts
Next Steps
After setting up billing:- Monitor Performance - Track usage and revenue
- Optimize Pricing - Adjust based on customer behavior
- Scale Operations - Add more features and customers
- Automate Processes - Set up webhooks and integrations
Troubleshooting
”No charges in upcoming invoice”
- Check that events are being transmitted
- Verify feature is in the plan
- Confirm customer subscription is active
- Review free tier settings
”Wrong billing amounts”
- Verify pricing configuration
- Check event aggregation values
- Review billing period dates
- Confirm usage reset settings
”Unexpected charges”
- Review recent events for the customer
- Check for duplicate events
- Verify external_customer_id mapping
- Review plan configuration changes
Getting Help
If you’re experiencing billing issues:- Check the Event Debugger for event processing status
- Review your plan configuration carefully
- Verify customer subscription status
- Contact support with specific examples and error messages

