MCPcopy
hub / github.com/CodebuffAI/codebuff / getUserByStripeCustomerId

Function getUserByStripeCustomerId

packages/internal/src/util/stripe.ts:31–51  ·  view source on GitHub ↗
(
  stripeCustomerId: string,
)

Source from the content-addressed store, hash-verified

29 * Look up a user by their Stripe customer ID.
30 */
31export async function getUserByStripeCustomerId(
32 stripeCustomerId: string,
33): Promise<{
34 id: string
35 banned: boolean
36 email: string
37 name: string | null
38} | null> {
39 const users = await db
40 .select({
41 id: schema.user.id,
42 banned: schema.user.banned,
43 email: schema.user.email,
44 name: schema.user.name,
45 })
46 .from(schema.user)
47 .where(eq(schema.user.stripe_customer_id, stripeCustomerId))
48 .limit(1)
49
50 return users[0] ?? null
51}

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected