How can I provide my users with an option to sign up for a subscription that will start in a future date?

How to create a future subscription using a hosted checkout page? I need a way to allow users who signup to be able to pick the start date for their subscription.

Here are the steps on how you create a subscription to start on a future date using hosted page checkout:

1. Get the date selected by your user on a form in your website prior to redirecting them to the hosted page.
2. Convert the selected date into a Unix timestamp.
3. Add the timestamp to your ChargeBee hosted page URL and redirect the user.

When the user completes the checkout, their subscription will be created with state as "Future". When the subscription's "start date" arrives, the subscription will either go into "Trial" or "Active" depending on the plan the subscription is linked to.

Here's a sample on what the end result may look like:

And here's how it's done:

By default, all plan URLs will look something similar to this:

To create a subscription with a future date through the hosted checkout page, all you need to this is add an extra parameter (start_date in Unix format) along with the plan's hosted page URL to get something similar to this:[start_date]=1385769600

"1385769600" is the converted Unix timestamp of when your subscription needs to start.

We made use of jQuery UI's Datepicker widget to help us in the example above.

You can also checkout the source code for this setup in this JSFiddle.

How can we add this future start date to a page that's on our site, not a hosted page?

Hello There,


If you are not using our hosted pages, there are two other ways how you can create a subscription.


Using the API.


You will need to use a custom form to capture all the customer & subscription information including the preferred start date for the subscription.

Please Note: To capture payment and sensitive information your website will need to be PCI compliant. Or if you are using Braintree of Stripe as your payment gateway you can use their JAVA Script to capture the customer card details.


Next step is to use the information capture in the Create Subscription API call.

Using the “start_date” parameter with the preferred date in a UNIX time stamp format. 

Sample in cURL

     -d customer[email]="" \

     -d customer[first_name]="John" \

     -d customer[last_name]="Doe" \

     -d customer[phone]="+1-949-999-9999" \

     -d card[gateway]="chargebee" \

     -d card[first_name]="John" \

     -d card[last_name]="Doe" \

     -d card[number]="4111111111111111" \

     -d card[expiry_month]="3" \

     -d card[expiry_year]="2017" \

     -d card[cvv]="585" \

     -d plan_id="copy-test" \

     -d start_date="1474141675"

If the API was successful the subscription will be created in a future date as specified, all trial periods or charges will start post this date.


Using the Admin Console.


If you are using the Chargebee Admin console to create a subscription, go to Subscriptions » Subscriptions » Create New Subscription.

When creating the subscription you need to specify the Start Date, see image insert.


Please Note: Once the customer record is created in Chargebee is when payment (card) information can be added. Creating a new subscription (as mentioned above) will also create a new customer, unless you using the Create New Subscription from the customer details page.

Thank you.

Login or Signup to post a comment