Skip to main content

Barcode validation

Fetching and validating barcodes

You can retrieve a barcode of a ticket by fetching the order to which that ticket belongs through the https://api.openticket.tech/order/:GUID endpoint. The response lists an order and its associated tickets. Each ticket lists its barcode in the ticket_number field.

To check the validity of a barcode, create a GET request to the https://api.openticket.tech/ticketswap/validate. The following code block shows some examples of such a request.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://api.openticket.tech/ticketswap/validate"
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
This request results in the following response
{
"barcode": "TTZ2PM9NGRJXAUTWHHW",
"valid": true,
"swappable": true,
"retrievable_after": 0
}