## TL;DR
Stripe orders invoice lines by when they were created, so proration lines land after the base subscription lines regardless of date. You cannot reorder them in the dashboard. If order matters to customers, render your own invoice view sorted by period start, or add clear line descriptions that make the order self-explanatory.

```text
invoice PDF line order wrong after proration
```

## Use this when
- The invoice PDF shows proration lines after the main lines and customers complain.
- A mid-cycle plan change makes the invoice read out of chronological order.
- You need to decide whether to fix this in presentation or accept it.

## Not for this skill when
- Line amounts are wrong. That is a proration calculation problem.
- Lines are missing entirely. That is an invoice-item problem.

## Steps
1. ('Open the invoice lines via the API and note each line period start. Verify: the order is creation order, not date order.', 'Decide the fix: for most businesses, clearer line descriptions solve the complaint. Verify: descriptions name the plan change.', 'If order is critical, build your own invoice rendering sorted by period start. Verify: the custom view matches the PDF totals.', 'Keep the official Stripe PDF as the record of truth. Verify: your custom view never replaces it for disputes.', 'Set proration line descriptions at the API call level so every future invoice reads clearly. Verify: new invoices carry the descriptions.')

## Variant phrasings
### stripe invoice lines out of order
Short search.

### proration lines at bottom of invoice stripe
Observation search.

### stripe pdf line order
PDF-specific search.


Compatibility: Stripe Billing invoices and hosted PDF rendering, all client versions.

## Why it happens
Invoice lines are an append-only ledger: each line records when it entered the invoice, and the PDF renders that order. Prorations are computed after the base lines exist, so they append at the end. Stripe prioritizes ledger integrity (nothing reorders history) over reading order, which is the right default for accounting but reads oddly for a customer looking at a mid-cycle change.

## Edge cases / pitfalls
- Do not void and recreate invoices just to fix line order. The ledger history matters more.
- Custom invoice views must carry a disclaimer that the Stripe PDF is the official record.
- Sorting by period start can still look odd when periods overlap. Test with real data.
- Proration line descriptions are set per subscription update; a global default is not available.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_oeF_xYyrMHxhVPWGRMyAvg
