Vouchers
Add Voucher
post /sites/{siteid}/vouchersDetermines what identifier to use for products in the endpoint. Default is product ID.
- sku
- productid
{ "vouchertype": 200, "vouchername": "Resellers", "value_x": 30}4| HTTP Status Code Summary | |
|---|---|
| 200 | Returns voucherid |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Vouchers
get /sites/{siteid}/vouchersThe index of the item to start from
The number of items returned
Comma separated list of fields to return. Use this to query only the fields you are using. See Voucher for all fields.
Determines what identifier to use for products in the endpoint. Default is product ID.
- sku
- productid
{ "totalcount": 3, "items": [ { "voucherid": 1, "vouchername": "Spring Sale", "datecreated": 1462953900, "vouchertype": 110, "voucherstate": 10 }, { "voucherid": 2, "vouchername": "10% Off", "datecreated": 1462954020, "vouchertype": 210, "voucherstate": 10 }, { "voucherid": 3, "vouchername": "$10 Off", "datecreated": 1462954020, "vouchertype": 200, "voucherstate": 10 } ]}| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an envelope with items of type Voucher. |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Voucher
get /sites/{siteid}/vouchers/{voucherid}Determines what identifier to use for products in the endpoint. Default is product ID.
- sku
- productid
{ "voucherid": 4, "active": true, "activepos": true, "vouchercode": "", "voucherpassword": "", "vouchername": "Resellers", "vouchercomment": "", "voucherterms": "", "datecreated": 1550669774, "datestart": null, "dateend": null, "tags": [], "vouchertype": 200, "value_x": 30, "value_y": null, "value_z": null, "money_m": null, "money_n": null, "vouchername1": null, "vouchercode1": null, "vouchername2": null, "vouchercode2": null, "maxuses": null, "priority": 3, "pricelisttags": null, "vouchergrouptype": 20, "voucherstate": 10, "products": [], "productoptions": [], "discountoptions": []}| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an item of type Voucher. |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Update Voucher
put /sites/{siteid}/vouchers/{voucherid}Determines what identifier to use for products in the endpoint. Default is product ID.
- sku
- productid
{ "vouchername": "Voucher for Resellers"}true| HTTP Status Code Summary | |
|---|---|
| 200 | Returns true |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Delete Voucher
delete /sites/{siteid}/vouchers/{voucherid}true| HTTP Status Code Summary | |
|---|---|
| 200 | Returns true |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Add Voucher Products
post /sites/{siteid}/vouchers/{voucherid}/productsEndpoint for adding products to an existing voucher of group type 20 (Product). Adding products that already exist in the voucher is OK and will not give any error.
Determines what identifier to use for products in the endpoint. Default is product ID.
- sku
- productid
[ 123, 345, 789]true| HTTP Status Code Summary | |
|---|---|
| 200 | Returns true |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Delete Voucher Products
delete /sites/{siteid}/vouchers/{voucherid}/productsEndpoint for removing products from an existing voucher of group type 20 (Product). Removing products that do not exist in the voucher is OK and will not give any error.
Determines what identifier to use for products in the endpoint. Default is product ID.
- sku
- productid
[ 123, 345, 789]true| HTTP Status Code Summary | |
|---|---|
| 200 | Returns true |
| 400 | Bad Request. Invalid syntax, missing required argument or invalid request. |
| 401 | Unauthorized. Authorization failed. |
| 404 | Resource not found. The url is invalid. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Objects
Moneystring
ProductAttributeMappingobject
Object with product custom attribute IDs as property names with an array of string (attribute values) that will be used to identify products for voucher.
Timestampinteger
Number of seconds since the Unix Epoch.
Voucherobject
Vouchers are used for creating campaigns.
The ID of the voucher.
If true then this voucher is active in the webshop.
If true then this voucher is active in the POS.
Code used for this voucher. (Used for grouping vouchers in reports and stats)
Optional password used for this voucher.
Name of this voucher.
Internal description for this voucher.
Terms for this voucher.
The date this voucher was created.
The start date for the validity of this voucher. No start date if value is null.
The end date for the validity of this voucher. No end date if value is null.
The tags for this voucher. If added, then the voucher will only be applied for stores with the same tags.
Voucher Type
The X value (integer) used for calculations on the voucher.
The Y value (integer) used for calculations on the voucher.
The Z value (integer) used for calculations on the voucher.
The M value (money) used for calculations on the voucher.
The N value (money) used for calculations on the voucher.
The vouchername used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 3 for 2 discount.
The vouchercode used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 3 for 2 discount.
The vouchername used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 2 for 1.5 discount.
The vouchercode used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 2 for 1.5 discount.
The maximum number of times the voucher can be applied for a purchase.
The priority of the voucher where 1 is highest and 5 is lowest.
These tags are used to activate price lists with the same tags.
The group type for the voucher. Implicit value depending on the vouchertype.
Voucher state.
An array of product IDs (integer) or SKUs (string). The type is depending on the product_identifier query parameter.
| One of |
|---|
| integer |
| string |
Definition of which products that this voucher should be applied for. Only valid for vouchers with grouptype Order and Product.
Product custom attributes matching the set of products that should be included for this voucher.
Product custom attributes matching the set of products that should be excluded for this voucher. Any products in this set will have precedence over the include set.
An array of VoucherProductOption used for vouchers of Package group type. Each option of the array must be fulfilled for the voucher to be applied.
An array of VoucherDiscountOption used for vouchers of type ProductBuyXGetDiscountList and ProductBuyForMGetDiscountList. Each discount option can be used if the products required to meet the conditions have been added to the cart.
If true, then the calculation will be done on top of already discounted prices enabled from a price lists campaign. Only valid for vouchers with grouptype Product.
VoucherDiscountOptionobject
Used for defining an option for vouchers of type ProductBuyXGetDiscountList and ProductBuyForMGetDiscountList. When applying a discount option on a set of products (target). Only one of the parameters moneyprice, moneydiscount, moneydiscounttotal and decimaldiscount will be used, so only one of them should be set. If for some reason more than one of these properties has a value, the first one in priority order will be used (see each property for priority).
The maximum quantity of products that this discount option can be applied to. If more than num products are available to give discount on, then the products will be selected by price in reverse order (highest price first).
An optional array of product IDs (integer) or SKUs (string) that determine which products that this option should give discounts on (target products). The type is depending on the product_identifier query parameter.
| One of |
|---|
| integer |
| string |
Definition of which products that this option should give discounts on (target products).
Product custom attributes matching the set of products that should be included for this discount option.
Product custom attributes matching the set of products that should be excluded for this discount option. Any products in this set will have precedence over the include set.
If set, this is the new price to use for each product in the target group (prio 3).
If set, this is the discount given per item in the target group (prio 2).
If set, this is the total discount given for all items in the target group (prio 1).
If set, this is the percentage given for all items in the target group (prio 4).
VoucherGroupTypeinteger
10Order - The voucher is applied to the entire purchase with some exceptions20Product - The voucher is applied to the products that are connected to it30Package - The voucher is applied to a specific combination of products in a package40Pricelist - The voucher activates certain price lists using tags
VoucherProductOptionobject
Used for defining an option for vouchers of "Package" type.
The number of products for this option that has to exists in the cart for the option to be fulfilled.
An array of product IDs (integer) or SKUs (string) representing this option. The type is depending on the product_identifier query parameter.
| One of |
|---|
| integer |
| string |
VoucherStateinteger
10Active20Planned30Inactive
VoucherTypeinteger
100OrderDiscountM - Money discount proportionally distributed on all items in purchase110OrderDiscountX - Percentage discount on all items in purchase120OrderBuyForMGetDiscountN - Buy for M (money) get N discount (money)200ProductDiscountM - Money discount per product210ProductDiscountX - Percentage discount per product220ProductBuyXForPriceM - Buy X (quantity) for M (money)230ProductBuyXPayForY - Buy X (quantity) pay for Y (quantity)240ProductBuyXPayForYDiscountZRest - Buy X (quantity) pay for Y (quantity) and get rest at discount Z (percentage)250ProductBuyMinXDiscountY - Buy minimum X (quantity) and get discount Y (percentage)260ProductBuyXGetDiscountList - Buy X (quantity) get discounts on target products defined in discount options265ProductBuyForMGetDiscountList - Buy for M (money) get discounts on target products defined in discount options270ProductBuy3For2Or2For1AndAHalf - Buy 3, pay for 2, or buy 2, pay for 1.5300PackageBuyForPriceM - Buy product package for M (money)310PackageDiscountX - Buy product package get discount X (percentage)320PackageDiscountM - Buy product package get discount M (money)400PricelistActivate - Activate price lists with selected tags410PricelistActivateFinal - Activate price lists with selected tags, and set items to not be included for other vouchers