TourCMS, a leading online booking and channel management solution is operated by Palisis.

Contact Info

Palisis AG
Florastrasse 18A
8610 Uster
support@palisis.com
+41 44 533 40 40

Follow Us

home > support > API > Marketplace API > cancel booking

Cancel Booking

Cancel a booking

Notes

Tour operators can cancel any bookings made in their account, Marketplace Agents can cancel bookings they have made in any account they are connected to.
 
Excludes temporary bookings, just delete those or let them expire.
 
Generally speaking with the TourCMS API you will be looking for an error node containing the text OK to determine success, note PREVIOUSLY CANCELLED here would also indicate a booking as being cancelled.

REST info

Endpoint/c/booking/cancel
FormatsXML
ExampleURL: /c/booking/cancel.xml
 
POST data:
<?xml version="1.0"?>
<booking>
  <booking_id>12345</booking_id>
  <note>Optionally add a (staff-facing) note here</note>
</booking>
VerbPOST

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object cancel_booking ( SimpleXMLElement $booking_data, int $channel )


Parameters

$booking_data
SimpleXmlElement containing the booking data (must include booking ID)
$channel
ID number for the channel the booking belongs to

Example

// Set the channel ID
$channel = 3930;

// Create a new SimpleXMLElement to hold the booking details
$booking = new SimpleXMLElement('<booking />');

// Must set the Booking ID on the XML, so TourCMS knows which to cancel
$booking->addChild('booking_id', '12345');

// Optionally add a note explaining why the booking is cancelled
$booking->addChild('note', 'Booking created accidentally');

// Call TourCMS API, cancelling the booking
$result = $tourcms->cancel_booking($booking, $channel);

// Check the result, will be "OK" if a booking was updated
if ($result->error == "OK") {
    // Print a success message
	print "Booking cancelled.";
} else if($result->error == "PREVIOUSLY CANCELLED" {
    // Print a different success message
	print "Booking has already been cancelled.";
} else {
	// Some  problem
	print "Unable to cancel booking (" . $result->error . ").";
}
Booking deleted.

C# examples use the .Net Client Library

Overload list

XmlDocument CancelBooking ( XmlDocument bookingData, int channelId )


Parameters

bookingData
XmlDocument containing the booking data (must include booking ID)
channelId
ID number for the channel the booking belongs to

Example

// Set the ID for the channel this booking is made with
int channelId = 12345;

// Create an XMLDocument to hold the booking details
XmlDocument bookingData = new XmlDocument();

// Create the XML Declaration, append it to XML document
XmlDeclaration dec = bookingData.CreateXmlDeclaration("1.0", null, null);
bookingData.AppendChild(dec);

// Create the root element, append it to the XML document
XmlElement root = bookingData.CreateElement("booking");
bookingData.AppendChild(root);

// Must set the Booking ID so TourCMS knows which booking to update
XmlElement bookingId = bookingData.CreateElement("booking_id");
bookingId.InnerText = "12345";
root.AppendChild(bookingId);

// Optionally add a note explaining the reason for cancellation
XmlElement req = bookingData.CreateElement("note");
req.InnerText = "Booking created accidentally";
root.AppendChild(req);

// Query the TourCMS API.
XmlDocument response = myTourCMS.CancelBooking(bookingData, channelId);

// Check the status
// Will be "OK" if the booking was cancelled.
// "PREVIOUSLY CANCELLED" if it has been cancelled already.
string status = response.GetElementsByTagName("error")[0].InnerText;
if (status == "OK")
{
    Console.WriteLine("Booking cancelled.");
}
else
{
    Console.WriteLine("Error: " + status);
}
OK

VB examples use the .Net Client Library

Overload list

XmlDocument CancelBooking ( XmlDocument bookingData, Integer channelId )


Parameters

bookingData
XmlDocument containing the booking data (must include booking ID)
channelId
ID number for the channel the booking belongs to

Example


' Set the ID for the channel this booking is made with
Dim channelId As Integer = 3930

' Create an XMLDocument to hold the booking details
Dim bookingData As XmlDocument = new XmlDocument()

' Create the XML Declaration, append it to XML document
Dim dec As XmlDeclaration = bookingData.CreateXmlDeclaration("1.0", null, null)
bookingData.AppendChild(dec)

' Create the root element, append it to the XML document
Dim root As XmlElement = bookingData.CreateElement("booking")
bookingData.AppendChild(root)

' Must set the Booking ID so TourCMS knows which booking to cancel
Dim bookingId As XmlElement = bookingData.CreateElement("booking_id")
bookingId.InnerText = "12345"
root.AppendChild(bookingId)

' Optionally add a note
Dim req As XmlElement = bookingData.CreateElement("note")
req.InnerText = "Booking created accidentally"
root.AppendChild(req)

' Send the data to the TourCMS API, cancelling the Booking
Dim doc As XmlDocument = myTourCMS.CancelBooking(bookingIdData, channelId)

' Check the status
' Will be "OK" if the booking was updated
' "PREVIOUSLY CANCELLED" if it has been cancelled already
Dim status As String = doc.GetElementsByTagName("error")(0).InnerXml
If status = 'OK' Then
Console.WriteLine("Booking Cancelled.")
Else
Console.WriteLine("Error: " & status)
End If
OK

NodeJS examples use the NodeJS Wrapper


Example

TourCMS.cancelBooking({
  channelId: 3930,
  booking: {
    booking_id: 8451,
    note: "Booked accidentally"
  },
  callback: function(response) {
    console.log(response.error);
  }
});
OK

Looking for sample code in a different language? TourCMS and community provided API libraries

Implementing yourself? Check the REST info for this endpoint.

Try it

Enter your TourCMS API credentials below to call the Cancel Booking endpoint.

Take care, submitting this form will modify live data!


            
            

Post fields

The following fields can be posted as XML when calling the API, the booking_id is the only required field.

Post fields
XML NodeNotes
booking_id TourCMS ID for the booking to delete
note Optionally add a note explaining why the booking was cancelled
cancel_reasonIf not set, we will assume reason 22

1 - Cancelled by customer request, see notes
2 - Cancelled by customer request, booked another tour
3 - Cancelled by staff, see notes
4 - Cancelled by staff, boook another tour
5 - Cancelled by staff, payment not received
6 - Cancelled by staff, tour not reached min. numbers
7 - Cancelled by staff, booking made in error
8 - Cancelled by staff, capacity exceeded
9 - Cancelled by staff, operational reasons
10 - Cancelled by staff, booking reopened for editing
11 - Cancelled by staff, bad weather
20 - Cancelled by system, expired quotation
21 - Cancelled by system, expired provisional booking
22 - Cancelled by customer (via website)
23 - Cancelled by agent (via website)

suppress_emailOptional. Set to 1 to stop TourCMS sending a cancellation email.
 
For use by Tour Operators only (not for use by Marketplace Partners.

Response fields

Response fields
XML NodeNotes
request Confirmation of the request that you sent
error Any error message returned, if there is no error this will just contain the text OK.
 
If the booking is already cancelled - either via API or by a staff member in the back office - TourCMS will return a PREVIOUSLY CANCELLED error. You may wish to code for this, and handle the same as an "OK" response.

More information