Skip to content

fix: keep paid limits during Stripe retries#386

Merged
KMKoushik merged 1 commit intomainfrom
fix/stripe-retry-entitlement
Apr 1, 2026
Merged

fix: keep paid limits during Stripe retries#386
KMKoushik merged 1 commit intomainfrom
fix/stripe-retry-entitlement

Conversation

@KMKoushik
Copy link
Copy Markdown
Member

@KMKoushik KMKoushik commented Apr 1, 2026

Summary

  • keep teams on paid entitlement while Stripe is retrying a failed invoice so send limits do not fall back to the free daily cap immediately
  • reuse the same subscription-status check in the billing UI so retrying subscriptions are still shown as paid instead of free
  • add unit coverage for the entitled subscription statuses, including past_due

Verification

  • pnpm --filter=web exec vitest run -c vitest.unit.config.ts src/lib/subscription-status.unit.test.ts

Summary by cubic

Keep teams on paid limits while Stripe retries failed invoices so they don’t drop to free caps during past_due. The billing UI now also shows the paid plan during retries.

  • Bug Fixes
    • Added isEntitledSubscriptionStatus to treat active, trialing, and past_due as paid/entitled.
    • Used the helper in billing sync to set isActive and in PlanDetails to display the paid plan during retries.
    • Added unit tests covering entitled statuses, including past_due.

Written for commit 33e340e. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Expanded subscription entitlement logic to properly recognize trial and past-due accounts as active subscribers, ensuring accurate plan display and team status.
  • Tests

    • Added comprehensive test coverage for subscription status validation.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
unsend-marketing Ready Ready Preview, Comment Apr 1, 2026 2:35am

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

A new utility function isEntitledSubscriptionStatus was introduced to determine whether a subscription qualifies as entitled based on its status. The function treats "active", "trialing", and "past_due" statuses as entitled. This helper is now used in the PlanDetails component to decide which plan label to display and in the billing sync logic to determine team active status. Unit tests were added to validate the function's behavior across various subscription states.

Possibly related PRs

Suggested labels

codex

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: keep paid limits during Stripe retries' directly addresses the main objective: preserving paid entitlement during Stripe retries so send limits don't revert to free tier.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying usesend with  Cloudflare Pages  Cloudflare Pages

Latest commit: 33e340e
Status: ✅  Deploy successful!
Preview URL: https://f476ac27.usesend.pages.dev
Branch Preview URL: https://fix-stripe-retry-entitlement.usesend.pages.dev

View logs

@KMKoushik KMKoushik merged commit b20f3b5 into main Apr 1, 2026
6 of 7 checks passed
@KMKoushik KMKoushik deleted the fix/stripe-retry-entitlement branch April 1, 2026 02:37
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