Create a new product

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/settings/products

Examples

Creating a simple product

In this example we’ll be creating a simple product: a t-shirt with different sizes. The default price of the t-shirt is 25 euro. The small t-shirts costs 20 euro, and the large t-shirt costs 30 euro.

It will be for sale from 2017 till 2025 in saleschannels 1 and 2.

Request

 1use Ticketmatic\Endpoints\Settings\Products;
 2
 3$result = Products::create($client, array(
 4    "typeid" => 26001,
 5    "name" => "T-shirt",
 6    "description" => "Show us some love with our latest shirt, available in 3 sizes.",
 7    "instancevalues" => array(
 8        "default" => array(
 9            "price" => 25,
10        ),
11        "exceptions" => array(
12            array(
13                "properties" => array(
14                    "size" => array(
15                        "S",
16                    ),
17                ),
18                "value" => array(
19                    "price" => 20,
20                ),
21            ),
22            array(
23                "properties" => array(
24                    "size" => array(
25                        "M",
26                    ),
27                ),
28                "value" => array(
29                    "price" => 25,
30                ),
31            ),
32            array(
33                "properties" => array(
34                    "size" => array(
35                        "L",
36                    ),
37                ),
38                "value" => array(
39                    "price" => 30,
40                ),
41            ),
42        ),
43    ),
44    "properties" => array(
45        array(
46            "name" => "Size",
47            "description" => "Size of the T-Shirt",
48            "key" => "size",
49            "values" => array(
50                array(
51                    "key" => "S",
52                    "value" => "Small",
53                ),
54                array(
55                    "key" => "M",
56                    "value" => "Medium",
57                ),
58                array(
59                    "key" => "L",
60                    "value" => "Large",
61                ),
62            ),
63        ),
64    ),
65    "saleendts" => "2025-01-01 00:00:00",
66    "saleschannels" => array(
67        1,
68        2,
69    ),
70    "salestartts" => "2017-01-01 00:00:00",
71));

Response

  1object(\Ticketmatic\Model\Product) (11) {
  2  ["id"]=>
  3  int(0)
  4  ["typeid"]=>
  5  int(0)
  6  ["name"]=>
  7  string(7) "T-shirt"
  8  ["code"]=>
  9  string(12) "781736175845"
 10  ["description"]=>
 11  string(62) "Show us some love with our latest shirt, available in 3 sizes."
 12  ["instancevalues"]=>
 13  object(\Ticketmatic\Model\ProductInstancevalues) (2) {
 14    ["default"]=>
 15    object(\Ticketmatic\Model\ProductInstanceValue) (1) {
 16      ["price"]=>
 17      float(25.000000)
 18    }
 19    ["exceptions"]=>
 20    array(3) {
 21      [0]=>
 22      object(\Ticketmatic\Model\ProductInstanceException) (2) {
 23        ["properties"]=>
 24        array(1) {
 25          ["size"]=>
 26            array(1) {
 27              [0]=>
 28              string(1) "S"
 29            }
 30        }
 31        ["value"]=>
 32        object(\Ticketmatic\Model\ProductInstanceValue) (1) {
 33          ["price"]=>
 34          float(20.000000)
 35        }
 36      }
 37      [1]=>
 38      object(\Ticketmatic\Model\ProductInstanceException) (2) {
 39        ["properties"]=>
 40        array(1) {
 41          ["size"]=>
 42            array(1) {
 43              [0]=>
 44              string(1) "M"
 45            }
 46        }
 47        ["value"]=>
 48        object(\Ticketmatic\Model\ProductInstanceValue) (1) {
 49          ["price"]=>
 50          float(25.000000)
 51        }
 52      }
 53      [2]=>
 54      object(\Ticketmatic\Model\ProductInstanceException) (2) {
 55        ["properties"]=>
 56        array(1) {
 57          ["size"]=>
 58            array(1) {
 59              [0]=>
 60              string(1) "L"
 61            }
 62        }
 63        ["value"]=>
 64        object(\Ticketmatic\Model\ProductInstanceValue) (1) {
 65          ["price"]=>
 66          float(30.000000)
 67        }
 68      }
 69    }
 70  }
 71  ["properties"]=>
 72  array(1) {
 73    [0]=>
 74    object(\Ticketmatic\Model\ProductProperty) (4) {
 75      ["name"]=>
 76      string(4) "Size"
 77      ["description"]=>
 78      string(19) "Size of the T-Shirt"
 79      ["key"]=>
 80      string(4) "size"
 81      ["values"]=>
 82      array(3) {
 83        [0]=>
 84        object(\Ticketmatic\Model\KeyValueItem) (2) {
 85          ["key"]=>
 86          string(1) "S"
 87          ["value"]=>
 88          string(5) "Small"
 89        }
 90        [1]=>
 91        object(\Ticketmatic\Model\KeyValueItem) (2) {
 92          ["key"]=>
 93          string(1) "M"
 94          ["value"]=>
 95          string(6) "Medium"
 96        }
 97        [2]=>
 98        object(\Ticketmatic\Model\KeyValueItem) (2) {
 99          ["key"]=>
100          string(1) "L"
101          ["value"]=>
102          string(5) "Large"
103        }
104      }
105    }
106  }
107  ["saleendts"]=>
108  object(\DateTime) (3) {
109    ["date"]=>
110    string(26) "2025-01-01 00:00:00.000000"
111    ["timezone_type"]=>
112    int(3)
113    ["timezone"]=>
114    string(3) "UTC"
115  }
116  ["saleschannels"]=>
117  array(2) {
118    [0]=>
119    int(0)
120    [1]=>
121    int(0)
122  }
123  ["salestartts"]=>
124  object(\DateTime) (3) {
125    ["date"]=>
126    string(26) "2017-01-01 00:00:00j.000000"
127    ["timezone_type"]=>
128    int(3)
129    ["timezone"]=>
130    string(3) "UTC"
131  }
132  ["isarchived"]=>
133  bool(false)
134}
135

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/products"
 4)
 5
 6result, err := products.Create(client, &ticketmatic.Product{
 7    Typeid: 26001,
 8    Name: "T-shirt",
 9    Description: "Show us some love with our latest shirt, available in 3 sizes.",
10    Instancevalues: &ticketmatic.ProductInstancevalues{
11        Default: &ticketmatic.ProductInstanceValue{
12            Price: 25,
13        },
14        Exceptions: []*ticketmatic.ProductInstanceException{
15            &ticketmatic.ProductInstanceException{
16                Properties: map[string][]string{
17                    "size": []string{
18                        "S",
19                    },
20                },
21                Value: &ticketmatic.ProductInstanceValue{
22                    Price: 20,
23                },
24            },
25            &ticketmatic.ProductInstanceException{
26                Properties: map[string][]string{
27                    "size": []string{
28                        "M",
29                    },
30                },
31                Value: &ticketmatic.ProductInstanceValue{
32                    Price: 25,
33                },
34            },
35            &ticketmatic.ProductInstanceException{
36                Properties: map[string][]string{
37                    "size": []string{
38                        "L",
39                    },
40                },
41                Value: &ticketmatic.ProductInstanceValue{
42                    Price: 30,
43                },
44            },
45        },
46    },
47    Properties: []*ticketmatic.ProductProperty{
48        &ticketmatic.ProductProperty{
49            Name: "Size",
50            Description: "Size of the T-Shirt",
51            Key: "size",
52            Values: []*ticketmatic.KeyValueItem{
53                &ticketmatic.KeyValueItem{
54                    Key: "S",
55                    Value: "Small",
56                },
57                &ticketmatic.KeyValueItem{
58                    Key: "M",
59                    Value: "Medium",
60                },
61                &ticketmatic.KeyValueItem{
62                    Key: "L",
63                    Value: "Large",
64                },
65            },
66        },
67    },
68    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
69    Saleschannels: []int64{
70        1,
71        2,
72    },
73    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
74})

