POST /coupons

This API creates a new coupon for a specific promotion or offers.

Servers

Request headers

Name Type Required Description
chargebee-request-origin-device String No

The device from which the customer has made the request

Content-Type String Yes The media type of the request body.

Default value: "application/x-www-form-urlencoded"

chargebee-event-webhook String No

skip only webhooks

Possible values:

  • "all-disabled"
chargebee-event-actions String No

skip all actions to be done on the events

Possible values:

  • "all-disabled"
chargebee-request-origin-user String No

The email address of your customer/user. Use this when the email address has only ASCII characters.

chargebee-request-origin-ip String No

The IP address of the customer where the request originated

chargebee-request-origin-user-encoded String No

The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored.

chargebee-event-email String No

skip only emails

Possible values:

  • "all-disabled"

Request body fields

Name Type Required Description
discount_quantity Integer No
invoice_name String No

Display name used in invoice. If it is not configured then name is used in invoice.

meta_data Object No

A set of key-value pairs stored as additional information for the coupon. [Learn more](./#meta_data).

valid_till Integer No

Date upto which the coupon can be applied to new subscriptions.

plan_constraint String No

Plans the coupon can be applied to. * all - Coupon applicable to all plans. * specific - Coupon only applicable to specified plans. If used, it is mandatory to specify the plan(s). * none - Coupon not applicable to any plans.

Possible values:

  • "specific"
  • "none"
  • "all"
max_redemptions Integer No

Maximum number of times this coupon can be redeemed.
Note:

If not specified, the coupon can be redeemed an indefinite number of times. .

duration_month Integer No

(Deprecated) The duration of time in months for which the coupon is attached to the subscription. Applicable only when duration_type is limited_period.
Note: This parameter has been deprecated. Use period and period_unit instead.

invoice_notes String No

A customer-facing note added to all invoices associated with this API resource. This note becomes one among all the notes displayed on the invoice PDF.

id String Yes

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. .

apply_on String Yes

The amount on the invoice to which the coupon is applied. * invoice_amount - The coupon is applied to the invoice sub_total. * each_unit_of_specified_items - Discount will be applied to each unit of plan and addon items specified. * each_specified_item - The coupon is applied to the invoice.line_item.amount that corresponds to the plan or addon specified by plan_ids and addon_ids. * specified_items_total - Discount will be applied to the total of plan and addon items specified.

Possible values:

  • "each_specified_item"
  • "invoice_amount"
plan_ids[] Array No

Identifier of the plan.

name String Yes

The display name used in web interface for identifying the coupon.
Note:

When the name of the coupon set contains a special character; for example: #, the API returns an error. Make sure that you encode the name of the coupon set in the path parameter before making an API call. .

addon_constraint String No

Addons the coupon can be applied to. * specific - Coupon only applicable to specified addons. If used, it is mandatory to specify the addon(s). * all - Coupon applicable to all addons. * none - Coupon not applicable to any addons.

Possible values:

  • "specific"
  • "none"
  • "all"
duration_type String No

Specifies the time duration for which this coupon is attached to the subscription. * forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. * limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by period and period_unit. * one_time - The coupon stays attached to the subscription till it is applied on an invoice once. It is removed after that from the subscription.

Possible values:

  • "limited_period"
  • "forever"
  • "one_time"

Default value: "forever"

discount_type String No

The type of deduction. * fixed_amount - The specified amount will be deducted. * percentage - The specified percentage will be deducted. * offer_quantity - Applies a discount based on the number of free units offered in a per unit plan subscription without reducing the total quantity sold.

Possible values:

  • "fixed_amount"
  • "offer_quantity"
  • "percentage"

Default value: "percentage"

addon_ids[] Array No

Identifier of the addon.

discount_amount Integer No

The value of the deduction. The format of this value depends on the kind of currency.

discount_percentage Number No

The percentage of the original amount that should be deducted from it.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.