Skip to main content

Cancel a Booking

The cancel endpoint cancels a hotel reservation. Cancellation policies determine if penalties apply.

Endpoint

POST /connect/hotels/v1/cancel

Request

Request Body Parameters

ParameterTypeDescription
input.bookingIDstringBundleport booking ID (required)
settings.connectionCodesarrayProvider connection codes (required)
ParameterTypeDescription
reasonstringCancellation reason (optional)
cancelPenaltyobjectPenalty handling (optional)

Example Request

{
"input": {
"bookingID": "BK-987654321"
},
"settings": {
"connectionCodes": ["testb-hbds-1876"]
}
}

Response

Success Response

{
"booking": {
"bookingID": "BK-987654321",
"status": "CANCELLED",
"cancelPenalties": [
{
"value": 75.00,
"currency": "EUR",
"deadline": "2025-06-10T00:00:00Z",
"hoursBefore": 24
}
]
}
}

Free Cancellation

If cancellation is free:

{
"booking": {
"bookingID": "BK-987654321",
"status": "CANCELLED",
"cancelPenalties": []
}
}

Cancellation Policies

Before canceling, check the cancellation policy:

const booking = await getBooking(bookingId);
const cancelPolicy = booking.booking.cancelPolicy;

if (!cancelPolicy.refundable) {
// Non-refundable - full penalty
console.log('Booking is non-refundable');
} else {
// Check if within free cancellation period
const freeCancelDeadline = getFreeCancelDeadline(cancelPolicy.cancelPenalties);
const now = new Date();

if (now < new Date(freeCancelDeadline)) {
console.log('Free cancellation available');
} else {
// Calculate penalty
const penalty = calculatePenalty(cancelPolicy.cancelPenalties, booking.booking.price);
console.log(`Cancellation penalty: ${penalty.amount} ${penalty.currency}`);
}
}

Best Practices

1. Check Cancellation Policy First

async function cancelBooking(bookingId, reason) {
// Get booking to check cancellation policy
const booking = await getBooking(bookingId);

// Calculate penalty
const penalty = calculateCancellationPenalty(booking.booking);

// Inform user of penalty
if (penalty.amount > 0) {
const confirmed = await confirmCancellation({
bookingId,
penalty,
message: `Cancellation penalty: ${penalty.amount} ${penalty.currency}`,
});

if (!confirmed) {
return { cancelled: false };
}
}

// Proceed with cancellation
return await cancelBooking(bookingId);
}

2. Handle Cancellation Response

const cancelResult = await cancelBooking(bookingId, reason);

if (cancelResult.booking.status === 'CANCELLED') {
// Process refund if applicable
// Note: Refund information would be in the booking details, not in cancel response

// Update internal records
await updateBookingStatus(bookingId, 'CANCELLED');

// Notify customer
await notifyCustomer({
bookingId,
status: 'CANCELLED',
penalties: cancelResult.booking.cancelPenalties,
});
}

Code Examples

curl -X POST https://api.bundleport.com/connect/hotels/v1/cancel \
-H "Authorization: ApiKey YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"bookingID": "BK-987654321"
},
"settings": {
"connectionCodes": ["testb-hbds-1876"]
}
}'

Next Steps