Skip to content

Commit

Permalink
Remove trial period
Browse files Browse the repository at this point in the history
  • Loading branch information
handotdev committed May 17, 2023
1 parent 02e108d commit 28cd7b7
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions server/services/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ dotenv.config();

const PriceIds = {
dev: {
team: 'price_1KcGymIslOV3ufr2svaasDZX'
team: 'price_1KcGymIslOV3ufr2svaasDZX',
},
prod: {
team: 'price_1KcGnzIslOV3ufr2TDG9TFto'
}
}
team: 'price_1KcGnzIslOV3ufr2TDG9TFto',
},
};

const teamPriceId = process.env.NODE_ENV === 'production' ? PriceIds.prod.team : PriceIds.dev.team;

Expand All @@ -21,7 +21,9 @@ export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {

export const getPremiumCheckoutSession = async (email: string, scheme: string) => {
const user = await User.findOne({ email });
const customerInfo = user?.stripeCustomerId ? { customer: user.stripeCustomerId } : { customer_email: email };
const customerInfo = user?.stripeCustomerId
? { customer: user.stripeCustomerId }
: { customer_email: email };
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [
Expand All @@ -32,19 +34,16 @@ export const getPremiumCheckoutSession = async (email: string, scheme: string) =
enabled: true,
minimum: 1,
maximum: 10,
}
},
},
],
subscription_data: {
trial_period_days: 7,
},
...customerInfo,
success_url: `https://mintlify.com/start/open?scheme=${scheme}&event=upgrade`,
cancel_url: `https://mintlify.com/start/open?scheme=${scheme}`,
});

return session;
}
};

export const getCustomerPortalSession = async (email: string, scheme: string) => {
const user = await User.findOne({ email });
Expand All @@ -64,4 +63,4 @@ export const getCustomerPortalSession = async (email: string, scheme: string) =>
});

return session;
}
};

0 comments on commit 28cd7b7

Please sign in to comment.