home > support > API > booking creation > commit new booking

Commit new booking

Convert a temporary booking created with Start new booking into a live booking


Notes

Only returns basic booking information, use the booking_id and Show Booking to get full detail.

Once committed a booking can no longer be deleted, it can however be cancelled which returns the availability but leaves a cancelled booking in the operator account. Cancelled bookings can be deleted by staff via the TourCMS system web interface.

REST info

Endpoint/c/booking/new/commit
FormatsXML
ExampleURL: /c/booking/new/commit.xml
 
POST data:
<?xml version="1.0"?>
<booking>
	<booking_id>12345</booking_id>
</booking>
VerbPOST

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object commit_new_booking ( SimpleXmlElement $booking_data, int $channel )


Parameters

$booking_data
SimpleXmlElement containing the booking data (ID)
$channel
ID number for the channel the booking is being made with

Example

// Temporary booking ID (obtained via "Start booking")
$booking_id = 123456;

// Channel the booking is made with
$channel = 3039;

// Build the XML to post to TourCMS
$booking = new SimpleXMLElement('<booking />');
$booking->addChild('booking_id', $booking_id);

// Query the TourCMS API, upgrading the booking from temporary to live
$result = $tourcms->commit_new_booking($booking, $channel);

// Check whether everything was ok
if($result->error == "OK")
	print "Thanks, your booking ID is " . $result->booking->booking_id;
else
	print "Sorry, there was a problem: " . $result->error;
Thanks, your booking ID is 123456

C# examples use the .Net Client Library

Overload list

XmlDocument CommitNewBooking (XmlDocument bookingData, int channelId)


Parameters

bookingData
XmlDocument containing the temporary booking ID to commit
channelId
The channel the temporary booking was made with

VB examples use the .Net Client Library

Overload list

XmlDocument CommitNewBooking (XmlDocument bookingData, Integer channelId)


Parameters

bookingData
XmlDocument containing the temporary booking ID to commit
channelId
The channel the temporary booking was made with

NodeJS examples use the NodeJS Wrapper


Example

// This example commits (converts from temporary) booking 1234 on Channel 3930
// It also suppresses any email that would usually send (suppress_email: 1)
// This suppression is common for tour operators who let a subsequent payment 
// move the booking to "Confirmed", only sending an email at that point
TourCMS.commitBooking({
  channelId: 3930,
  booking: {
    booking_id: 1234,
    suppress_email: 1
  },
  callback: function(response) {
    console.log(response.error);
  }
});
OK

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

Querystring parameters

There are no querystring parameters.

Post fields

Post fields
XML NodeNotes
booking

The root XML element

XML NodeNotes
booking_idThe temporary booking ID obtained via a call to the Start new booking API
suppress_emailOptional. Set to 1 to stop TourCMS sending a booking confirmation email, perhaps because you wish to send your own or are processing a payment (which might cause TourCMS to send a second email).
 
For use by Tour Operators only (not for use by Marketplace Partners.
agent_refOptional travel agent booking reference. Can also be supplied at Start new booking however perhaps you do not have your own reference at that point, so provide it here. See notes on Booking Start for usage information

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.
booking

If the temporary booking was converted to live there will be a booking node containing:

XML NodeNotes
booking_idID number for the new temporary booking
channel_idChannel ID
account_idAccount ID
statusStatus of the booking
 
0 - Quote
1 - Provisional
2 - Confirmed
status_textTextual representation of the booking status.
E.g. "Confirmed"
voucher_urlIf the account is using the standard voucher system, this link will point to the page showing the voucher.
 
When the URL is visited the voucher will only be displayed if the booking is Confirmed status, if it is Quotation or Provisional status an alternative message will be displayed.
barcode_dataIf you are creating your own barcode on a voucher, please use this data (See notes about barcodes on the useful notes page)

More information