## TL;DR

Stripe will not finalize an invoice whose discount references a deleted coupon: the coupon object is gone, so the discount cannot be evaluated. Remove the stale discount from the draft invoice (or replace it with a live coupon), then finalize. Audit where the coupon was deleted to stop the pattern.

```text
stripe invoice finalize failed: discount references a deleted coupon
```

## Use this when

- Stripe invoice finalize fails because the discount references a deleted coupon
- A draft invoice carries a discount from an old promotion
- You clean up coupons and invoices start failing

## Not for this skill when

- The coupon exists but is expired (different validation)
- Finalize fails for a different reason (customer, tax, or payment method)
- You are debugging subscription creation rather than invoice finalize

## Steps

1. Open the draft invoice and list its discounts; identify the one pointing at a deleted coupon.
   Expected: You find the stale reference.
2. Remove the stale discount from the invoice, or attach a live replacement coupon.
   Expected: The invoice references only existing coupons.
3. Finalize the invoice.
   Expected: Finalization succeeds.
4. Check how the coupon was deleted: add a guard that blocks deleting coupons still referenced by draft invoices.
   Expected: The root process is fixed.
5. Reconcile other draft invoices for the same stale coupon.
   Expected: No sibling invoice fails the same way.

## Tool compatibility

Stripe Invoicing API; coupon and discount objects. Deleting a coupon does not retroactively clean draft invoice discounts.

## Variant phrasings

### stripe finalize invoice deleted coupon discount

Word-order variant.

### stripe draft invoice stale discount coupon

The data-state framing.

### stripe cannot finalize invoice coupon not found

The lookup-failure phrasing.

## Why it happens

In Stripe, a coupon is a standalone object and an invoice discount is a reference to it. Deleting the coupon removes the object but leaves existing references dangling on draft invoices. Finalization evaluates every discount, and a dangling reference cannot be evaluated, so the finalize call fails. Stripe does not cascade the delete because the discount may carry business meaning worth preserving. The invoice must be repaired to reference only live objects.

## Edge cases / pitfalls

- Deleting a coupon does not affect already-finalized invoices; only drafts are at risk.
- If the promotion must continue, create a new coupon and swap it in rather than resurrecting the deleted one.
- API-based coupon cleanup scripts are the usual culprit; make them check for draft references first.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_ZMUJcOz-JObnJCRNGx3T9w
