Trial Periods
Offer free trials on paid plans in Commet with automatic billing when the trial ends.
A trial period lets customers use your product before being charged. Configure trial days on a plan and every new subscription gets a trial automatically.
Trial components
| Component | Description | Example |
|---|---|---|
| Trial Days | Free trial duration before billing | 7, 14, 30 |
| Per Interval | Each billing interval can have different trial days | Monthly: 14 days, Yearly: 30 days |
| Skip Trial | Bypass trial for specific customers via SDK | skipTrial: true |
Configure trial days in the dashboard
In the dashboard, go to Plans, edit a plan, and set Trial Days on each price interval. Trial days are configured per plan price, not per customer. Each interval (monthly, quarterly, yearly) can have its own trial duration. Free plans cannot have trials.
Create a subscription with trial
No code changes needed to enable trials. The subscription starts in trialing status automatically when the plan has trial days configured.
const { data } = await commet.subscriptions.create({
customerId: 'user_123',
planCode: 'pro',
})
// data.status → 'trialing'
// data.trialEndsAt → '2026-01-15T00:00:00.000Z'
redirect(data.checkoutUrl)response = commet.subscriptions.create(
customer_id='user_123',
plan_code='pro',
)
# response.data['status'] → 'trialing'
# response.data['trial_ends_at'] → '2026-01-15T00:00:00.000Z'
redirect(response.data['checkout_url'])result, err := client.Subscriptions.Create(ctx, &commet.CreateSubscriptionParams{
CustomerID: "user_123",
PlanCode: "pro",
})
// result.Data.Status → "trialing"
// result.Data.TrialEndsAt → "2026-01-15T00:00:00.000Z"
// redirect(result.Data.CheckoutURL)ApiResponse<Subscription> result = commet.subscriptions().create("user_123", "pro");
// result.getData().getStatus() → "trialing"
// result.getData().getTrialEndsAt() → "2026-01-15T00:00:00.000Z"
// redirect(result.getData().getCheckoutUrl())$result = $commet->subscriptions->create(
customerId: 'user_123',
planCode: 'pro',
);
// $result->data['status'] → 'trialing'
// $result->data['trialEndsAt'] → '2026-01-15T00:00:00.000Z'
redirect($result->data['checkoutUrl']);curl -X POST https://commet.co/api/subscriptions \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "user_123",
"planCode": "pro"
}'Skip a trial
const { data } = await commet.subscriptions.create({
customerId: 'user_123',
planCode: 'pro',
skipTrial: true,
})response = commet.subscriptions.create(
customer_id='user_123',
plan_code='pro',
skip_trial=True,
)skipTrial := true
result, err := client.Subscriptions.Create(ctx, &commet.CreateSubscriptionParams{
CustomerID: "user_123",
PlanCode: "pro",
SkipTrial: &skipTrial,
})CreateSubscriptionParams params = CreateSubscriptionParams.builder()
.customerId("user_123")
.planCode("pro")
.skipTrial(true)
.build();
ApiResponse<Subscription> result = commet.subscriptions().create(params);$result = $commet->subscriptions->create(
customerId: 'user_123',
planCode: 'pro',
skipTrial: true,
);curl -X POST https://commet.co/api/subscriptions \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "user_123",
"planCode": "pro",
"skipTrial": true
}'skipTrial is the only way to bypass a plan's trial for a specific customer.
Check trial status
const { data } = await commet.subscriptions.get('user_123')
if (data.status === 'trialing') {
const trialEnd = new Date(data.trialEndsAt)
}response = commet.subscriptions.get(customer_id='user_123')
if response.data['status'] == 'trialing':
trial_end = datetime.fromisoformat(response.data['trial_ends_at'])result, err := client.Subscriptions.Get(ctx, "user_123")
if result.Data.Status == "trialing" {
trialEnd, _ := time.Parse(time.RFC3339, result.Data.TrialEndsAt)
_ = trialEnd
}ApiResponse<Subscription> result = commet.subscriptions().get("user_123");
if ("trialing".equals(result.getData().getStatus())) {
Instant trialEnd = Instant.parse(result.getData().getTrialEndsAt());
}$result = $commet->subscriptions->get('user_123');
if ($result->data['status'] === 'trialing') {
$trialEnd = new DateTime($result->data['trialEndsAt']);
}curl "https://commet.co/api/subscriptions/active?customerId=user_123" \
-H "x-api-key: $COMMET_API_KEY"Learn more
Related
- Manage Plans — Configure trial days on plan prices
- Manage Subscriptions — Subscribe customers to plans
- Handle Failed Payments — What happens after trial ends
How is this guide?