Back to all terms
Payment
Paymentsintermediate

Invoice Generation

Creating and managing invoices for one-time charges and subscription billing cycles, including line item customization, tax itemization, and PDF generation through Stripe's Invoice API.

Also known as: Stripe invoicing, automated invoices, billing invoices, invoice creation

Description

Invoice generation handles the creation, customization, and delivery of invoices that document what a customer is being charged for. Stripe automatically generates invoices for subscription billing cycles, creating a draft invoice at the start of each period, finalizing it, and attempting payment collection. You can also create one-time invoices manually via the API for ad-hoc charges, professional services, or custom billing scenarios. Each invoice contains line items, tax details, discounts, a unique invoice number, and a hosted URL where the customer can view and pay.

Stripe invoices follow a lifecycle: draft (editable, not yet sent), open (finalized, payment pending), paid (payment collected), void (canceled before payment), and uncollectible (payment failed, written off). During the draft phase, you can add, modify, or remove line items, apply coupons, and adjust amounts. Once finalized (automatically at the end of the billing period for subscriptions, or manually via stripe.invoices.finalizeInvoice()), the invoice is immutable and assigned a sequential invoice number. Finalization also triggers the invoice.finalized webhook and, depending on settings, sends the invoice email to the customer.

For custom invoicing needs, you can hook into the invoice.created webhook to modify draft invoices before they're finalized. This is useful for adding dynamic line items like usage-based charges, platform fees, or credits. The invoice.upcoming webhook fires approximately one hour before the next subscription invoice is finalized, giving you a window to preview and modify it. Stripe also provides PDF rendering via the invoice.invoice_pdf URL and a hosted invoice page where customers can pay, download, and view their payment history.

Prompt Snippet

Listen for the invoice.created webhook on subscription renewals to modify draft invoices before finalization: add usage-based line items with stripe.invoiceItems.create({ customer, invoice: inv_id, amount, description }), apply credits, or attach metadata. Use stripe.invoices.upcoming({ customer, subscription }) to preview the next invoice and display it in your billing UI before the customer is charged. Configure invoice_settings.custom_fields on the Customer object to add PO numbers or internal references that appear on the PDF. For enterprise customers requiring net-30 terms, create invoices with collection_method: 'send_invoice' and days_until_due: 30, and track payment via the invoice.paid webhook.

Tags

invoicingbillingsubscriptionsstripepdfaccounting