Skip to content

[Usage-based] Untie paid Stripe subscriptions from calendar months #14705

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 3 commits into from
Nov 16, 2022

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Nov 15, 2022

Description

Related Issue(s)

Fixes #14700

How to test

  1. Create a team called "Gitpod [Something]"
  2. Upgrade that team to usage-based on Stripe by adding a payment method (e.g. 4242 4242 4242 4242, 4/24, 424)
  3. Once active, the Billing UI should show the dates "(today) - (today + 1 month)"
    a. It should not show "(first day of month)" or "(last day of month)" as was the case before
    a. Hint: You can hover over the billing cycle dates to see the exact millisecond (both boundaries should be on the same second, one month apart)

Release Notes

NONE

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-jx-adjust-monthly-cycles.1 because the annotations in the pull request description changed
(with .werft/ from main)

@jankeromnes jankeromnes force-pushed the jx/adjust-monthly-cycles branch from 32c6638 to 3224ece Compare November 15, 2022 14:31
@roboquat roboquat added size/M and removed size/XS labels Nov 15, 2022
@jankeromnes jankeromnes force-pushed the jx/adjust-monthly-cycles branch from 6a1dcff to e8f8dd6 Compare November 15, 2022 15:07
@jankeromnes jankeromnes marked this pull request as ready for review November 16, 2022 08:52
@jankeromnes jankeromnes requested a review from a team November 16, 2022 08:52
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Nov 16, 2022
@jankeromnes jankeromnes force-pushed the jx/adjust-monthly-cycles branch from e8f8dd6 to d6cec8e Compare November 16, 2022 09:21
@jankeromnes jankeromnes requested a review from a team November 16, 2022 09:21
@github-actions github-actions bot added the team: workspace Issue belongs to the Workspace team label Nov 16, 2022
@jankeromnes jankeromnes force-pushed the jx/adjust-monthly-cycles branch from d6cec8e to c936b09 Compare November 16, 2022 10:18
@jankeromnes jankeromnes requested a review from a team November 16, 2022 10:18
Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
/hold for Qs

How will you update the existing Stripe CostCenter records?

Also, the ResetJob doesn't touch any Stripe CostCenters, so the value in https://github.com/gitpod-io/gitpod/pull/14705/files#diff-3d0d7f3b128d2677bfd96f23f31f3f8935756b31537aad113d58eb08ac654cb1R190 will be out of date after the first subscription to stripe.

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Nov 16, 2022

How will you update the existing Stripe CostCenter records?

That's the beauty of it -- we don't 😇

  • All existing Stripe CostCenters are firmly anchored to calendar months. They may not have a NextBillingTime, or even a BillingCycleStart, but that doesn't matter, because the UI falls back to calendar months and always shows the right dates 👍

  • Only new Stripe CostCenters can be anchored on any arbitrary date after this PR is deployed. And, thankfully, in the same PR, we also make sure that any new Stripe CostCenter has both a NextBillingTime and a BillingCycleStart 👍

Thus, the UI will always show the right dates, no matter if old or new Stripe CostCenter. 🪄

Also, the ResetJob doesn't touch any Stripe CostCenters, so the value in https://github.com/gitpod-io/gitpod/pull/14705/files#diff-3d0d7f3b128d2677bfd96f23f31f3f8935756b31537aad113d58eb08ac654cb1R190 will be out of date after the first subscription to stripe.

Aha, interesting, I assumed that it would create a new Stripe CostCenter. If not, this sounds like a good follow-up issue. 💡

@jankeromnes jankeromnes force-pushed the jx/adjust-monthly-cycles branch from c936b09 to e253c20 Compare November 16, 2022 11:17
@jankeromnes
Copy link
Contributor Author

jankeromnes commented Nov 16, 2022

Artemis 1 is go for launch! 🚀 🌖

/unhold

@easyCZ
Copy link
Member

easyCZ commented Nov 16, 2022

Aha, interesting, I assumed that it would create a new Stripe CostCenter. If not, this sounds like a good follow-up issue. 💡

This was by design at that time, because the Stripe Invoice webhook is what triggers a spending limit reset and the CostCenter was meant to remain the same. Nothing stops us from creating a new CostCenter, but it should happen in response to the Stripe invoice, rather than when the billing period "ends" in our system.

@roboquat roboquat merged commit 0c38331 into main Nov 16, 2022
@roboquat roboquat deleted the jx/adjust-monthly-cycles branch November 16, 2022 11:29
@roboquat roboquat added the deployed: webapp Meta team change is running in production label Nov 17, 2022
@gtsiolis gtsiolis mentioned this pull request Nov 21, 2022
4 tasks
@roboquat roboquat added deployed: workspace Workspace team change is running in production deployed Change is completely running in production labels Dec 7, 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: workspace Workspace team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Usage-based] Untie paid Stripe subscriptions from calendar months
3 participants