Invoice Lifecycle
Invoice Structure
An invoice contains:All amounts are in the smallest currency unit (cents for USD).
Invoice Types
- Subscription
- One-Time
- Usage
Generated automatically at billing cycle:
- Base subscription fee
- Usage charges for the period
- Add-on charges
- Prorated amounts for changes
Line Items
Each line item represents a charge:- Subscription fees - Fixed recurring charges
- Usage charges - Metered usage from meters
- Add-ons - Optional purchased add-ons
- Overage - Usage beyond included amounts
- Proration - Partial period charges
Line items include detailed usage breakdown when grouped by dimensions (endpoint, region, etc.).
Amount Calculation
Billing Cycles
Invoices are generated based on subscription billing cadence:- Monthly - Invoice at end of each month
- Quarterly - Invoice every 3 months
- Annual - Invoice once per year
- Custom - Define your own billing period
Anniversary vs Calendar
- Anniversary
- Calendar
Bill based on subscription start date:
- Started March 15 → Bill on 15th of each month
- Consistent with customer’s signup date
- Proration on first invoice if mid-month
Payment Processing
Once invoice is finalized:Integration with Payment Providers
FlexPrice syncs invoices with:- Stripe - Create/update Stripe invoices
- Chargebee - Sync to Chargebee subscription
- Razorpay - Generate payment links
- Custom - Webhook events for custom systems
External invoice IDs are stored for reconciliation and two-way sync.
Credit Notes
Issue refunds or adjustments:Proration
When subscriptions change mid-period:- Calculate unused time on old plan
- Calculate used time on new plan
- Credit for unused portion
- Charge for new portion
- Net amount added to next invoice
Proration ensures fair billing when customers upgrade, downgrade, or cancel.
Related Resources
Subscriptions
Subscription lifecycle and billing
Invoices Guide
Detailed invoice management
List Invoices API
API reference for invoices
Payments
Payment processing and methods