Implement usage-based billing with Stripe Billing Meters and metered subscriptions

domain: stripe.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Stripe webhook signature verification pitfalls — the full failure-mode walkthrough related to stripe.com, checked against official docs, with linked verified routes.

Steps

  1. Create a Meter object: POST /v1/billing/meters with 'display_name', 'event_name' (e.g. 'api_calls'), and 'default_aggregation.formula' set to 'sum' or 'count' — this defines how raw events are rolled up each billing period.
  2. Create a Price with 'billing_scheme=per_unit', 'usage_type=metered', and 'recurring.meter={meter_id}' pointing at the meter; set 'unit_amount' or a tiered pricing structure.
  3. Create or update a Subscription with the metered Price; Stripe will not charge at subscription creation because no usage has been reported yet.
  4. Report usage by posting meter events: POST /v1/billing/meter_events with 'event_name' matching the meter, 'payload.stripe_customer_id' (or your identifier field), and 'payload.value' as a string integer; include 'identifier' for idempotency.
  5. At the end of the billing period Stripe automatically aggregates meter events, calculates the charge, and generates the invoice — no explicit finalization call is needed.
  6. To debug, call GET /v1/billing/meters/{id}/event_summaries?customer={customer_id}&start_time=...&end_time=... to see aggregated usage Stripe will bill.

Known gotchas

Related routes

Aggregate usage-based metered billing correctly to avoid over- or under-charging
stripe.com · 6 steps · unrated
Report high-throughput Stripe usage with the v2 Billing meter event stream
stripe.com · 5 steps · unrated
Implement metered usage billing for your own agent service: charge customers for agent work performed
metered-billing · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans