home > support > API > Marketplace API > Voucher redemption > Redeem Voucher

Redeem Voucher

Redeem / check in the client on a component (tour) on a booking


Notes

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

REST info

Call/c/voucher/redeem
FormatsXML
ExampleURL: /c/voucher/redeem.xml
 
POST data:
<?xml version="1.0"?>
<voucher>
	<key>XXXXXXXXXXXXXX</key>
	<note>Optional note regarding check in</note>
</voucher>
VerbPOST

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object redeem_voucher (
	SimpleXmlElement $voucher_data [, int $channel = 0 ]
)


Parameters

$voucher_data
XML containing the voucher info to search, currently just the barcode data
$channel
If authenticating as an operator use their Channel ID, Agents skip this / pass 0

Example

// 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


Example

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

Querystring parameters

N/A

Post fields

The following should be posted as XML

Post fields
XML NodeNotes
voucher

XML NodeNotes
key The key for the component to redeem / check-in (or in the case of a redemption-reversal, reverse) obtained from either a previous call to this API method or from a call to Voucher Search
note Optionally add a note related to the check in process, perhaps the client showed some form of identification or if using the same API credentials for multiple machines in a ticket booth add a note to log the machine and/or user carrying out the redemption. Free text.

Response fields

Response fields
XML NodeNotes
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)

More information