Stripe hosted invoice page: customizing and expiring the payment link
Customizes and expires the Stripe hosted invoice page payment link. Use when you share invoice payment links with customers and need branding plus link lifecycle control. Not for Checkout sessions.
TL;DR
Every finalized invoice with online payment enabled gets a hostedinvoiceurl; customize its branding in the dashboard branding settings and control link lifetime by voiding or finalizing state changes (the link dies with the invoice). For tighter expiry, collect via a Checkout session with its own expiry instead. Rotate links by voiding and reissuing when a link leaks.
Steps
Confirm the invoice is finalized with collection enabled; copy the hostedinvoiceurl. Expected output: The link exists and is live.
Set branding (logo, colors, business name) in dashboard branding settings. Expected output: The page matches your brand.
Understand the lifecycle: the link works while the invoice is open; voiding or paying kills it. Expected output: Expiry is tied to invoice state.
For a hard expiry time, create a Checkout session for the invoice amount with expires_at instead. Expected output: You get clock-based expiry.
If a link is shared too widely, void the invoice and reissue to rotate the URL. Expected output: Leaked links are neutralized.
When to use
- You share invoice payment links with customers
- The hosted page needs your branding
- A payment link should expire
When not to use
- You need full checkout customization (use Checkout sessions)
- The invoice is a draft (no hosted page yet)
- You want the PDF, not the payment page (invoice_pdf)
Compatibility
Stripe Billing; hostedinvoiceurl on finalized invoices. Checkout sessions support expires_at.
Variant phrasings
### Stripe hosted invoice page branding
### expire hosted invoice URL Stripe
### customize invoice payment link
Root cause
The hosted page is a convenience payment surface bound to the invoice lifecycle, not a standalone expiring token - its validity mirrors whether the invoice can still be paid. True time-based expiry belongs to Checkout sessions, which were built as tokens with clocks.
Edge cases
- Branding changes apply to future page loads, not to already-sent email copies
- Paid invoices keep a viewable (not payable) page for the customer's records
- Some customers block third-party payment pages; offer the PDF with bank details as fallback
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_l2CFYLRC9epCXBAYgok40A