-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(billing): should allow restoring subscription #1728
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
Greptile Overview
Greptile Summary
This PR enables users to restore subscriptions that have been scheduled for cancellation (cancelAtPeriodEnd=true). Previously, the UI showed a disabled button with a tooltip when a subscription was already cancelled. Now users can actively restore their subscription before it expires.
Key changes:
- Backend: Modified billing portal route to query subscriptions with
cancelAtPeriodEnd=truein addition to active subscriptions, allowing cancelled subscriptions to access the billing portal - Frontend: Replaced disabled tooltip button with functional "Restore" button, updated dialog messaging and styling to support restoration flow
- UI improvements: Dynamic labels, button colors (green for restore, red for cancel), and clearer messaging about subscription status
Scope:
This functionality currently only works for organization/team/enterprise subscriptions, as individual user subscriptions don't track the cancelAtPeriodEnd field in the user subscription store.
Confidence Score: 4/5
- This PR is safe to merge with minimal risk - changes are focused and well-tested
- The implementation is clean and logical, with proper error handling and state management. Backend query correctly includes cancelled subscriptions. The only minor concern is that restore functionality only works for organization subscriptions, not individual user subscriptions, though this appears intentional based on the data model
- No files require special attention - both changes are straightforward and well-implemented
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/api/billing/portal/route.ts | 5/5 | Added query condition to allow billing portal access for cancelled subscriptions (cancelAtPeriodEnd=true), enabling users to restore subscriptions |
| apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/components/cancel-subscription/cancel-subscription.tsx | 4/5 | Replaced disabled tooltip button with functional restore button, updated UI labels and styling to support subscription restoration flow for cancelled organization subscriptions |
Sequence Diagram
sequenceDiagram
participant User
participant UI as CancelSubscription Component
participant Store as Organization Store
participant Auth as Better Auth Client
participant API as Billing Portal API
participant DB as Database
participant Stripe
Note over User,Stripe: Subscription Restoration Flow
User->>UI: Click Restore button
UI->>UI: Check isCancelAtPeriodEnd
UI->>UI: Execute handleKeep function
UI->>Store: Get subscriptionData
Store-->>UI: Return subscription with cancelAtPeriodEnd flag
alt Organization subscription exists and is cancelled
UI->>Auth: Call restore method with referenceId and subscriptionId
Auth->>Stripe: Restore subscription via API
Stripe-->>Auth: Return success
Auth-->>UI: Subscription restored
UI->>Store: Trigger refresh
Store->>API: Fetch updated billing data
API->>DB: Query subscription table
DB-->>API: Return updated subscription data
API-->>Store: Updated subscription data
UI->>Store: Load organization subscription
Store->>API: Request organization subscription
API->>DB: Query with active OR cancelAtPeriodEnd condition
DB-->>API: Subscription data found
API-->>Store: Organization subscription
UI->>Store: Refresh organization
Store-->>UI: Organization refreshed
UI->>UI: Close dialog
UI->>User: Display updated UI state
else No subscription or error occurs
UI->>UI: Set error state
UI->>User: Display error message
end
2 files reviewed, no comments
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * improvement(api-keys): move to workspace level * remove migration to prep merge * remove two more unused cols * prep staging merge * add migration back --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * improvement(start): revert to start block * make it work with start block * fix start block persistence * cleanup triggers * debounce status checks * update docs * improvement(start): revert to start block * make it work with start block * fix start block persistence * cleanup triggers * debounce status checks * update docs * SSE v0.1 * v0.2 * v0.3 * v0.4 * v0.5 * v0.6 * broken checkpoint * Executor progress - everything preliminarily tested except while loops and triggers * Executor fixes * Fix var typing * Implement while loop execution * Loop and parallel result agg * Refactor v1 - loops work * Fix var resolution in for each loop * Fix while loop condition and variable resolution * Fix loop iteration counts * Fix loop badges * Clean logs * Fix variable references from start block * Fix condition block * Fix conditional convergence * Dont execute orphaned nodse * Code cleanup 1 and error surfacing * compile time try catch * Some fixes * Fix error throwing * Sentinels v1 * Fix multiple start and end nodes in loop * Edge restoration * Fix reachable nodes execution * Parallel subflows * Fix loop/parallel sentinel convergence * Loops and parallels orchestrator * Split executor * Variable resolution split * Dag phase * Refactor * Refactor * Refactor 3 * Lint + refactor * Lint + cleanup + refactor * Readability * Initial logs * Fix trace spans * Console pills for iters * Add input/output pills * Checkpoint * remove unused code * THIS IS THE COMMIT THAT CAN BREAK A LOT OF THINGS * ANOTHER BIG REFACTOR * Lint + fix tests * Fix webhook * Remove comment * Merge stash * Fix triggers? * Stuff * Fix error port * Lint * Consolidate state * Clean up some var resolution * Remove some var resolution logs * Fix chat * Fix chat triggers * Fix chat trigger fully * Snapshot refactor * Fix mcp and custom tools * Lint * Fix parallel default count and trace span overlay * Agent purple * Fix test * Fix test --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Add pause resume block * Add db schema * Initial test passes * Tests pass * Execution pauses * Snapshot serializer * Ui checkpoint * Works 1 * Pause resume simple v1 * Hitl block works in parallel branches without timing overlap * Pending status to logs * Pause resume ui link * Big context consolidation * HITL works in loops * Fix parallels * Reference blocks properly * Fix tag dropdown and start block resolution * Filter console logs for hitl block * Fix notifs * Fix logs page * Fix logs page again * Fix * Checkpoint * Cleanup v1 * Refactor v2 * Refactor v3 * Refactor v4 * Refactor v5 * Resume page * Fix variables in loops * Fix var res bugs * Ui changes * Approval block * Hitl works e2e v1 * Fix tets * Row level lock --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Add pause resume block * Add db schema * Initial test passes * Tests pass * Execution pauses * Snapshot serializer * Ui checkpoint * Works 1 * Pause resume simple v1 * Hitl block works in parallel branches without timing overlap * Pending status to logs * Pause resume ui link * Big context consolidation * HITL works in loops * Fix parallels * Reference blocks properly * Fix tag dropdown and start block resolution * Filter console logs for hitl block * Fix notifs * Fix logs page * Fix logs page again * Fix * Checkpoint * Cleanup v1 * Refactor v2 * Refactor v3 * Refactor v4 * Refactor v5 * Resume page * Fix variables in loops * Fix var res bugs * Ui changes * Approval block * Hitl works e2e v1 * Fix tets * Row level lock --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* feat(i18n): update translations * fix(streaming-api): fix streaming api (#1846) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Server side logic to check auth scopes * Fix scopes code * Remove frontend changes * Fix tests * Lint * Remove log for lint * Fix scopes check * Fix conflict --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
…/editing process (#1834) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * make templates root level url and make it part of deployment system * separate updating template and deployment versions * add tags * add credentials extraction logic + use should import with workflow variables * fix credential extraction * add trigger mode indicator * add starred tracking * last updated field * progress on creator profiles * revert creator profile context type * progress fix image uploads * render templates details with creator details * fix collab rules for workflow edit button * creator profile perm check improvements * restore accidental changes * fix accessibility issues for non logged in users * remove unused code * fix type errors --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* feat(i18n): update translations * fix(streaming-api): fix streaming api (#1846) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Server side logic to check auth scopes * Fix scopes code * Remove frontend changes * Fix tests * Lint * Remove log for lint * Fix scopes check * Fix conflict --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
…/editing process (#1834) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * make templates root level url and make it part of deployment system * separate updating template and deployment versions * add tags * add credentials extraction logic + use should import with workflow variables * fix credential extraction * add trigger mode indicator * add starred tracking * last updated field * progress on creator profiles * revert creator profile context type * progress fix image uploads * render templates details with creator details * fix collab rules for workflow edit button * creator profile perm check improvements * restore accidental changes * fix accessibility issues for non logged in users * remove unused code * fix type errors --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* feat(blog): fundraise blog * added scaffolding and authors for everyone's articles * rename blog to studio * add blog post for multiplayer * add profile pic * Executor blog * mark emcn blog as draft * Fix x * v0.4.26 * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> * fix(conflict): resolve merge conflict * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com> * fix(billing): should allow restoring subscription (#1728) (#1925) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com> * cleanup blog --------- Co-authored-by: waleed <waleed> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> Co-authored-by: Siddharth Ganesan <siddharthganesan@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * improvement(api-keys): move to workspace level * remove migration to prep merge * remove two more unused cols * prep staging merge * add migration back --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * improvement(start): revert to start block * make it work with start block * fix start block persistence * cleanup triggers * debounce status checks * update docs * improvement(start): revert to start block * make it work with start block * fix start block persistence * cleanup triggers * debounce status checks * update docs * SSE v0.1 * v0.2 * v0.3 * v0.4 * v0.5 * v0.6 * broken checkpoint * Executor progress - everything preliminarily tested except while loops and triggers * Executor fixes * Fix var typing * Implement while loop execution * Loop and parallel result agg * Refactor v1 - loops work * Fix var resolution in for each loop * Fix while loop condition and variable resolution * Fix loop iteration counts * Fix loop badges * Clean logs * Fix variable references from start block * Fix condition block * Fix conditional convergence * Dont execute orphaned nodse * Code cleanup 1 and error surfacing * compile time try catch * Some fixes * Fix error throwing * Sentinels v1 * Fix multiple start and end nodes in loop * Edge restoration * Fix reachable nodes execution * Parallel subflows * Fix loop/parallel sentinel convergence * Loops and parallels orchestrator * Split executor * Variable resolution split * Dag phase * Refactor * Refactor * Refactor 3 * Lint + refactor * Lint + cleanup + refactor * Readability * Initial logs * Fix trace spans * Console pills for iters * Add input/output pills * Checkpoint * remove unused code * THIS IS THE COMMIT THAT CAN BREAK A LOT OF THINGS * ANOTHER BIG REFACTOR * Lint + fix tests * Fix webhook * Remove comment * Merge stash * Fix triggers? * Stuff * Fix error port * Lint * Consolidate state * Clean up some var resolution * Remove some var resolution logs * Fix chat * Fix chat triggers * Fix chat trigger fully * Snapshot refactor * Fix mcp and custom tools * Lint * Fix parallel default count and trace span overlay * Agent purple * Fix test * Fix test --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Add pause resume block * Add db schema * Initial test passes * Tests pass * Execution pauses * Snapshot serializer * Ui checkpoint * Works 1 * Pause resume simple v1 * Hitl block works in parallel branches without timing overlap * Pending status to logs * Pause resume ui link * Big context consolidation * HITL works in loops * Fix parallels * Reference blocks properly * Fix tag dropdown and start block resolution * Filter console logs for hitl block * Fix notifs * Fix logs page * Fix logs page again * Fix * Checkpoint * Cleanup v1 * Refactor v2 * Refactor v3 * Refactor v4 * Refactor v5 * Resume page * Fix variables in loops * Fix var res bugs * Ui changes * Approval block * Hitl works e2e v1 * Fix tets * Row level lock --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* feat(i18n): update translations * fix(streaming-api): fix streaming api (#1846) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Server side logic to check auth scopes * Fix scopes code * Remove frontend changes * Fix tests * Lint * Remove log for lint * Fix scopes check * Fix conflict --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
…/editing process (#1834) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * make templates root level url and make it part of deployment system * separate updating template and deployment versions * add tags * add credentials extraction logic + use should import with workflow variables * fix credential extraction * add trigger mode indicator * add starred tracking * last updated field * progress on creator profiles * revert creator profile context type * progress fix image uploads * render templates details with creator details * fix collab rules for workflow edit button * creator profile perm check improvements * restore accidental changes * fix accessibility issues for non logged in users * remove unused code * fix type errors --------- Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix
Summary
Restore subscription functionality if already cancelled.
Type of Change
Testing
Tested with Stripe test CLI
Checklist