mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 04:19:22 +00:00
fix(demo): put get plans inside a sync function (#4372)
This commit is contained in:
@@ -41,15 +41,6 @@ if (!dialect) {
|
|||||||
throw new Error("No dialect found");
|
throw new Error("No dialect found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRO_PRICE_ID = {
|
|
||||||
default: "price_1RoxnRHmTADgihIt4y8c0lVE",
|
|
||||||
annual: "price_1RoxnoHmTADgihItzFvVP8KT",
|
|
||||||
};
|
|
||||||
const PLUS_PRICE_ID = {
|
|
||||||
default: "price_1RoxnJHmTADgihIthZTLmrPn",
|
|
||||||
annual: "price_1Roxo5HmTADgihItEbJu5llL",
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseURL: string | undefined =
|
const baseURL: string | undefined =
|
||||||
process.env.VERCEL === "1"
|
process.env.VERCEL === "1"
|
||||||
? process.env.VERCEL_ENV === "production"
|
? process.env.VERCEL_ENV === "production"
|
||||||
@@ -200,24 +191,43 @@ export const auth = betterAuth({
|
|||||||
subscription: {
|
subscription: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReTrialsForDifferentPlans: true,
|
allowReTrialsForDifferentPlans: true,
|
||||||
plans: [
|
plans: () => {
|
||||||
{
|
const PRO_PRICE_ID = {
|
||||||
name: "Plus",
|
default:
|
||||||
priceId: PLUS_PRICE_ID.default,
|
process.env.STRIPE_PRO_PRICE_ID ??
|
||||||
annualDiscountPriceId: PLUS_PRICE_ID.annual,
|
"price_1RoxnRHmTADgihIt4y8c0lVE",
|
||||||
freeTrial: {
|
annual:
|
||||||
days: 7,
|
process.env.STRIPE_PRO_ANNUAL_PRICE_ID ??
|
||||||
|
"price_1RoxnoHmTADgihItzFvVP8KT",
|
||||||
|
};
|
||||||
|
const PLUS_PRICE_ID = {
|
||||||
|
default:
|
||||||
|
process.env.STRIPE_PLUS_PRICE_ID ??
|
||||||
|
"price_1RoxnJHmTADgihIthZTLmrPn",
|
||||||
|
annual:
|
||||||
|
process.env.STRIPE_PLUS_ANNUAL_PRICE_ID ??
|
||||||
|
"price_1Roxo5HmTADgihItEbJu5llL",
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: "Plus",
|
||||||
|
priceId: PLUS_PRICE_ID.default,
|
||||||
|
annualDiscountPriceId: PLUS_PRICE_ID.annual,
|
||||||
|
freeTrial: {
|
||||||
|
days: 7,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
name: "Pro",
|
||||||
name: "Pro",
|
priceId: PRO_PRICE_ID.default,
|
||||||
priceId: PRO_PRICE_ID.default,
|
annualDiscountPriceId: PRO_PRICE_ID.annual,
|
||||||
annualDiscountPriceId: PRO_PRICE_ID.annual,
|
freeTrial: {
|
||||||
freeTrial: {
|
days: 7,
|
||||||
days: 7,
|
},
|
||||||
},
|
},
|
||||||
},
|
];
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
deviceAuthorization({
|
deviceAuthorization({
|
||||||
|
|||||||
Reference in New Issue
Block a user