Displaying real-time cost for graduated pricing in your customer dashboard
Last updated: July 10, 2026
Computing an accurate in-period cost estimate for a customer on graduated pricing is complex to do client-side. You'd need to know which tier they're currently in, how much usage was consumed at lower tiers, and the marginal rate for the remainder. Lago's Invoice Preview API removes that complexity by returning the exact amount the customer would be charged if the billing period ended right now, with all tier calculations already applied server-side.
How it works
The Invoice Preview endpoint generates a dry-run invoice for an active subscription based on current usage. It returns a full invoice object with line items, applied tier breakdowns, and the total amount, without creating an actual invoice or affecting billing in any way. See the Invoice Preview API reference and the guide on dry-run invoices for full detail.
What to do
Call POST /api/v1/invoices/preview for the subscription you want to show costs for, and poll it periodically, hourly or on-demand when a user views their dashboard, to keep the displayed estimate current. If the endpoint errors or isn't visible in your account, contact Lago support, since Invoice Preview may need to be explicitly enabled for your organization on Lago Cloud.
This article reflects guidance drawn from customer case resolutions. It is not officially supported documentation and may not apply to all situations.