SaaS Trial Period
Trial is standard for SaaS. User tries product without payment, then converts to paying customer. Goal — show value before trial ends and reduce friction on conversion.
Stripe: Trial on Subscription Creation
const subscription = await stripe.subscriptions.create({
customer: customerId,
items: [{ price: priceId }],
trial_period_days: 14,
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent'],
});
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
customer: customerId,
line_items: [{ price: priceId, quantity: 1 }],
subscription_data: {
trial_period_days: 14,
},
payment_method_collection: 'always',
success_url: `${APP_URL}/dashboard?trial=started`,
cancel_url: `${APP_URL}/pricing`,
});
Trial Without Card
export async function startFreeTrial(userId: string): Promise<void> {
const trialEndsAt = new Date();
trialEndsAt.setDate(trialEndsAt.getDate() + 14);
await db.user.update({
where: { id: userId },
data: {
trialEndsAt,
trialUsed: true,
}
});
await sendTrialStartedEmail(userId, trialEndsAt);
}
export async function checkTrialAccess(userId: string): Promise<boolean> {
const user = await db.user.findUnique({
where: { id: userId },
select: {
trialEndsAt: true,
subscription: { select: { status: true } }
}
});
if (user?.subscription?.status === 'ACTIVE') return true;
if (user?.trialEndsAt && user.trialEndsAt > new Date()) return true;
return false;
}
Notifications During Trial
export async function sendTrialReminders() {
const now = new Date();
const threeDaysLeft = new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000);
const trialEndingSoon = await db.user.findMany({
where: {
trialEndsAt: {
gte: now,
lte: threeDaysLeft,
},
subscription: null,
trialReminderSent: false,
}
});
for (const user of trialEndingSoon) {
await sendEmail({
to: user.email,
template: 'trial-ending-soon',
variables: {
daysLeft: Math.ceil((user.trialEndsAt!.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)),
upgradeUrl: `${APP_URL}/settings/billing`,
}
});
await db.user.update({
where: { id: user.id },
data: { trialReminderSent: true }
});
}
const expired = await db.user.findMany({
where: {
trialEndsAt: { lt: now },
subscription: null,
trialExpiredEmailSent: false,
}
});
for (const user of expired) {
await sendEmail({
to: user.email,
template: 'trial-expired',
variables: { upgradeUrl: `${APP_URL}/settings/billing` }
});
await db.user.update({
where: { id: user.id },
data: { trialExpiredEmailSent: true }
});
}
}
UI: Trial Banner
export function TrialBanner({
trialEndsAt,
daysLeft,
}: {
trialEndsAt: Date;
daysLeft: number;
}) {
const urgency = daysLeft <= 3;
return (
<div
className={`flex items-center justify-between px-4 py-2 text-sm
${urgency
? 'bg-red-50 border-b border-red-200 text-red-800'
: 'bg-blue-50 border-b border-blue-200 text-blue-800'
}`}
>
<span>
{urgency
? `Trial ends in ${daysLeft} days!`
: `Trial active for ${daysLeft} more days (until ${trialEndsAt.toLocaleDateString('en-US')})`
}
</span>
<a
href="/settings/billing"
className={`ml-4 font-medium underline ${urgency ? 'text-red-900' : 'text-blue-900'}`}
>
Upgrade to paid plan
</a>
</div>
);
}
Trial Metrics
Key indicators to monitor:
- Trial-to-Paid Conversion Rate — goal 15–25% for B2B SaaS
- Trial Activation Rate — percent who took key action
- Time to First Key Action — when user felt value
- Churn at Trial End — how many leave on day X
posthog.capture('trial_started', {
distinct_id: userId,
trial_days: 14,
plan: 'pro',
source: 'checkout',
});
posthog.capture('trial_converted', {
distinct_id: userId,
trial_day: daysFromTrialStart,
plan: 'pro',
billing_period: 'monthly',
});
Trial period setup with notifications and Stripe integration — 2–3 working days.







