Phoenix Games
Webhook Endpoints

Rollback

Reverse a previous withdraw

POST {api_base_url}/rollback

Called when a bet is cancelled or fails to open. Reverses the original withdraw and restores the player's balance.

A rollback always references the original withdraw by its tx_id.

Request

{
  "player_id": "player_123",
  "game": "aviator",
  "instance_id": "inst_abc",
  "action": "BET",
  "action_id": "bet_789",
  "tx_id": "withdraw:bet:bet_789",
  "round_id": "round_456",
  "amount": 5000
}
FieldTypeDescription
player_idstringPlayer whose balance to restore
gamestringGame identifier
instance_idstringGame instance identifier
actionstring"BET"
action_idstringThe bet being rolled back
tx_idstringSame tx_id as the original withdraw (withdraw:bet:{action_id})
round_idstringGame round identifier
amountintegerOriginal withdraw amount in cents

Response

On successful rollback:

{"type": "SUCCESS", "balance": 1000.00, "timestamp": 1712401234567}

Always return HTTP 200.

Behavior Rules

Normal rollback

The withdraw tx_id exists and hasn't been rolled back yet. Reverse the deduction and return SUCCESS with the restored balance.

Duplicate rollback (same tx_id sent again)

The withdraw was already rolled back. Return SUCCESS with the current balance. Do not credit the amount again.

Unknown tx_id (withdraw never happened)

The tx_id doesn't exist in your system. Return:

{"type": "ERROR", "code": "BET_NOT_FOUND", "balance": 1000.00}

Do not modify the balance.

Rollback after deposit (bet already settled)

If a deposit has already been processed for this bet, the rollback should be rejected:

{"type": "ERROR", "code": "BET_ALREADY_CLOSED", "balance": 1050.00}

The deposit stands. Do not reverse it.

Why Rollbacks Happen

  • Player cancels a bet before the game round starts
  • A game round fails to start due to a technical issue
  • Any error in the bet opening process

Rollbacks only apply to the withdraw (wager). Once a bet is settled via deposit, it cannot be rolled back.