Discount Codes

  1. Overview
  2. List Discount Codes
  3. Get a single Discount Code
  4. Create a new Discount Code
  5. Update a Discount Code
  6. Delete a Discount Code

Overview

This resource represents Discount Codes which are used to provide a flexible discount that can be applied to rental. Upon applying the Discount Code Usage gets created.

Parameters

Name Type Read/Write Description
id String[UUID] Read Discount Code’s id.
discount_code String Read Discount Code itself.
currency String Read Discount Code’s currency.
fixed_amount Float Read Fixed amount of discount.
percentage integer Read Discount percentage.
all_rentals Boolean Read Flag, that indicates that this discount is applicable to all rentals with provided currency.
number_of_times Integer Read Number of times the Discount Code can be applied.
minimum_nights_booked integer Read Minimum number of nights that must be booked in order to apply Discount Code.
minimum_spend Float Read Minimum amount that must be spent in order to apply Discount Code.
start_date Date Read The start date from which the Discount Code will be applicable.
end_date Date Read The expiration date of the Discount Code.
created_at Time Read Discount Code create time
updated_at Time Read Discount Code update time
canceled_at Time Read Discount Code soft delete time
Name Type Read/Write Description
id String[UUID] Read Discount Code’s id.
discount_code String Read/Write Discount Code itself.
currency String Read/Write Discount Code’s currency.
fixed_amount Float Read/Write Fixed amount of discount.
percentage integer Read/Write Discount percentage.
all_rentals Boolean Read Flag, that indicates that this discount is applicable to all rentals with the same currency.
number_of_times Integer Read/Write Number of times the Discount Code can be applied.
minimum_nights_booked integer Read/Write Minimum number of nights that must be booked in order to apply Discount Code.
minimum_spend Float Read/Write Minimum amount that must be spent in order to apply Discount Code.
start_date Date Read/Write The start date from which the Discount Code will be applicable.
end_date Date Read/Write The expiration date of the Discount Code.
rentals_eligibility String Write What rentals this Discount Code can be applied to.
minimum_requirements String Write Minimum requirements to make Discount Code applicable to booking.
usage_limit String Write Usage limit of the Discount Code.
discount_value_type String Write The type of discount.
rental_ids Array of Integers Write The ids of rentals Discount Code can be used with. Should be empty if rentals_eligibility is “all_rentals”.
created_at Time Read Discount Code create time
updated_at Time Read Discount Code update time
canceled_at Time Read Discount Code soft delete time

List Discount Codes

Returns all Discount Codes for current account.

GET /booking/discount_codes

Response

{
  "links": {
    "discount_codes.account": "http://www.bookingsync.com/api/v3/accounts/{discount_codes.account}",
    "discount_codes.rentals": "http://www.bookingsync.com/api/v3/rentals/{discount_codes.rentals}",
    "discount_codes.bookings": "http://www.bookingsync.com/api/v3/bookings/{discount_codes.bookings}"
  },
  "discount_codes": [
    {
      "links": {
        "account": 6,
        "bookings": [

        ],
        "rentals": [
          42,
          103
        ]
      },
      "id": "db6c0845-6122-4de6-a9ab-7a685e2a17f0",
      "discount_code": "PROMO123",
      "currency": "EUR",
      "percentage": null,
      "all_rentals": false,
      "minimum_nights_booked": 5,
      "number_of_times": 10,
      "start_date": "2023-09-19",
      "end_date": "2023-09-21",
      "fixed_amount": "100.00",
      "minimum_spend": null,
      "created_at": "2023-01-24T15:22:55Z",
      "updated_at": "2023-01-24T15:22:55Z",
      "canceled_at": null
    }
  ],
  "meta": {
  }
}

Get a single Discount Code

Returns a single Discount Code identified by ID.

GET /booking/discount_codes/:discount_code_id

Response

{
  "links": {
    "discount_codes.account": "http://www.bookingsync.com/api/v3/accounts/{discount_codes.account}",
    "discount_codes.rentals": "http://www.bookingsync.com/api/v3/rentals/{discount_codes.rentals}",
    "discount_codes.bookings": "http://www.bookingsync.com/api/v3/bookings/{discount_codes.bookings}"
  },
  "discount_codes": [
    {
      "links": {
        "account": 6,
        "bookings": [

        ],
        "rentals": [
          42,
          103
        ]
      },
      "id": "db6c0845-6122-4de6-a9ab-7a685e2a17f0",
      "discount_code": "PROMO123",
      "currency": "EUR",
      "percentage": null,
      "all_rentals": false,
      "minimum_nights_booked": 5,
      "number_of_times": 10,
      "start_date": "2023-09-19",
      "end_date": "2023-09-21",
      "fixed_amount": "100.00",
      "minimum_spend": null,
      "created_at": "2023-01-24T15:22:55Z",
      "updated_at": "2023-01-24T15:22:55Z",
      "canceled_at": null
    }
  ],
  "meta": {
  }
}

Create a new Discount Code

Creates a Discount Code and renders it.

POST /booking/discount_codes

Example JSON request

{
  "discount_codes": [
    {
      "rentals_eligibility": "specific_rentals",
      "minimum_requirements": "minimum_nights_booked",
      "minimum_nights_booked": 5,
      "usage_limit": "number_of_times",
      "number_of_times": 10,
      "currency": "EUR",
      "discount_code": "PROMO123",
      "discount_value_type": "fixed_amount",
      "fixed_amount": 100,
      "start_date": "Mon, 19 Sep 2023 13:14:09.392265926 UTC +00:00",
      "end_date": "Wed, 21 Sep 2023 13:13:48.669825452 UTC +00:00",
      "rental_ids": [
        42,
        103
      ]
    }
  ]
}

Response

{
  "links": {
    "discount_codes.account": "http://www.bookingsync.com/api/v3/accounts/{discount_codes.account}",
    "discount_codes.rentals": "http://www.bookingsync.com/api/v3/rentals/{discount_codes.rentals}",
    "discount_codes.bookings": "http://www.bookingsync.com/api/v3/bookings/{discount_codes.bookings}"
  },
  "discount_codes": [
    {
      "links": {
        "account": 6,
        "bookings": [

        ],
        "rentals": [
          42,
          103
        ]
      },
      "id": "db6c0845-6122-4de6-a9ab-7a685e2a17f0",
      "discount_code": "PROMO123",
      "currency": "EUR",
      "percentage": null,
      "all_rentals": false,
      "minimum_nights_booked": 5,
      "number_of_times": 10,
      "start_date": "2023-09-19",
      "end_date": "2023-09-21",
      "fixed_amount": "100.00",
      "minimum_spend": null,
      "created_at": "2023-01-24T15:22:55Z",
      "updated_at": "2023-01-24T15:22:55Z",
      "canceled_at": null
    }
  ],
  "meta": {
  }
}

Update a Discount Code

Updated the Discount Code identified by ID and renders it.

PUT /booking/discount_codes/:discount_code_id

Example JSON request

{
  "discount_codes": [
    {
      "rentals_eligibility": "specific_rentals",
      "minimum_requirements": "minimum_nights_booked",
      "minimum_nights_booked": 5,
      "usage_limit": "number_of_times",
      "number_of_times": 10,
      "currency": "EUR",
      "discount_code": "PROMO123",
      "discount_value_type": "fixed_amount",
      "fixed_amount": 100,
      "start_date": "Mon, 19 Sep 2023 13:14:09.392265926 UTC +00:00",
      "end_date": "Wed, 21 Sep 2023 13:13:48.669825452 UTC +00:00",
      "rental_ids": [
        42,
        103
      ]
    }
  ]
}

Response

{
  "links": {
    "discount_codes.account": "http://www.bookingsync.com/api/v3/accounts/{discount_codes.account}",
    "discount_codes.rentals": "http://www.bookingsync.com/api/v3/rentals/{discount_codes.rentals}",
    "discount_codes.bookings": "http://www.bookingsync.com/api/v3/bookings/{discount_codes.bookings}"
  },
  "discount_codes": [
    {
      "links": {
        "account": 6,
        "bookings": [

        ],
        "rentals": [
          42,
          103
        ]
      },
      "id": "db6c0845-6122-4de6-a9ab-7a685e2a17f0",
      "discount_code": "PROMO123",
      "currency": "EUR",
      "percentage": null,
      "all_rentals": false,
      "minimum_nights_booked": 5,
      "number_of_times": 10,
      "start_date": "2023-09-19",
      "end_date": "2023-09-21",
      "fixed_amount": "100.00",
      "minimum_spend": null,
      "created_at": "2023-01-24T15:22:55Z",
      "updated_at": "2023-01-24T15:22:55Z",
      "canceled_at": null
    }
  ],
  "meta": {
  }
}

Delete a Discount Code

Deletes Discount Code identified by ID.

DELETE /booking/discount_codes/:discount_code_id

Returns 204 on success or 404 on error.