Skip to content

Add plan cancellation and re-subscription functionality #6826

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

Merged

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented Apr 23, 2025

TL;DR

Added functionality to cancel and renew subscriptions through Stripe, replacing the previous in-app cancellation flow.

What changed?

  • Added new API endpoints for cancellation and resubscription:
    • getPlanCancelUrl: Generates a Stripe URL for cancellation
    • reSubscribePlan: Reactivates a canceled subscription
  • Created a new RenewSubscriptionButton component for reactivating canceled subscriptions
  • Updated the CancelPlanButton to redirect to Stripe for cancellation instead of using the previous in-app form
  • Added UI indicators to show when a plan is scheduled for cancellation
  • Updated the pricing card component to support resubscription functionality
  • Added planCancellationDate field to the Team model to track scheduled cancellations

How to test?

  1. Navigate to a team's billing settings
  2. Test canceling a subscription by clicking "Cancel Plan" - you should be redirected to Stripe
  3. After cancellation, verify the UI shows the plan is scheduled to cancel
  4. Test resubscribing by clicking "Renew Subscription"
  5. Verify the cancellation status is removed after resubscription

Why make this change?

This change improves the subscription management flow by:

  • Leveraging Stripe's native cancellation UI instead of a custom form
  • Providing users with a clear way to reactivate subscriptions before they expire
  • Giving better visibility into subscription status with UI indicators for scheduled cancellations
  • Simplifying the cancellation process while maintaining the ability to collect feedback through Stripe

PR-Codex overview

This PR focuses on enhancing the billing and subscription management features in the application. It introduces new functionalities for plan cancellation and renewal, updates the data structure to manage cancellation dates, and refines the UI components related to billing.

Detailed summary

  • Added planCancellationDate to relevant data structures.
  • Introduced tryCatch utility for improved error handling in async functions.
  • Created RenewSubscriptionButton for renewing subscriptions.
  • Added getPlanCancelUrl and reSubscribePlan actions in billing.
  • Updated PlanInfoCard to display cancellation status and renewal options.
  • Modified various components to utilize new billing functionalities and data.
  • Removed deprecated cancelPlan methods and logic in favor of new implementations.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 11:13 Inactive
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 11:13 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 11:13 Inactive
Copy link

vercel bot commented Apr 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2025 5:37pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Apr 23, 2025 5:37pm
login ⬜️ Skipped (Inspect) Apr 23, 2025 5:37pm
thirdweb_playground ⬜️ Skipped (Inspect) Apr 23, 2025 5:37pm
wallet-ui ⬜️ Skipped (Inspect) Apr 23, 2025 5:37pm

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 11:13 Inactive
Copy link

changeset-bot bot commented Apr 23, 2025

⚠️ No Changeset found

Latest commit: b722df1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added Dashboard Involves changes to the Dashboard. packages labels Apr 23, 2025
Copy link
Member Author

jnsdls commented Apr 23, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jnsdls jnsdls force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from a944510 to a759921 Compare April 23, 2025 11:14
@jnsdls jnsdls marked this pull request as ready for review April 23, 2025 11:14
@jnsdls jnsdls requested review from a team as code owners April 23, 2025 11:14
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 11:14 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 11:14 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 11:14 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 11:14 Inactive
@jnsdls jnsdls force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from a759921 to 50b5dd0 Compare April 23, 2025 11:16
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 11:16 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 11:16 Inactive
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 11:16 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 11:16 Inactive
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.18%. Comparing base (4baefa5) to head (b722df1).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6826   +/-   ##
=======================================
  Coverage   55.18%   55.18%           
=======================================
  Files         896      896           
  Lines       56953    56953           
  Branches     3946     3946           
=======================================
  Hits        31429    31429           
  Misses      25428    25428           
  Partials       96       96           
Flag Coverage Δ
packages 55.18% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

github-actions bot commented Apr 23, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 50.92 KB (0%) 1.1 s (0%) 199 ms (+170.2% 🔺) 1.3 s
thirdweb (cjs) 143.74 KB (0%) 2.9 s (0%) 321 ms (+82.2% 🔺) 3.2 s
thirdweb (minimal + tree-shaking) 5.66 KB (0%) 114 ms (0%) 82 ms (+1584.93% 🔺) 195 ms
thirdweb/chains (tree-shaking) 514 B (0%) 11 ms (0%) 45 ms (+3003.69% 🔺) 55 ms
thirdweb/react (minimal + tree-shaking) 19.33 KB (0%) 387 ms (0%) 101 ms (+546% 🔺) 488 ms

@jnsdls jnsdls force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from 50b5dd0 to 6961ea4 Compare April 23, 2025 11:41
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 11:41 Inactive
@jnsdls jnsdls force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from 6961ea4 to 9b45b42 Compare April 23, 2025 12:39
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 12:39 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 12:39 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 12:39 Inactive
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 12:39 Inactive
@jnsdls jnsdls force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from 9b45b42 to 23297a7 Compare April 23, 2025 12:40
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 12:40 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 12:40 Inactive
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 12:40 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 12:40 Inactive
@jnsdls jnsdls force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from 23297a7 to 259f17a Compare April 23, 2025 12:50
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 12:50 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 12:50 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 12:50 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 12:50 Inactive
@MananTank MananTank force-pushed the Add_plan_cancellation_and_re-subscription_functionality branch from 259f17a to b722df1 Compare April 23, 2025 17:30
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 23, 2025 17:30 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 23, 2025 17:30 Inactive
@vercel vercel bot temporarily deployed to Preview – login April 23, 2025 17:30 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 23, 2025 17:30 Inactive
@jnsdls jnsdls merged commit f912e42 into main Apr 23, 2025
24 checks passed
@jnsdls jnsdls deleted the Add_plan_cancellation_and_re-subscription_functionality branch April 23, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard. packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants