home > support > API > Marketplace API > Show promo code

Show promo code

Check a promo code is valid and whether any membership number is required to verify


Notes

Checks a promo code is valid for use on a given channel, not necessarily that it applies any discount to a particular tour or booking (that is indicated when a booking is created via Start New Booking).

REST info

Endpoint/c/promo/show
FormatsXML
Examples/c/promo/show.xml?promo_code=AAAMEMBER
VerbGET

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object show_promo ( string $promo, int $channel )


Parameters

$promo
The promo code to check
$channel
ID for the Channel (supplier)

Example

// The promo code
$promo = "AAAMEMBER";

// Set the channel
$channel = 3930;

// Query the TourCMS API
$result = $tourcms->show_promo($promo, $channel);


// If the promo code is valid
if($result->error == "OK") {

  print "Promo code is valid";

} else {

  print "Promo code is not valid";

}
Promo code is valid

C# examples use the .Net Client Library

Overload list

XmlDocument ShowPromo (String promo, int channelId)


Parameters

promo
The promo code to check
channelId
Id number for the Channel (supplier)

VB examples use the .Net Client Library

Overload list

XmlDocument ShowPromo (String promo, Integer channelId)


Parameters

promo
The promo code to check
channelId
Id number for the Channel (supplier)

NodeJS examples use the NodeJS Wrapper


Example

// Check if promo 'TENPERCENT' is valid for Channel 3930
// If so, <error> will be "OK"
TourCMS.showPromo({
  channelId: 3930,
  promo: 'TENPERCENT',
  callback: function(response) {
    console.log(response.error);
  }
});
OK

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

Querystring parameters

Querystring parameters
ParameterNotes
promoThe promo code to show/check


The Channel ID is also passed via the request header, this is required as Tour IDs are unique within a particular channel (supplier) rather than being unique system wide.

Response fields

Response fields
XML NodeNotes
request Confirmation of the request that you sent
error Any error message returned. If the promo code is valid on the given channel this will be OK, otherwise it will be PROMO CODE NOT VALID or similar
promo

If the promo code is valid for the channel a promo node will be returned, containing:

NodeNotes
channel_id Channel ID
account_id Account ID
promo_code The promo code
value The value for the promo code, e.g. "10"
value_type The type specified in value, currently just "PERCENT" however in the future other types may be supported
requires_membership Whether the customer should provide a membership number that can be used to validate their use of the promo code. Perhaps a club or association membership number.
 
1 - A membership number is required
0 - A membership number is NOT required
membership_mask Indicates the format for a membership number, e.g. "16" for 16 characters, "3-3-9-1" for 16 characters that are formatted on a membership card as two groups of 3 digits then 9 digits then 1 digit.

More information