⚡
LootlyCasher SDK Documentation
Dashboard

Server-to-Server (S2S) Callbacks RECOMMENDED

The most secure way to receive conversion notifications from LootlyCasher.

ℹ️ Why S2S is Better
Server-to-Server callbacks are more secure than client-side callbacks. They prevent fraud, tampering, and ensure reliable reward delivery even if the user closes the app.

How S2S Works

We'll send a POST request to your server when a user completes an offer:

JSON PAYLOAD
{
  "transaction_id": "txn_abc123",
  "user_id": "user_12345",
  "offer_id": "offer_789",
  "payout": 0.50,
  "currency": "USD",
  "signature": "a1b2c3d4e5f6...",
  "timestamp": 1729123456,
  "sandbox": false
}

Verify Signature (PHP)

PHP
$payload = file_get_contents('php://input');
$data = json_decode($payload, true);
$secret = 'YOUR_SECRET_KEY';
$msg = $data['user_id'] . $data['offer_id'] . $data['payout'] . $data['timestamp'];
$expected = hash_hmac('sha256', $msg, $secret);
if (!hash_equals($expected, $data['signature'])) {
    http_response_code(401);
    exit('Invalid signature');
}
// credit user, return 200
http_response_code(200);
echo 'OK';