Path Parameters
The unique identifier of the invoice to finalize
What Happens When You Finalize an Invoice
Finalizing an invoice performs the following actions:
Locks the invoice : The invoice status changes from DRAFT to FINALIZED
Freezes line items : No further modifications can be made to line items or amounts
Generates invoice number : A human-readable invoice number is assigned (if not already present)
Sets finalization timestamp : The finalized_at timestamp is recorded
Enables payment : The invoice becomes eligible for payment processing
Invoice Finalization Workflow
Once an invoice is finalized, it cannot be edited. Only payment status can change. If you need to modify a finalized invoice, you must void it and create a new one.
Finalization is irreversible. Ensure all line items, amounts, and customer information are correct before finalizing.
Response
Confirmation message indicating successful finalization
curl -X POST "https://api.flexprice.io/v1/invoices/inv_1234567890/finalize" \
-H "Authorization: Bearer YOUR_API_KEY"
200 - Success
400 - Already Finalized
400 - Invalid Status
404 - Not Found
{
"message" : "invoice finalized successfully"
}
After Finalization
Once an invoice is finalized, you can:
Collect payment : Use the Attempt Payment endpoint to charge wallet credits
Update payment status : Mark the invoice as paid via payment gateway integration
Void the invoice : If needed, use the Void Invoice endpoint
Send to customer : Trigger invoice communication via webhook or email
Download PDF : Generate and retrieve the invoice PDF
Common Use Cases
For one-time invoices or complex billing scenarios, you may want to review draft invoices before finalizing them:
Create invoice in draft status
Review line items and amounts
Make any necessary adjustments
Finalize when ready
For automated subscription billing, invoices are typically finalized automatically:
Billing cycle triggers invoice generation
Invoice created and finalized in one step
Payment collected automatically (if configured)
For metered billing, finalization marks the end of the usage collection period:
Usage accumulated during billing period
At period end, create draft invoice
Verify usage calculations
Finalize to lock usage amounts