Free trials
Offer a no-card install trial or a PayPal subscription trial, show trial status in your extension, and pick the right kind.
ExtensionBill has two kinds of free trial: an install trial that unlocks paid features with no checkout, and a subscription trial at the start of a PayPal subscription. You can use both in the same extension.
| Install trial | Subscription trial | |
|---|---|---|
| Configured on | The app (Settings → General) | A recurring price (trialDays) |
| Payment details up front | No | Yes, PayPal wallet or card |
| Started by | Your code: bill.startTrial() | The buyer approving a subscription in PayPal |
| Converts to paid | Only if the user buys | Automatically, on the first billing date |
| Limit | One per install | One per subscription signup |
| Shows up in | user.trial | user.subscription.trialEndsAt |
Install trials
Enable it
-
Open Settings → General for your app in the dashboard.
-
Turn on Free trial and set the length in days (default
7). -
Choose whether to require an email. With Require email on, the trial can only start once the install has a verified email (for example after the user signs in through the restore flow), and
user.trial.availablestaysfalseuntil then. Leave it off for a one-click trial. -
Save. The setting applies to sandbox and live. It is stored as
App.trial({ "enabled": true, "days": 7, "requireEmail": false }), andbill.getPlans()reports it astrial: { enabled, days }.
Add a trial button
// popup.js
import { bill } from './bill'
const button = document.getElementById('start-trial')
const status = document.getElementById('trial-status')
function render(user) {
button.hidden = user.paid || !user.trial.available
}
button.addEventListener('click', async () => {
button.disabled = true
try {
await bill.startTrial() // every open context re-renders through onChange
} catch (err) {
status.textContent = err.code === 'trial_unavailable'
? 'Your free trial has already been used on this browser.'
: 'Could not start the trial. Check your connection and try again.'
} finally {
button.disabled = false
}
})
render(await bill.getUser())
bill.onChange(render)
The shared bill client is set up in the Quick start. With a framework binding, call bill.startTrial() from a button and read user.trial from the binding: see Frameworks. The Paywall UI already includes a trial button.
bill.startTrial() works from any context (popup, options page, content script). It resolves with the updated UserState, and every open context receives the change through bill.onChange. Each install gets exactly one trial: if the trial is disabled, already used or blocked by Require email, the call rejects with ExtensionBillError code trial_unavailable (HTTP 409). Check user.trial.available before showing the button so users rarely hit it.
When a trial starts, ExtensionBill sends the trial.started event to your webhooks.
Trial state on the user
Every UserState carries a trial object:
| Field | Type | Meaning |
|---|---|---|
available | boolean | The trial is enabled and this install can still start one. |
active | boolean | A trial is running right now. |
startedAt | string | null | ISO timestamp the trial started. |
endsAt | string | null | ISO timestamp the trial ends. |
daysLeft | number | null | Whole days remaining while active. |
bill.hasAccess(user) returns true while user.paid or user.trial.active is true, so your gates need no special case during a trial. The signed entitlementToken also carries trialEndsAt, so the trial keeps working offline until the token expires.
When the trial ends, trial.active becomes false, hasAccess returns false, and bill.onChange fires in every open context, so your UI locks itself. If the user buys during the trial, user.paid becomes true and bill.onPaid fires.
Trial ending reminder
With Settings → Emails → Trial reminders on (emails.trialReminders, off by default), ExtensionBill emails the user 3 days before an install trial ends. The email is only sent when the install is linked to an email address; anonymous one-click trials don’t get one. See Emails sent to buyers.
Resetting a trial for support
If a user had a technical problem during their trial, open Customers → Installs, find the install (search by the install ID your extension shows via bill.getInstallId()), and click Reset trial. The trial is cleared, trial.available becomes true again, and the user can start a fresh trial. The action is recorded in the audit log.
Subscription trials
The buyer goes through checkout, approves the subscription in PayPal (with their PayPal balance, bank or card), pays nothing today, and is charged automatically when the trial ends.
Enable it
In Sell → Products, add or edit a recurring price and set Free trial days (trialDays). ExtensionBill creates the PayPal billing plan with a TRIAL billing cycle priced at 0, followed by the regular cycle, so you do nothing in PayPal (how PayPal subscriptions work). Trials are only available on recurring prices. See Products & pricing.
How it behaves
- The subscription becomes active as soon as the buyer approves it, so
user.paidistrueanduser.plan.typeis'recurring'during the trial. user.subscription.trialEndsAtholds the trial end date. It isnullfor subscriptions without a trial or once the trial is over.- At the end of the trial PayPal charges the first regular payment. ExtensionBill records it as a renewal order, emails a receipt, and emits
subscription.renewedandorder.paid. - With Trial reminders on, the buyer gets a reminder 3 days before the first charge.
- If the buyer cancels during the trial (in the customer portal or via PayPal), no payment is taken and access ends when the trial ends.
- A failed first charge follows the normal dunning flow. See Subscription lifecycle.
Which one to use
Use an install trial when:
- You want the most people possible to try your paid features.
- Your extension sells one-time purchases or has no subscription.
- You’d rather not ask for payment details before people see value.
Use a subscription trial when:
- You sell a subscription and want trials to convert without the user coming back.
- You want one trial per paying buyer rather than per browser.
- You’re fine with fewer, higher-intent trial starts.
Combining them is common: an install trial for a quick taste, and a paywall offering a subscription for those who want to continue. Avoid also putting a long trialDays on the same subscription, since users who already tried the product rarely need a second free period.
Customize
Show the trial length
Read it from bill.getPlans() before the user starts the trial. Each recurring price also exposes its own trialDays:
const { trial, plans } = await bill.getPlans()
if (trial.enabled) button.textContent = `Try Pro free for ${trial.days} days`
for (const plan of plans) {
for (const price of plan.prices) {
console.log(plan.name, price.trialDays ? `${price.trialDays} days free, then ${price.formatted}` : price.formatted)
}
}
Ending-soon banner
Show the days left and push the upgrade harder near the end:
const ENDING_SOON_DAYS = 2
function renderTrialBanner(user, banner, upgradeButton) {
const { trial } = user
const endingSoon = trial.active && trial.daysLeft !== null && trial.daysLeft <= ENDING_SOON_DAYS
banner.hidden = !trial.active || user.paid
if (trial.active) {
banner.textContent =
trial.daysLeft === 0 ? 'Your free trial ends today.'
: trial.daysLeft === 1 ? 'Your free trial ends tomorrow.'
: `Free trial: ${trial.daysLeft} days left.`
banner.classList.toggle('warning', endingSoon)
}
upgradeButton.textContent = endingSoon ? 'Keep Pro after your trial' : 'Upgrade to Pro'
}
Show the subscription conversion date
function billingStatus(user) {
const sub = user.subscription
if (sub?.trialEndsAt && new Date(sub.trialEndsAt) > new Date()) {
const date = new Date(sub.trialEndsAt).toLocaleDateString()
return sub.cancelAt
? `Trial ends on ${date}. Your subscription is canceled and will not renew.`
: `Trial ends on ${date}. Your first payment is taken that day.`
}
return user.paid ? `You're on ${user.plan.name}.` : 'Free plan'
}