Vouchers

Add Voucher

post /sites/{siteid}/vouchers
PARAMETERS
siteid
integer
path
REQUIRED
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
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
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
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}$

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
(integer)

An array of product ID.

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. Each discount option can be used if the products required have been added to the cart.

voucherdiscountoption
object

Used for defining an option for vouchers of type ProductBuyXGetDiscountList.

PROPERTIES
num
integer

The number of products this discount option is valid for.

products
array
(integer)

Array of productids which are used to activate this option.

moneyprice

The discounted price used, if set.

moneydiscount

The discount given, if set.

decimaldiscount
string

The discount in percentage given, if set.

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
(string)

Array of productids representing this option.

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 in list
  • 270 ProductBuy3For2Or2For1AndAHalf - Buy 3, pay for 2, or buy 2, pay for 1.5
  • 300 PackageBuyForPriceM - Buy product package for M (money)
  • 400 PricelistActivate - Activate price lists with selected tags