@@ -10,6 +10,7 @@ import { BillingMode } from "@gitpod/gitpod-protocol/lib/billing-mode";
10
10
import { getCurrentTeam , TeamsContext } from "./teams-context" ;
11
11
import { getGitpodService } from "../service/service" ;
12
12
import UsageBasedBillingConfig from "../components/UsageBasedBillingConfig" ;
13
+ import Alert from "../components/Alert" ;
13
14
14
15
type PendingStripeSubscription = { pendingSince : number } ;
15
16
@@ -24,6 +25,7 @@ export default function TeamUsageBasedBilling() {
24
25
const [ pollStripeSubscriptionTimeout , setPollStripeSubscriptionTimeout ] = useState < NodeJS . Timeout | undefined > ( ) ;
25
26
const [ stripePortalUrl , setStripePortalUrl ] = useState < string | undefined > ( ) ;
26
27
const [ usageLimit , setUsageLimit ] = useState < number | undefined > ( ) ;
28
+ const [ billingError , setBillingError ] = useState < string | undefined > ( ) ;
27
29
28
30
useEffect ( ( ) => {
29
31
if ( ! team ) {
@@ -85,6 +87,7 @@ export default function TeamUsageBasedBilling() {
85
87
window . localStorage . removeItem ( `pendingStripeSubscriptionForTeam${ team . id } ` ) ;
86
88
clearTimeout ( pollStripeSubscriptionTimeout ! ) ;
87
89
setPendingStripeSubscription ( undefined ) ;
90
+ setBillingError ( error . message || "Could not subscribe team to Stripe. See console for error messages." ) ;
88
91
}
89
92
} ) ( ) ;
90
93
} , [ location . search , team ] ) ;
@@ -160,6 +163,11 @@ export default function TeamUsageBasedBilling() {
160
163
161
164
return (
162
165
< >
166
+ { billingError && (
167
+ < Alert className = "max-w-xl mb-4" closable = { false } showIcon = { true } type = "error" >
168
+ { billingError }
169
+ </ Alert >
170
+ ) }
163
171
< h3 > Usage-Based Billing</ h3 >
164
172
< UsageBasedBillingConfig
165
173
userOrTeamId = { team ?. id || "" }
0 commit comments