Vouchers

Add Voucher

post /sites/{siteid}/vouchers
PARAMETERS
siteid
integer
path
REQUIRED
product_identifier
string
query

Determines what identifier to use for products in the endpoint. Default is product ID.

Available values:
  • sku
  • productid
Default: "productid"
REQUEST BODY
object
posthttps://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers.json
{
"vouchertype": 200,
"vouchername": "Resellers",
"value_x": 30
}
RESPONSE JSON
4
HTTP Status Code Summary
200Returns voucherid
400Bad Request. Invalid syntax, missing required argument or invalid request.
401Unauthorized. Authorization failed.
404Resource not found. The url is invalid.
429Too Many Requests.
500Internal Server Error.

Get Vouchers

get /sites/{siteid}/vouchers
PARAMETERS
siteid
integer
path
REQUIRED
start
integer
query

The index of the item to start from

Default: 0
num
integer
query

The number of items returned

Default: 10
fields
array (string)
query

Comma separated list of fields to return. Use this to query only the fields you are using. See Voucher for all fields.

Default: [ "voucherid", "vouchername", "datecreated", "vouchertype", "voucherstate" ]
Example: /sites/{siteid}/vouchers?fields=voucherid,vouchertype,voucherstate
product_identifier
string
query

Determines what identifier to use for products in the endpoint. Default is product ID.

Available values:
  • sku
  • productid
Default: "productid"
Returns

Returns an envelope with items of type Voucher.

gethttps://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers.json?num=3
RESPONSE JSON
{
"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
200Returns an envelope with items of type Voucher.
400Bad Request. Invalid syntax, missing required argument or invalid request.
401Unauthorized. Authorization failed.
404Resource not found. The url is invalid.
429Too Many Requests.
500Internal Server Error.

Get Voucher

get /sites/{siteid}/vouchers/{voucherid}
PARAMETERS
siteid
integer
path
REQUIRED
voucherid
integer
path
REQUIRED
product_identifier
string
query

Determines what identifier to use for products in the endpoint. Default is product ID.

Available values:
  • sku
  • productid
Default: "productid"
Returns

Returns an item of type Voucher.

gethttps://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers/4.json
RESPONSE JSON
{
"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
200Returns an item of type Voucher.
400Bad Request. Invalid syntax, missing required argument or invalid request.
401Unauthorized. Authorization failed.
404Resource not found. The url is invalid.
429Too Many Requests.
500Internal Server Error.

Update Voucher

put /sites/{siteid}/vouchers/{voucherid}
PARAMETERS
siteid
integer
path
REQUIRED
voucherid
integer
path
REQUIRED
product_identifier
string
query

Determines what identifier to use for products in the endpoint. Default is product ID.

Available values:
  • sku
  • productid
Default: "productid"
REQUEST BODY
object
puthttps://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers/4.json
{
"vouchername": "Voucher for Resellers"
}
RESPONSE JSON
true
HTTP Status Code Summary
200Returns true
400Bad Request. Invalid syntax, missing required argument or invalid request.
401Unauthorized. Authorization failed.
404Resource not found. The url is invalid.
429Too Many Requests.
500Internal Server Error.

Delete Voucher

delete /sites/{siteid}/vouchers/{voucherid}
PARAMETERS
siteid
integer
path
REQUIRED
voucherid
integer
path
REQUIRED
deletehttps://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers/4.json
RESPONSE JSON
true
HTTP Status Code Summary
200Returns true
400Bad Request. Invalid syntax, missing required argument or invalid request.
401Unauthorized. Authorization failed.
404Resource not found. The url is invalid.
429Too Many Requests.
500Internal Server Error.

Objects

Money
string

Pattern: ^[-+]?[0-9]+\.[0-9]{2}$
Example: "123.00"

ProductAttributeMapping
object

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.

Example: { "BRAND": [ "Acme" ], "GROUP": [ "Shoes", "Bags" ] }
<*>
array (string)
Custom attribute IDs are valid as properties with value of type string array. The "_PRODUCTS_" constant can be used with a single string value of "all" in the array to indicate that the mapping should be for all products.

Timestamp
integer

Number of seconds since the Unix Epoch.

Voucher
object

Vouchers are used for creating campaigns.

PROPERTIES
voucherid
integer
READ ONLY

The ID of the voucher.

active
boolean
DEPRECATED

If true then this voucher is active in the webshop.

activepos
boolean

If true then this voucher is active in the POS.

vouchercode
string

Code used for this voucher. (Used for grouping vouchers in reports and stats)

voucherpassword
string

Optional password used for this voucher.

vouchername
string
REQUIRED

Name of this voucher.

vouchercomment
string

Internal description for this voucher.

voucherterms
string
DEPRECATED

Terms for this voucher.

datecreated
READ ONLY

The date this voucher was created.

datestart

The start date for the validity of this voucher. No start date if value is null.

dateend

The end date for the validity of this voucher. No end date if value is null.

tags
array
(string)

The tags for this voucher. If added, then the voucher will only be applied for stores with the same tags.

Pattern: ^[A-Z0-9_-]{1,16}$
vouchertype
REQUIRED

Voucher Type

value_x
integer

The X value (integer) used for calculations on the voucher.

value_y
integer

The Y value (integer) used for calculations on the voucher.

value_z
integer

The Z value (integer) used for calculations on the voucher.

money_m

The M value (money) used for calculations on the voucher.

money_n

The N value (money) used for calculations on the voucher.

vouchername1
string

The vouchername used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 3 for 2 discount.

vouchercode1
string

The vouchercode used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 3 for 2 discount.

vouchername2
string

The vouchername used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 2 for 1.5 discount.

vouchercode2
string

The vouchercode used when voucher of type ProductBuy3For2Or2For1AndAHalf has triggered a 2 for 1.5 discount.

maxuses
integer

The maximum number of times the voucher can be applied for a purchase.

priority
integer

The priority of the voucher where 1 is highest and 5 is lowest.

pricelisttags
array
(string)

These tags are used to activate price lists with the same tags.

Pattern: ^[A-Z0-9_-]{1,16}$
vouchergrouptype
READ ONLY

The group type for the voucher. Implicit value depending on the vouchertype.

voucherstate
READ ONLY

Voucher state.

products
array

An array of product IDs (integer) or SKUs (string). The type is depending on the product_identifier query parameter.

One of
integer
string
productattributes
object

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.

productoptions

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.

discountoptions

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.

use_discounted_price
boolean

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.

Default: true

VoucherDiscountOption
object

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).

PROPERTIES
num
integer

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).