Response

 1result := &ticketmatic.Product{
 2    Id: 10149,
 3    Typeid: 26001,
 4    Name: "T-shirt",
 5    Code: "781736175845",
 6    Description: "Show us some love with our latest shirt, available in 3 sizes.",
 7    Instancevalues: &ticketmatic.ProductInstancevalues{
 8        Default: &ticketmatic.ProductInstanceValue{
 9            Price: 25,
10        },
11        Exceptions: []*ticketmatic.ProductInstanceException{
12            &ticketmatic.ProductInstanceException{
13                Properties: map[string][]string{
14                    "size": []string{
15                        "S",
16                    },
17                },
18                Value: &ticketmatic.ProductInstanceValue{
19                    Price: 20,
20                },
21            },
22            &ticketmatic.ProductInstanceException{
23                Properties: map[string][]string{
24                    "size": []string{
25                        "M",
26                    },
27                },
28                Value: &ticketmatic.ProductInstanceValue{
29                    Price: 25,
30                },
31            },
32            &ticketmatic.ProductInstanceException{
33                Properties: map[string][]string{
34                    "size": []string{
35                        "L",
36                    },
37                },
38                Value: &ticketmatic.ProductInstanceValue{
39                    Price: 30,
40                },
41            },
42        },
43    },
44    Properties: []*ticketmatic.ProductProperty{
45        &ticketmatic.ProductProperty{
46            Name: "Size",
47            Description: "Size of the T-Shirt",
48            Key: "size",
49            Values: []*ticketmatic.KeyValueItem{
50                &ticketmatic.KeyValueItem{
51                    Key: "S",
52                    Value: "Small",
53                },
54                &ticketmatic.KeyValueItem{
55                    Key: "M",
56                    Value: "Medium",
57                },
58                &ticketmatic.KeyValueItem{
59                    Key: "L",
60                    Value: "Large",
61                },
62            },
63        },
64    },
65    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
66    Saleschannels: []int64{
67        1,
68        2,
69    },
70    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00j")),
71    Isarchived: false,
72}

Request

 1POST /api/1/{accountname}/settings/products HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 26001,
 6    "name": "T-shirt",
 7    "description": "Show us some love with our latest shirt, available in 3 sizes.",
 8    "instancevalues": {
 9        "default": {
10            "price": 25.000000
11        },
12        "exceptions": [
13            {
14                "properties": {
15                    "size": [
16                        "S"
17                    ]
18                },
19                "value": {
20                    "price": 20.000000
21                }
22            },
23            {
24                "properties": {
25                    "size": [
26                        "M"
27                    ]
28                },
29                "value": {
30                    "price": 25.000000
31                }
32            },
33            {
34                "properties": {
35                    "size": [
36                        "L"
37                    ]
38                },
39                "value": {
40                    "price": 30.000000
41                }
42            }
43        ]
44    },
45    "properties": [
46        {
47            "name": "Size",
48            "description": "Size of the T-Shirt",
49            "key": "size",
50            "values": [
51                {
52                    "key": "S",
53                    "value": "Small"
54                },
55                {
56                    "key": "M",
57                    "value": "Medium"
58                },
59                {
60                    "key": "L",
61                    "value": "Large"
62                }
63            ]
64        }
65    ],
66    "saleendts": "2025-01-01 00:00:00",
67    "saleschannels": [ 1, 2 ],
68    "salestartts": "2017-01-01 00:00:00"
69}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 10149,
 6    "typeid": 26001,
 7    "name": "T-shirt",
 8    "code": "781736175845",
 9    "description": "Show us some love with our latest shirt, available in 3 sizes.",
10    "instancevalues": {
11        "default": {
12            "price": 25.000000
13        },
14        "exceptions": [
15            {
16                "properties": {
17                    "size": [
18                        "S"
19                    ]
20                },
21                "value": {
22                    "price": 20.000000
23                }
24            },
25            {
26                "properties": {
27                    "size": [
28                        "M"
29                    ]
30                },
31                "value": {
32                    "price": 25.000000
33                }
34            },
35            {
36                "properties": {
37                    "size": [
38                        "L"
39                    ]
40                },
41                "value": {
42                    "price": 30.000000
43                }
44            }
45        ]
46    },
47    "properties": [
48        {
49            "name": "Size",
50            "description": "Size of the T-Shirt",
51            "key": "size",
52            "values": [
53                {
54                    "key": "S",
55                    "value": "Small"
56                },
57                {
58                    "key": "M",
59                    "value": "Medium"
60                },
61                {
62                    "key": "L",
63                    "value": "Large"
64                }
65            ]
66        }
67    ],
68    "saleendts": "2025-01-01 00:00:00",
69    "saleschannels": [ 1, 2 ],
70    "salestartts": "2017-01-01 00:00:00j",
71    "isarchived": false
72}

Creating a voucher product

To sell vouchers, a voucher product needs to be created.

In this example a voucher product that sells payment vouchers is created. You can find a sample to create a payment voucher here.

The default voucher amount is 20 euro for a price of 20 euro. There is also a voucher of 10 euro (for the same price) and a promotional price of 50 euro for a voucher with an amount of 60 euro.

Note: Although it’s possible to create multiple products that sell the same voucher via the API, the backoffice management UI has no support for multiple products that link to the same voucher. Keep this in mind while creating voucher products.

Request

 1use Ticketmatic\Endpoints\Settings\Products;
 2
 3$result = Products::create($client, array(
 4    "typeid" => 26002,
 5    "name" => "Voucher",
 6    "description" => "Give a gift! Remember that for 50 euro you get a voucher of 60 euro!",
 7    "instancevalues" => array(
 8        "default" => array(
 9            "price" => 20,
10            "voucher" => array(
11                "amount" => 20,
12                "voucherid" => 10001,
13            ),
14        ),
15        "exceptions" => array(
16            array(
17                "properties" => array(
18                    "money" => array(
19                        "money_10",
20                    ),
21                ),
22                "value" => array(
23                    "price" => 10,
24                    "voucher" => array(
25                        "amount" => 10,
26                        "voucherid" => 10001,
27                    ),
28                ),
29            ),
30            array(
31                "properties" => array(
32                    "money" => array(
33                        "money_20",
34                    ),
35                ),
36                "value" => array(
37                    "price" => 20,
38                    "voucher" => array(
39                        "amount" => 20,
40                        "voucherid" => 10001,
41                    ),
42                ),
43            ),
44            array(
45                "properties" => array(
46                    "money" => array(
47                        "money_50",
48                    ),
49                ),
50                "value" => array(
51                    "price" => 50,
52                    "voucher" => array(
53                        "amount" => 60,
54                        "voucherid" => 10001,
55                    ),
56                ),
57            ),
58        ),
59    ),
60    "properties" => array(
61        array(
62            "name" => "Monetary value",
63            "description" => "The monetary value of your voucher",
64            "key" => "money",
65            "values" => array(
66                array(
67                    "key" => "money_10",
68                    "value" => "Value of 10 euro",
69                ),
70                array(
71                    "key" => "money_20",
72                    "value" => "Value of 20 euro",
73                ),
74                array(
75                    "key" => "money_50",
76                    "value" => "Value of 50+10 euro",
77                ),
78            ),
79        ),
80    ),
81    "saleendts" => "2025-01-01 00:00:00",
82    "saleschannels" => array(
83        1,
84        2,
85    ),
86    "salestartts" => "2017-01-01 00:00:00",
87));

