---
title: tm.voucher
slug: db/tmvoucher
createdAt: 2023-12-14T14:10:54.606Z
---

A voucher gives right to something, e.g. a free ticket or a reduction.

## Fields

| FIELD                 | TYPE              | DESCRIPTION                                                                                                                                                                                                                                                                                                                      |
| --------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                    | `int`             | Unique ID                                                                                                                                                                                                                                                                                                                        |
| typeid                | `int`             | Type ID                                                                                                                                                                                                                                                                                                                          |
| name                  | `mlstring`        | Name of the voucher                                                                                                                                                                                                                                                                                                              |
| description           | `mlstring`        | Description of the voucher                                                                                                                                                                                                                                                                                                       |
| validity              | `VoucherValidity` | Definition of the validity of this voucher. Depends on the typeid.                                                                                                                                                                                                                                                               |
| 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.                                                                                                                     |
| nbrofcodes            | `int`             | The number of codes that were created for this voucher.                                                                                                                                                                                                                                                                          |
| codeformatid          | `int`             | Format used when generating codes for the voucher. Possible values:<br />- **27001**: 12 digits<br />- **27002**: 16 digits<br />- **27003**: 8 alphanumerical characters<br />- **27004**: 12 alphanumerical characters<br />- **27005**: 16 alphanumerical characters<br />- **27099**: Specified from list, not autogenerated |
| codeprefix            | `string`          | 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.                                                                                                                                                             |
| 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                                                                                                                                                                |
| createdts             | `timestamp`       | Created timestamp                                                                                                                                                                                                                                                                                                                |
| lastupdatets          | `timestamp`       | Last updated timestamp                                                                                                                                                                                                                                                                                                           |
| isarchived            | `bool`            | Whether or not this item is archived                                                                                                                                                                                                                                                                                             |

