Usage-based billing lets you charge customers based on actual consumption rather than a flat fee. Emit named events from your application — for exampleDocumentation Index
Fetch the complete documentation index at: https://danestvesllc-2b77d201.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
api_request or storage_used — and Polar aggregates them against a meter definition. At the end of the billing period, Polar calculates the charge automatically.
Events are not stored locally. They are forwarded to Polar for processing. Use the Polar dashboard or the meters API to view aggregated usage data. Define meters and attach them to products in the Polar dashboard first.
Tracking a single event
CallingestUsageEvent() on your billable model. Pass the event name and an optional array of properties that describe the event:
Batch ingestion
When you need to record multiple events at once — for example at the end of a background job — useingestUsageEvents() to send them all in a single API call:
Event structure
Each item in the array supports the following keys:| Key | Type | Required | Description |
|---|---|---|---|
eventName | string | Yes | The name of the meter event to record |
properties | array | No | Arbitrary key/value metadata for the event |
timestamp | \DateTime | No | Event timestamp; defaults to the current time |
Events are sent directly to Polar for processing. They are not persisted in your local database. Use the Polar dashboard or the meters API to view aggregated usage data.
Listing customer meters
Retrieve all meters for a customer to inspect their current balances:Components\CustomerMeter objects.
Getting a specific meter
Use theLaravelPolar facade when you know the meter ID and want to fetch it directly: