You are viewing the documentation for the older version of our API (V1). Click here for information on upgrading to the latest version (V2).

Coupon codes are used along with existing coupons in Chargebee. You can create a coupon set using a bunch of coupon codes and this coupon set will be associated with an existing coupon. A coupon code can only be applied to a single subscription and cannot be re-used.

Using coupon codes you can distribute several unique codes for a single main coupon, when you are running promotions.

Sample coupon code [ JSON ]

{ "object": "coupon_code", "coupon_id": "beta", "coupon_set_name": "Promo Coupon Codes", "code": "CBCC4356" }
code
Unique coupon code that can be redeemed only once.
string, max chars=50
coupon_id
Id of the main coupon resource.
string, max chars=50
coupon_set_name
Coupon set name to which this coupon code would be grouped under. If the coupon set with the passed name is not present, a new coupon set will be created.
string, max chars=50
Create a new coupon code and associate it to an existing main coupon resource.
Sample Request
curl  https://{site}.chargebee.com/api/v1/coupon_codes \
     -u {site_api_key}: \
     -d coupon_id="beta" \
     -d coupon_set_name="Promo Coupon Codes" \
     -d code="CBCC435"
copy
curl  https://{site}.chargebee.com/api/v1/coupon_codes \
     -u {site_api_key}: \
     -d coupon_id="beta" \
     -d coupon_set_name="Promo Coupon Codes" \
     -d code="CBCC435"

Sample Response [ JSON ]

{"coupon_code": { "object": "coupon_code", "coupon_id": "beta", "coupon_set_name": "Launch Promotion", "code": "CBCC435" }}

URL Format POST

https://{site}.chargebee.com/api/v1/coupon_codes
coupon_id
Id of the main coupon resource.
required, string, max chars=50
coupon_set_name
Coupon set name to which this coupon code would be grouped under. If the coupon set with the passed name is not present, a new coupon set will be created.
required, string, max chars=50
code
Unique coupon code that can be redeemed only once.
required, string, max chars=50
Resource object representing coupon_code.
always returned
Retrieve a coupon code for a code.
Sample Request
curl  https://{site}.chargebee.com/api/v1/coupon_codes/CBCC4356 \
     -u {site_api_key}:
copy
curl  https://{site}.chargebee.com/api/v1/coupon_codes/CBCC4356 \
     -u {site_api_key}:

Sample Response [ JSON ]

{"coupon_code": { "object": "coupon_code", "coupon_id": "beta", "coupon_set_name": "Promo Coupon Codes", "code": "CBCC4356" }}

URL Format GET

https://{site}.chargebee.com/api/v1/coupon_codes/{coupon_code_code}
Resource object representing coupon_code.
always returned