To use this capability add ventrata/offers
to your X-Capabilities
header.
The offers capability depends on ventrata/pricing
and if you want to make use of combination discounts you will also need ventrata/cart
.
The offers capability gives the ability for promotion codes to be applied to the booking. It also provides "comparisons" which are alternative products the guest can upgrade to, and "combinations" which are related products the the customer can purchase at a discount.
// ..rest of the booking object"pricing": {"original": 8800,"retail": 7400,"net": 5500,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 674,"net": 452}]},"offerCode": "20CE","offerTitle": "20% OFF",
{ "error": "Promotion code is invalid" }
The only new additions to the booking object are detailed below:
// ..rest of the booking object"pricing": {"original": 8800,"retail": 7400,"net": 5500,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 674,"net": 452}]},"offerCode": "20CE","offerTitle": "20% OFF",
The value of original
will be the price before the discount was applied. The value of offerCode
will be the code used and offerTitle
will be the name of the offer if you want to display it somewhere.
// ..rest of the booking object"offerComparisons": [{"productId": "8d7519d2-cac2-4daa-8aab-d9f97265e495","optionId": "c0b29b9d-0540-4bb4-8034-6e93cd95d6e8","pricing": {"original": 9600,"retail": 9600,"net": 7500,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 874,"net": 825}]}}]
This capability will add the following fields to the booking object:
// ..rest of the booking object"offerComparisons": [{"productId": "8d7519d2-cac2-4daa-8aab-d9f97265e495","optionId": "c0b29b9d-0540-4bb4-8034-6e93cd95d6e8","pricing": {"original": 9600,"retail": 9600,"net": 6700,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 874,"net": 782}]}}]
These are meant to be an array of comparable products that you can upgrade the booking too. The pricing object on the comparison is the cost of the equivalent booking if it were upgraded.
To upgrade the booking you simply perform a booking update request:
PATCH https://api.ventrata.com/octo/bookings/:uuid{"productId": "8d7519d2-cac2-4daa-8aab-d9f97265e495","optionId": "c0b29b9d-0540-4bb4-8034-6e93cd95d6e8"}
{"id": "55460013-641c-4642-9c85-8b7acc81902b","status": "ON_HOLD","bookings": [ ... ],"pricing": {"original": 8800,"retail": 8800,"net": 7200,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 800,"net": 782}]},"offerCombinations": [{"productId": "bb4fb601-ee1e-4af6-a1e5-32f08f22a8ec","optionId": "DEFAULT","offerCode": "combination+4bd3e625-b056-4ce1-a194-6563f4a9a3f5","offerTitle": "€10 OFF","pricing": {"original": 7100,"retail": 6100,"net": 5500,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 610,"net": 562}]}}]}
The main addition here from the order object is the offerCombinations
field which looks like this:
"offerCombinations": [{"productId": "bb4fb601-ee1e-4af6-a1e5-32f08f22a8ec","optionId": "DEFAULT","offerCode": "combination+4bd3e625-b056-4ce1-a194-6563f4a9a3f5","offerTitle": "€10 OFF","pricing": {"original": 7100,"retail": 6100,"net": 5500,"currency": "EUR","includedTaxes": [{"name": "VAT 10","retail": 610,"net": 520}]}}]
The array is a list of all the availability combinations. To add one of the combination options to cart you first have to query the availability