Skip to content
Docs menu

Finance subscriptions and billing runs

Bill customers every month, quarter, half year or year. Items carry their prices in price books (flat, graduated or volume tiers, from a date), subscriptions are prorated day by day, and billing runs make each period's invoice once, as a draft for review unless you choose to issue it.

View .md

Recurring billing belongs to the Billing module (finance.billing), next to sales invoices. It has four parts, each a tab of Finance > Billing:

  • Items (/finance/billing): what you sell, with the revenue account and tax code its invoice lines use.
  • Price books (/finance/billing/prices): each item's price in a currency, from a date, flat or in tiers.
  • Subscriptions (/finance/billing/subscriptions): a customer billed for items at an interval.
  • Billing runs (/finance/billing/runs): what each run billed, line by line.

A billing run never writes an invoice of its own: it creates a normal sales invoice through the same code as New invoice, so everything on Finance sales invoices applies to it (the gapless number when it is issued, the journal, credit memos, voiding, sending).

Items

An item has a code (unique in the organisation), a name, a unit (seat, room, GB) and a charge type:

Charge type Billed
recurring (default) every period, prorated by day when it is on for part of one
usage every period, on the quantity last set on the subscription
one_time once, whole, in the first period it is on a subscription

An item belongs to one entity, or to every entity when you leave the entity empty (that needs Billing rights on every entity). Its revenue account must be an income account of its entity or a shared one, and its tax code VAT, GST or sales tax, never withholding. When your organisation has Funnel and you may open it, an item can point at a Funnel product; without Funnel the choice is not shown. Turning an item off keeps it on the subscriptions that have it and keeps new subscriptions from taking it.

Price books

A price book is a named list of prices in one currency ("Standard SGD", "Partners USD"). A price is one item in one book from a date (valid_from) to an optional last date (valid_to). A period is priced by the price valid on its first day, so a price change is a new price from a later date: the periods before it keep the old price.

Each price has a model:

Model What the quantity costs
flat quantity × unit price
graduated each tier's units at that tier's price, plus the flat fee of every tier reached
volume every unit at the price of the tier the quantity falls in, plus that tier's flat fee

A tier says the last quantity it covers (up_to, inclusive); the last tier is open. With tiers up to 10 at 10.00 and above at 8.00, 15 units cost 10 × 10.00 + 5 × 8.00 = 140.00 graduated, and 15 × 8.00 = 120.00 by volume.

Price books are kept through the item tools rather than tools of their own: an item's prices name a book by price_book and currency (the book is made the first time it is named) or by price_book_id, and finance_item_list returns the books with the items. A price is replaced when you send the same book and valid_from again.

Subscriptions

A subscription bills one customer of one entity from one price book, in that book's currency:

