Skip to content

Commit 05a665b

Browse files
committed
fix(billing): remove stripe metering user skip list
1 parent 6bb1472 commit 05a665b

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ STRIPE_SECRET_KEY=sk_test_dummy_stripe_secret
1717
STRIPE_WEBHOOK_SECRET_KEY=whsec_dummy_webhook_secret
1818
STRIPE_USAGE_PRICE_ID=price_dummy_usage_id
1919
STRIPE_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
2422
LINKUP_API_KEY=dummy_linkup_key

packages/billing/src/stripe-metering.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import type { Logger } from '@codebuff/common/types/contracts/logger'
88

99
const STRIPE_METER_EVENT_NAME = 'credits'
1010
const STRIPE_METER_REQUEST_TIMEOUT_MS = 10_000
11-
const STRIPE_METERING_SKIP_USER_IDS_ENV_VAR =
12-
'CODEBUFF_STRIPE_METERING_SKIP_USER_IDS'
1311

1412
function 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-
3119
export 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 }

0 commit comments

Comments
 (0)