Skip to content
KOI Games Developer

Wallet callbacks

Win

KOI calls your rewards endpoint once for every settled bet. A paying round sends the payout; a losing round sends a win with amount: 0, which credits nothing and closes the bet. Answer both the same way. Free-bet rounds never send a win: their total is paid once by a bonus win.

Payload

FieldTypeDescription
actionstringAlways win.
provider_tx_idnumberKOI transaction ID of this win. Use it as your idempotency key.
linked_tx_idnumberprovider_tx_id of the bet being paid.
user_idstringYour player ID.
amountnumberAmount to credit, stake included. 0 when the bet lost.
currencystringSession currency.
gamestringGame slug.
round_idstringSame round_id as the bet.
session_tokenstringKOI session token.
modestringMode of the original bet: common or auto.
extra_datastring | nullThe extra_data from request-access.
providerstringAlways koi.
aggregatorstringYour KOI account ID.
json
{
  "user_id": "player-123",
  "amount": 12.5,
  "currency": "BRL",
  "provider": "koi",
  "game": "amazonia-adventure",
  "provider_tx_id": 104234,
  "linked_tx_id": 104233,
  "action": "win",
  "round_id": "r-7f3a2c",
  "session_token": "b3e1f6d2c9a84f0e",
  "extra_data": "brand=acme;device=mobile",
  "aggregator": "7",
  "mode": "common"
}

What to do

  1. Verify X-Koi-Signature.
  2. If you already processed this provider_tx_id, return the original result.
  3. Credit amount, even if the session has expired. A win always belongs to the player.
  4. Answer 200 with old_balance, new_balance and operator_tx_id.

Timeout

KOI waits up to 80 seconds. On timeout, GENERAL_ERROR or INVALID_REQUEST, KOI retries once and then hands the win to reconciliation, which resends it for up to 24 hours. See Idempotency & retries.