Docs
checkout, future, subscription, v3, drop-in script
461783
2020-07-23T08:22:04Z
2024-04-30T05:28:32Z
813
1
0
247230
Is it possible to set a future start date for a subscription via drop-in script?
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