stripe plugin doesnt seem to work

Hey, i've tried integrating the stripe plugin and i just keep getting this type error: There is a issue on github about this but it's just saying that this happens because of a version mismatch.
Type '{ id: "stripe"; endpoints: { stripeWebhook: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & ... 4 more ... & { ...; }) | undefined): Promise<...>; options: { ...; } & ...' is not assignable to type 'BetterAuthPlugin'.
Types of property 'init' are incompatible.
Type '(ctx: AuthContext) => { options: { databaseHooks: { user: { create: { after(user: { id: string; name: string; emailVerified: boolean; email: string; createdAt: Date; updatedAt: Date; image?: string | ... 1 more ... | undefined; }, ctx: GenericEndpointContext | undefined): Promise<...>; }; }; }; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { session?: { session?: { [x: string]: any; id?: string | undefined; token?: string | undefined; userId?: string | undefined; expiresAt?: { ...; } | undefined; createdAt?: { ...; } | undefined; updatedAt?: { ...; } | undefined; ipAddress?: string | ... 1 more
Type '{ id: "stripe"; endpoints: { stripeWebhook: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & ... 4 more ... & { ...; }) | undefined): Promise<...>; options: { ...; } & ...' is not assignable to type 'BetterAuthPlugin'.
Types of property 'init' are incompatible.
Type '(ctx: AuthContext) => { options: { databaseHooks: { user: { create: { after(user: { id: string; name: string; emailVerified: boolean; email: string; createdAt: Date; updatedAt: Date; image?: string | ... 1 more ... | undefined; }, ctx: GenericEndpointContext | undefined): Promise<...>; }; }; }; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { session?: { session?: { [x: string]: any; id?: string | undefined; token?: string | undefined; userId?: string | undefined; expiresAt?: { ...; } | undefined; createdAt?: { ...; } | undefined; updatedAt?: { ...; } | undefined; ipAddress?: string | ... 1 more
auth.ts:
const stripeClient = new Stripe(STRIPE_SECRET_KEY, {
apiVersion: "2025-03-31.basil",
})


export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: schema,
}),
account: {
accountLinking: {
enabled: true,
},
},
basePath: "/v1/auth",
trustedOrigins: [SITE_URL],
plugins: [
stripe({
stripeClient: stripeClient,
stripeWebhookSecret: STRIPE_WEBHOOK_SECRET,
createCustomerOnSignUp: true,
})
]
});
const stripeClient = new Stripe(STRIPE_SECRET_KEY, {
apiVersion: "2025-03-31.basil",
})


export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: schema,
}),
account: {
accountLinking: {
enabled: true,
},
},
basePath: "/v1/auth",
trustedOrigins: [SITE_URL],
plugins: [
stripe({
stripeClient: stripeClient,
stripeWebhookSecret: STRIPE_WEBHOOK_SECRET,
createCustomerOnSignUp: true,
})
]
});
package.json
"dependencies": {
"@better-auth/stripe": "^1.2.12",
"better-auth": "^1.2.12",
"dependencies": {
"@better-auth/stripe": "^1.2.12",
"better-auth": "^1.2.12",
Solution:
The issue occured in the tsconfig file. The error seems to only occur when module and moduleResolution is set to NodeNext This is the config that builds properly and doesnt throw the stripe plugin errors: ...
Jump to solution
3 Replies
sebastian
sebastianOP2mo ago
What i've tried doing: - Downgrading both packages, up to 1.2.9 with no success - rm -rf node_modules My setup is hono with node.js and pnpm adding @ts-ignore to that seems to fix the issue, app proceeds to work and build normally, but of course this shouldnt be a solution The error also leads to other parts of the auth not working at all. For example, inferring types doesnt work when @ts-ignore is present (or this error)
Solution
sebastian
sebastian2mo ago
The issue occured in the tsconfig file. The error seems to only occur when module and moduleResolution is set to NodeNext This is the config that builds properly and doesnt throw the stripe plugin errors: tsconfig.json
{
"compilerOptions": {
"strict": true,
"types": [
"node"
],
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"outDir": "./dist",
"module": "esnext", // setting to NodeNext will throw an error in stripe plugin
"moduleResolution": "bundler",
"skipLibCheck": true,
"esModuleInterop": true,
},
"exclude": ["node_modules"],
"include": ["src/**/*"]
}
{
"compilerOptions": {
"strict": true,
"types": [
"node"
],
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"outDir": "./dist",
"module": "esnext", // setting to NodeNext will throw an error in stripe plugin
"moduleResolution": "bundler",
"skipLibCheck": true,
"esModuleInterop": true,
},
"exclude": ["node_modules"],
"include": ["src/**/*"]
}
mcajongbah
mcajongbah4w ago
Same config but error still persists

Did you find this page helpful?