Create Voucher

Method to create a standalone voucher. You can choose varied types of vouchers.

📘

Voucher Model

You can find a full list of possible voucher properties in voucher object description.

If you want to create a voucher with a given code (e.g. "WELCOME"):
curl -X POST \
  -H "X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b" \
  -H "X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c" \
  -H "Content-Type: application/json" \
  -d '{
    "category": "New Customers",
    "discount": {
        "percent_off": 10.0,
        "type": "PERCENT"
    },
    "start_date": "2016-01-01T00:00:00Z",
    "expiration_date": "2016-12-31T23:59:59Z",
    "redemption": {
        "quantity": 100 
    }
  }' \
  http://api.voucherify.io/v1/vouchers/WELCOME

Voucher code pattern

You can specify how to create the random code by passing a code_config:

  • length - Number of characters in a generated code (excluding prefix and postfix).
  • charset - Characters that can appear in the code.
  • prefix - A text appended before the code.
  • postfix - A text appended after the code.
  • pattern - A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.
"code_config": {
    "pattern": "##-##-##",
}
"code_config": {
    "prefix": "PROMO-",
    "length": 5,
    "charset": "0123456789"
}

Returns

Returns a voucher object if the call succeeded. The returned object will have information about discount type, and discount amount, if that information has been provided.

Language
Click Try It! to start a request and see the response here!