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/{bundle_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.

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

{
	"value": 50.0,          // Credit of 50.00 (OPTIONAL, value in hotel currency)
	"currency": ISO 4217,   // Currency (OPTIONAL, defaults to hotel currency)
	"expiration": ISO 8601, // Expiration date (OPTIONAL, no expiration if null/undefined)
}

NOTE: Sending a body is optional. Voucher codes can just unlock an associated offer (see voucher bundles).

JSON Response Example of POST/PUT request

{
	"flag": 1,
	"msg": "Voucher code added.",
	"code": "BBB",
	"locked": false,
	"active": true,
	"usages": 0,
	"value": 50,
  "currency": "EUR",
  "expiration": "2020-08-15"
}

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

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