Callback Documentation

Vote postback rewards.

Use callbacks to automatically reward players in-game after they vote for your server.

How it works

  1. Your server listing has a private callback URL and secret.
  2. You send players to your Foxenix vote URL with their username or reward token.
  3. After the vote is accepted, Foxenix calls your callback URL.
  4. Your game/site checks the secret and gives the player their reward.

Player vote URL format

Use this format from your server website or in-game vote command after the player enters their in-game name on your site:

https://foxenix.net/vote.php?id=SERVER_ID&callback=PLAYER_NAME&username=PLAYER_NAME

You may also send only callback if your reward script uses the callback value as the player/token:

https://foxenix.net/vote.php?id=SERVER_ID&callback=PLAYER_NAME

If a player clicks Vote directly from Foxenix without a callback or username, the vote still counts for ranking, but no reward callback is sent.

VariableMeaning
idYour Foxenix server id or slug.
callbackA unique value we send back to your reward script. Usually the player name or vote token.
usernameOptional player username. Recommended when your callback is a unique token instead of the actual name.

Variables sent to your callback URL

After a successful vote, Foxenix sends a GET request to your configured callback URL with these values:

VariableExampleDescription
callbackKhaosThe callback/reward token from the vote URL.
usernameKhaosThe username entered or prefilled on the vote page.
ip127.0.0.1The voter IP address.
secretyour-secretYour private callback secret. Check this before rewarding.
server_idsrv_...Your Foxenix server listing id.

Callback URL examples

If your callback URL has no placeholders, Foxenix appends the variables automatically:

https://yourdomain.com/vote/callback.php

Foxenix calls it like this:

https://yourdomain.com/vote/callback.php?callback=Khaos&username=Khaos&ip=127.0.0.1&secret=YOUR_SECRET&server_id=SERVER_ID

If your script needs a custom URL format, use placeholders:

https://yourdomain.com/vote/callback.php?player={username}&token={callback}&key={secret}

Example PHP reward receiver

<?php
$secret = $_GET['secret'] ?? '';
$expectedSecret = 'PASTE_YOUR_FOXENIX_SECRET_HERE';

if (!hash_equals($expectedSecret, $secret)) {
    http_response_code(403);
    exit('Invalid secret');
}

$username = preg_replace('/[^a-zA-Z0-9_ -]/', '', $_GET['username'] ?? '');
$callback = preg_replace('/[^a-zA-Z0-9_\-.]/', '', $_GET['callback'] ?? '');
$ip = $_GET['ip'] ?? '';

// TODO: insert reward into your game database here.
// Example columns: username, callback_token, voter_ip, claimed, created_at

http_response_code(200);
echo 'OK';
?>

Security tips

Open Callback Tester