Skip to content

[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

Merged
merged 6 commits into from
Sep 15, 2022

Conversation

andrew-farries
Copy link
Contributor

@andrew-farries andrew-farries commented Sep 14, 2022

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.

Related Issue(s)

Part of #12685 and #12684.

How to test

  1. Create a "Gitpod-something" team in the preview env.
  2. Sign the team up for UBP.
  3. Go to the billing tab on your individual user settings page.
  4. Sign yourself up for UBP.
  5. See the individual user created in the Stripe dashboard with a payment method and subscription.

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview
  • /werft with-payment

* Use the new `useStripe` hook on the team and individual billing pages.
@andrew-farries andrew-farries requested a review from a team September 14, 2022 07:44
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 14, 2022
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-af-create-user-stripe-customer-from-ui.17 because the annotations in the pull request description changed
(with .werft/ from main)

Move the useEffect hooks into the common `UsageBasedBillingConfig`
component.
Calculate it from the subject id instead.
return;
}
try {
const pendingStripeSubscription = window.localStorage.getItem(localStorageKey);
Copy link
Member

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?

Copy link
Member

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.

Copy link
Contributor

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? 👀

Copy link
Member

@svenefftinge svenefftinge Sep 15, 2022

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?

Copy link
Contributor

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:

  1. Enter credit card details
  2. They go through, we're subscribing you to Stripe
  3. You reload the page -- we're still subscribing you to Stripe and waiting for confirmation

Without the persistence, it changes to:

  1. Enter credit card details
  2. They go through, we're subscribing you to Stripe
  3. You reload the page -- it looks like it didn't work, so maybe you immediately try to add your credit card again

Copy link
Contributor

@jankeromnes jankeromnes left a 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

@andrew-farries andrew-farries force-pushed the af/create-user-stripe-customer-from-ui branch from 2a0bbe1 to 48edfca Compare September 15, 2022 08:56
@andrew-farries
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit 61e424e into main Sep 15, 2022
@roboquat roboquat deleted the af/create-user-stripe-customer-from-ui branch September 15, 2022 10:26
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants