Coupons

Update Coupon

PUT
/product_families/{product_family_id}/coupons/{coupon_id}.json

Updates a coupon.

You can restrict a coupon to only apply to specific products / components by optionally passing in hashes of restricted_products and/or restricted_components in the format: { "<product/component_id>": boolean_value }

Authorization

BasicAuth
AuthorizationBasic <token>

The username is a Maxio Chargify API key. The password is x.

In: header

Path Parameters

product_family_id*integer

The Advanced Billing id of the product family to which the coupon belongs

coupon_id*integer

The Advanced Billing id of the coupon

Request Body

application/json

coupon?
restricted_products?

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.

restricted_components?

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 PUT "https://example.com/product_families/0/coupons/0.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"    },    "restricted_products": {      "1": true    },    "restricted_components": {      "1": true,      "2": false    }  }'
{  "coupon": {    "id": 67,    "name": "Foo Bar",    "code": "YEPPER99934",    "description": "my cool coupon",    "amount_in_cents": 10000,    "product_family_id": 4,    "created_at": "2017-11-08T10:01:15-05:00",    "updated_at": "2017-11-08T10:01:15-05:00",    "start_date": "2017-11-08T10:01:15-05:00",    "end_date": null,    "percentage": null,    "recurring": false,    "duration_period_count": null,    "duration_interval": null,    "duration_interval_unit": null,    "allow_negative_balance": false,    "archived_at": null,    "conversion_limit": null,    "stackable": true,    "compounding_strategy": "compound"  }}