404 on subscription routes

Hey there, I am currently trying to setup stripe with Better Auth, but I am always getting a 404 error when trying to upgrade / create a subscription, even though I should have the correct route setup, if I'm not mistaken
No description
No description
2 Replies
nikatune
nikatune4mo ago
send your auth config
Zetax
ZetaxOP4mo ago
I think I found the issue: The schema generation command doesn't actually generate the subscription tables etc. Here is my config:
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { apiKey, organization } from "better-auth/plugins";
import { stripe } from "@better-auth/stripe";
import Stripe from "stripe";

import { db } from "@/lib/db/client";
import { authSchema } from "./db/schemas/auth";

const stripeClient = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: "2025-06-30.basil",
});

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: authSchema,
}),
emailAndPassword: {
enabled: true,
},
plugins: [
organization(),
apiKey(),
stripe({
stripeClient,
stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
createCustomerOnSignUp: true,
plans: [
{
name: "basic",
priceId: "price_1RizE5PBaDjRkMArV0Dxvy6K",
limits: {
projects: 1,
storage: 1,
},
},
{
name: "pro",
priceId: "price_1RizDwPBaDjRkMArNijyDnDx",
limits: {
projects: 1,
storage: 1,
},
},
],
}),
],
});
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { apiKey, organization } from "better-auth/plugins";
import { stripe } from "@better-auth/stripe";
import Stripe from "stripe";

import { db } from "@/lib/db/client";
import { authSchema } from "./db/schemas/auth";

const stripeClient = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: "2025-06-30.basil",
});

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: authSchema,
}),
emailAndPassword: {
enabled: true,
},
plugins: [
organization(),
apiKey(),
stripe({
stripeClient,
stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
createCustomerOnSignUp: true,
plans: [
{
name: "basic",
priceId: "price_1RizE5PBaDjRkMArV0Dxvy6K",
limits: {
projects: 1,
storage: 1,
},
},
{
name: "pro",
priceId: "price_1RizDwPBaDjRkMArNijyDnDx",
limits: {
projects: 1,
storage: 1,
},
},
],
}),
],
});
But adding the tables manually doesnt resolve it either Nevermind, issue closed. I forgot to put the plans array in the correct key in the stripe plugin config

Did you find this page helpful?