Create voucher codes
Content
Resource URL
https://apps.ticketmatic.com/api/1/{accountname}/settings/vouchers/{id}/codes
Description
Creates individual voucher codes.
Codes will be randomly generated unless supplied.
Example
Request
1use Ticketmatic\Endpoints\Settings\Vouchers;
2
3$result = Vouchers::createcodes($client, $id, array(
4 "amount" => 15.75,
5 "codes" => array(
6 array(
7 "code" => "ABC56149819",
8 ),
9 array(
10 "code" => "382932SDF38",
11 ),
12 array(
13 "code" => "FDSA4490323",
14 ),
15 ),
16 "count" => 3,
17 "update" => false,
18));
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/vouchers"
4)
5
6result, err := vouchers.Createcodes(client, id, &ticketmatic.AddVoucherCodes{
7 Amount: 15.75,
8 Codes: []*ticketmatic.VoucherCode{
9 &ticketmatic.VoucherCode{
10 Code: "ABC56149819",
11 },
12 &ticketmatic.VoucherCode{
13 Code: "382932SDF38",
14 },
15 &ticketmatic.VoucherCode{
16 Code: "FDSA4490323",
17 },
18 },
19 Count: 3,
20 Update: false,
21})
Request
1POST /api/1/{accountname}/settings/vouchers/{id}/codes HTTP/1.1
2Content-Type: application/json
3
4{
5 "amount": 15.750000,
6 "codes": [
7 {
8 "code": "ABC56149819"
9 },
10 {
11 "code": "382932SDF38"
12 },
13 {
14 "code": "FDSA4490323"
15 }
16 ],
17 "count": 3,
18 "update": false
19}
Request body fields
Field | Description |
---|---|
amount decimal | Value of the voucher Example value:15.750000 |
codes | List of voucher codes, can also (optionally) contain expiry timestamps. Example value:[ { "code": "ABC56149819" }, { "code": "382932SDF38" }, { "code": "FDSA4490323" } ] |
count int (required) | Number of codes to create Example value:3 |
update bool | Whether or not to reactivate and update the expiry of already existing vouchercodes.
|
Type reference: AddVoucherCodes
Result fields
This call returns an array of objects.
Field | Description |
---|---|
code string | Code to use voucher Example value:"5518684698498" |
expiryts timestamp | Expiry timestamp for this code Example value:"2014-09-26 15:24:36" |
Type reference: VoucherCode[]