Textlocal Logo

API Documentation

Redeem Ticket

This command can be used to redeem a valid voucher or ticket code created with our Vouchers and Ticketing system.

Resource URL

https://api.textlocal.in/scan_ticket/

Sample Request

<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// Redemption details
	$seed = "ABCDEF";
	$direction = "-";
	$amount = "1";


	// Prepare data for POST request
	$data = array('apikey' => $apiKey, 'seed' => $seed, "amount" => $amount, "direction" => $direction);

	// Send the POST request with cURL
	$ch = curl_init('https://api.textlocal.in/scan_ticket/');
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);

	// Process your response here
	echo $response;
?>
<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// Redemption details
	$seed = urlencode("ABCDEF");
	$direction = "-";
	$amount = "1";

	// Prepare data for POST request
	$data = 'apikey=' . $apiKey . '&seed=' . $seed . "&direction=" . $direction . "&amount=" . $amount;

	// Send the GET request with cURL
	$ch = curl_init('https://api.textlocal.in/scan_ticket/?' . $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);

	// Process your response here
	echo $response;
?>

Sorry, we do not have an example for Class in the language you have chosen.

Parameters

seed The code of the ticket or voucher code being redeemed.
Login Parameters (Additional Information)
apiKey You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address.
Optional Parameters
amount If redeeming a loyalty card, this corresponds to the amount added or taken away from the current balance.
direction Related to amount this defines whether the balance is to be added to or subtracted from. Accepts either + or -

Sample Response

{
   "status":"success",
   "message":"Scanned: 2 times. Last Scanned: 2015-09-24 10:00:00",
   "contact":{
    "id":"3834939965",
      "customer":"123456",
      "number":"918123456789",
      "message":null,
      "datetime":"0000-00-00 00:00:00",
      "groupid":"123456",
      "Firstname":"",
      "Lastname":"",
      "Custom1":"ABCDEF",
      "Custom2":"",
      "Custom3":"",
      "status":"D",
      "optout":"",
      "operator":"",
      "netid":"",
      "keyword":null,
      "keywordopt":null,
      "fullRReceipt":"0",
      "tyPSMSid":"1442850794",
      "badStatusCount":"0"
   },
   "RAW":{
    "id":"776",
      "customer":"123456",
      "groupId":"123456",
      "field":"Custom1",
      "prefix":"",
      "suffix":"",
      "length":"5",
      "numbers":"1",
      "letters":"1",
      "overwrite":"1",
      "dateField":"",
      "singleValidation":"n",
      "predefined":"0",
      "expiryDate":"0",
      "expiryMessage":"",
      "csvFile":"",
      "ticketType":"voucher",
      "schemeName":"Ticket Redemption",
      "isInboxGroup":"group",
      "isComplete":"y",
      "isDeleted":"0",
      "dateCreated":"2015-08-12 12:00:00",
      "webPageCreated":"y",
      "webShowPassbook":"n",
      "webShowQR":"n",
      "webShowBarcode":"n",
      "webCompanyName":"Company Name",
      "webAdditional":"Helpful information for your customer",
      "webAdditionalFoot":"Helpful information for your customer",
      "webImageURL":"",
      "passbookID":"0",
      "dataField":null,
      "pasteList":"",
      "repeatBreakpoints":"y",
      "defaultBalance":"0",
      "balanceField":"Custom2",
      "isUpload":"n"
   }
}
<response>
    <status>success</status>
    <message>
        Scanned: 2 times. Last Scanned: 2015-09-24 10:00:00
    </message>
    <contact>
        <id>3834939965</id>
        <customer>123456</customer>
        <number>918123456789</number>
        <message></message>
        <datetime>0000-00-00 00:00:00</datetime>
        <groupid>123456</groupid>
        <Firstname></Firstname>
        <Lastname></Lastname>
        <Custom1>ABCDEF</Custom1>
        <Custom2></Custom2>
        <Custom3></Custom3>
        <status>D</status>
        <optout></optout>
        <operator></operator>
        <netid></netid>
        <keyword></keyword>
        <keywordopt></keywordopt>
        <fullRReceipt>0</fullRReceipt>
        <tyPSMSid>1442850794</tyPSMSid>
        <badStatusCount>0</badStatusCount>
    </contact>
    <RAW>
        <id>776</id>
        <customer>123456</customer>
        <groupId>123456</groupId>
        <field>Custom1</field>
        <prefix></prefix>
        <suffix></suffix>
        <length>5</length>
        <numbers>1</numbers>
        <letters>1</letters>
        <overwrite>1</overwrite>
        <dateField></dateField>
        <singleValidation>n</singleValidation>
        <predefined>0</predefined>
        <expiryDate>0</expiryDate>
        <expiryMessage></expiryMessage>
        <csvFile></csvFile>
        <ticketType>voucher</ticketType>
        <schemeName>Ticket Redemption</schemeName>
        <isInboxGroup>group</isInboxGroup>
        <isComplete>y</isComplete>
        <isDeleted>0</isDeleted>
        <dateCreated>2015-08-12 12:00:00</dateCreated>
        <webPageCreated>y</webPageCreated>
        <webShowPassbook>n</webShowPassbook>
        <webShowQR>n</webShowQR>
        <webShowBarcode>n</webShowBarcode>
        <webCompanyName>Company</webCompanyName>
        <webAdditional>Helpful information for your customer</webAdditional>
        <webAdditionalFoot>Helpful information for your customer</webAdditionalFoot>
        <webImageURL></webImageURL>
        <passbookID>0</passbookID>
        <dataField></dataField>
        <pasteList></pasteList>
        <repeatBreakpoints>y</repeatBreakpoints>
        <defaultBalance>0</defaultBalance>
        <balanceField>Custom2</balanceField>
        <isUpload>n</isUpload>
    </RAW>
</response>

Errors

Error Codes
35 Invalid Code Specified
99 Ticket Code Not Found
100 Redemption Amount Required
101 Ticket Redeemed Previously
102 Ticket Expiry Date Passed