Response

  1object(\Ticketmatic\Model\Product) (11) {
  2  ["id"]=>
  3  int(0)
  4  ["typeid"]=>
  5  int(0)
  6  ["name"]=>
  7  string(7) "Voucher"
  8  ["code"]=>
  9  string(12) "455961222916"
 10  ["description"]=>
 11  string(68) "Give a gift! Remember that for 50 euro you get a voucher of 60 euro!"
 12  ["instancevalues"]=>
 13  object(\Ticketmatic\Model\ProductInstancevalues) (2) {
 14    ["default"]=>
 15    object(\Ticketmatic\Model\ProductInstanceValue) (2) {
 16      ["price"]=>
 17      float(20.000000)
 18      ["voucher"]=>
 19      object(\Ticketmatic\Model\ProductVoucherValue) (2) {
 20        ["amount"]=>
 21        float(20.000000)
 22        ["voucherid"]=>
 23        int(0)
 24      }
 25    }
 26    ["exceptions"]=>
 27    array(3) {
 28      [0]=>
 29      object(\Ticketmatic\Model\ProductInstanceException) (2) {
 30        ["properties"]=>
 31        array(1) {
 32          ["money"]=>
 33            array(1) {
 34              [0]=>
 35              string(8) "money_10"
 36            }
 37        }
 38        ["value"]=>
 39        object(\Ticketmatic\Model\ProductInstanceValue) (2) {
 40          ["price"]=>
 41          float(10.000000)
 42          ["voucher"]=>
 43          object(\Ticketmatic\Model\ProductVoucherValue) (2) {
 44            ["amount"]=>
 45            float(10.000000)
 46            ["voucherid"]=>
 47            int(0)
 48          }
 49        }
 50      }
 51      [1]=>
 52      object(\Ticketmatic\Model\ProductInstanceException) (2) {
 53        ["properties"]=>
 54        array(1) {
 55          ["money"]=>
 56            array(1) {
 57              [0]=>
 58              string(8) "money_20"
 59            }
 60        }
 61        ["value"]=>
 62        object(\Ticketmatic\Model\ProductInstanceValue) (2) {
 63          ["price"]=>
 64          float(20.000000)
 65          ["voucher"]=>
 66          object(\Ticketmatic\Model\ProductVoucherValue) (2) {
 67            ["amount"]=>
 68            float(20.000000)
 69            ["voucherid"]=>
 70            int(0)
 71          }
 72        }
 73      }
 74      [2]=>
 75      object(\Ticketmatic\Model\ProductInstanceException) (2) {
 76        ["properties"]=>
 77        array(1) {
 78          ["money"]=>
 79            array(1) {
 80              [0]=>
 81              string(8) "money_50"
 82            }
 83        }
 84        ["value"]=>
 85        object(\Ticketmatic\Model\ProductInstanceValue) (2) {
 86          ["price"]=>
 87          float(50.000000)
 88          ["voucher"]=>
 89          object(\Ticketmatic\Model\ProductVoucherValue) (2) {
 90            ["amount"]=>
 91            float(60.000000)
 92            ["voucherid"]=>
 93            int(0)
 94          }
 95        }
 96      }
 97    }
 98  }
 99  ["properties"]=>
100  array(1) {
101    [0]=>
102    object(\Ticketmatic\Model\ProductProperty) (4) {
103      ["name"]=>
104      string(14) "Monetary value"
105      ["description"]=>
106      string(34) "The monetary value of your voucher"
107      ["key"]=>
108      string(5) "money"
109      ["values"]=>
110      array(3) {
111        [0]=>
112        object(\Ticketmatic\Model\KeyValueItem) (2) {
113          ["key"]=>
114          string(8) "money_10"
115          ["value"]=>
116          string(16) "Value of 10 euro"
117        }
118        [1]=>
119        object(\Ticketmatic\Model\KeyValueItem) (2) {
120          ["key"]=>
121          string(8) "money_20"
122          ["value"]=>
123          string(16) "Value of 20 euro"
124        }
125        [2]=>
126        object(\Ticketmatic\Model\KeyValueItem) (2) {
127          ["key"]=>
128          string(8) "money_50"
129          ["value"]=>
130          string(19) "Value of 50+10 euro"
131        }
132      }
133    }
134  }
135  ["saleendts"]=>
136  object(\DateTime) (3) {
137    ["date"]=>
138    string(26) "2025-01-01 00:00:00.000000"
139    ["timezone_type"]=>
140    int(3)
141    ["timezone"]=>
142    string(3) "UTC"
143  }
144  ["saleschannels"]=>
145  array(2) {
146    [0]=>
147    int(0)
148    [1]=>
149    int(0)
150  }
151  ["salestartts"]=>
152  object(\DateTime) (3) {
153    ["date"]=>
154    string(26) "2017-01-01 00:00:00.000000"
155    ["timezone_type"]=>
156    int(3)
157    ["timezone"]=>
158    string(3) "UTC"
159  }
160  ["isarchived"]=>
161  bool(false)
162}
163

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/products"
 4)
 5
 6result, err := products.Create(client, &ticketmatic.Product{
 7    Typeid: 26002,
 8    Name: "Voucher",
 9    Description: "Give a gift! Remember that for 50 euro you get a voucher of 60 euro!",
10    Instancevalues: &ticketmatic.ProductInstancevalues{
11        Default: &ticketmatic.ProductInstanceValue{
12            Price: 20,
13            Voucher: &ticketmatic.ProductVoucherValue{
14                Amount: 20,
15                Voucherid: 10001,
16            },
17        },
18        Exceptions: []*ticketmatic.ProductInstanceException{
19            &ticketmatic.ProductInstanceException{
20                Properties: map[string][]string{
21                    "money": []string{
22                        "money_10",
23                    },
24                },
25                Value: &ticketmatic.ProductInstanceValue{
26                    Price: 10,
27                    Voucher: &ticketmatic.ProductVoucherValue{
28                        Amount: 10,
29                        Voucherid: 10001,
30                    },
31                },
32            },
33            &ticketmatic.ProductInstanceException{
34                Properties: map[string][]string{
35                    "money": []string{
36                        "money_20",
37                    },
38                },
39                Value: &ticketmatic.ProductInstanceValue{
40                    Price: 20,
41                    Voucher: &ticketmatic.ProductVoucherValue{
42                        Amount: 20,
43                        Voucherid: 10001,
44                    },
45                },
46            },
47            &ticketmatic.ProductInstanceException{
48                Properties: map[string][]string{
49                    "money": []string{
50                        "money_50",
51                    },
52                },
53                Value: &ticketmatic.ProductInstanceValue{
54                    Price: 50,
55                    Voucher: &ticketmatic.ProductVoucherValue{
56                        Amount: 60,
57                        Voucherid: 10001,
58                    },
59                },
60            },
61        },
62    },
63    Properties: []*ticketmatic.ProductProperty{
64        &ticketmatic.ProductProperty{
65            Name: "Monetary value",
66            Description: "The monetary value of your voucher",
67            Key: "money",
68            Values: []*ticketmatic.KeyValueItem{
69                &ticketmatic.KeyValueItem{
70                    Key: "money_10",
71                    Value: "Value of 10 euro",
72                },
73                &ticketmatic.KeyValueItem{
74                    Key: "money_20",
75                    Value: "Value of 20 euro",
76                },
77                &ticketmatic.KeyValueItem{
78                    Key: "money_50",
79                    Value: "Value of 50+10 euro",
80                },
81            },
82        },
83    },
84    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
85    Saleschannels: []int64{
86        1,
87        2,
88    },
89    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
90})

