Vouchers

Contain data reffered to vouchers.


Receive a list of all Vouchers

Query parameters:
  • fields - list of fields returning in response
  • limit - number of returned pages (default: 50)
  • page - currently displayed page (default: 1)
  • since_id - restrict vouchers to greater identifiers than specified id
  • code - filter with code
  • discount_type - filter with discount_type. Acceptable values:
    • 1 - Price discount
    • 2 - Percent discount
    • 3 - Free shipping
    • 5 - Progressive discount
    • 6 - Price discount & Free shipping
    • 7 - Percent discount & Free shipping
  • progressive_steps_treshold_type - if discount_type is 5 (progressive voucher) returns a treshold type (1 - cart value, 2 - products count) for progressive_steps objects
  • progressive_steps_discount_type - if discount_type is 5 (progressive voucher) returns a discount type (1 - price, 2 - percentage) for progressive_steps objects
  • progressive_steps - if discount_type is 5 (progressive voucher), returns list of progressive steps
  • start_at - Shows vouchers, which starting date was later than specified (format: 2011-06-19 13:18:50)
  • finish_at - Shows vouchers, which starting date was earlier than specified (format: 2011-06-19 13:18:50)
GET /services/vouchers

Returns all vouchers

HTTP/1.1 200 OK
                        {
                        "vouchers": [
                        {
                        "id" : 1,
                        "code" : "RO1MJLRR",
                        "start_at" : "2014-11-01 08:00:00",
                        "finish_at" : "2014-12-05 08:00:00",
                        "quantity" : -1,
                        "quantity_used" : 0,
                        "discount_type" : 1,
                        "discount_value" : 1000,
                        "discount_on" : 1,
                        "discount_on_type" : 0,
                        "discount_on_value" : 0,
                        "activate" : 1,
                        "apply_once" : 1,
                        "per_client" : 0,
                        "available_on_promo" : 0,
                        "created_at" : "2011-09-22 01:15:35",
                        },
                        {
                        "id" : 2,
                        "code" : "KACWTHBO",
                        "start_at" : "2014-12-01 00:00:00",
                        "finish_at" : "2015-01-01 00:00:00",
                        "quantity" : -1,
                        "quantity_used" : 0,
                        "discount_type" : 2,
                        "discount_value" : 50,
                        "discount_on" : 1,
                        "discount_on_type" : 0,
                        "discount_on_value" : 0,
                        "activate" : 1,
                        "apply_once" : 1,
                        "per_client" : 0,
                        "available_on_promo" : 0,
                        "created_at" : "2011-09-22 01:16:21"
                        }
                        ]
                        }

Receive a count of all Vouchers

Query parameters:
  • since_id - restrict vouchers to greater identifiers than specified id
  • discount_type - filter with discount_type
  • discount_on - filter with discount_on
  • start_at - filter with start_at
  • finish_at - filter with finish_at
GET /services/vouchers/count

Receive a count of all Vouchers

HTTP/1.1 200 OK
                        {
                        "count": 2
                        }

Receive a single Voucher

Query parameters:
  • fields - list of fields returning in response
GET services/vouchers/{id}

Receive a single Voucher

Response
HTTP/1.1 200 OK
                        {
                        "id" : 2,
                        "code" : "KACWTHBO",
                        "start_at" : "2014-12-01 00:00:00",
                        "finish_at" : "2015-01-01 00:00:00",
                        "quantity" : 3,
                        "quantity_used" : 0,
                        "discount_type" : 2,
                        "discount_value" : 50,
                        "discount_on" : 1,
                        "discount_on_type" : 0,
                        "discount_on_value" : 0,
                        "activate" : 1,
                        "apply_once" : 1,
                        "per_client" : 0,
                        "available_on_promo" : 0,
                        "created_at" : "2011-09-22 01:16:21",
                        "items" : [
                            {"code": "29PMESEHK", "used": 0},
                            {"code": "29PPYHFLW", "used": 0},
                            {"code": "29PPZARZF", "used": 0}
                        ]
                        }

