@@ -119,6 +119,7 @@ import { UsageServiceDefinition } from "@gitpod/usage-api/lib/usage/v1/usage.pb"
119
119
import { BillingServiceClient , BillingServiceDefinition } from "@gitpod/usage-api/lib/usage/v1/billing.pb" ;
120
120
import { IncrementalPrebuildsService } from "../prebuilds/incremental-prebuilds-service" ;
121
121
import { ConfigProvider } from "../../../src/workspace/config-provider" ;
122
+ import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server" ;
122
123
123
124
@injectable ( )
124
125
export class GitpodServerEEImpl extends GitpodServerImpl {
@@ -2177,6 +2178,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
2177
2178
2178
2179
const user = this . checkAndBlockUser ( "subscribeToStripe" ) ;
2179
2180
2181
+ let team : Team | undefined ;
2180
2182
try {
2181
2183
if ( attrId . kind === "team" ) {
2182
2184
const team = await this . guardTeamOperation ( attrId . teamId , "update" ) ;
@@ -2189,6 +2191,18 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
2189
2191
throw new Error ( `No Stripe customer profile for '${ attributionId } '` ) ;
2190
2192
}
2191
2193
2194
+ const createStripeSubscriptionOnUsage = await getExperimentsClientForBackend ( ) . getValueAsync (
2195
+ "createStripeSubscriptionOnUsage" ,
2196
+ false ,
2197
+ {
2198
+ user : user ,
2199
+ } ,
2200
+ ) ;
2201
+
2202
+ if ( createStripeSubscriptionOnUsage ) {
2203
+ await this . billingService . createStripeSubscription ( { attributionId, setupIntentId, usageLimit } ) ;
2204
+ }
2205
+
2192
2206
await this . stripeService . setDefaultPaymentMethodForCustomer ( customerId , setupIntentId ) ;
2193
2207
await this . stripeService . createSubscriptionForCustomer ( customerId , attributionId ) ;
2194
2208
0 commit comments