Canceling a Booking

From an API perspective, canceling a booking is relatively simple. You call the Cancel a booking endpoint, pass the bookingId and the reservation is now canceled.

The complexity of cancelations comes from the reservation type and the cancelation policies in place. Together they define if and when a room is fully refundable upon cancelation

How to tell if a booking is refundable

The first thing to look for is the refundableTag field on a rate. It should be set to RFN or NRFN, refundable and non-refundable, respectively.

If the room is marked NRFN, or non-refundable, a cancelation call will still terminate the booking, but it will not refund the purchase price.

If the room is marked RFN, or refundable, its cancellation policies determine the amount refunded.

How do cancelation policies work?

The amount listed for a cancelation policy is the amount the user will be charged if they cancel after that policy date. Some bookings have multiple policies, in which case the policy with the cancelTime most recently passed will be used.

Take this example.

"retailRate": {  
      "total": [  
        {  
          "amount": 712.39,  
          "currency": "USD"  
        }  
      ],  
      "msp": [  
        {  
          "amount": 712.39,  
          "currency": "USD"  
        }  
      ],  
      "taxesAndFees": null  
    },  
    "cancellationPolicies": {  
      "cancelPolicyInfos": [  
        {  
          "cancelTime": "2024-11-11 08:00:00",  
          "amount": 712.39,  
          "currency": "USD",  
          "type": "amount",  
          "timezone": "GMT"  
        }  
      ],  
      "hotelRemarks": \[],  
      "refundableTag": "RFN"  
    }

First, we check and see if it is refundable. At the bottom, it lists refundableTag: "RFN" which means it can be refunded.

"cancelPolicyInfos": [  
        {  
          "cancelTime": "2024-11-11 08:00:00",  
          "amount": 712.39,  
          "currency": "USD",  
          "type": "amount",  
          "timezone": "GMT"  
        }  
      ]

This policy 👆 tells us that after November 11th at 8 am GMT users will be charged the full room amount of $712.39 if they cancel.
Since there is no policy in place before November 11th, and the room is marked RFN, any cancelation before then will refund the full amount.

What about 0-amount policies?

Policies are driven by the individual hotels and not liteAPI, so there is some inconsistency. Some hotels return a placeholder policy for 0 and some do not. For some bookings you will see a 0-amount policy like the one listed here:

"cancelPolicyInfos": [  
        {  
          "cancelTime": "2024-11-11 08:00:00",  
          "amount": 0,  
          "currency": "USD",  
          "type": "amount",  
          "timezone": "GMT"  
        }  
      ]

A 0-amount policy may exist alone, or it can be part of a longer policy chain. The important thing to know, is if there is an applicable policy, but the amount is 0, then the room is still fully refundable as the charge will be 0.

⭐️ Note: When implementing cancelation policies and looking for a consistent implementation, one solution is to check the amount, if it is 0, then discard the node.