A discount
, just like coupons
, represents a deduction from the amounts in an invoice
. While coupons are typically used by your customers, discount
s 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:
1 | Line-level, fixed amount coupons |
|
2 | Line-level, fixed amount discounts |
|
3 | Line-level, percentage coupons |
|
4 | Line-level, percentage discounts |
|
5 | Invoice-level, fixed amount coupons |
|
6 | Invoice-level, fixed amount discounts |
|
7 | Invoice-level, percentage coupons |
|
8 | Invoice-level, percentage discounts |
|
For example, consider the following scenario:
A subscription is created with:
The above coupons and discount are applied in the following order:
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.0,
"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 percentage. discount.type
is fixed_amount
. discount.type
is fixed_amount
.period
and period_unit
.period_units
. Applicable only when duration_type
is limited_period
. period
. Applicable only when duration_type
is limited_period
. 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
. sub_total
.specific_item_priceThe discount is applied to the invoice.line_item.amount
that corresponds to the item price specified by item_price_id
.apply_on
= specific_item_price
. limited_period
duration type discount.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.