Cancellation Policy API

The Cancellation Policy Metadata request, initiated by Hotel Trader, contains detailed cancellation policy information such as penalty windows, penalty amount, etc. 

A single cancellation policy can be set up to have multiple penalty windows which is also called a staggered cancellation policy.

Initiator - Hotel Trader

Endpoint

New Cancellation Policies

Creates single or multiple cancellation policies for the first time in the client system.

[POST] https://<client-base-url>/cancellation-policies

Update existing cancellation policies

Updates a single existing cancellation policy in the client system.

[PUT] https://<client-base-url>/cancellation-policy/<code>

Request

HTTP Headers

All the HTTP Headers are mandatory. These headers are applicable and remain the same for both end-points of the Cancellation Policy API.

Header Name Type
Content-Type application/json
Accept-Encoding gzip
Authorization Bearer <token>

Request Description

All the fields in the request are described below.

Field/Object Datatype Required Description
messageId String Yes A string that uniquely identifies this particular message. This should be returned in the response.
updateType String Yes The type of cancellation policy update.
Possible values - NEW, UPDATE.
ENABLED and DISABLED are not allowed for this API.
More information on this object can be found here.
propertyCode String Yes A unique hotel code provided by Hotel Trader identifies the hotel for which cancellation policy metadata is sent in this request.
cancellationPolicies Array Yes An array of cancellation policy objects.

Cancellation Policy

Field/ObjectDatatypeRequiredDescription
nameStringYesThe name of the cancellation policy
codeStringYesA code provided by Hotel Trader that identifies this cancellation policy. This code is unique for each cancellation policy for a property.
descriptionStringYesA short description of the cancellation policy.
penaltyWindowsArrayYesAn array of penalty window objects each specifying deadlines and penalties.

Penalty Window

The penaltyWindow node must include either absoluteDeadline or relativeDeadline, but not both simultaneously.


Field/ObjectDatatypeRequiredDescription
absoluteDeadlineStringNoThe absolute timestamp on the arrival day in HH: MM in 24-hour format.
relativeDeadlineObjectNoIf the penalty window is relative to the check-in date or booking date, use the relative deadline object. 
penaltyObjectYesPenalty details associated with this policy window.

Relative Deadline

Field/ObjectDatatypeRequiredDescription
relativeToStringYesIndicates the reference point for the relative deadline.
Possible values: BOOKING_CREATION, CHECKIN_TIME, CHECKIN_DAY_MIDNIGHT.
typeStringYesSpecifies whether the relative deadline is before or after the reference point.
Possible values: BEFORE, AFTER.
offsetUnitStringYesThe unit of the offset for the relative deadline.
Possible values: DAY, HOUR, MINUTE.
offsetValueIntegerYesThe numeric value for the offset indicates how many units before or after the reference point the deadline is set.

Penalty

For the penalty node, exactly one of flat, percent, or nights must be provided. Multiple values are not allowed.

Field/ObjectDatatypeRequiredDescription
flatFloatNoSpecifies the flat penalty amount. 
percentFloatNoSpecifies the penalty as a percentage. 
nightsIntegerNoIndicates the number of nights to which the penalty applies.
taxInclusiveBooleanYesIndicates whether the penalty includes taxes.

Example

Request for adding a new cancellation policy

{
    "messageId": "s6aa3d81-6c1d-4e12-b374-c76735b49fc9",
    "updateType": "UPDATE",
    "propertyCode": "NYCMIL",
    "cancellationPolicies": [
        {
            "code": "CP001",
            "name": "Standard Cancellation Policy",
            "description": "Free cancellation up to 24 hours before check-in.",
            "penaltyWindows": [
                {
                    "relativeDeadline": {
                        "relativeTo": "CHECKIN_TIME",
                        "type": "Before",
                        "offsetUnit": "HOUR",
                        "offsetValue": 24
                    },
                    "penalty": {
                        "percent": null,
                        "nights": 1,
                        "taxInclusive": true
                    }
                }
            ]
        }
    ]
}

Request for updating an existing cancellation policy

{
    "messageId": "s6aa3d81-6c1d-4e12-b374-c76735b49fc9",
    "updateType": "UPDATE",
    "propertyCode": "NYCMIL",
    "cancellationPolicies": [
        {
            "code": "CP001",
            "name": "Standard Cancellation Policy",
            "description": "Free cancellation up to 24 hours before check-in.",
            "penaltyWindows": [
                {
                    "relativeDeadline": {
                        "relativeTo": "CHECKIN_TIME",
                        "type": "Before",
                        "offsetUnit": "HOUR",
                        "offsetValue": 24
                    },
                    "penalty": {
                        "percent": null,
                        "nights": 1,
                        "taxInclusive": true
                    }
                }
            ]
        }
    ]
}

Response

This API follows the Standard Response model of the Metadata Push API.