-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[stripe] Create customers with attributionId #12752
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
/werft run 👍 started the job as gitpod-build-mp-stripe-attribution-id.1 |
// userId is deprecated, use attributionId where possible | ||
userId: user.id, |
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.
Nit: I think the only place where this userId
metadata is used is a few lines above in findCustomerByUserId
.
If you also update findCustomerByUserId
to use the attributionId
, then you can completely remove the now useless userId
metadata. 👍
// userId is deprecated, use attributionId where possible | |
userId: user.id, |
// teamId is deprecated, use attributionId where possible | ||
teamId: team.id, |
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.
Nit: Same as above -- the only place where the teamId
metadata is used is in findCustomerByTeamId
above. If you update this method, you can remove the now useless teamId
metadata.
// teamId is deprecated, use attributionId where possible | |
teamId: team.id, |
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 cannot yet update the find queries to use this field as we have customers in Stripe without the attributionID property.
We cannot remove it yet, lookup queries would fail on existing customers.
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.
The reason it stays on the create is consistency, we want to phase out teamId, but that doesn't mean we can stop setting it, due to existing queries.
/hold |
Actually yes, we can. The updated find queries may no longer find existing Stripe customers, and thus conclude that your team/user is not a customer yet. This is totally safe and allows you to create a new customer. Also, in production, there is currently one single customer. I'll even go ahead and add the EDIT: Done ✅ |
There's also the Usage component which performs these queries. Let's do it properly:
|
270dcb5
to
3196d74
Compare
True, there are also 4 occurrences to fix in https://github.com/gitpod-io/gitpod/blob/main/components/usage/pkg/stripe/stripe.go Fixing them shouldn't take too long. 😊
I don't see any benefit in doing this very slowly over multiple PRs/deployments. Why take several days to do something we could do in just 5 minutes in one PR? Reminder: There is just one customer in Stripe that matters, and its metadata is already up-to-date. We don't need a very slow & very safe migration path for one customer which is ourselves. |
Sounds like #12753 is relevant here. This is where we start creating new Stripe customers for individual users. It currently sets |
We want staging to work also. The reason for doing it properly is to practice the mechanics. Sooner or later we will need to do this when UBP is released to real customers and we won't have as much room for error on this. |
/unhold |
Customers in staging don't matter. If queries can't find existing customers, it's just like the customers never existed, and teams can upgrade again with a fake credit card.
Agreed, once UBP is released and deployed and massively used, we will need to migrate much more slowly and safely. However, today it's not useful to slow ourselves down. In fact, the more days of work we save ourselves, the sooner we can release UBP. |
I'll do it iteratively. If not for any other benefit than my own to practice this when it is needed for real. Thank you for the suggestion of an alternative approach! |
Description
Create customers (user/team) with an AttributionID instead of user/team ID. We cannot yet update the find queries to use this field as we have customers in Stripe without the attributionID property.
Once this has propagated enough, we can also kill the user/team specific methods and use the Attribution ID only.
Related Issue(s)
Fixes #
How to test
Release Notes
Documentation
Werft options: