Is it possible to set a future start date for a subscription via drop-in script?

Modified on: Thu, 23 Jul, 2020 at 1:52 PM


This applies to the In-App version of the checkout (Checkout V3). If you are using the older version (Checkout V2) and want to switch, reach out to support@chargebee.com.


Summary


You may want to set a future start date for the service that your customers are subscribing to, rather than having the subscription activate immediately. When a future start date is given, the subscription is created in the Future state, and the customer is not charged immediately, but only when the subscription becomes Active, on the subscription start date.


Solution


In the drop-in script embedded, the product.data[“start_date”] parameter would need to be used. Below is the sample code for reference:


<!DOCTYPE html>
<html>
<head>
<script src="https://js.chargebee.com/v2/chargebee.js" data-cb-site="sitename"></script>
</head>
<body>
<div>
<a href="javascript:void(0)" data-cb-type="checkout" data-cb-plan-id="plan_id">Subscribe</a>
</div>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
var cbInstance = Chargebee.getInstance();
var link = document.querySelectorAll("[data-cb-type=checkout]")[0];
var product = cbInstance.getProduct(link);
product.data["start_date"] = "1611750900";
});
</script>
</body>
</html>


Any date values would need to be in the form of a UNIX timestamp.

Related Documentation & Articles


What is In-App Checkout?

Unable to find the drop-in script


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
×