Field Values Default
bill_interval monthly, quarterly, half_yearly, yearly monthly
timing advance (billed on a period's first day), arrears (billed the day after its last) advance
start_date the first day billed; periods are anchored on its day of the month required
end_date the last day billed, or none none
invoice_mode draft (each invoice waits for a person to review and issue it), issue (issued at once) draft
uplift_bps, term_months the price rise at each renewal, compounding, every term_months from the start 0, 12
terms_days payment terms of its invoices the customer's

Drafts are the default so that a person checks each invoice before it takes a number from the entity's gapless sequence. With issue, the run issues the invoice right after creating it; if issuing is refused (an account missing, the customer blocked) the draft stays and the run's line says why.

Periods. Period n starts n intervals after the start, on the start's day of the month, or on the last day of a shorter month: a monthly subscription from 31 January runs 31 January to 27 February, 28 February to 30 March, 31 March to 29 April. Days are counted inclusive, and February has 29 days in a leap year.

Changing items. Items change as a whole list from an effective date. Lines that change end the day before and the new ones start on the day, so every period is priced day by day. In arrears nothing more is needed: the period is billed after it ended, each line for its own days. In advance the period was billed already, so the difference for the rest of the period is settled at once:

  • a rise (an upgrade) is charged on the next invoice, as its own line ("Seat: change from 16 January to 31 January");
  • a fall (a downgrade, or an end date inside the billed period) becomes the subscription's credit due. An invoice line is never negative, so issue the credit as a credit memo on the last invoice, then mark it done (clear_credit_due).

Nothing before the last billed period changes; correct earlier invoices with a credit memo or a new invoice. The start date, interval and timing never change: cancel the subscription and start a new one.

Pausing stops billing. Resuming bills from the period the resume falls in; the periods while it was paused are not billed. Cancelling sets the last day billed (default today in the entity's time zone) and needs a reason. In advance, the unused days of the billed period become a credit due. In arrears, the next run bills the last period up to the end date. The subscription shows as cancelled once nothing is left to bill.

The subscription's page shows the next invoice it will make: the period, the day it falls due, each line prorated by day with its tax, and the total. It is worked out by the same code the billing run uses.

Billing runs

A run bills one entity's active subscriptions that fall due by a date (default today in the entity's time zone, never later). Each period due becomes one invoice, oldest first, up to 12 periods a subscription and 200 subscriptions a run (the run says when more is due). For each period, in one transaction: the subscription is read again under a lock, the invoice is created with source billing_run and the subscription on it, the run's line is written, and the subscription moves to its next period.

  • Once per subscription and period. A database index allows one invoiced line per subscription and period, so a run started twice for the same period creates nothing the second time, also when two runs overlap.
  • Paused and cancelled subscriptions are skipped.
  • A failure stays on its line. No price on the period's first day, a blocked customer or a missing account fails that subscription with the reason; the run goes on with the others, and the subscription stays due for the next run.
  • Nothing to charge (every line zero) is a skipped line, and the subscription moves on.

Runs start three ways: Run billing on the runs page or Bill now on a subscription, the finance_billingrun_start tool, and the daily sweep. The sweep looks at every entity with a subscription due, in organisations with finance.billing, and starts at most one run per entity and day, as of the entity's own date. It runs as the system (system:billing-run).

Arithmetic and rounding

Every amount is a whole number of the currency's minor units; nothing passes through floating point. Each step rounds half to even, once:

Step Formula
Tier price the exact sum over the tiers of units × unit price, rounded once, plus the flat fees
Renewal uplift amount × (10000 + uplift_bps) / 10000 at each renewal, rounded each time
Proration amount × days on / days in the period, rounded once

The result is the invoice line's unit price, with quantity 1; the line's discount and tax then follow the invoice rules (half up, per line). For example, 10 seats at 10.00 upgraded to 15 seats on 16 March, in arrears: 100.00 × 15 / 31 = 48.39 for the first 15 days, and 150.00 × 16 / 31 = 77.42 for the rest.

Rights

Reading items, subscriptions and runs needs billing.read or billing.issue on their entity (an AR clerk, a controller or an auditor); every change needs billing.issue (an AR clerk or a controller). A subscription or run of an entity you cannot see answers as an unknown id. Every page, tool and REST call checks the Billing module first and answers 403 product_not_enabled without it. Every change is an event on the audit trail.

For a Finance agent, creating or changing an item, a price or a subscription, cancelling one and starting a billing run are decisions on billing.issue: without a job whose authority grants that, the agent's call is only a recommendation for a person.

Tools

Tool REST What it does
finance_item_list GET /api/v1/finance/items items with their prices, and the price books
finance_item_create POST /api/v1/finance/items a new item, with prices
finance_item_update PATCH /api/v1/finance/items/{id} change an item, add or replace prices
finance_subscription_list GET /api/v1/finance/subscriptions subscriptions, newest first
finance_subscription_get GET /api/v1/finance/subscriptions/{id} one subscription with its next invoice
finance_subscription_create POST /api/v1/finance/subscriptions a new subscription
finance_subscription_update PATCH /api/v1/finance/subscriptions/{id} change items from a date, terms, pause or resume
finance_subscription_cancel POST /api/v1/finance/subscriptions/{id}/cancel cancel from a date
finance_billingrun_start POST /api/v1/finance/billing-runs bill what falls due for an entity
finance_billingrun_get GET /api/v1/finance/billing-runs/{id} one run with its lines

An item with a graduated price, then a subscription for it:

{"code":"SEAT","name":"Seat","unit":"seat","revenue_account_id":"…","tax_code_id":"…","prices":[{"price_book":"Standard","currency":"SGD","valid_from":"2026-01-01","model":"graduated","tiers":[{"up_to":"10","unit_price_minor":1000},{"up_to":null,"unit_price_minor":800}]}]}
{"entity_id":"…","party_id":"…","price_book_id":"…","bill_interval":"monthly","timing":"advance","start_date":"2026-12-01","items":[{"item_id":"…","quantity":"12"}]}