Context
You want to bill customers based on their actual consumption of your product or service—such as API calls, compute hours, storage, or any other measurable metric. This guide shows you how to configure this end-to-end using Hyperline’s interface.Prerequisites
Before you begin, make sure you have:- Access to your Hyperline account (we recommend using test mode for this setup)
- Usage data ready to import, or the ability to generate simulated data for testing
- A clear understanding of what metric you want to bill (e.g., API calls, GB stored, hours used)
Steps
1. Connect your usage data
Hyperline needs usage data to calculate charges for usage-based products. You have three options to connect your data:CSV import
API integration
Data loaders
Using data loaders (recommended)
Data loaders allow you to pull usage data directly from your database without writing code. This is ideal for connecting to existing data sources like PostgreSQL, BigQuery, MongoDB, or Snowflake.Navigate to data loaders
Create a new connection
Enter connection details
- Host and port
- Database name
- Authentication credentials
- SSL settings (if required)
Create a data loader
timestamp- The date and time of the eventcustomerId- Your customer’s unique identifierid- The event’s unique identifier- Any additional fields you want to track (e.g.,
quantity,region,product_type)
Test and activate
2. Create a usage-based product
Once your events are flowing into Hyperline, you can create a product that bills based on this usage.Navigate to the product catalog
Select usage-based product type
- Name: A descriptive name for your product (e.g., “API Calls”, “Storage GB”)
- Description: Optional details about what this product represents
Link an aggregator
- Event type: Which events to aggregate
- Operation: How to calculate usage:
- Count: Count the number of events
- Sum: Add up a specific numeric property
- Filters: Optional conditions to narrow eligible events
Define pricing tiers
- Pricing model: Choose between:
- Volume pricing: Price per unit changes based on total usage
- Bulk pricing: All units charged at the rate of the tier reached
- Basis points: Percentage-based pricing
- Price tiers: Define your pricing tiers and amounts
- Example: 0.08 per unit for 1,001-10,000 units
- Billing interval: Set when this product should be billed (monthly, quarterly, yearly)
Save the product
Example 💡
- 0-10,000 calls: $0.01 per call
- 10,001-100,000 calls: $0.008 per call
- 100,001+ calls: $0.005 per call
3. Create a customer
Before assigning a subscription, you need a customer in Hyperline.Go to the Customers section
Fill in customer details
- Name: Customer or company name
- Currency: The currency for billing this customer
- Country: Customer’s country (used for tax calculations)
Save the customer
4. Configure a subscription with the usage product
Now you’ll create a subscription that includes your usage-based product.Start creating a subscription
Set subscription duration
- Immediately: Start billing right away
- In the future: Schedule for a specific date
- On checkout completion: Wait for customer to complete checkout
Add your usage-based product
- Pricing: Select or customize the pricing tier
- Metering period: Choose when usage is measured:
- Same as payment interval: Usage resets each billing cycle
- Committed period: Usage measured over the entire contract
- Custom: Define a specific metering window
- Min/max amounts: Optionally set spending limits per billing period
- Committed units: Set minimum usage commitments if needed (customer pays for at least X units)
Configure payment settings
- Checkout page: Customer completes payment via Hyperline checkout
- Immediately: Charge the customer’s default payment method
Assign the subscription
Example 💡
5. Simulate usage (optional, for testing)
If you’re in test mode, you can simulate usage events to see how billing works without real data.Go to the customer's Events tab
Click Simulate new events
Configure the simulated events
- Event type: Use the same event type configured in your product
- Date: Choose when the events occurred (must be within the current billing period)
- Number of events: How many events to create
- Payload (optional): Add custom event properties in JSON format
Create the events
6. Monitor usage and understand open invoices
After creating usage events, you can track consumption and preview upcoming charges.View current usage
From the customer’s Subscriptions tab, you’ll see the current usage displayed next to each usage-based product. Click the eye icon next to the unit count to open the consumption details modal, which shows:- Total usage for the current billing period
- Individual events contributing to the usage
- Calculated amount based on your pricing tiers
- Breakdown by time period or event properties
Understanding open invoices
An open invoice is a live preview of the invoice that will be charged at the end of the billing period. For usage-based subscriptions, this invoice updates automatically in real-time as new usage events are recorded. Key characteristics of open invoices:- No invoice number yet: Open invoices don’t have a final invoice number because they’re still being calculated
- Cannot be paid: Customers cannot pay an open invoice—it’s for preview purposes only
- Updates in real-time: As usage accumulates, the invoice amount increases automatically
- Visible to customers: Customers can see their open invoice in the customer portal to track their current charges
- Go to the customer’s Invoices tab
- Look for the invoice with status
open - Click on the invoice to see the current charges and line items
Example 💡
- January 5: 2,500 calls → Invoice shows $25
- January 15: 8,000 calls → Invoice shows $80
- January 31: 15,000 calls → Invoice shows $138 (with tiered pricing)
Invoice lifecycle for usage-based billing
Usage-based invoices follow this lifecycle:- Open: Invoice is created at the start of the billing period and updates as usage accumulates
- Grace period: At the end of the billing period, the invoice enters a grace period (default: 3 days) where you can review and make manual adjustments if needed
- To pay: After the grace period, the invoice is finalized with an invoice number and sent for payment
- Paid: Payment is collected and the invoice is settled

