---
title: "Read revenue and usage"
description: "Polar's live metrics in the admin console: recurring revenue, new, renewed and churned subscriptions, cancellations per reason, checkouts, usage per meter, and costs and margin once AI costs are reported, read fresh with no ledger of its own."
canonical_url: "https://nuxt-backend.dev/docs/build/growth/measure/revenue"
---
# Read revenue and usage

> Polar's live metrics in the admin console: recurring revenue, new, renewed and churned subscriptions, cancellations per reason, checkouts, usage per meter, and costs and margin once AI costs are reported, read fresh with no ledger of its own.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

- [API reference](https://nuxt-backend.dev/docs/reference/api/billing)
- [Source](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/revenue.ts)

See how the business is doing, from the source. The admin console's **Analytics** tab opens on the **Revenue** view, which reads the billing provider's own metrics when an administrator opens it. The package keeps no copy of revenue, so there is nothing to reconcile.

**What Polar does natively** (checked on 2026-10-25, [Get metrics](https://polar.sh/docs/api-reference/2027-01/metrics/get-metrics)): it computes recurring revenue, active, new, renewed and churned subscriptions, churn rate, checkouts and their conversion, lifetime value, and cancellations per reason. With [Cost Insights](https://polar.sh/docs/features/cost-insights/introduction), it adds costs, cost per user and gross margin.

**What the package adds:** the view in the console, kept to administrators, drawn with the package's parts, and fed with AI costs from the job queue.

## What it shows

- **Revenue**: monthly and annual recurring revenue, and revenue over the period you pick.
- **Subscriptions**: new, renewed and churned, per day, week or month, and the churn rate.
- **Cancellations per reason**: how many left for each of the eight reasons the [cancel flow](https://nuxt-backend.dev/docs/build/growth/engage/cancel-flow) asks about, and how many save offers were accepted.
- **Checkouts**: started, completed, and the conversion between them.
- **Usage per meter**: what each metered feature consumed, the credits AI actions spend included.
- **Costs and margin**: cost per user and gross margin, once costs reach Polar.

Pick the last 30, 90 or 365 days, per day, week or month (a new window takes the interval that suits it), and **Refresh** to read again. Each chart follows your [theme tokens](https://nuxt-backend.dev/docs/build/ui/customize/tokens) like the rest of the console: a bar per period in the text colour, churn on `--bk-error`.

## Show it

The tab appears once `backend/billing.ts` re-exports `getRevenue` from `billing.api`, as the scaffold does:

```ts [backend/billing.ts]
export const {
  // …the other billing functions
  getRevenue,
} = billing.api
```

`getRevenue({ since, until, interval })` is an action: `since` and `until` are epoch milliseconds, read as whole UTC days (`until` defaults to now), and `interval` is `day` (the default), `week` or `month`. A window covers at most 366 days. It answers a `RevenueReport`:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      What it holds
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        totals
      </code>
    </td>
    
    <td>
      Each metric over the window: <code>
        monthlyRecurringRevenue
      </code>
      
      , <code>
        annualRecurringRevenue
      </code>
      
      , <code>
        revenue
      </code>
      
      , <code>
        netRevenue
      </code>
      
      , <code>
        activeSubscriptions
      </code>
      
      , <code>
        newSubscriptions
      </code>
      
      , <code>
        renewedSubscriptions
      </code>
      
      , <code>
        churnedSubscriptions
      </code>
      
      , <code>
        canceledSubscriptions
      </code>
      
      , <code>
        churnRate
      </code>
      
      , <code>
        checkouts
      </code>
      
      , <code>
        succeededCheckouts
      </code>
      
      , <code>
        checkoutsConversion
      </code>
      
      , <code>
        lifetimeValue
      </code>
      
      , <code>
        costs
      </code>
      
      , <code>
        costPerUser
      </code>
      
      , <code>
        grossMargin
      </code>
      
       and <code>
        grossMarginPercentage
      </code>
      
      . Money is in cents, a rate a fraction, and <code>
        null
      </code>
      
       where Polar has no value.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        periods
      </code>
    </td>
    
    <td>
      The same metrics per period, each with its start (<code>
        at
      </code>
      
      ), oldest first.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cancellations
      </code>
    </td>
    
    <td>
      <code>
        reasons
      </code>
      
      : cancellations per reason. <code>
        saveOffers
      </code>
      
      : the offers the cancel flow made in the window, and how many were accepted.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        meters
      </code>
    </td>
    
    <td>
      Each catalog meter's <code>
        total
      </code>
      
       and its quantity per period.
    </td>
  </tr>
</tbody>
</table>

Only the save offers are counted in your deployment, from the cancel flow's own records. Everything else is one call to Polar's metrics and one per meter to its meter quantities.

## Report AI costs

Polar's Cost Insights reads a `_cost` property on the usage events it ingests. Every credit spend is already a usage event ([Spend credits in your functions](https://nuxt-backend.dev/docs/build/billing/credits/spending)). The job queue adds each job's AI cost to its event, so Panels' cost per strip shows next to its revenue without code of yours ([Charge for a queued job](https://nuxt-backend.dev/docs/build/ai/jobs/credits)). The admin Costs tab shows what every AI call cost per person, jobs included.

## Who may read it

Administrators only, with the role read fresh on every call ([Run the admin console](https://nuxt-backend.dev/docs/build/auth/admin)). An administrator visiting someone's account reads nothing. The billing access token needs Polar's `metrics:read` scope, which `npx nuxt-backend doctor --only analytics` checks.

## In development

The view reads the sandbox organization your development deployment bills on, so it shows the purchases you made with test cards ([Develop on real sandboxes](https://nuxt-backend.dev/docs/develop/sandboxes)).

## What happens when…

<table>
<thead>
  <tr>
    <th>
      Situation
    </th>
    
    <th>
      Result
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      A non-administrator calls it
    </td>
    
    <td>
      Refused as <code>
        forbidden
      </code>
      
      , reason <code>
        admin_only
      </code>
      
       (<a href="https://nuxt-backend.dev/docs/reference/backend/errors#forbidden">
        Errors
      </a>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      An administrator visiting someone's account calls it
    </td>
    
    <td>
      Refused as <code>
        forbidden
      </code>
      
      , reason <code>
        impersonating
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      No <code>
        BILLING_ACCESS_TOKEN
      </code>
      
       is set
    </td>
    
    <td>
      Refused as <code>
        unavailable
      </code>
      
      , reason <code>
        not_configured
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      A window longer than 366 days, or one that ends before it starts
    </td>
    
    <td>
      Refused as <code>
        invalid_input
      </code>
      
       (<code>
        since
      </code>
      
       or <code>
        until
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      The token lacks <code>
        metrics:read
      </code>
    </td>
    
    <td>
      Refused as <code>
        unavailable
      </code>
      
      , and <code>
        doctor
      </code>
      
       names the missing scope (<a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#analytics-metrics">
        <code>
          analytics-metrics
        </code>
      </a>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      Polar is unreachable
    </td>
    
    <td>
      Refused as <code>
        unavailable
      </code>
      
      . The rest of the console keeps working.
    </td>
  </tr>
</tbody>
</table>

## Limits

- **Read live, not stored.** Each visit calls Polar's metrics API, so a long period takes a moment to load.
- **Polar's definitions.** Recurring revenue, churn and lifetime value are Polar's numbers, computed its way.
- **Costs only when reported.** Margin reads as revenue alone until usage events carry a cost.

## Test it

Open the console as an administrator on a development deployment after a test checkout with `4242 4242 4242 4242`, and check that the new subscription shows. A page test runs the view over fixed metrics from `createBackendMock`, with `backend.stub('billing:getRevenue', () => report)` ([Test pages over a mock backend](https://nuxt-backend.dev/docs/develop/testing/pages)).

## Related

- [Measure growth](https://nuxt-backend.dev/docs/build/growth/measure): the funnel and cohorts beside it.
- [Handle cancellations and win people back](https://nuxt-backend.dev/docs/build/growth/engage/cancel-flow): where the reasons come from.
- [Billing and credits](https://nuxt-backend.dev/docs/build/billing): the catalog and subscriptions these metrics count.
- [Polar](https://nuxt-backend.dev/docs/services/polar): the access token and its scopes.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
