For V2 checkout pages:
If you want to pass a discount code to the checkout page URL, just make use of the following syntax:
Here's a sample URL for reference:
For V3 checkout pages:
You can include a coupon code to the checkout script so that it is automatically applied. It can be done similar to the example mentioned in the "Add-on customizations" section in this document. The script code to include coupons is as mentioned below.
var cbInstance = Chargebee.getInstance();
var link = document.querySelectorAll(“[data-cb-type=checkout]“);
var product = cbInstance.getProduct(link);