subscription table is not generated

Following https://www.better-auth.com/docs/plugins/stripe#subscription guide and version 1.2.5 my auth looks like:
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
}),
plugins: [
admin(),
organization(),
emailOTP({
async sendVerificationOTP({ email, otp, type }) {
logger.info("Sending verification OTP to:", email);
logger.info(otp, "OTP:");
logger.info(type, "Type:");
},
}),
stripe({
stripeClient,
stripeWebhookSecret: env.STRIPE_WEBHOOK_SECRET!,
createCustomerOnSignUp: true,
onCustomerCreate: async ({ customer, stripeCustomer, user }, request) => {
// Do something with the newly created customer
console.log(`Customer ${customer.id} created for user ${user.id}`);
},
getCustomerCreateParams: async ({ user, session }, request) => {
// Customize the Stripe customer creation parameters
return {
metadata: {
referralSource: user.metadata?.referralSource,
},
};
},
}),
// Always put nextCookies at the end of this array
nextCookies(),
],
});
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
}),
plugins: [
admin(),
organization(),
emailOTP({
async sendVerificationOTP({ email, otp, type }) {
logger.info("Sending verification OTP to:", email);
logger.info(otp, "OTP:");
logger.info(type, "Type:");
},
}),
stripe({
stripeClient,
stripeWebhookSecret: env.STRIPE_WEBHOOK_SECRET!,
createCustomerOnSignUp: true,
onCustomerCreate: async ({ customer, stripeCustomer, user }, request) => {
// Do something with the newly created customer
console.log(`Customer ${customer.id} created for user ${user.id}`);
},
getCustomerCreateParams: async ({ user, session }, request) => {
// Customize the Stripe customer creation parameters
return {
metadata: {
referralSource: user.metadata?.referralSource,
},
};
},
}),
// Always put nextCookies at the end of this array
nextCookies(),
],
});
and when i do npx @better-auth/cli generate, i dont see subscription table in generated schema. The only change i see is a new field stripeCustomerId: text("stripe_customer_id"), added to user table. is this expected? as the guide says both user and subscription table will be generated. not sure if this is related, but i am getting metadata not exists on referralSource: user.metadata?.referralSource,
Stripe | Better Auth
Stripe plugin for Better Auth to manage subscriptions and payments.
No description
2 Replies
vz
vzOP3w ago
GitHub
better-auth/packages/stripe/src/schema.ts at 18744b04ba1bff4c660f7d...
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
KiNFiSH
KiNFiSH3w ago
yeah you need to enable it

Did you find this page helpful?