A discount, just like coupons, represents a deduction from the amounts in an invoice. While coupons are typically used by your customers, discounts can be directly applied to subscriptions by your sales team while negotiating new deals or upgrades. If the negotiations are on the price itself, the price override feature helps adjust the price further.
Although a discount appears as a deduction on an invoice, it is applied to a subscription while creating or updating the subscription. Every discount in Chargebee is attached to only one subscription.
Note:
A discount can be added to a subscription by calling either Create subscription or Update subscription. Once added, the discount is applied to all subsequent invoices if apply_on is set to invoice_amount. When apply_on = specific_item_price, the discount is applied (as a discount.line_item_discount) in each invoice of the subscription that contains the specified item.
A discount can be added to an invoice using Create invoice for items and one-time charges using the discounts parameter.
A discount can be added to a quote using the following operations:
A discount can be added to an estimate using the following endpoints:
A discount can be removed by calling Update subscription with the relevant discounts[operation_type][] set to remove. Also, discounts that have duration_type as one_time or limited_period are removed automatically upon expiry.
A discount can be removed from a quote using the following operations:
A discount can be removed from an estimate using the following operation:
A discount is associated with exactly one subscription. You can fetch all the discounts currently attached to a subscription by calling the List discounts for a subscription API or by passing include_discounts as true while creating, importing, updating or retrieving a subscription.
When both coupons and discounts are applied simultaneously to a subscription or one-time invoice, they're applied in the following order:
| Summary | Description | |
|---|---|---|
| 1 | Line-level, fixed amount coupons | coupon with apply_on = each_specified_item and discount_type = flat |
| 2 | Line-level, fixed amount discounts | discount with apply_on = specific_item_price and type = fixed_amount |
| 3 | Line-level, percentage coupons | coupon with apply_on = each_specified_item and discount_type = percentage |
| 4 | Line-level, percentage discounts | discount with apply_on = specific_item_price and type = percentage |
| 5 | Line-level, offer quantity coupons | coupon with apply_on = each_specified_item and discount_type = offer_quantity |
| 6 | Line-level, offer quantity discounts | discount with apply_on = specific_item_price and discount_type = offer_quantity |
| 7 | Invoice-level, fixed amount coupons | coupon with apply_on = invoice_amount and discount_type = flat |
| 8 | Invoice-level, fixed amount discounts | discount with apply_on = invoice_amount and type = fixed_amount |
| 9 | Invoice-level, percentage coupons | coupon with apply_on = invoice_amount and discount_type = percentage |
| 10 | Invoice-level, percentage discounts | discount with apply_on = invoice_amount and type = percentage |
For example, consider the following scenario:
A subscription is created with:
The above coupons and discount are applied in the following order:
| Discount or coupon applied | Subtotal at each step | |
|---|---|---|
| 1 | Initial subtotal (plan price + addon price) | $200 + $20 = $220 |
| 2 | 1% off coupon on the addon | $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 |
| 3 | Flat $2 coupon on the invoice | $219.98 - $2 = $217.98 |
| 4 | Flat $5 invoice discount | $217.98 - $5 = $212.98 |
{
"id": "__dev__KyVmqWSHMbJxp2",
"name": "__dev__KyVmqWSHMbJxp2",
"invoice_name": "10% Off",
"percentage": 10,
"duration_type": "limited_period",
"period": 3,
"period_unit": "month",
"apply_on": "specific_item_price",
"item_price_id": "plan1",
"included_in_mrr": "true",
"created_at": 1605792731,
"updated_at": 1605792731,
"resource_version": 1605792731000,
"applied_count": 1,
"object": "discounts",
"apply_till": 1599831828
}type, amount, and currency_code of the discount. For example, it can be 10% off or 10$ off. discount.type is fixed_amount. discount.type is fixed_amount. duration_type is one_time and when the feature is enabled in Chargebee. Also, If the site-level setting is to exclude one-time discounts from MRR calculations, this value is always returned false. apply_on = specific_item_price. Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
Note:
When the coupon ID contains a special character; for example: #, the API returns an error.
Make sure that you encode the coupon ID in the path parameter before making an API call.