Response

 1result := &ticketmatic.Product{
 2    Id: 10153,
 3    Typeid: 26002,
 4    Name: "Voucher",
 5    Code: "455961222916",
 6    Description: "Give a gift! Remember that for 50 euro you get a voucher of 60 euro!",
 7    Instancevalues: &ticketmatic.ProductInstancevalues{
 8        Default: &ticketmatic.ProductInstanceValue{
 9            Price: 20,
10            Voucher: &ticketmatic.ProductVoucherValue{
11                Amount: 20,
12                Voucherid: 10001,
13            },
14        },
15        Exceptions: []*ticketmatic.ProductInstanceException{
16            &ticketmatic.ProductInstanceException{
17                Properties: map[string][]string{
18                    "money": []string{
19                        "money_10",
20                    },
21                },
22                Value: &ticketmatic.ProductInstanceValue{
23                    Price: 10,
24                    Voucher: &ticketmatic.ProductVoucherValue{
25                        Amount: 10,
26                        Voucherid: 10001,
27                    },
28                },
29            },
30            &ticketmatic.ProductInstanceException{
31                Properties: map[string][]string{
32                    "money": []string{
33                        "money_20",
34                    },
35                },
36                Value: &ticketmatic.ProductInstanceValue{
37                    Price: 20,
38                    Voucher: &ticketmatic.ProductVoucherValue{
39                        Amount: 20,
40                        Voucherid: 10001,
41                    },
42                },
43            },
44            &ticketmatic.ProductInstanceException{
45                Properties: map[string][]string{
46                    "money": []string{
47                        "money_50",
48                    },
49                },
50                Value: &ticketmatic.ProductInstanceValue{
51                    Price: 50,
52                    Voucher: &ticketmatic.ProductVoucherValue{
53                        Amount: 60,
54                        Voucherid: 10001,
55                    },
56                },
57            },
58        },
59    },
60    Properties: []*ticketmatic.ProductProperty{
61        &ticketmatic.ProductProperty{
62            Name: "Monetary value",
63            Description: "The monetary value of your voucher",
64            Key: "money",
65            Values: []*ticketmatic.KeyValueItem{
66                &ticketmatic.KeyValueItem{
67                    Key: "money_10",
68                    Value: "Value of 10 euro",
69                },
70                &ticketmatic.KeyValueItem{
71                    Key: "money_20",
72                    Value: "Value of 20 euro",
73                },
74                &ticketmatic.KeyValueItem{
75                    Key: "money_50",
76                    Value: "Value of 50+10 euro",
77                },
78            },
79        },
80    },
81    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
82    Saleschannels: []int64{
83        1,
84        2,
85    },
86    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
87    Isarchived: false,
88}

Request

 1POST /api/1/{accountname}/settings/products HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 26002,
 6    "name": "Voucher",
 7    "description": "Give a gift! Remember that for 50 euro you get a voucher of 60 euro!",
 8    "instancevalues": {
 9        "default": {
10            "price": 20.000000,
11            "voucher": {
12                "amount": 20.000000,
13                "voucherid": 10001
14            }
15        },
16        "exceptions": [
17            {
18                "properties": {
19                    "money": [
20                        "money_10"
21                    ]
22                },
23                "value": {
24                    "price": 10.000000,
25                    "voucher": {
26                        "amount": 10.000000,
27                        "voucherid": 10001
28                    }
29                }
30            },
31            {
32                "properties": {
33                    "money": [
34                        "money_20"
35                    ]
36                },
37                "value": {
38                    "price": 20.000000,
39                    "voucher": {
40                        "amount": 20.000000,
41                        "voucherid": 10001
42                    }
43                }
44            },
45            {
46                "properties": {
47                    "money": [
48                        "money_50"
49                    ]
50                },
51                "value": {
52                    "price": 50.000000,
53                    "voucher": {
54                        "amount": 60.000000,
55                        "voucherid": 10001
56                    }
57                }
58            }
59        ]
60    },
61    "properties": [
62        {
63            "name": "Monetary value",
64            "description": "The monetary value of your voucher",
65            "key": "money",
66            "values": [
67                {
68                    "key": "money_10",
69                    "value": "Value of 10 euro"
70                },
71                {
72                    "key": "money_20",
73                    "value": "Value of 20 euro"
74                },
75                {
76                    "key": "money_50",
77                    "value": "Value of 50+10 euro"
78                }
79            ]
80        }
81    ],
82    "saleendts": "2025-01-01 00:00:00",
83    "saleschannels": [ 1, 2 ],
84    "salestartts": "2017-01-01 00:00:00"
85}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 10153,
 6    "typeid": 26002,
 7    "name": "Voucher",
 8    "code": "455961222916",
 9    "description": "Give a gift! Remember that for 50 euro you get a voucher of 60 euro!",
10    "instancevalues": {
11        "default": {
12            "price": 20.000000,
13            "voucher": {
14                "amount": 20.000000,
15                "voucherid": 10001
16            }
17        },
18        "exceptions": [
19            {
20                "properties": {
21                    "money": [
22                        "money_10"
23                    ]
24                },
25                "value": {
26                    "price": 10.000000,
27                    "voucher": {
28                        "amount": 10.000000,
29                        "voucherid": 10001
30                    }
31                }
32            },
33            {
34                "properties": {
35                    "money": [
36                        "money_20"
37                    ]
38                },
39                "value": {
40                    "price": 20.000000,
41                    "voucher": {
42                        "amount": 20.000000,
43                        "voucherid": 10001
44                    }
45                }
46            },
47            {
48                "properties": {
49                    "money": [
50                        "money_50"
51                    ]
52                },
53                "value": {
54                    "price": 50.000000,
55                    "voucher": {
56                        "amount": 60.000000,
57                        "voucherid": 10001
58                    }
59                }
60            }
61        ]
62    },
63    "properties": [
64        {
65            "name": "Monetary value",
66            "description": "The monetary value of your voucher",
67            "key": "money",
68            "values": [
69                {
70                    "key": "money_10",
71                    "value": "Value of 10 euro"
72                },
73                {
74                    "key": "money_20",
75                    "value": "Value of 20 euro"
76                },
77                {
78                    "key": "money_50",
79                    "value": "Value of 50+10 euro"
80                }
81            ]
82        }
83    ],
84    "saleendts": "2025-01-01 00:00:00",
85    "saleschannels": [ 1, 2 ],
86    "salestartts": "2017-01-01 00:00:00",
87    "isarchived": false
88}

