Docs
How can I apply multiple manual discounts to an existing subscription via API? How can I remove a manual discount applied to a subscription via API?
On Chargebee sites with the latest Product Catalog version, you can apply manual discounts to an existing subscription using the update_subscription_for_items API. You can apply discounts to specific items or to all items (invoice amount).
Note:
Manual discounts are available on selective plans. See the plans and pricing page. On previous plans, this feature is available on Enterprise plans.
To apply a discount on specific items (e.g., 20% on a specific item price):
curl https://{site-name}.chargebee.com/api/v2/subscriptions/{subscription_id}/update_for_items \
-u {site_api_key}:
-d discounts[apply_on][0]="specific_item_price"
-d discounts[item_price_id][0]="{item_price_id}"
-d discounts[duration_type][0]="{forever/onetime}"
-d discounts[percentage][0]=20.0
-d discounts[operation_type][0]="add"
Pass discounts[apply_on][0...n] as "specific_item_price" and include the item price ID in discounts[item_price_id][0...n].
To apply a discount on all items (e.g., 20% on invoice amount):
curl https://{site-name}.chargebee.com/api/v2/subscriptions/{subscription_id}/update_for_items \
-u {site_api_key}:
-d discounts[apply_on][0]="invoice_amount"
-d discounts[duration_type][0]="forever/onetime"
-d discounts[percentage][0]=20.0
-d discounts[operation_type][0]="add"
Pass discounts[apply_on][0...n] as "invoice_amount".
To remove a discount: Pass "remove" for discounts[operation_type][0...n] and include the discount ID in discounts[id][0...n]. Use the Retrieve a subscription API to get the correct discount ID.
For full parameter details, see update-subscription-for-items - discounts_apply_on.
Show more
Was this article helpful?