Scope
How to pass coupon id on the checkout URL?
How to create a checkout URL?
Solution
For V2 checkout pages:
If you want to pass a discount code to the checkout page URL, just make use of the following syntax:
For V3 checkout pages:
If you are an Enterprise customer in PC 2.0, there is a new manual discounting feature. Reach out to support@chargebee.com to know more.
You can include a coupon code in the checkout script so that it is automatically applied. It can be done similarly to the example mentioned in the “Add-on customizations” section in this document. The script code to include coupons is mentioned below.
var cbInstance = Chargebee.getInstance();
var link = document.querySelectorAll(“[data-cb-type=checkout]“)[0];
var product = cbInstance.getProduct(link);
product.addCoupon(“COUPON NAME”);
Also, every plan details page in PC 2.0 has a dynamic payment URL on each price point page, making it incredibly simple for you to share a payment link. Navigate from the Product Catalog > Plans index page > Plan details page > Customer-Facing Info > Get Payment Link. You just have to add the Coupon to the plan and it will create a checkout link with the coupon attached.
[[screenshot assets/images/Billing/bxTIost6kqnDm1OISko0Z8jSpDAWcCEHqw.png]](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72946684/original/4XjfA0EJz0TflCJ0V0agm2Xt1AkhNc1IvQ.png?1677752921)