-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[server][dashboard] Allow new Stripe customers to select their billing currency #12376
Conversation
01bc480
to
91374b6
Compare
2274614
to
b8eaa99
Compare
913cf9f
to
0734efb
Compare
0734efb
to
c105b5e
Compare
…thProviderEntryDBSpec
…red billing currency
…calling e.stopPropagation() on click events
c105b5e
to
491c9fc
Compare
return customer; | ||
} | ||
|
||
async setPreferredCurrencyForCustomer(customer: Stripe.Customer, currency: string): Promise<void> { |
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.
How do we ensure that currency
is a valid value? Does Stripe reject an invalid type of currency?
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.
currency
can be any string. Then, when we choose a Gitpod Product Price in Stripe, we see if one is available in our configuration for that specific string. If there is, great. If not, we pick the USD
Price.
if (!customer) { | ||
customer = await this.stripeService.createCustomerForTeam(user, team!); | ||
} | ||
await this.stripeService.setPreferredCurrencyForCustomer(customer, currency); |
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.
Would this allow me to change my currency after I've got a subscription in one currency? And if so, is that a problem?
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.
Would this allow me to change my currency after I've got a subscription in one currency?
Yes -- you can always cancel your Subscription, then buy a new Subscription in any available currency.
And if so, is that a problem?
No -- this is a feature. If you're paying in USD, but want to change to EUR, you can.
ERRATUM: @AlexTugarev found that you actually cannot switch currencies without first recreating a new Stripe customer. If you subscribe with one currency, then cancel, then upgrade with another currency, Stripe will refuse the upgrade with:
The only way to switch currencies is to contact Gitpod support, so that we delete the Stripe customer (or, maybe better, modify the |
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.
LGTM from a backend side. I don't have as much context on the UI but looks good to me.
/hold in case you want someone else to take a look at UI side
Many thanks @easyCZ! @AlexTugarev had a good follow-up suggestion -- for these cases where subscribing fails, we don't properly display errors in the UI. It would be good to show (maybe not the full Stripe errors, but at least some hint that things went wrong and that you may need to contact support). |
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.
LGTM!
The flow to set a currency worked nicely 👏🏻
We catched #12376 (comment)
Can be handled as follow-up
Many thanks! 🚀 Let's improve in follow-ups. /unhold |
Filed this follow-up issue: #12580 |
Description
Allow new Stripe customers to select their billing currency.
Related Issue(s)
Fixes #12343
How to test
Release Notes
Documentation
Werft options: