Creating future subscriptions conditionally 

Creating Future subscriptions using the API is pretty easy as you have full control over the way you would want it to be.

However, creating a future subscription conditionally using just the hosted pages, can be a bit tricky.

Here's how you can create a future subscription based on a condition via the hosted pages.

Say the URL of your hosted page is,

To specify the start date of a subscription, all you need to pass is the additional parameter subscription[start_date] with the value being the timestamp (in UTC) specifying when you would like it to start.

So, a sample URL with a start date passed would look like:[start_date]=1746921600


If Chargebee is running on day-based billing mode, then the time component of the start date cannot be set by you. It is internally implied to be 00:00:00.000 hrs.

Now, the challenge would be to calculate the start date of the subscription.


Calculate the start date accordingly,

  • If the sign up date < = 11, use the same plan URL.
  • If the sign up date > 11, append the subscription start date to it!

You can use a quick script to have the work done for you, add it to your plan page where your customers would subscribe.

We have created the sample script in JSFiddle. Take a look at it: 

How do I use this script? 

Add the script to your plan page as in the example. Replace the URL in the HTML code, with a URL of your own hosted plan page. Now, on your website, click on the "Subscribe" button at the plan page. Depending on your signup date, check the subscription information at Chargebee's end.

This is how the subscription information for a future subscription would look like.

Go ahead, try out the tip and let us know how it goes - drop a note to support 

Was this article helpful?