From e88760de5281831d7e316990a6175e404a424010 Mon Sep 17 00:00:00 2001 From: Addison LeClair Date: Tue, 15 Sep 2026 20:02:16 +0000 Subject: [PATCH] fix(billing): only list issued invoices for projects Filter out draft and void invoices so the project billing page shows only open, paid, or uncollectible invoices. --- apps/dashboard/src/lib/server/billing/autumn.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/lib/server/billing/autumn.ts b/apps/dashboard/src/lib/server/billing/autumn.ts index 6378c9f..8783771 100644 --- a/apps/dashboard/src/lib/server/billing/autumn.ts +++ b/apps/dashboard/src/lib/server/billing/autumn.ts @@ -507,6 +507,12 @@ export function purchaseProjectCredits(projectId: string, credits: number) { }); } +const ISSUED_INVOICE_STATUSES = new Set(['open', 'paid', 'uncollectible']); + +function isIssuedInvoice(invoice: { status: string }) { + return ISSUED_INVOICE_STATUSES.has(invoice.status.toLowerCase()); +} + export async function getProjectInvoices(projectId: string) { if (!isBillingConfigured()) return []; @@ -516,7 +522,7 @@ export async function getProjectInvoices(projectId: string) { expand: ['invoices'] }); - return (customer.invoices ?? []).map((invoice) => ({ + return (customer.invoices ?? []).filter(isIssuedInvoice).map((invoice) => ({ stripeId: invoice.stripeId, status: invoice.status, total: invoice.total,