Validates (scans) an e-ticket, marking it as used.
Marks an e-ticket as validated, which typically happens when a ticket is scanned at event check-in. This prevents the ticket from being used multiple times and tracks when the buyer entered the event. The endpoint will indicate if the ticket was already validated previously.
POST /validateEticket
| Parameter | Type | Required | Description |
|---|---|---|---|
ticket_id |
string | Yes | The unique ticket ID to validate |
The response contains validation details and status information.
[
'success' => true,
'ticket_id' => 'TICKET123',
'order_id' => 'ORDER456',
'product_name' => 'Conference 2024',
'buyer_name' => 'John Doe',
'validated_at' => '2024-06-15 10:30:00',
'was_already_validated' => false,
'message' => 'Ticket validated successfully'
]| Field | Type | Description |
|---|---|---|
success |
bool | Whether the validation was successful |
ticket_id |
string | The validated ticket ID |
order_id |
string | The order ID associated with the ticket |
product_name |
string | The name of the event |
buyer_name |
string | Full name of the ticket buyer |
validated_at |
string | Date and time when ticket was validated (ISO 8601 format) |
was_already_validated |
bool | Whether this ticket was already validated before |
message |
string|null | Optional message (e.g., warnings or errors) |
use GoSuccess\Digistore24\Api\Digistore24;
use GoSuccess\Digistore24\Api\Client\Configuration;
use GoSuccess\Digistore24\Api\Request\Eticket\ValidateEticketRequest;
// Initialize API client
$config = new Configuration('YOUR-API-KEY');
$ds24 = new Digistore24($config);
$request = new ValidateEticketRequest(
ticketId: 'TICKET123456'
);
try {
$response = $ds24->eticket->validate($request);
if ($response->success) {
echo "✓ Access Granted\n\n";
echo "Ticket ID: {$response->ticketId}\n";
echo "Event: {$response->productName}\n";
echo "Buyer: {$response->buyerName}\n";
echo "Validated: {$response->validatedAt->format('Y-m-d H:i:s')}\n";
if ($response->wasAlreadyValidated) {
echo "\n⚠ Warning: This ticket was already scanned before!\n";
echo "Message: {$response->message}\n";
}
} else {
echo "✗ Access Denied\n";
echo "Reason: {$response->message}\n";
}
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}function checkInAttendee(string $ticketId): void
{
$ds24 = new Digistore24('your-api-key');
$request = new ValidateEticketRequest(ticketId: $ticketId);
try {
$response = $ds24->eticket->validate($request);
if (!$response->success) {
// Invalid ticket
displayError("Invalid Ticket", $response->message);
logCheckInAttempt($ticketId, 'FAILED', $response->message);
return;
}
if ($response->wasAlreadyValidated) {
// Already scanned - potential duplicate entry attempt
displayWarning(
"Duplicate Scan Detected",
"This ticket was already used. Buyer: {$response->buyerName}"
);
logCheckInAttempt($ticketId, 'DUPLICATE', $response->buyerName);
return;
}
// First-time valid scan
displaySuccess(
"Check-In Successful",
"Welcome {$response->buyerName} to {$response->productName}!"
);
logCheckInAttempt($ticketId, 'SUCCESS', $response->buyerName);
printBadge($response->buyerName, $response->productName);
} catch (\Exception $e) {
displayError("System Error", $e->getMessage());
logCheckInAttempt($ticketId, 'ERROR', $e->getMessage());
}
}// Scan QR code and validate ticket
$scannedData = scanQrCode(); // Returns ticket ID from QR code
$request = new ValidateEticketRequest(
ticketId: $scannedData
);
$response = $ds24->eticket->validate($request);
if ($response->success && !$response->wasAlreadyValidated) {
// Grant access
openGate();
incrementAttendeeCount();
echo "Welcome! Enjoy the event.\n";
} elseif ($response->wasAlreadyValidated) {
// Duplicate scan
soundAlarm();
echo "This ticket has already been used.\n";
echo "Please contact event staff.\n";
} else {
// Invalid ticket
soundAlarm();
echo "Invalid ticket. Access denied.\n";
}$ticketIds = ['TICKET001', 'TICKET002', 'TICKET003'];
foreach ($ticketIds as $ticketId) {
try {
$request = new ValidateEticketRequest(ticketId: $ticketId);
$response = $ds24->eticket->validate($request);
$status = match(true) {
!$response->success => "❌ Invalid",
$response->wasAlreadyValidated => "⚠️ Already Used",
default => "✓ Validated"
};
echo "{$ticketId}: {$status} - {$response->buyerName}\n";
} catch (\Exception $e) {
echo "{$ticketId}: ❌ Error - {$e->getMessage()}\n";
}
}- Event Check-In: Scan tickets at venue entrance to grant access
- Access Control: Prevent duplicate entries by tracking validated tickets
- Attendance Tracking: Record who actually attended the event
- Security: Detect fraudulent or duplicate ticket usage
- Staff Management: Allow event staff to validate tickets via mobile app
- Real-Time Monitoring: Track check-in rates during event
- If a ticket is scanned twice,
was_already_validatedwill betrue - The ticket remains valid (
success = true), but you should handle duplicates appropriately - Consider your policy: allow re-entry, deny access, or alert security
validated_atshows the current validation time- For already-validated tickets, this shows the ORIGINAL validation time
- Use this to check how long ago a ticket was first scanned
- Always check both
successANDwas_already_validatedflags - Log all validation attempts for security auditing
- Consider implementing rate limiting for validation endpoints
- Alert staff for suspicious patterns (multiple failed attempts, etc.)
- createEticket - Create free e-tickets
- getEticket - Get details of a specific e-ticket
- listEtickets - List all e-tickets
- getEticketSettings - Get e-ticket configuration
- listEticketLocations - List available locations
- listEticketTemplates - List available templates
try {
$response = $ds24->eticket->validate($request);
// Check success status
if (!$response->success) {
// Handle invalid ticket
handleInvalidTicket($response->message);
}
// Check for duplicate
if ($response->wasAlreadyValidated) {
// Handle already-used ticket
handleDuplicateTicket($response);
}
} catch (\GoSuccess\Digistore24\Api\Exception\NotFoundException $e) {
// Ticket doesn't exist
echo "Ticket not found";
} catch (\GoSuccess\Digistore24\Api\Exception\AuthenticationException $e) {
// Invalid API key
echo "Authentication failed";
} catch (\GoSuccess\Digistore24\Api\Exception\ApiException $e) {
// Other API error
echo "API error: " . $e->getMessage();
}[
'success' => true,
'was_already_validated' => false,
'message' => 'Ticket validated successfully'
]Action: Grant access, welcome attendee
[
'success' => true,
'was_already_validated' => true,
'message' => 'Warning: This ticket was already validated'
]Action: Check your policy - allow re-entry or alert staff
[
'success' => false,
'was_already_validated' => false,
'message' => 'Ticket not found or invalid'
]Action: Deny access, check for fraud
- Always Log: Keep records of all validation attempts
- Handle Duplicates: Have a clear policy for already-validated tickets
- User Feedback: Provide clear messages to attendees
- Staff Alerts: Notify staff of suspicious activity
- Offline Mode: Consider caching for network outages
- Testing: Test your scanner system thoroughly before the event
- Backup: Have a manual check-in process as backup
// Mobile app with camera scanner
$qrCodeData = $_POST['scanned_qr'];
$response = $ds24->eticket->validate(
new ValidateEticketRequest(ticketId: $qrCodeData)
);
echo json_encode([
'success' => $response->success,
'allow_entry' => $response->success && !$response->wasAlreadyValidated,
'buyer_name' => $response->buyerName,
'event' => $response->productName,
'warning' => $response->wasAlreadyValidated ? 'Duplicate scan' : null
]);// Attendee scans their own ticket at kiosk
$ticketId = getInputFromKiosk();
$response = $ds24->eticket->validate(
new ValidateEticketRequest(ticketId: $ticketId)
);
if ($response->success && !$response->wasAlreadyValidated) {
displayWelcomeScreen($response->buyerName);
printBadge($response);
openTurnstile();
} else {
displayErrorScreen($response->message);
callStaff();
}