-
Notifications
You must be signed in to change notification settings - Fork 591
fix(billing): show correct tier for declined payment statuses #4481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
@Ridhim-RR is attempting to deploy a commit to the Unkey Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughChanged billing-tier detection in the dashboard settings: introduced a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/client.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Flo4604
Repo: unkeyed/unkey PR: 4190
File: go/internal/services/keys/verifier.go:51-53
Timestamp: 2025-10-30T15:10:52.743Z
Learning: PR #4190 for unkeyed/unkey is focused solely on database schema and query changes for identity-based credits. It adds IdentityCredits and KeyCredits fields to structs and queries, but does not implement the priority enforcement logic in the usagelimiter. The logic implementation is intentionally deferred to a later PR in the stack.
📚 Learning: 2024-10-08T15:33:04.290Z
Learnt from: mcstepp
Repo: unkeyed/unkey PR: 2120
File: apps/dashboard/app/(app)/settings/billing/stripe/success/page.tsx:19-19
Timestamp: 2024-10-08T15:33:04.290Z
Learning: In the `StripeSuccess` function, TypeScript's type-checking of the `new_plan` parameter ensures that only "free", "pro", or undefined values are accepted, so additional runtime validation is not necessary.
Applied to files:
apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/client.tsx
🔇 Additional comments (2)
apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/client.tsx (2)
79-79: LGTM! Clean simplification of free tier detection.The
isFreeTierlogic now correctly prevents showing the free tier alert during payment issues, which resolves the reported bug.
81-84: Verify that quota display and plan change policies align with business requirements during declined payment states.The change now displays
currentProductfor allpaidStatusesincluding declined payments. This affects:
- Line 99: Users see their paid tier quota even during
past_due,unpaid, orincompletestates- Lines 108-115: Users can still access
PlanSelectionModalto change plans during declined statesBefore merging, confirm:
- The displayed quota on line 99 matches what the backend enforces when payments are declined
- Whether plan changes should be permitted (or restricted) during payment issues per your business policy
What does this PR do?
Closes #4447
When a user's payment declines, the UI incorrectly shows the user as on the Free tier. Users on a paid/billing tier should continue to see their
billing tier while payment retries are in progress. The Free tier label should only be shown if the user is actually on the Free tier.
Fixes # (issue)
Updated the billing tier detection logic to treat payment statuses (past_due) as paid subscriptions for UI purposes:
If there is not an issue for this, please create one first. This is used to tracking purposes and also helps us understand why this PR exists
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtmake fmton/godirectoryconsole.logsgit pull origin mainAppreciated