Creating a fixed bundle product

In this example a fixed bundle which contains two tickets for two events is created. The price of the bundle itself is 0 euro but the tickettypeprices have prices configured. The result is that the total price is equal to the sum of the prices for the tickets.

The bundle will be for sale from 2017 untill 2025 in saleschannels 1 and 2.

In this example the fixedbundle product has no variants (and thus no properties) but if desired multiple variants of a fixed bundle can be created. Each variant can contain different tickettypeprices.

Request

 1use Ticketmatic\Endpoints\Settings\Products;
 2
 3$result = Products::create($client, array(
 4    "typeid" => 26003,
 5    "name" => "Classical bundle",
 6    "description" => "Come see all our classical concert at a reduced price!",
 7    "instancevalues" => array(
 8        "default" => array(
 9            "price" => 0,
10            "tickettypeprices" => array(
11                645,
12                693,
13            ),
14        ),
15    ),
16    "properties" => array(
17    ),
18    "saleendts" => "2025-01-01 00:00:00",
19    "saleschannels" => array(
20        1,
21        2,
22    ),
23    "salestartts" => "2017-01-01 00:00:00",
24));

Response

 1object(\Ticketmatic\Model\Product) (11) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["name"]=>
 7  string(16) "Classical bundle"
 8  ["code"]=>
 9  string(12) "446504504544"
10  ["description"]=>
11  string(54) "Come see all our classical concert at a reduced price!"
12  ["instancevalues"]=>
13  object(\Ticketmatic\Model\ProductInstancevalues) (1) {
14    ["default"]=>
15    object(\Ticketmatic\Model\ProductInstanceValue) (2) {
16      ["price"]=>
17      float(0.000000)
18      ["tickettypeprices"]=>
19      array(2) {
20        [0]=>
21        int(0)
22        [1]=>
23        int(0)
24      }
25    }
26  }
27  ["properties"]=>
28  array(0) {
29  }
30  ["saleendts"]=>
31  object(\DateTime) (3) {
32    ["date"]=>
33    string(26) "2025-01-01 00:00:00.000000"
34    ["timezone_type"]=>
35    int(3)
36    ["timezone"]=>
37    string(3) "UTC"
38  }
39  ["saleschannels"]=>
40  array(2) {
41    [0]=>
42    int(0)
43    [1]=>
44    int(0)
45  }
46  ["salestartts"]=>
47  object(\DateTime) (3) {
48    ["date"]=>
49    string(26) "2017-01-01 00:00:00.000000"
50    ["timezone_type"]=>
51    int(3)
52    ["timezone"]=>
53    string(3) "UTC"
54  }
55  ["isarchived"]=>
56  bool(false)
57}
58

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/products"
 4)
 5
 6result, err := products.Create(client, &ticketmatic.Product{
 7    Typeid: 26003,
 8    Name: "Classical bundle",
 9    Description: "Come see all our classical concert at a reduced price!",
10    Instancevalues: &ticketmatic.ProductInstancevalues{
11        Default: &ticketmatic.ProductInstanceValue{
12            Price: 0,
13            Tickettypeprices: []int64{
14                645,
15                693,
16            },
17        },
18    },
19    Properties: []*ticketmatic.ProductProperty{
20    },
21    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
22    Saleschannels: []int64{
23        1,
24        2,
25    },
26    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
27})

Response

 1result := &ticketmatic.Product{
 2    Id: 10160,
 3    Typeid: 26003,
 4    Name: "Classical bundle",
 5    Code: "446504504544",
 6    Description: "Come see all our classical concert at a reduced price!",
 7    Instancevalues: &ticketmatic.ProductInstancevalues{
 8        Default: &ticketmatic.ProductInstanceValue{
 9            Price: 0,
10            Tickettypeprices: []int64{
11                645,
12                693,
13            },
14        },
15    },
16    Properties: []*ticketmatic.ProductProperty{
17    },
18    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
19    Saleschannels: []int64{
20        1,
21        2,
22    },
23    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
24    Isarchived: false,
25}

Request

 1POST /api/1/{accountname}/settings/products HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 26003,
 6    "name": "Classical bundle",
 7    "description": "Come see all our classical concert at a reduced price!",
 8    "instancevalues": {
 9        "default": {
10            "price": 0.000000,
11            "tickettypeprices": [ 645, 693 ]
12        }
13    },
14    "properties": [],
15    "saleendts": "2025-01-01 00:00:00",
16    "saleschannels": [ 1, 2 ],
17    "salestartts": "2017-01-01 00:00:00"
18}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 10160,
 6    "typeid": 26003,
 7    "name": "Classical bundle",
 8    "code": "446504504544",
 9    "description": "Come see all our classical concert at a reduced price!",
10    "instancevalues": {
11        "default": {
12            "price": 0.000000,
13            "tickettypeprices": [ 645, 693 ]
14        }
15    },
16    "properties": [],
17    "saleendts": "2025-01-01 00:00:00",
18    "saleschannels": [ 1, 2 ],
19    "salestartts": "2017-01-01 00:00:00",
20    "isarchived": false
21}

Creating an optionbundle product

In this example an optionbundle product is created. Depending on how many tickets are added to this optionbundle, the price changes.

The ranges are 0-1,2-3,4+. The bundle itself has price 0 thus the total price of the bundle is the sum of the prices for the tickets.

In this example the optionbundle product has no variants (and thus no properties) but if desired multiple variants of an optionbundle can be created.

