Coupons

Update Coupon Subcodes

PUT
/coupons/{coupon_id}/codes.json

Updates the subcodes for a coupon, replacing all existing subcodes with the new list. Send an array of new coupon subcodes.

Note: All current subcodes for that Coupon will be deleted first, and replaced with the list of subcodes sent to this endpoint. The response will contain:

  • The created subcodes,

  • Subcodes that were not created because they already exist,

  • Any subcodes not created because they are invalid.

Authorization

BasicAuth
AuthorizationBasic <token>

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

In: header

Path Parameters

coupon_id*integer

The Advanced Billing id of the coupon

Request Body

application/json

codes?array<string>

Response Body

application/json

curl -X PUT "https://example.com/coupons/0/codes.json" \  -H "Content-Type: application/json" \  -d '{    "codes": [      "AAAA",      "BBBB",      "CCCC"    ]  }'
{  "created_codes": [    "string"  ],  "duplicate_codes": [    "string"  ],  "invalid_codes": [    "string"  ]}

Create Coupon Subcodes POST

Creates subcodes for an existing coupon. Coupon Subcodes allow you to create a set of unique codes that allow you to expand the use of one coupon. For example: Master Coupon Code: + SPRING2020 Coupon Subcodes: + SPRING90210 + DP80302 + SPRINGBALTIMORE When creating a coupon subcode, you must specify a coupon to attach it to using the coupon_id. Valid coupon subcodes are all capital letters, contain only letters and numbers, and do not have any spaces. Lowercase letters are capitalized before the subcode is created. Note: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), you must encode them for use in the URL. % to %25 @ to %40 + to %2B - to %2D _ to %5F . to %2E So, if the coupon subcode is `20%OFF`, the URL to delete this coupon subcode would be: `https://<subdomain>.chargify.com/coupons/567/codes/20%25OFF.<format>`. For more information on coupon codes and applying coupons to subscriptions, see [Coupon Codes](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes) and [Coupons and Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions).

Delete Coupon Subcode DELETE

Deletes a specific subcode from a coupon. ## Example Given a coupon with an ID of 567, and a coupon subcode of 20OFF, the URL to `DELETE` this coupon subcode would be: ``` http://subdomain.chargify.com/coupons/567/codes/20OFF.<format> ``` Note: If you are using any of the allowed special characters (“%”, “@”, “+”, “-”, “_”, and “.”), you must encode them for use in the URL. | Special character | Encoding | |-------------------|----------| | % | %25 | | @ | %40 | | + | %2B | | – | %2D | | _ | %5F | | . | %2E | ## Percent Encoding Example Or if the coupon subcode is 20%OFF, the URL to delete this coupon subcode would be: @https://<subdomain>.chargify.com/coupons/567/codes/20%25OFF.<format>.