Bill Lemon Squeezy dimensions at their own price, in events units

An LS subscription carries one item billed at $1/1M and cannot carry a second, so
riding metrics on it charged the events rate — 10x the intended price, and $37.62
a month instead of $3.76 for the largest affected customer.

Restating the count in that meter's units fixes it exactly: metrics are ten to a
unit (10M datapoints -> 1M units -> $1) and replays a thousandth (1k replays -> 1M
units -> $1). Both now bill the advertised price through the one item, and replays
no longer have to sit dormant.

MeterTarget distinguishes the shared events item from a per-meter item of a
dimension's own, because only the former needs restating — scaling a correctly
priced item would reintroduce the error in the other direction. Conversion happens
before chunking so the stored quantity is what goes over the wire and LS's 1M cap
applies to the value it is about; raw counts stay in apis.daily_usage for
reconciliation.
This commit is contained in:
Anthony Alaribe 2026-08-27 23:07:29 +02:00
commit 3f607e87c7
3 changed files with 88 additions and 53 deletions