Request

 1use Ticketmatic\Endpoints\Settings\Products;
 2
 3$result = Products::create($client, array(
 4    "typeid" => 26005,
 5    "name" => "Option bundle",
 6    "description" => "Select the events you want to see and get a reduced price if you buy more than 1 ticket",
 7    "instancevalues" => array(
 8        "default" => array(
 9            "price" => 0,
10            "pricetypes" => array(
11                array(
12                    "id" => 10,
13                    "from" => 0,
14                ),
15                array(
16                    "id" => 11,
17                    "from" => 2,
18                ),
19                array(
20                    "id" => 12,
21                    "from" => 4,
22                ),
23            ),
24        ),
25    ),
26    "properties" => array(
27    ),
28    "saleendts" => "2025-01-01 00:00:00",
29    "saleschannels" => array(
30        1,
31        2,
32    ),
33    "salestartts" => "2017-01-01 00:00:00",
34));

Response

 1object(\Ticketmatic\Model\Product) (11) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["name"]=>
 7  string(13) "Option bundle"
 8  ["code"]=>
 9  string(12) "120128357495"
10  ["description"]=>
11  string(87) "Select the events you want to see and get a reduced price if you buy more than 1 ticket"
12  ["instancevalues"]=>
13  object(\Ticketmatic\Model\ProductInstancevalues) (1) {
14    ["default"]=>
15    object(\Ticketmatic\Model\ProductInstanceValue) (2) {
16      ["price"]=>
17      float(0.000000)
18      ["pricetypes"]=>
19      array(3) {
20        [0]=>
21        object(\Ticketmatic\Model\ProductInstancePricetypeValue) (2) {
22          ["id"]=>
23          int(0)
24          ["from"]=>
25          int(0)
26        }
27        [1]=>
28        object(\Ticketmatic\Model\ProductInstancePricetypeValue) (2) {
29          ["id"]=>
30          int(0)
31          ["from"]=>
32          int(0)
33        }
34        [2]=>
35        object(\Ticketmatic\Model\ProductInstancePricetypeValue) (2) {
36          ["id"]=>
37          int(0)
38          ["from"]=>
39          int(0)
40        }
41      }
42    }
43  }
44  ["properties"]=>
45  array(0) {
46  }
47  ["saleendts"]=>
48  object(\DateTime) (3) {
49    ["date"]=>
50    string(26) "2025-01-01 00:00:00.000000"
51    ["timezone_type"]=>
52    int(3)
53    ["timezone"]=>
54    string(3) "UTC"
55  }
56  ["saleschannels"]=>
57  array(2) {
58    [0]=>
59    int(0)
60    [1]=>
61    int(0)
62  }
63  ["salestartts"]=>
64  object(\DateTime) (3) {
65    ["date"]=>
66    string(26) "2017-01-01 00:00:00.000000"
67    ["timezone_type"]=>
68    int(3)
69    ["timezone"]=>
70    string(3) "UTC"
71  }
72  ["isarchived"]=>
73  bool(false)
74}
75

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/products"
 4)
 5
 6result, err := products.Create(client, &ticketmatic.Product{
 7    Typeid: 26005,
 8    Name: "Option bundle",
 9    Description: "Select the events you want to see and get a reduced price if you buy more than 1 ticket",
10    Instancevalues: &ticketmatic.ProductInstancevalues{
11        Default: &ticketmatic.ProductInstanceValue{
12            Price: 0,
13            Pricetypes: []*ticketmatic.ProductInstancePricetypeValue{
14                &ticketmatic.ProductInstancePricetypeValue{
15                    Id: 10,
16                    From: 0,
17                },
18                &ticketmatic.ProductInstancePricetypeValue{
19                    Id: 11,
20                    From: 2,
21                },
22                &ticketmatic.ProductInstancePricetypeValue{
23                    Id: 12,
24                    From: 4,
25                },
26            },
27        },
28    },
29    Properties: []*ticketmatic.ProductProperty{
30    },
31    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
32    Saleschannels: []int64{
33        1,
34        2,
35    },
36    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
37})

Response

 1result := &ticketmatic.Product{
 2    Id: 10161,
 3    Typeid: 26004,
 4    Name: "Option bundle",
 5    Code: "120128357495",
 6    Description: "Select the events you want to see and get a reduced price if you buy more than 1 ticket",
 7    Instancevalues: &ticketmatic.ProductInstancevalues{
 8        Default: &ticketmatic.ProductInstanceValue{
 9            Price: 0,
10            Pricetypes: []*ticketmatic.ProductInstancePricetypeValue{
11                &ticketmatic.ProductInstancePricetypeValue{
12                    Id: 10,
13                    From: 0,
14                },
15                &ticketmatic.ProductInstancePricetypeValue{
16                    Id: 11,
17                    From: 2,
18                },
19                &ticketmatic.ProductInstancePricetypeValue{
20                    Id: 12,
21                    From: 4,
22                },
23            },
24        },
25    },
26    Properties: []*ticketmatic.ProductProperty{
27    },
28    Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2025-01-01 00:00:00")),
29    Saleschannels: []int64{
30        1,
31        2,
32    },
33    Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2017-01-01 00:00:00")),
34    Isarchived: false,
35}

Request

 1POST /api/1/{accountname}/settings/products HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 26005,
 6    "name": "Option bundle",
 7    "description": "Select the events you want to see and get a reduced price if you buy more than 1 ticket",
 8    "instancevalues": {
 9        "default": {
10            "price": 0.000000,
11            "pricetypes": [
12                {
13                    "id": 10,
14                    "from": 0
15                },
16                {
17                    "id": 11,
18                    "from": 2
19                },
20                {
21                    "id": 12,
22                    "from": 4
23                }
24            ]
25        }
26    },
27    "properties": [],
28    "saleendts": "2025-01-01 00:00:00",
29    "saleschannels": [ 1, 2 ],
30    "salestartts": "2017-01-01 00:00:00"
31}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 10161,
 6    "typeid": 26004,
 7    "name": "Option bundle",
 8    "code": "120128357495",
 9    "description": "Select the events you want to see and get a reduced price if you buy more than 1 ticket",
