createVoucher( data )

Creates a discount code.

Access rights

Full access required


data – an array with these elements:

  • code – the voucher code
  • product_ids – β€œall” (default) or comma-separated list of product IDs for which this discount code applies
  • valid_from (optional) – point in time (e.g. 2017-12-31 12:00:00) from when the code applies
  • expires_at (optional) – point in time when the code becomes invalid
  • first_rate (optional) – the discount percent on the first payment (for subscriptions/installment payments) or on the purchase amount for single payments
  • other_rates (optional) – the discount percent on the follow-up payments (for subscription/installment payment)
  • first_amount (optional) – the discount as a fixed amount on the first payment/single payment
  • other_amounts (optional) – the discount as a fixed amount on the follow-up payments
  • currency (optional) – currency of the above amounts
  • is_count_limited – Boolean – for FALSE (default), the code can be used indefinitely For TRUE, use is limited.
  • count_left – falls is_count_limited == TRUE: the number of remaining uses. Default is 1.
  • upgrade_policy determines how the code is used for upgrades:
    • valid – voucher fully usable
    • other_only – only discount on follow-up installments
    • not_valid – voucher not usable

Return data

[data] => Array
[discount code_id] => 12345
[code] => voucher