home > support > API > Marketplace API > Voucher redemption > search vouchers
Get a list of bookings and any of their components that are due to start today that match a voucher barcode
Search TourCMS using the data from a TourCMS or supported OTA voucher barcode and retrieve a list of components available to be checked in.
Either scan the voucher barcode, or if you know the details of a TourCMS booking that you want to search for you can obtain the barcode data via Show Booking, or construct your own barcode data in the format: TOURCMS|account_id|booking_id.
Call | /c/voucher/search |
Formats | XML |
Example | URL: /c/voucher/search.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object search_voucher ( SimpleXmlElement $voucher_data [, int $channel = 0 ] )
// Tour Operators set their channel here
// Marketplace Agents don't need to specify one
// Used for API authentication only, not searching bookings
$channel = 0;
// Create a new SimpleXMLElement to hold the voucher details
$voucher_data = new SimpleXMLElement('<voucher />');
// Include the contents of the barcode
$voucher_data->addChild('barcode_data', '12345');
// Query the TourCMS API
$results = $tourcms->search_voucher($voucher_data, $channel);
// Loop through each booking
foreach($results->booking as $booking) {
// If the booking is valid
if($booking->booking_valid == "OK") {
// Print out the booking ID
print $booking->booking_id
// Loop through all the components on the booking
foreach($booking->component as $component) {
// Output the tour name and redemption status
print " " . $component->name;
print " (" . $component->voucher_redemption_status . ")";
}
} else {
// There is some problem with the booking
print $booking->booking_id . " " . $booking->booking_valid_reason;
}
}
123455 - Half day rafting (1)
123456 - Half day rafting (0) Off-road (1)
123457 - BOOKING NOT CONFIRMED
123458 - Half day rafting (1)
C# examples use the .Net Client Library
VB examples use the .Net Client Library
NodeJS examples use the NodeJS Wrapper
// Search for vouchers containing the text VOUCHER_STRING_HERE
// the wideDates param being set to 1 causes TourCMS to include dates other than today in the search
TourCMS.searchVouchers({
channelId: 3930,
voucherString: "VOUCHER_STRING_HERE",
wideDates: 1,
callback: function(response) {
console.log("Found " + response.booking.length + " bookings")
}
});
Found 2 bookings
Looking for sample code in a different language? TourCMS and community provided API libraries
Enter your TourCMS API credentials below to call the Search Vouchers endpoint.
N/A
Post the contents of the barcode found on the voucher. Or, if you have the details of a TourCMS booking construct the barcode data manually.
XML Node | Notes | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
voucher |
|
TourCMS will return all matching bookings and - if a given booking is valid - any of its components due to start today.
XML Node | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
There will be one booking node for each booking matching our barcode data. Each booking node contains the following child nodes.
|