How to add a trial period in stripe

I’ve just gone through this course for setting up stripe in my bubble app Bubble x Stripe: Integrate a SaaS payments solution (Available now). it’s been really good and I’ve got it all setup, but since this course, stripe has changed where you can add a trial period, so I’m not able to add the trial to the product, it seems like you can only add to the pricing table settings. is anyone able to help out with adding a trialing period to subscriptions in the same way as this course?

No, if you are using plugin you can add trial days there and also if you use promo code you can create promo code and give to user which they can enter into strip and get discount or trial

Ok so for anyone trying to figure this out, it turned out to be quite easy in the end. To add a trial period go to the API connector plugin settings for the checkout-session.

Add a new parameter called: subscription_data[trial_period_days] (details in the stripe API docs here Create a subscription | Stripe API Reference)

In the value field, add the number of days for the trial period. eg 14 for a 14 day trial period.

image

Then go to the pricing table and go to the workflow for the get started button.

This is where you can add the trial period in the checkout session

and that’s it. When the user goes to the stripe page, it will show the trial period.

On the account page, you can also pull back the trail start and end dates as well, to show this on the user account page if you want.

hi bacchus_100,

many thanks for your detailed explanation! May I ask you please how you set the trial period to show on the user account page?

Best,

Yuliya

Hi Yulia

Sorry I didn’t get back to you. This is the account page I have which show’s the trial period on the user’s account page. Hope that helps.

Hi there!

Many thanks for answering me! May I ask how/where do you set the settings of the trial_start and trial_end to be a date so that you can set here the format? For me, there are different options available and I can’t find the parameters in the backend workflow *checkout session* to manage the data. Many thanks in advance!

Are you using a plugin or api connector?

API connector

reinitalize the api again and change the format of the date from text to “unix”

Hey,

I have reinitialized the call (checkout session), however there is no such value for trial start and trial end to change the date settings to unix.

Best,

add a parameter to the “checkout session” api call

subscription_data[trial_period] = unix(get the unix code of the date/how long the trial period will last, if the trial period lasts for 7days, get the unix code for +7days of the current period]

e

hi! I can’t find in the screenie the line about the trial period. Is this an example you are sharing? Unfortunately I don’t know how to get a unix code to do as recommended

best

Hi

Since different users will have different trial dates, you can just add a random unix code code there(at least a date from now, say 7days from now and make it public)

Then in the workflow, use it like this;

Current date/time +(days): 7:extract Unix timestamp

Hi and thank you for your detailed explanation. I managed to generate a unix code, however the key you suggest subscription_data[trial_period] is not working. I added subscription_data[trial_period_days] instead, but in this case, there is no data parameter for trial_start and trial_end in the list to change the setting to UNIX. Do you know why is that?

Nah

You make use of the retrieve subscription api call

As @bacchus_100 pointed out earlier

Ah alright, I was in the wrong API call :smiley: now its finally working! Thank you for your help!

You’re welcome!:sweat_smile: