Skip to main content
In this quickstart you’ll build a complete usage-based billing integration. You’ll follow the same path as data through Polar: usage first, then pricing, then customers buying and your application reacting.

What you’ll build

  • Usage events flowing from your application into a meter
  • A subscription product with a base fee, metered usage and included credits
  • A checkout that links each purchase to the user in your application
  • A webhook handler that keeps your application in sync with each customer’s access

Prerequisites

Every example uses this client:
Prefer to let your agent do it? Run polar agent setup to connect Claude Code, Codex or Cursor to Polar, then ask it to follow this quickstart. See MCP.
Use your own user IDs. Every Polar customer can carry an external_id, set to the user’s ID in your application. The quickstart uses user_123 this way throughout, so you never store Polar’s customer IDs or map them back to your users. See External IDs.

The path

1

Track usage

Send events from your application and aggregate them with a meter. Start here, even before you’ve decided on pricing. Track usage →
2

Set up your catalog

Create a product that bills a base fee and metered usage, and includes credits. Set up your catalog →
3

Integrate checkout & customers

Link Polar customers to your users and send them to checkout. Integrate checkout →
4

Sync customer state

Listen to webhooks and read the customer state to grant access in your application. Sync customer state →

Why usage comes first

Events are raw facts about what customers do in your product. Polar stores every event and computes usage from them when you ask, so:
  • You can start sending events before you’ve settled on pricing, and decide later what to charge for, if anything.
  • Events sent with your own user ID are linked to the customer as soon as a customer with that external ID exists, even if the events came first.
  • New meters work on events you’ve already sent, so you see real usage the moment you create them.
The sooner events flow, the more real data you have when you set your prices.

Start with usage

Send your first event and create a meter.