How Usage Billing Works
- Usage occurs - Customer uses your product (API calls, storage, etc.)
- Events recorded - Usage events are sent to Alguna
- Usage aggregated - Alguna totals usage for the billing period
- Invoice generated - Charges calculated based on your pricing
- Payment collected - Customer pays for their usage
Step 1: Create a Billable Metric
Define what you want to measure:- Navigate to Settings → Billable Metrics
- Click Create Metric
- Fill in the details:
- Name: What you’re measuring (e.g., “API Calls”)
- Code: Unique identifier (e.g.,
api_calls) - Aggregation Type: How to count usage
Aggregation Types
| Type | Description | Example |
|---|---|---|
| Count | Count number of events | Number of API requests |
| Sum | Sum a property value | Total GB transferred |
| Unique Count | Count unique values | Unique active users |
| Max | Maximum value in period | Peak concurrent connections |
- Click Create
Step 2: Create a Usage-Based Product
- Navigate to Products
- Click New Product
- Configure:
- Name: Product name (e.g., “API Usage”)
- Fee Type: Select Metered
- Metric: Select the metric you created
- Pricing Model: Choose how to price usage
Pricing Models for Usage
| Model | Description | Example |
|---|---|---|
| Per Unit | Fixed price per unit | $0.001 per API call |
| Tiered | Different prices at different volumes | First 1,000 free, then $0.01 each |
| Volume | All units at same rate based on total | 0-1000: 0.008 each |
| Package | Price per bundle of units | $10 per 1,000 calls |
- Click Save
Step 3: Add to a Plan
- Navigate to Plans
- Select or create a plan
- Click Add Product
- Select your usage-based product
- Click Save
Step 4: Send Usage Events
Work with your development team to send usage events. They’ll need:- Metric Code: The code you defined (e.g.,
api_calls) - Account ID: The customer’s Alguna account ID
- Timestamp: When the usage occurred
Viewing Customer Usage
Current Period Usage
- Navigate to Customers → [Customer Name]
- Click the Usage tab
- View:
- Usage by metric
- Estimated charges
- Usage trends
Historical Usage
- Navigate to Reports → Usage
- Filter by customer, metric, or date range
- Export data if needed
Common Use Cases
API Billing
| Metric | Aggregation | Pricing |
|---|---|---|
| API Requests | Count | Tiered (free tier + overage) |
Storage Billing
| Metric | Aggregation | Pricing |
|---|---|---|
| Storage (GB) | Max | Per unit per month |
Compute Billing
| Metric | Aggregation | Pricing |
|---|---|---|
| Compute Hours | Sum | Per unit |
Active User Billing
| Metric | Aggregation | Pricing |
|---|---|---|
| Active Users | Unique Count | Per user per month |
Troubleshooting
No Usage Showing
- Verify usage events are being sent (check with your dev team)
- Confirm the metric code matches exactly
- Check timestamps are within the billing period
Incorrect Charges
- Review the metric aggregation type
- Check pricing model configuration
- Verify billing period dates
Best Practices
Clear Naming
Use descriptive metric names customers will understand.
Test First
Test usage tracking in sandbox before production.
Monitor Usage
Regularly review usage reports for anomalies.
Communicate Pricing
Clearly explain usage-based charges to customers.