Create a Voucher

Accepted parameters:
  • code - Unique value for each discount
  • start_at - datetime in format YYYY-MM-DD HH:II:SS
  • finish_at - datetime in format YYYY-MM-DD HH:II:SS
  • discount_type - filter with discount_type. Acceptable values:
    • 1 - Price discount
    • 2 - Percent discount
    • 3 - Free shipping
    • 5 - Progressive discount
    • 6 - Price discount & Free shipping
    • 7 - Percent discount & Free shipping
  • discount_on - filter with discount_on. Acceptable values:
    • 1 - Discount on all orders
    • 2 - DEPRECATED Discount on orders which sum is bigger than a discount_on_value value
    • 3 - Discount on product/category/collection/vendor
  • discount_on_type - when discount_on is set to 3, you can describe type of things the discount is on:
    • 1 - Discount on products
    • 2 - Discount on category
    • 3 - Discount on collection
    • 4 - Discount on vendor

    When discount_on field is set to 1, value of discount_on_type should be set to 1.

  • products - Array of Product IDs (if discount_on_type is equal 1)
  • discount_set - ID of category, collection or vendor (if discount_on_type is set to 2, 3 or 4)
  • discount_amount - amount of discount (when discount_type is set to 1 or 6)
  • discount_percent - percent of discount (when discount_type is set to 2 or 7)
  • voucher_multiple_use - specifies if voucher can be used only once per client. Acceptable values:
    • 0 - One customer can use voucher without limit
    • 1 - One customer can use voucher only once
  • progressive_steps_treshold_type - 1 for cart value, 2 for products count
  • progressive_steps_discount_type - 1 for price, 2 for percentage
  • progressive_steps - array of objects with key pairs: treshold and discount
  • apply once - way to match discount to orders. Acceptable values:
    • 0 - apply once on cart sum
    • 1 - apply to all matching products
  • discount_maximal_value_require - if set, you can set maximal value of discount amount, using discount_maximal_value field
  • discount_minimal_value_require - if set, you can set minimal value of orders that matches voucher, using discount_minimal_value field
  • available_on_promo - If set to 1, discount will be available when product is on promotion
  • quantity - the number of voucher can be used at all
  • unique - If set to 1, there will be generated as many discount codes as many quantity is specified
POST services/vouchers

Create voucher with specified parameters

Request
{
                        "code" : "KACWTHBO",
                        "start_at" : "2014-12-01",
                        "type" : 1,
                        "discount_amount" : 1000,
                        "apply_once" : 1,
                        "per_client" : 0,
                        "available_on_promo" : 0
                        }
Response
HTTP/1.1 200 OK
                        {
                        "id" : 2,
                        "code" : "KACWTHBO",
                        "start_at" : "2014-12-01 00:00:00",
                        "finish_at" : "2015-01-01 00:00:00",
                        "quantity" : -1,
                        "quantity_used" : 0,
                        "discount_type" : 1,
                        "discount_value" : 1000,
                        "discount_on" : 1,
                        "discount_on_type" : 0,
                        "discount_on_value" : 0,
                        "activate" : 1,
                        "apply_once" : 1,
                        "per_client" : 0,
                        "available_on_promo" : 0,
                        "created_at" : "2011-09-22 01:16:21"
                        }
                    

Update an existing Voucher

PUT services/vouchers/{id}

You can update a given voucher

Request
                        {
                        "start_at" : "2014-12-01",
                        "finish_at" : "2015-01-01",
                        "type" : 2,
                        "discount_value" : 25
                        }
Response
HTTP/1.1 200 OK
                        {
                        "id"	: 2,
                        }

Delete an existing Voucher

DELETE services/vouchers/{id}

Delete an existing voucher from a shop

Response
HTTP/1.1 200 OK
                        {
                        "status"	: "ok",
                        }