Order API - Get Voucher

Get voucher

Endpoint: GET *base*/vouchers/*id*
Authentication: API Key

Return active/inactive voucher by specified ID. Cancelled vouchers are ignored.

Parameters

id
int
required

Voucher id.

xml
boolean
optional

Response in xml format instead of json.

Request example

GET <base>/vouchers/1 HTTP/1.1

Response

200 Content-type: application/json

status
string
required

ok if success, else no.

voucher
object
required

The voucher object.

id
int
optional

ID of the voucher.

name
string
optional

Name for the voucher.

code
string
optional

Code of the voucher

startDate
date
optional

The date in Y-m-d format when the voucher starts being active

stopDate
date
optional

The date in Y-m-d format when the voucher stops being active

type
string
optional

Type of the voucher e.g. priceoff, percentoff

value
float
optional

Value of the voucher. Exists for percentoff voucher type

valueByPrcelist
object
optional

Value of the voucher for each price list. Contains id of price list to value. Exists for priceoff voucher type

store
int
optional

Store the voucher is valid for

markets
array
optional

List of the markets voucher is valid for

limit
int
optional

The voucher max usage limit

status
string
optional

Status of the voucher. One of active, inactive

priority
int
optional

The voucher priority

conversionHtml
string
optional

Conversion html for voucher

createdAt
datetime
optional

The date in Y-m-d H-i-s format when the voucher was created.

Response example

{
    "status": "ok",
    "voucher": {
        "id": 1,
        "name": "Welcome 10%",
        "code": "welcome10",
        "conversionHtml": "",
        "startDate": "2020-06-26",
        "stopDate": "2020-07-09",
        "type": "percentoff",
        "value": "10",
        "store": 1,
        "markets": [
            1
        ],
        "limit": 1,
        "status": "active",
        "priority": 1,
        "createdAt": "2020-06-25 12:00:00"
    }
}
{
    "status": "ok",
    "voucher": {
        "id": 1,
        "name": "Welcome 10",
        "code": "welcome10",
        "conversionHtml": "",
        "startDate": "2020-06-26",
        "stopDate": "2020-07-09",
        "type": "priceoff",
        "value": null,
        "valueByPricelist": {
            "1": 10,
            "2": 44,
            "3": 13,
            "4": 130,
        },
        "store": 1,
        "markets": [
            1
        ],
        "limit": 1,
        "status": "active",
        "priority": 1,
        "createdAt": "2020-06-25 12:00:00"
    }
}

Previous article: Order API - Clone Voucher
Next article: Integration API (SOAP)