Callback Documentation
Vote postback rewards.
Use callbacks to automatically reward players in-game after they vote for your server.
How it works
- Your server listing has a private callback URL and secret.
- You send players to your Foxenix vote URL with their username or reward token.
- After the vote is accepted, Foxenix calls your callback URL.
- 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.
| Variable | Meaning |
|---|---|
id | Your Foxenix server id or slug. |
callback | A unique value we send back to your reward script. Usually the player name or vote token. |
username | Optional 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:
| Variable | Example | Description |
|---|---|---|
callback | Khaos | The callback/reward token from the vote URL. |
username | Khaos | The username entered or prefilled on the vote page. |
ip | 127.0.0.1 | The voter IP address. |
secret | your-secret | Your private callback secret. Check this before rewarding. |
server_id | srv_... | 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
- Always verify the secret before rewarding.
- Use HTTPS for your callback URL.
- Do not reward the same callback token twice.
- Keep a log of successful and failed callbacks.
- Return HTTP 200 when your reward script accepts the callback.