Default: 1
products
array

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
productattributes
object

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.

moneyprice

If set, this is the new price to use for each product in the target group (prio 3).

moneydiscount

If set, this is the discount given per item in the target group (prio 2).

moneydiscounttotal

If set, this is the total discount given for all items in the target group (prio 1).

decimaldiscount
string

If set, this is the percentage given for all items in the target group (prio 4).

VoucherGroupType
integer

  • 10 Order - The voucher is applied to the entire purchase with some exceptions
  • 20 Product - The voucher is applied to the products that are connected to it
  • 30 Package - The voucher is applied to a specific combination of products in a package
  • 40 Pricelist - The voucher activates certain price lists using tags

VoucherProductOption
object

Used for defining an option for vouchers of "Package" type.

PROPERTIES
num
integer

The number of products for this option that has to exists in the cart for the option to be fulfilled.

products
array

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

VoucherState
integer

  • 10 Active
  • 20 Planned
  • 30 Inactive

VoucherType
integer

  • 100 OrderDiscountM - Money discount proportionally distributed on all items in purchase
  • 110 OrderDiscountX - Percentage discount on all items in purchase
  • 120 OrderBuyForMGetDiscountN - Buy for M (money) get N discount (money)
  • 200 ProductDiscountM - Money discount per product
  • 210 ProductDiscountX - Percentage discount per product
  • 220 ProductBuyXForPriceM - Buy X (quantity) for M (money)
  • 230 ProductBuyXPayForY - Buy X (quantity) pay for Y (quantity)
  • 240 ProductBuyXPayForYDiscountZRest - Buy X (quantity) pay for Y (quantity) and get rest at discount Z (percentage)
  • 250 ProductBuyMinXDiscountY - Buy minimum X (quantity) and get discount Y (percentage)
  • 260 ProductBuyXGetDiscountList - Buy X (quantity) get discounts on target products defined in discount options
  • 265 ProductBuyForMGetDiscountList - Buy for M (money) get discounts on target products defined in discount options
  • 270 ProductBuy3For2Or2For1AndAHalf - Buy 3, pay for 2, or buy 2, pay for 1.5
  • 300 PackageBuyForPriceM - Buy product package for M (money)
  • 310 PackageDiscountX - Buy product package get discount X (percentage)
  • 400 PricelistActivate - Activate price lists with selected tags
  • 410 PricelistActivateFinal - Activate price lists with selected tags, and set items to not be included for other vouchers