InvoiceZip
Stripe invoice link expired? Here's how to get a working one
Old Stripe invoice links stop working after a while. Here is when that happens according to Stripe's docs, what to do if you're the customer, how the business gets a fresh link, and how a business can keep its own copy of the PDFs so it doesn't need old links later.
When Stripe invoice links expire
- Stripe's docs say invoice URLs expire 30 days after the due date. If an invoice has no due date, the link expires 30 days after the invoice is finalized. In every case the window is never longer than 120 days.
- Invoices that are charged automatically (
collection_method=charge_automatically, which is common for subscriptions) have no due date, so the 30 days start at finalization.
- This applies to the hosted invoice page link in the invoice email, the PDF download links, and the link printed in the footer of the invoice PDF.
- Stripe says links shown in the Dashboard, or fetched through the API, stay valid for at least 10 days, even for older invoices.
If you're the customer
- Opening an expired link takes you to a Stripe page saying the link has expired, with the business's contact details.
- If the business sent the invoice by email through Stripe, you get a recovery page instead. Enter the email address the invoice was sent to and Stripe emails you a new copy of the original email with working links.
- Otherwise, contact the business and ask them to resend the invoice or send you the PDF. InvoiceZip can't help here: only the Stripe account owner can use it.
If you're the business
- One invoice: open it in the Stripe Dashboard under Invoices and click Invoice PDF on the invoice details page, or resend the invoice to the customer. Links from the Dashboard are fresh.
- From code: don't store and reuse
invoice_pdf or hosted_invoice_url. Store the invoice ID and retrieve the invoice again when you need a link. Stripe says an expired PDF URL requested by a non-browser client (for example curl) returns 400 with a URL expired body, so your code can detect it and fetch the invoice again.
- A whole month: to keep your own copies so you don't depend on links at all, download the PDFs and save them. That's what InvoiceZip does: see below.
How InvoiceZip handles links
- It doesn't use old emailed links. At export time it lists the month's invoices through the Stripe API with your restricted key, so each
invoice_pdf link is a fresh one, and it downloads the PDFs straight away.
- That's why it works for older months too: the links are new when it uses them. You get
invoicezip-YYYY-MM.zip with one invoice-<number>.pdf per finalized invoice, plus an invoice-index-YYYY-MM.csv. With Charges: Read on the key, it also adds receipt-… files. What's in the ZIP.
- Once saved, the files on your drive don't expire. A simple monthly backup routine.
Limits
- It's for the business that owns the Stripe account. You need a restricted key (
rk_live_ or rk_test_) with Invoices: Read. Customers can't use it to recover an invoice someone sent them.
- It doesn't create, resend or change invoices, and it can't make a hosted payment link work again. It only makes read requests.
- It doesn't keep a copy for you. Your key and the files are only held for that one export, so save the ZIP somewhere safe.
- Drafts have no PDF (Stripe's
invoice_pdf is null until an invoice is finalized), so drafts are left out. If a PDF download fails during the export, that file is missing from the ZIP and its file name cell in the CSV is blank. Compare the CSV with the files.
- One calendar month (UTC, by created date) per export. No credit notes, and no filtering by customer.
Sources
- Stripe Docs, Hosted invoice page: Invoice URLs (30 days after due date or finalization, 120-day maximum, at least 10 days for Dashboard/API links, recovery page,
400 URL expired for non-browser PDF requests, link in the PDF footer)
- Stripe API reference, The Invoice object (
invoice_pdf and hosted_invoice_url are null until finalized; due_date is null for charge_automatically)
- Stripe Docs, Send customer emails (resend an invoice; Invoice PDF on the invoice details page)