Validate a licence key
One POST to /apps/{appId}/licenses/authenticate. PHP 7.4+ with ext-curl. No dependencies.
<?php
$appId = 'YOUR_APP_ID';
$ch = curl_init("https://api.evora.lol/api/developer-api/apps/$appId/licenses/authenticate");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('EVORA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['licenseKey' => $_POST['license']]),
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!empty($result['authenticated'])) {
// issue YOUR session here — never hand the API key to the browser
$_SESSION['plan'] = $result['subscription']['level'] ?? 0;
}