Metrics: MRR and cohorts count only paid invoices
Open (unpaid) invoices no longer count toward MRR, so they don't put a customer in a cohort either; an invoice counts once it's paid. This matches the customer count, which takes only those who have spent more than $0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,8 +67,10 @@ func TestBuild(t *testing.T) {
|
||||
ln{cust: "cus_a", from: "2026-04-25", to: "2026-05-10", amount: -2500, proration: true},
|
||||
ln{cust: "cus_a", from: "2026-04-25", to: "2026-05-10", amount: 4000, proration: true})
|
||||
d.Exec(`UPDATE stripe_invoice_lines SET amount = 8000 WHERE customer = 'cus_a' AND period_start >= ?`, day("2026-05-10"))
|
||||
// A trial, a void invoice and an uncollectible one count for nothing.
|
||||
// A trial, an unpaid (open) invoice, a void one and an uncollectible
|
||||
// one count for nothing.
|
||||
addLines(t, d, ln{cust: "cus_t", from: "2026-03-01", to: "2026-04-01", interval: "month", amount: 0},
|
||||
ln{cust: "cus_o", from: "2026-03-01", to: "2026-04-01", interval: "month", amount: 9900, status: "open"},
|
||||
ln{cust: "cus_v", from: "2026-03-01", to: "2026-04-01", interval: "month", amount: 9900, status: "void"},
|
||||
ln{cust: "cus_u", from: "2026-03-01", to: "2026-04-01", interval: "month", amount: 9900, status: "uncollectible"})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user