Voucher

A single voucher.

More info: see the get operation and the vouchers endpoint.

Fields

FieldDescription
id
int 
(required)

Unique ID

Example value:123
typeid
int 
(required)

Type ID

Example value:24001
name
mlstring 
(required)

Name of the voucher

Example value:"Gift voucher"
codeformatid
int 
(required)

Format used when generating codes for the voucher. Possible values:

  • 27001: 12 digits
  • 27002: 16 digits
  • 27003: 8 alphanumerical characters
  • 27004: 12 alphanumerical characters
  • 27005: 16 alphanumerical characters
  • 27099: Specified from list, not autogenerated
Example value:27001
codeprefix
string 
(required)

If set, the codes that are generated are padded with this prefix. This can be used to ensure that vouchercodes are unique. The prefix can be max 10 characters long.

Example value:"998"
description
mlstring 
(required)

Description of the voucher

Example value:"Gift voucher description"
nbrofcodes
int 
(required)

The number of codes that were created for this voucher.

Example value:10000
ordervalidationscript
string

A validation script that is used for vouchers of type order. For each order with a voucher of this type attached, the script will be run to validate the contents

Example value:"return order.tickets.count<5;"
paymentmethodid
int

Paymentmethod to use when creating payments for vouchers of type payment. This field is required when a payment voucher is created. The paymentmethod that is referred to should be of a voucher type.

Example value:345
validity
VoucherValidity 
(required)

Definition of the validity of this voucher. Depends on the typeid.

Example value:{ "expiry_fixeddate": "2025-01-01", "maxusages": 10, "maxusagesperevent": 2 }
isarchived
bool 
(required)

Whether or not this item is archived

createdts
timestamp 
(required)

Created timestamp

Example value:"2014-09-26 15:24:36"
lastupdatets
timestamp 
(required)

Last updated timestamp

Example value:"2014-09-26 15:24:36"

Example

 1{
 2    "id": 123,
 3    "typeid": 24001,
 4    "name": "Gift voucher",
 5    "codeformatid": 27001,
 6    "codeprefix": "998",
 7    "description": "Gift voucher description",
 8    "nbrofcodes": 10000,
 9    "ordervalidationscript": "return order.tickets.count<5;",
10    "paymentmethodid": 345,
11    "validity": {
12        "expiry_fixeddate": "2025-01-01",
13        "maxusages": 10,
14        "maxusagesperevent": 2
15    },
16    "isarchived": false,
17    "createdts": "2014-09-26 15:24:36",
18    "lastupdatets": "2014-09-26 15:24:36"
19}