File tree Expand file tree Collapse file tree 2 files changed +0
-15
lines changed
Expand file tree Collapse file tree 2 files changed +0
-15
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,6 @@ STRIPE_SECRET_KEY=sk_test_dummy_stripe_secret
1717STRIPE_WEBHOOK_SECRET_KEY = whsec_dummy_webhook_secret
1818STRIPE_USAGE_PRICE_ID = price_dummy_usage_id
1919STRIPE_TEAM_FEE_PRICE_ID = price_dummy_team_fee_id
20- # Optional: comma-separated user IDs to skip Stripe metering (dev/staging)
21- CODEBUFF_STRIPE_METERING_SKIP_USER_IDS =
2220
2321# External Services
2422LINKUP_API_KEY = dummy_linkup_key
Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ import type { Logger } from '@codebuff/common/types/contracts/logger'
88
99const STRIPE_METER_EVENT_NAME = 'credits'
1010const STRIPE_METER_REQUEST_TIMEOUT_MS = 10_000
11- const STRIPE_METERING_SKIP_USER_IDS_ENV_VAR =
12- 'CODEBUFF_STRIPE_METERING_SKIP_USER_IDS'
1311
1412function shouldAttemptStripeMetering ( ) : boolean {
1513 // Avoid sending Stripe metering events in CI/tests, and when Stripe isn't configured.
@@ -18,16 +16,6 @@ function shouldAttemptStripeMetering(): boolean {
1816 return Boolean ( process . env . STRIPE_SECRET_KEY )
1917}
2018
21- function shouldSkipStripeMeteringForUser ( userId : string ) : boolean {
22- const rawIds = process . env [ STRIPE_METERING_SKIP_USER_IDS_ENV_VAR ]
23- if ( ! rawIds ) return false
24- return rawIds
25- . split ( ',' )
26- . map ( ( value ) => value . trim ( ) )
27- . filter ( Boolean )
28- . includes ( userId )
29- }
30-
3119export async function reportPurchasedCreditsToStripe ( params : {
3220 userId : string
3321 stripeCustomerId ?: string | null
@@ -59,7 +47,6 @@ export async function reportPurchasedCreditsToStripe(params: {
5947 } = params
6048
6149 if ( purchasedCredits <= 0 ) return
62- if ( shouldSkipStripeMeteringForUser ( userId ) ) return
6350 if ( ! shouldAttemptStripeMetering ( ) ) return
6451
6552 const logContext = { userId, purchasedCredits, eventId }
You can’t perform that action at this time.
0 commit comments