Order API - Clone Voucher

Clone voucher

Endpoint: PUT *base*/voucher/*id*/clone
Authentication: API Key

This will clone a voucher with updated provided information

Parameters

name
string
optional
b2b b2c

Name of the voucher.

code
string
optional
b2b b2c

Code of the voucher. Will be generated a random one if not passed.

stopDate
string
required
b2b b2c

Stop date of the voucher in Y-m-d format.

conversionHtml
string
optional
b2b b2c

Conversion html of the voucher

Request example

PUT <base>/voucher/3/clone HTTP/1.1

{
    "name": "Welcome 10%",
    "code": "new-welcome-10",
    "stopDate": "2022-07-09"
}

Response

200 Content-type: application/json

status
string
required

ok if success, else no.

voucher
int
optional

Id of a new voucher

code
string
optional

Code of a new voucher

Response example

{
    "status": "ok",
    "voucher": 4,
    "code": "new-welcome-10"
}

Errors example

Required fields are not passed

{
    "status": "no",
    "voucher": "4",
    "msg": {
        "stopDate": "required"
    }
}

Voucher not found

{
    "status": "no",
    "voucher": "3",
    "msg": {
        "voucher": "Voucher not found"
    }
}

Auto vouchers not supported

{
    "status": "no",
    "voucher": "3",
    "msg": {
        "voucher": "Auto vouchers not supported"
    }
}

Voucher does not belong to this store

{
    "status": "no",
    "voucher": "3",
    "msg": {
        "voucher": "Voucher does not belong to this store"
    }
}

Previous article: Order API - Create Voucher
Next article: Order API - Get Voucher