Creates a coupon under the specified product family.
You can create either a flat amount coupon, by specifying amount_in_cents, or percentage coupon by specifying percentage.
See Apply Coupons to Subscriptions for information on applying a coupon to a subscription in the Advanced Billing UI.
The username is a Maxio Chargify API key and the password is x. Basic authentication works only with the US and EU environments, which connect to chargify.com directly. The Maxio API Gateway environment does not accept Basic authentication.
In: header
The Advanced Billing id of the product family to which the coupon belongs
application/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
application/json
curl -X POST \ --url 'https://subdomain.chargify.com/product_families/1/coupons.json' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ACCESS_TOKEN' \ --data-raw '{ "coupon": { "name": "15% off", "code": "15OFF", "description": "15% off for life", "percentage": 15, "allow_negative_balance": false, "recurring": false, "end_date": "2012-08-29", "product_family_id": "2", "stackable": true, "compounding_strategy": "compound", "exclude_mid_period_allocations": true, "apply_on_cancel_at_end_of_period": true }, "restricted_products": { "1": true }, "restricted_components": { "1": true, "2": false }}'An object where the keys are product IDs or handles (prefixed with 'handle:'), and the values are booleans indicating if the coupon should be applicable to the product.
An object where the keys are component IDs or handles (prefixed with 'handle:'), and the values are booleans indicating if the coupon should be applicable to the component.