-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[UBP] Allow individual users to sign up for usage based pricing #12942
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
* Use the new `useStripe` hook on the team and individual billing pages.
started the job as gitpod-build-af-create-user-stripe-customer-from-ui.17 because the annotations in the pull request description changed |
Move the useEffect hooks into the common `UsageBasedBillingConfig` component.
Calculate it from the subject id instead.
return; | ||
} | ||
try { | ||
const pendingStripeSubscription = window.localStorage.getItem(localStorageKey); |
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.
Why is pendingStripeSubscription a global and not local state?
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.
I see it used to be like this before this change, just wonder what the reason is.
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.
@svenefftinge Can you do a local state that survives navigations and page reloads? 👀
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.
Of course not (navigation, yes). Why does it need to survive that?
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.
We've seen that users like to reload billing/subscription pages often.
The currently-persisted "pending subscription" allows the following UX:
- Enter credit card details
- They go through, we're subscribing you to Stripe
- You reload the page -- we're still subscribing you to Stripe and waiting for confirmation
Without the persistence, it changes to:
- Enter credit card details
- They go through, we're subscribing you to Stripe
- You reload the page -- it looks like it didn't work, so maybe you immediately try to add your credit card again
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.
Many thanks! Code looks good to me, and works as intended. 🎯
/hold because of the margin fix
components/dashboard/src/components/UsageBasedBillingConfig.tsx
Outdated
Show resolved
Hide resolved
components/dashboard/src/components/UsageBasedBillingConfig.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Keromnes <[email protected]>
2a0bbe1
to
48edfca
Compare
/unhold |
Description
Allow individual users to sign up for usage based billing via their settings page:
Screen.Recording.2022-09-14.at.07.53.21.mov
Previously, signup for usage based billing was only available to teams.
This PR builds on several previous PRs to add the necessary endpoints to the server JSON-RPC API.
findStripeSubscriptionId
method to server #12876getStripePortalUrl
method to server #12864getUsageLimit
andsetUsageLimit
methods to server #12767subscribeToStripe
server method #12887Related Issue(s)
Part of #12685 and #12684.
How to test
"Gitpod-something"
team in the preview env.Release Notes
Documentation
Werft options: