Skip to content

fix(api): restore tier on paid subscription renewal - #116

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-management-c9d1
Draft

fix(api): restore tier on paid subscription renewal#116
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-management-c9d1

Conversation

@cursor

@cursor cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

A subscriber whose invoice temporarily failed was downgraded to the free tier by invoice.payment_failed. If Stripe later collected the renewal invoice, invoice.paid granted credits but did not restore the paid tier, leaving a paying customer stuck on free-tier limits.

Root cause

The renewal webhook only incremented credits. It did not apply tierFromSubscriptionPlanId(subscription.metadata.plan_id) the way the initial subscription checkout path does.

Fix

Add a focused helper for paid subscription invoice updates and use it in the renewal transaction so recognized plan metadata restores the paid tier while malformed metadata does not accidentally downgrade an existing tier.

Validation

  • npm run build
  • node tests/billing-helpers.test.mjs
  • npx tsc --noEmit
Open in Web View Automation 

cursoragent and others added 2 commits August 4, 2026 05:04
Co-authored-by: Deesmo <Deesmo@users.noreply.github.com>
Co-authored-by: Deesmo <Deesmo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant