Syntax
createVoucher( code, data )
Updates the voucher code.
Access rights
Full access required.
Arguments
code – code or ID of the voucher code
data – an array with these elements:
- code – the voucher code
- product_ids – “all” or a comma-separated list of product IDs for which this voucher code is valid
- valid_from – Time (e.g. 2017-12-31 12:00:00) from when the code is valid. Leave empty to remove a start time.
- expires_at – Time when the code becomes invalid. Leave empty to remove an end time.
- first_rate – the discount in percent on the first payment (for subscription and installment payments) or on the purchase amount for a single payment
- other_rates – the discount in percent on the follow-up payments (for subscription and installment payments)
- first_amount – the discount as a fixed amount on the first payment/single payment
- other_amounts – the discount as a fixed amount on the follow-up payments
- currency – currency of the above amounts.
- is_count_limited – Boolean – for FALSE (default), the code can be used without For TRUE, usage is limited.
- count_left – if is_count_limited == TRUE: the number of times it can still be used. Default is 1.
-
upgrade_policy determines how the code is used for upgrades:
- valid – voucher is fully valid
- other_only – only discount on follow-up installments
- not_valid – voucher is not valid
Return data
Array
(
[data] => Array
(
[discount code_id] =>
1234
[code] =>
EinGutscheinCode
[modified]
=> Y
)
)