@@ -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 {
@@ -2189,8 +2190,20 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
2189
2190
throw new Error ( `No Stripe customer profile for '${ attributionId } '` ) ;
2190
2191
}
2191
2192
2192
- await this . stripeService . setDefaultPaymentMethodForCustomer ( customerId , setupIntentId ) ;
2193
- await this . stripeService . createSubscriptionForCustomer ( customerId , attributionId ) ;
2193
+ const createStripeSubscriptionOnUsage = await getExperimentsClientForBackend ( ) . getValueAsync (
2194
+ "createStripeSubscriptionOnUsage" ,
2195
+ false ,
2196
+ {
2197
+ user : user ,
2198
+ } ,
2199
+ ) ;
2200
+
2201
+ if ( createStripeSubscriptionOnUsage ) {
2202
+ await this . billingService . createStripeSubscription ( { attributionId, setupIntentId, usageLimit } ) ;
2203
+ } else {
2204
+ await this . stripeService . setDefaultPaymentMethodForCustomer ( customerId , setupIntentId ) ;
2205
+ await this . stripeService . createSubscriptionForCustomer ( customerId , attributionId ) ;
2206
+ }
2194
2207
2195
2208
// Creating a cost center for this customer
2196
2209
const { costCenter } = await this . usageService . setCostCenter ( {
0 commit comments