10    "instancevalues": {
11        "default": {
12            "price": 0.000000,
13            "pricetypes": [
14                {
15                    "id": 10,
16                    "from": 0
17                },
18                {
19                    "id": 11,
20                    "from": 2
21                },
22                {
23                    "id": 12,
24                    "from": 4
25                }
26            ]
27        }
28    },
29    "properties": [],
30    "saleendts": "2025-01-01 00:00:00",
31    "saleschannels": [ 1, 2 ],
32    "salestartts": "2017-01-01 00:00:00",
33    "isarchived": false
34}

Request body fields

FieldDescription
typeid
int 
(required)

Type ID

Example value:26001
categoryid
int

Category for the product. Categories can be managed in account parameters and indicate the labels for a single and multiple product and also what labels to use for the holders of the product. If not set, the UI will fallback to default labels.

Example value:1
layoutid
int

Optional layout for the product. If not specified, there will be no ticket generated for the product

Example value:1
name
mlstring 
(required)

Name for the product

Example value:"T-shirt"
code
string

Unique 12-digit for the product

Example value:"123412341234"
description

Description for the product

Example value:"The new t-shirt is made of 100% cotton"
groupbycustomfield
int

The customfield that is used to group the option bundle in the UI (websales and backoffice)

Example value:10003
instancevalues

Instancevalues control the price for a product and for non simple products it also controls the content of the product. All products should have a default instancevalue and a set of exceptions (if there are any). If no specific exception is found for the selected product, the default instancevalue is used.

Example value:{ "default": { "price": 25.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } }, "exceptions": [ { "properties": { "colour": [ "red" ], "size": [ "S" ] }, "value": { "price": 15.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } } }, { "properties": { "colour": [ "red" ], "size": [ "M" ] }, "value": { "price": 17.000000, "voucher": { "amount": 30.000000, "voucherid": 124 } } } ] }
maxadditionaltickets
int

The amount of individual tickets per event that can be purchased alongside this bundle.

Example value:3
printtickets
bool

If true, tickets for items that belong to the product will be printed when printing the product.

Example value:true
properties
ProductProperty[] 
(required)

Definition of possible properties for the product. A product can have one or more properties. Properties can be used to introduce variants of a product (sizes of a t-shirt for example).

Example value:[ { "name": "Size", "description": "Size of the t-shirt", "key": "size", "values": [ { "key": "S", "value": "Small" }, { "key": "M", "value": "Medium" }, { "key": "L", "value": "Large" } ] }, { "name": "Colour", "description": "Colour of the t-shirt", "key": "colour", "values": [ { "key": "red", "value": "Red" }, { "key": "green", "value": "Green" } ] } ]
queuetoken
int

Queue ID

See rate limiting for more info.

Example value:421
saleendts
timestamp

End of sales

Example value:"2016-01-01 00:00:00"
saleschannels
int[]

Sales is active for these saleschannels

Example value:[ 1, 2, 3 ]
salestartts
timestamp

Start of sales

Example value:"2016-01-01 00:00:00"
translations
map<string, string>

Translations for the product properties

Example value:{ "properties:size:L:nl": "Groot", "properties:size:S:nl": "Klein" }

Type reference: Product

Result fields

FieldDescription
id
int

Unique ID

Example value:123
typeid
int

Type ID

Example value:26001
categoryid
int

Category for the product. Categories can be managed in account parameters and indicate the labels for a single and multiple product and also what labels to use for the holders of the product. If not set, the UI will fallback to default labels.

Example value:1
layoutid
int

Optional layout for the product. If not specified, there will be no ticket generated for the product

Example value:1
name

Name for the product

Example value:"T-shirt"
code
string

Unique 12-digit for the product

Example value:"123412341234"
description

Description for the product

Example value:"The new t-shirt is made of 100% cotton"
groupbycustomfield
int

The customfield that is used to group the option bundle in the UI (websales and backoffice)

Example value:10003
instancevalues

Instancevalues control the price for a product and for non simple products it also controls the content of the product. All products should have a default instancevalue and a set of exceptions (if there are any). If no specific exception is found for the selected product, the default instancevalue is used.

Example value:{ "default": { "price": 25.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } }, "exceptions": [ { "properties": { "colour": [ "red" ], "size": [ "S" ] }, "value": { "price": 15.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } } }, { "properties": { "colour": [ "red" ], "size": [ "M" ] }, "value": { "price": 17.000000, "voucher": { "amount": 30.000000, "voucherid": 124 } } } ] }
maxadditionaltickets
int

The amount of individual tickets per event that can be purchased alongside this bundle.

Example value:3
printtickets
bool

If true, tickets for items that belong to the product will be printed when printing the product.

Example value:true
properties

Definition of possible properties for the product. A product can have one or more properties. Properties can be used to introduce variants of a product (sizes of a t-shirt for example).

Example value:[ { "name": "Size", "description": "Size of the t-shirt", "key": "size", "values": [ { "key": "S", "value": "Small" }, { "key": "M", "value": "Medium" }, { "key": "L", "value": "Large" } ] }, { "name": "Colour", "description": "Colour of the t-shirt", "key": "colour", "values": [ { "key": "red", "value": "Red" }, { "key": "green", "value": "Green" } ] } ]
queuetoken
int

Queue ID

See rate limiting for more info.

Example value:421
saleendts
timestamp

End of sales

Example value:"2016-01-01 00:00:00"
saleschannels
int[]

Sales is active for these saleschannels

Example value:[ 1, 2, 3 ]
salestartts
timestamp

Start of sales

Example value:"2016-01-01 00:00:00"
translations
map<string, string>

Translations for the product properties

Example value:{ "properties:size:L:nl": "Groot", "properties:size:S:nl": "Klein" }
isarchived
bool

Whether or not this item is archived

createdts
timestamp

Created timestamp

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

Last updated timestamp

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

Type reference: Product