Phoenix Games
Webhook Endpoints

Rollback

Reverse previous withdraw actions due to errors or cancellations

POST {api_base_url}/rollback

Used to reverse a previous /withdraw action due to error or game cancellation.

Request Fields

FieldTypeDescription
player_idstringPlayer ID
gamestringGame ID
instance_idstringInstance ID
actionenumAction being rolled back (BET, RAIN)
action_idstringID of the original action being rolled back
tx_idstringOriginal transaction ID to be rolled back

Response Format

All webhook endpoints must return a response with a type field indicating success or error.

Success Response

{
  "type": "SUCCESS",
  "balance": 1234.56,
  "timestamp": 1712401234567
}
FieldTypeDescription
typestringAlways "SUCCESS" for successful operations
balancefloatPlayer balance after rollback
timestampintegerTimestamp in milliseconds

Error Response

{
  "type": "ERROR",
  "balance": 1234.56,
  "code": "BET_NOT_FOUND"
}
FieldTypeDescription
typestringAlways "ERROR" for failed operations
balancefloat (optional)Current player balance (if available)
codestringError code explaining failure reason

Common Error Codes

  • BET_NOT_FOUND - Original transaction doesn't exist
  • BET_ALREADY_CLOSED - Transaction cannot be rolled back
  • INVALID_REQUEST - Request format or data is invalid

Implementation Notes

  • Idempotency: Handle multiple rollback requests for the same transaction gracefully
  • Validation: Verify the original transaction exists and is eligible for rollback
  • Balance Restoration: Ensure the player's balance is correctly restored to the pre-transaction state
  • Audit Trail: Log all rollback operations for compliance and debugging