mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 04:19:22 +00:00
fix(stripe): prevent duplicate trials when switching plans (#3622)
* fix(stripe): tiral subscription should use update flow * add changelog * chore: changeset
This commit is contained in:
@@ -39,15 +39,14 @@ if (!dialect) {
|
||||
throw new Error("No dialect found");
|
||||
}
|
||||
|
||||
const PROFESSION_PRICE_ID = {
|
||||
default: "price_1QxWZ5LUjnrYIrml5Dnwnl0X",
|
||||
annual: "price_1QxWZTLUjnrYIrmlyJYpwyhz",
|
||||
const PRO_PRICE_ID = {
|
||||
default: "price_1RoxnRHmTADgihIt4y8c0lVE",
|
||||
annual: "price_1RoxnoHmTADgihItzFvVP8KT",
|
||||
};
|
||||
const STARTER_PRICE_ID = {
|
||||
default: "price_1QxWWtLUjnrYIrmleljPKszG",
|
||||
annual: "price_1QxWYqLUjnrYIrmlonqPThVF",
|
||||
const PLUS_PRICE_ID = {
|
||||
default: "price_1RoxnJHmTADgihIthZTLmrPn",
|
||||
annual: "price_1Roxo5HmTADgihItEbJu5llL",
|
||||
};
|
||||
|
||||
export const auth = betterAuth({
|
||||
appName: "Better Auth Demo",
|
||||
database: {
|
||||
@@ -174,22 +173,23 @@ export const auth = betterAuth({
|
||||
stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
|
||||
subscription: {
|
||||
enabled: true,
|
||||
allowReTrialsForDifferentPlans: true,
|
||||
plans: [
|
||||
{
|
||||
name: "Starter",
|
||||
priceId: STARTER_PRICE_ID.default,
|
||||
annualDiscountPriceId: STARTER_PRICE_ID.annual,
|
||||
name: "Plus",
|
||||
priceId: PLUS_PRICE_ID.default,
|
||||
annualDiscountPriceId: PLUS_PRICE_ID.annual,
|
||||
freeTrial: {
|
||||
days: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Professional",
|
||||
priceId: PROFESSION_PRICE_ID.default,
|
||||
annualDiscountPriceId: PROFESSION_PRICE_ID.annual,
|
||||
},
|
||||
{
|
||||
name: "Enterprise",
|
||||
name: "Pro",
|
||||
priceId: PRO_PRICE_ID.default,
|
||||
annualDiscountPriceId: PRO_PRICE_ID.annual,
|
||||
freeTrial: {
|
||||
days: 7,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user