Skip to main content
Invoicing is the culmination of the billing cycle. Fluxrate automates the entire process — from generating draft invoices to emailing the final document to your customer.

Invoice Lifecycle

Invoice Statuses

StatusDescription
DRAFTNewly created. Editable. Not visible to customer.
OPENFinalized and emailed to customer. Awaiting payment.
PAIDPayment recorded. Immutable.
VOIDCancelled permanently. No payment collected.
UNCOLLECTIBLEBad debt. Written off.

How Invoices are Generated

The invoice generation worker runs every hour. When a subscription’s current_period_end has passed:
  1. Collects all active charges on the plan
  2. For fixed charges: Adds the flat amount (prorated if mid-period)
  3. For usage charges: Queries UsageEvent records, applies the meter’s aggregation type, multiplies by unit price
  4. Calculates tax based on customer and org billing address
  5. Creates Invoice record with status DRAFT
  6. Creates InvoiceLineItem records for each charge
  7. Sets scheduled_finalize_at = now + 1 hour

The 1-Hour Grace Period

After invoice creation, there’s a 1-hour review window before finalization. Use this time to:
  • Review the invoice for accuracy
  • Adjust line items if needed
  • Void the invoice if there was an error
After 1 hour, the invoice finalizer worker automatically transitions the invoice from DRAFT to OPEN and emails the customer.

Manual Control

You can also manually finalize an invoice:
POST /api/v1/invoices/<invoice_id>/finalize
Or send the email manually:
POST /api/v1/invoices/<invoice_id>/send-email

Tax Calculation

Fluxrate calculates tax automatically based on:
  • Customer billing address (country, state)
  • Organization billing address
  • Applicable tax rates
Tax calculation requires the customer to have at minimum a billing_address_country. Configure this in the customer’s profile.

Invoice Numbering

Invoice numbers follow the format: INV-{YEAR}-{SEQUENCE} (e.g., INV-2025-0042).