diagram.mmd — flowchart
Invoice Generation Flow flowchart diagram

Invoice generation is the process of creating a formal billing document that records what a customer owes, collecting payment, and delivering a receipt. In subscription systems, this process is automated and triggered on each billing cycle; in usage-based billing it may occur monthly after metering data is aggregated.

The flow begins when a billing event is triggered — either a scheduled renewal date, a one-time purchase, or a usage threshold being crossed. The billing system retrieves the subscription or order record to determine the line items: base price, prorated adjustments (for mid-cycle upgrades or downgrades), applicable taxes (which may vary by jurisdiction and require a tax calculation service), and any credits from the customer's account balance.

The invoice is created with a status of draft and assigned a sequential invoice number. In draft state, the line items can still be modified — for example, final usage counts may not be available until the metering window closes. When finalized, the invoice status transitions to open, indicating it is ready for payment.

For subscription invoices where a payment method is already on file, the billing system immediately attempts to charge the stored method. If the charge succeeds, the invoice status moves to paid and a PDF receipt is generated and emailed to the customer. If the charge fails, the invoice remains in open status and enters the retry/dunning workflow described in Subscription Billing Workflow.

For invoices sent to customers for manual payment (common in B2B billing), the invoice includes a payment link or banking details and is emailed directly. These invoices track their own due date and send automatic reminders as the due date approaches. Unpaid invoices after the due date transition to overdue status, triggering escalation workflows. All invoice activity feeds into Payment Reconciliation to verify that every invoice maps to a corresponding transaction record.

Free online editor
Edit this diagram in Graphlet
Fork, modify, and export to SVG or PNG. No sign-up required.
Open in Graphlet →

Frequently asked questions

Invoice generation is the automated process of creating a billing document that records what a customer owes, attempting payment, and delivering a receipt. In subscription billing it is triggered each renewal cycle; in usage-based billing it runs after metering data is aggregated.
A billing event triggers retrieval of the subscription or order record. The system calculates line items (base price, prorations, taxes, credits), creates a draft invoice, finalises it, and immediately charges the stored payment method. On success the invoice is marked paid and a receipt is emailed to the customer.
Use draft status when final line items are not yet determined — for example, when usage data for the metering window is still being aggregated. Keeping the invoice in draft allows adjustments before the customer is charged.
mermaid
flowchart TD A([Billing event triggered]) --> B[Retrieve subscription or order record] B --> C[Calculate line items] C --> D[Apply proration for mid-cycle changes] D --> E[Calculate tax by jurisdiction] E --> F[Apply account credits or coupons] F --> G[Create invoice in draft status] G --> H{Usage-based billing?} H -->|Yes| I[Wait for metering window to close] I --> J[Fetch final usage data] J --> K[Finalize line items] H -->|No| K K --> L[Finalize invoice — status: open] L --> M{Payment method on file?} M -->|Yes — subscription auto-charge| N[Attempt charge immediately] N --> O{Charge result} O -->|Success| P[Mark invoice paid] P --> Q[Generate PDF receipt] Q --> R[Email receipt to customer] O -->|Failure| S[Enter dunning retry workflow] M -->|No — manual payment B2B| T[Email invoice with payment link] T --> U{Paid before due date?} U -->|Yes| P U -->|No| V[Mark invoice overdue] V --> W[Send overdue reminder] W --> X[Escalate to collections workflow]
Copied to clipboard