Detecting end of trial

277 views
Skip to first unread message

Bob Lund

unread,
Sep 8, 2022, 11:07:51 AM9/8/22
to Stripe API Discussion
I want to offer a free 6 month trial that allows a user X number of actions per month. My thought is to use a web hook to provision X action credits per month for the duration of the trial. Then detect the end of the trial via a web hook to remove any remaining credits. At the end of the trial, the trial would convert to a paid subscription. I would also be OK with a solution where at the end of the trial the user had to select a subscription alternative.

My questions are:
1) What web hooks would I listen for to detect each month if the trial was still active?
2) Is it possible to have a $0 trial that terminates after 6 months?
3) Is there a better way to accomplish my goal?

Remi J.

unread,
Sep 8, 2022, 11:21:21 AM9/8/22
to api-d...@lists.stripe.com
Hey Bob,

Trial periods on a Subscription are covered in our docs here [1]. When a Subscription is on a trial period, it doesn't go through its usual "billing cycle". Instead, it stays with `status: 'trialing'` for the entire duration of that trial period. What this means is that if you have a Subscription with a $15/month Price that you create on September 8 with a 6 months trial, it will be created that day and be in a trial until March 8 2023. You won't get any Invoice every month or any Event about that Subscription and it will just be trialing for the whole period.

At the end of the trial, so on March 8 in our example above, the Subscription will have its new cycle start. At that point the Subscription moves to `status: 'active'` and its new cycle/period will start. This will be for a $15/month Price and the period will be from March 8 to April 8. At that point you will get the Event `customer.subscription.updated` to indicate the period change. You'll also get `invoice.created` to indicate the new Invoice, for that $15, is created and it will be finalized/paid asynchronously.

If you want to know if a trial will end soon, you can listen to the Event `customer.subscription.trial_will_end`. This Event is automatically sent 3 days before the end of the trial period. Your code could listen for that specific Event to email your customer about their upcoming cycle. Similarly, you can listen to the `invoice.upcoming` Event, which is sent X days before the next Invoice (X is configurable in the Dashboard). This is a similar way to warn your customer of their upcoming Invoice.

With all of that said, what you seem to want is more a "free period" than a real trial. You mentioned provisioning of free credits each month for that trial period. In that case, what people sometimes do is put the customer on a free Price, so a $0/month Price for example. This would mean that each month the Subscription goes through its cycle, a new period starts and a new Invoice is created. All of those for $0 is the price is "free". In that world you would usually use our SubscriptionSchedules feature. Those let you define "phases" a Subscription goes through and in your case it'd be for example 6 months on the free Price price_ABC and then another phase to move to the $15/month Price price_XYZ and continue indefinitely.

There's a lot of unknowns in your flow so it's not easy to say what would work best. I would highly recommend working with our support team directly to go over your detailed business model and ensure you're using the right product(s) and API(s) to design your system overall. You can contact them here [3].

Hope this helps!
Remi
 

--
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.

Bob Lund

unread,
Sep 8, 2022, 12:23:18 PM9/8/22
to api-d...@lists.stripe.com
Hi Remi,

This is very helpful. You are right that what I want is a free subscription. I had tried to create a $0.00 product (just didn't specify a price which defaulted to 0.00) but got the message "This price is required". Based on your reply, I tried it again but this time entered 0.00; it worked!

Thanks again,
Bob


To unsubscribe from this topic, visit https://groups.google.com/a/lists.stripe.com/d/topic/api-discuss/iJVoftAgUpk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-discuss...@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages