You're collecting recurring payments from customers, but you need a way to formalize billing, track what's due, and give customers proof of charges. That's where Stripe Invoicing comes in. It lets you create professional invoices, send them automatically, and track payment status—all without leaving Stripe.
What Stripe Invoices Do
Stripe Invoices are requests for payment tied to a customer. They're useful whether you're running subscriptions, one-time projects, or usage-based billing.
Understand the Invoice Lifecycle
An invoice starts in draft state, where you can edit line items and amounts. Once you send it, it moves to open, meaning the customer can view and pay it. After payment, it becomes paid. If it's unpaid after the due date, it's overdue. You can also void an invoice to cancel it entirely.
// Create an invoice in draft state
const invoice = await stripe.invoices.create({
customer: 'cus_123456',
collection_method: 'send_invoice',
days_until_due: 30
});Know When to Use Invoices
Use Stripe Invoices for anything that needs a formal payment request: subscription renewals, project-based work, service contracts, or whenever you want the customer to see a detailed breakdown of charges. If you just need a one-time charge and don't care about a formal invoice, a Payment Link or direct Charge is simpler.
// List all invoices for a customer to see their history
const invoices = await stripe.invoices.list({
customer: 'cus_123456',
limit: 10
});
invoices.data.forEach(inv => {
console.log(`Invoice ${inv.number}: $${inv.amount_due} - Status: ${inv.status}`);
});Creating and Sending Invoices
Invoices start as drafts. You add line items with description and amount, then send them to customers.
Add Line Items to Your Invoice
When creating an invoice, you add line items that describe what you're charging for. Each line item has a description, quantity, and unit amount. You can add multiple items to one invoice—useful for itemizing services or products.
// Create invoice with line items
const invoice = await stripe.invoices.create({
customer: 'cus_123456',
collection_method: 'send_invoice',
days_until_due: 30,
line_items: [
{
price_data: {
currency: 'usd',
product_data: {
name: 'Consulting Services'
},
unit_amount: 15000
},
quantity: 1
},
{
price_data: {
currency: 'usd',
product_data: {
name: 'Setup Fee'
},
unit_amount: 5000
},
quantity: 1
}
]
});Send the Invoice to Your Customer
Once your invoice is ready, call the send invoice action. Stripe sends the customer an email with a link to view and pay the invoice. The customer can pay directly from the invoice page without needing to log in.
// Send the invoice to the customer
const sentInvoice = await stripe.invoices.sendInvoice(
'in_123456'
);
console.log(`Invoice sent: ${sentInvoice.hosted_invoice_url}`);Track Invoice Payment Status
After sending, check the invoice status to see if it's been paid. You can retrieve a single invoice or list all invoices for a customer. Status values include open, paid, void, and draft.
// Retrieve a specific invoice to check status
const invoice = await stripe.invoices.retrieve('in_123456');
if (invoice.status === 'paid') {
console.log('Invoice paid on:', new Date(invoice.paid_at * 1000));
} else if (invoice.status === 'open') {
console.log('Invoice still open. Amount due: $' + (invoice.amount_due / 100));
}collection_method to send_invoice for manual payment flows.Customizing and Automating Invoices
Stripe Invoices can be customized with your company details and branding, and you can automate creation for subscriptions or specific events.
Add Custom Details and Branding
You can customize how invoices look by adding your company name, address, tax ID, and custom fields. These appear on the invoice that customers see. You can also set a default message that appears on every invoice.
// Create invoice with custom fields
const invoice = await stripe.invoices.create({
customer: 'cus_123456',
collection_method: 'send_invoice',
days_until_due: 30,
account_country: 'US',
custom_fields: [
{
name: 'Project Code',
value: 'PROJ-2026-001'
}
],
footer: 'Thank you for your business. Payment terms are Net 30.',
line_items: [
{
price: 'price_123456',
quantity: 1
}
]
});Automate Invoices for Subscriptions
If you're billing subscriptions, Stripe automatically creates invoices at each billing cycle. You don't need to create them manually. You can configure invoice settings (like days until due) on the subscription or product level.
// Create a subscription that auto-generates invoices
const subscription = await stripe.subscriptions.create({
customer: 'cus_123456',
items: [
{
price: 'price_monthly_plan'
}
],
collection_method: 'send_invoice',
days_until_due: 30
});
console.log('Subscription created. Invoices will auto-generate on billing cycle.');invoice.payment_succeeded or invoice.payment_failed to trigger actions in your app when payment status changes.Common Pitfalls
- Forgetting to set
days_until_due— Stripe defaults to 30 days, but if you don't set it explicitly, payment terms are unclear to the customer. - Mixing
charge_automatically(auto-billing) withsend_invoice(manual billing) — decide which approach fits your business model and stick to it. - Not listening to invoice webhooks — you won't know when a payment fails or succeeds unless you listen to events.
- Creating invoices with line items and also attaching a subscription — invoices and subscriptions are separate flows; don't do both for the same billing period.
Wrapping Up
Stripe Invoicing gives you a professional way to request and track payments while keeping customers informed. Whether you're billing subscriptions, projects, or usage-based work, invoices formalize the transaction and create a payment trail. If you want to track invoice metrics—like time to payment, payment success rates, or overdue invoice aging—across Stripe and other tools, Product Analyst can help.