This API method management voucher codes.

Table of Contents
  1. URL Endpoint
  2. Get Method
  3. Post or Put Method
  4. Delete Method

This is a pure REST method. Behavior is determined by the HTTP verb used.

URL Endpoint

/voucher/{voucher_id}/{voucher_code}

Warning

This method is only accessible using a Hotelier API account.

1. GET

Returns information about the requested voucher code (usage count, if it is enabled, if it is locked).

A 404 is returned if voucher code does not exist.

JSON Response Example of GET request

{
    "code": "AAA",
    "usages": 0,
    "locked": false,
    "active": true,
    "value": 50
}

2. POST or PUT

Creates a new voucher code for the specified voucher.

Returns 200 if created successfully.

Returns 500 if voucher could not be deleted.

Returns 409 if voucher code already exists.

Vouchers code can be associated with an arbitrary price modification. You can send a JSON body specifying the value, for example:

{
	"value": 50.0    // Discount of 50.00 (currency)
}

JSON Response Example of POST/PUT request

{
	"msg": "Voucher code added.",
	"code": "BBB",
	"proc": {},
	"locked": false,
	"active": true,
	"value": 50,
	"flag": 1,
	"usages": 0
}

3. DELETE

Deletes a voucher code.

Returns 200 if deleted successfully.

Returns 500 if voucher could not be deleted.

Returns 410 if the voucher code did not exist or was already deleted.

JSON Response Example of DELETE request

{
	"msg": "Voucher code deleted.",
	"code": "CCC",
	"proc": {},
	"flag": 1,
	"deleted": true
}