home > support > API > Marketplace API > Voucher redemption > Redeem Voucher
Redeem / check in the client on a component (tour) on a booking
Pass TourCMS a redeem_voucher_key obtained via Voucher Search to redeem the voucher and indicate that the client has checked in / joined the tour.
Also allows a previous redemption to be reversed
ONLY confirmed bookings (non-cancelled) may be redeemed
Call | /c/voucher/redeem |
Formats | XML |
Example | URL: /c/voucher/redeem.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object redeem_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
$channel = 0;
// Create a new SimpleXMLElement to hold the voucher details
$voucher_data = new SimpleXMLElement('<voucher />');
// Include the key of the component to be redeemed
// Obtained via a "Voucher Search"
$voucher_data->addChild('key', 'XXXXXXXXX');
// Optionally add a note
$voucher_data->addChild('note', 'Something');
// Query the TourCMS API, redeeming the component
$results = $tourcms->redeem_voucher($voucher_data, $channel);
// If the booking is ok
if($results->error == "OK") {
print "Booking updated";
} else {
print $result->error;
}
Booking updated
C# examples use the .Net Client Library
VB examples use the .Net Client Library
NodeJS examples use the NodeJS Wrapper
TourCMS.redeemVoucher({
channelId: 3930,
key: 'jZh9eZuLQwUdEZ6FqDHmHqy4lYV6xWa5wV2iOuw1A7M=',
note: 'Any free text regarding the redemption',
callback: function(response, status) {
console.log(response.error);
}
});
OK
Looking for sample code in a different language? TourCMS and community provided API libraries
Enter your TourCMS API credentials below to call the Redeem Voucher endpoint.
You will need to provide a key (one of redeem_key, redeem_voucher_key_reverse, bus_checkin_key, bus_checkin_key_reverse) from Search Vouchers.
Take care, submitting this form will modify live data!
N/A
The following should be posted as XML
XML Node | Notes | ||||||
---|---|---|---|---|---|---|---|
voucher |
|
XML Node | Notes |
---|---|
request | Confirmation of the request that you sent |
error | Any error message returned. "OK" indicates the redemption (or redemption reversal) was successful. "NO CHANGE" indicates no change was made to the booking, i.e. it had already been redeemed / reversed |
redeem_voucher_key_reverse | If you have just redeemed this component on this voucher - or attempted to redeem an already redeemed component - this field will be present and contain a key that can be passed to this API call to reverse the redemption |
redeem_voucher_key | If you have just reversed - or attempted to reverse a previously reversed - redemption of a component on this voucher this field will be present and contain a key that can be passed to this API call to set the item back to "redeemed" status |
bus_checkin_key_reverse | If you have just bus checked in this component on this voucher - or attempted to bus checkin an already redeemed component - this field will be present and contain a key that can be passed to this API call to reverse the checkin |
bus_checkin_key | If you have just reversed - or attempted to reverse a previously reversed - bus checkin of a component on this voucher this field will be present and contain a key that can be passed to this API call to set the bus checkin status back to "1" (checked in) |