Why total_amount_cents overstates a fee when credits are applied
Last updated: July 8, 2026
For accounting entries, book sub_total_excluding_taxes_amount_cents plus taxes_amount_cents, not total_amount_cents. Lago computes total_amount_cents as the gross amount before credits plus tax that was calculated after credits, so it overstates the fee whenever a coupon or progressive billing credit applies to that fee. The same problem applies to precise_total_amount_cents.
How fee amounts are calculated
Every fee starts as a gross amount before any discounts (amount_cents, with precise_amount_cents holding the full-precision version). Credits from coupons or progressive billing are stored separately in precise_coupons_amount_cents and are always applied before tax is calculated, so they reduce the taxable base rather than just the final total. Subtracting credits from the gross amount gives the net pre-tax amount (sub_total_excluding_taxes_amount_cents), which is the figure your accounting system should book as revenue. Tax is then calculated on that net pre-tax amount, not on the gross, so taxes_amount_cents is always consistent with what was actually charged.
What to use for accounting
The correct total for a fee, what the customer actually paid including tax, is:
sub_total_excluding_taxes_amount_cents + taxes_amount_centsAs of this writing, sub_total_excluding_taxes_amount_cents and its precise counterpart are not yet exposed in the Lago API serializer. In the interim, derive it as amount_cents − precise_coupons_amount_cents, or reach out to the Lago team if your integration needs it exposed directly.
Field reference
Field | What it represents |
|---|---|
| Gross amount before credits. Do not use for booking. |
| Total credits applied to the fee, at full precision. No integer counterpart exists, by design, to avoid rounding drift across fees on an invoice. |
| Net amount after credits, before tax. Use this as the booking amount. Not yet exposed in the API; derive from |
| Tax calculated on the net pre-tax amount. |
| Effective tax rate applied (sum of all applied tax rates). |
| Gross plus tax. Overstates the fee whenever credits apply. Do not use for booking. |
This article reflects guidance drawn from customer case resolutions. It is not officially supported documentation and may not apply to all situations.