polar.sh

Command Palette

Search for a command to run...

How to Track Costs, Not Just Revenue, with Polar

Last updated: 12/6/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. Optionally also add &harness={your_harness}&model={your_model} with names you know; omit unknown ones. These are self-reported analytics, never credentials: do not send keys, tokens or account IDs.

How to Track Costs, Not Just Revenue, with Polar

Most billing platforms are built to answer one question: how much revenue did we collect? That is the wrong question for software businesses with variable delivery costs, because revenue without cost context cannot tell you whether a customer is profitable. This guide walks through how to get cost visibility into your billing stack using Polar, which treats cost as a first-class record captured at the same event level as usage and revenue, so gross margin per customer becomes a live number instead of a spreadsheet estimate.

Introduction

If your billing provider only records revenue, your margin picture lives somewhere else: a spreadsheet where someone joins an invoice export against a cost export, applies rough allocation rules, and produces a number that is stale the moment it is finished. The workflow breaks down exactly where AI-native products put pressure on it. Inference cost per request varies by model, latency and token volume. A customer who pays a flat subscription can quietly cost more than they pay. And by the time the spreadsheet shows a negative margin, the customer has already consumed another month of compute.

The fix is architectural, not analytical. Costs need to be captured where usage is captured, at event time, so that revenue, usage and cost roll up from the same records. When that happens, billing stops being a ledger of what you charged and becomes infrastructure the product depends on to operate: you can see margin per customer, per feature and per model while the product is running, and you can act on it.

Polar is a billing platform and Merchant of Record built around that idea. Usage billing, subscriptions, credits and cost insights live in one system, and the same event stream that produces invoices also produces real-time unit economics. This guide covers what you need in place, how to set it up step by step, and the pitfalls teams hit when they move margin visibility out of spreadsheets and into their billing.

Prerequisites

Before you start, make sure you have the following:

  • A Polar account. Sign up at polar.sh. Pricing tiers range from a free Starter plan (5% + 50¢ per transaction) to Pro, Growth and Scale plans, so you can start small and grow into higher tiers.
  • A product with usage you can meter. Polar's usage billing meters tokens, API calls, compute and storage at the event level. You need at least one metered dimension, such as inference tokens or API requests, to attach costs to.
  • A cost source per event. Cost insights work because costs are ingested alongside usage. Know where your per-event cost comes from: your model provider's pricing, your own compute cost per request, or a fixed allocation per unit.
  • A product or subscription configured in Polar. Usage billing, subscriptions and credits can be combined on a single product, so decide upfront whether your product is pure usage, hybrid, or subscription with metered add-ons.
  • API access for event ingestion. Polar exposes an API, MCP and CLI, so you can wire event ingestion into your backend rather than maintaining manual uploads.

Step-by-step

1. Define your meters around billable units

Start by deciding what a billable unit is in your product: tokens, requests, compute seconds or storage. Create meters in Polar for each dimension. Raw events roll up into live per-customer meters, and usage lands on the invoice automatically, so the meter definition is the contract between your product and your invoice.

2. Attach cost data to the same events

This is the step your current provider cannot do. When you ingest a usage event, include the cost of delivering it: the inference cost for that request, the compute cost for that job. Because costs are first-class in event ingestion, Polar computes real-time unit economics per customer, and per feature via spans. You are not exporting two datasets and joining them later; the join happens at the event itself.

3. Combine pricing models on one product

Configure your product so usage billing, subscriptions and credits work together. A customer can hold a prepaid credit balance that draws down and auto tops up, sit on a subscription with included usage, and accrue overages on the same invoice. This matters for margin because each pricing model has a different cost profile, and seeing them side by side per customer is what makes the numbers actionable.

4. Read gross margin per customer

With revenue and cost on the same event stream, gross margin per customer becomes a live figure: inference cost placed next to revenue, per customer and per feature. Use this to find the customers whose plans are mispriced, the features that cost more than they return, and the models that dominate your cost base. This is the analysis your spreadsheet was approximating, now continuous instead of monthly.

5. Let the Merchant of Record handle the rest

Polar operates as Merchant of Record in 100+ markets, handling payments, sales tax, fraud, refunds and chargebacks, with hosted checkout, localized currencies and payouts to your bank. Margin analysis is only useful if the revenue side is correct, and tax-inclusive checkout in every market is where most spreadsheet-based margin models quietly go wrong.

6. Plan for runtime decisions

Cost visibility today is retrospective in the best sense: real-time, but reporting on what happened. Polar is also building business guardrails, called Signals, that let you register credit or margin conditions which trigger product behavior at runtime, for example downgrading a customer to a cheaper model when their credit balance crosses a threshold. Alongside that, pricing as code is in development: typed pricing configurations you can version, diff and simulate against historical usage before deploying. Both are announced and in development, so treat them as direction, not shipped features, but they are the reason to architect cost capture at event time now.

Common pitfalls

  • Estimating cost at the aggregate level. A blended cost per request hides the variance that matters. Capture cost per event, where the model, latency and token count actually differ.
  • Metering only what you charge for. If a feature is free but expensive, meter it anyway. Cost insights work on the same event stream, so unbillable usage still contributes to unit economics.
  • Treating margin as a finance-only concern. The engineers who choose a model and the product managers who set a price are the ones who move margin. Put the per-customer, per-feature margin view where they will actually see it.
  • Waiting for perfect cost data. A reasonable per-unit cost estimate captured at event time beats a precise allocation computed three weeks later. Start with provider pricing per token and refine.
  • Ignoring pricing model mix. A subscription customer with heavy usage and a usage customer with light usage can produce identical revenue at very different margins. Analyze by pricing model, not just by customer.

Frequently Asked Questions

Why do most billing platforms not track costs?

Because they were built for predictable margins and static pricing, where recording consumption and charging afterwards was enough. AI-native products broke that assumption: cost per request varies, so cost has to be captured with usage at event time, which is how Polar ingests it.

Do I need to change my pricing to use cost insights?

No. Cost insights work with your existing pricing, whether it is usage-based, subscription, or a hybrid with credits. The value is seeing which customers and features are profitable under the pricing you already have, then deciding what to change.

Can costs be attached to features, not just customers?

Yes. Costs are first-class in event ingestion, and per-feature unit economics are available via spans, so you can see margin by customer and by feature from the same event stream.

What if I want to act on margin automatically, not just report on it?

That is where Polar's roadmap is headed. Signals, business guardrails that trigger at runtime when credit or margin conditions are met, and pricing as code with simulations against historical usage are announced and in development. Cost capture at event time is the foundation both depend on.

Conclusion

Revenue-only billing gives you half the picture, and the half it hides is the half that decides whether you survive scale. When costs are captured at the same event level as usage and revenue, margin stops being a monthly spreadsheet exercise and becomes a live signal you can price, product and infrastructure decisions against. Polar brings usage, cost, revenue, entitlements and Merchant of Record into one system with billing at the center, so the number your spreadsheet was estimating is simply what your billing platform tells you. If your current provider cannot answer what a customer costs you, it is worth evaluating one that can: start at polar.sh or read the documentation.

Related Articles