Create Coupon
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.
Authorization
BasicAuth The username is a Maxio Chargify API key. The password is x.
In: header
Path Parameters
The Advanced Billing id of the product family to which the coupon belongs
Request Body
application/json
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.
Response Body
application/json
application/json
curl -X POST "https://example.com/product_families/0/coupons.json" \ -H "Content-Type: application/json" \ -d '{ "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 } }'{ "coupon": { "id": 0, "name": "string", "code": "string", "description": "string", "amount": 0, "amount_in_cents": 0, "product_family_id": 0, "product_family_name": "string", "start_date": "2019-08-24T14:15:22Z", "end_date": "2019-08-24T14:15:22Z", "percentage": "string", "recurring": true, "recurring_scheme": "do_not_recur", "duration_period_count": 0, "duration_interval": 0, "duration_interval_unit": "string", "duration_interval_span": "string", "allow_negative_balance": true, "archived_at": "2019-08-24T14:15:22Z", "conversion_limit": "string", "stackable": true, "compounding_strategy": "compound", "use_site_exchange_rate": true, "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "discount_type": "amount", "exclude_mid_period_allocations": true, "apply_on_cancel_at_end_of_period": true, "apply_on_subscription_expiration": true, "coupon_restrictions": [ { "id": 0, "item_type": "Component", "item_id": 0, "name": "string", "handle": "string" } ], "currency_prices": [ { "id": 0, "currency": "string", "price": 0, "coupon_id": 0 } ] }}List Coupons for Product Family GET
Lists coupons for a specific product family in a site.
Find Coupon GET
Searches for a coupon by code. If you have more than one product family and if the coupon you are trying to find does not belong to the default product family in your site, you need to specify (either in the URL or as a query string param) the `product_family_id`.