Change User Balance

The OMG platform calls this API to modify the player's balance.

circle-info

This API is only invoked when there is a change in the balance. For example, it is called once when a bet is placed and funds are deducted, once when a payout is made, and once when verification is completed. Each invocation includes a type field that specifies the reason for the call.

ChangeBalance

This API is provided by the integrator and is called by the OMG platform.

POST {AGENT_URL}/api/luck/balance/change_balance?trace_id=your_trace_id

circle-info

{AGENT_URL} is the callback address entered in the integrator's backend.

Headers

Name
Value

Content-Type

"application/json; charset=utf-8"

sign

"omg_sign_string"

circle-info

Please refer to the Signature Algorithm and Example page for details on the signature algorithm.

Body

Name
Type
Description

app_id

string

The unique identifier for the user, available in the merchant backend.

uname

string

User ID provided by the integrator

money

string (decimal)

Balance Change (Positive/Negative)

game_id

integer

Game ID

session_id

string

Main game round id

round_id

string

Sub-game round id. If there is only one game, the value is the same as session_id

order_id

string

A unique identifier generated each time there is a change in the amount (maximum length of 64 characters)

timestamp

integer

timestamp (in seconds)

bet

string (decimal)

Bet Amount: This value is always positive and is only present when the player places a bet.

type

integer

1:Place Bet; 2:Cancel Bet; 3:Game Payout; 4:Verify Game Completion;5:LuckWin Treasure Chest Reward Distribution;7: WG brand game promotion payout; Game Position Fee Deduction

Type Field Description*

end_round

bool

Is the current game session over

cancel_order_id

string

仅This field is only populated when type is 2, indicating which order was canceled.

award_order_ids

array

This field is only populated when type is 3, representing the total payout amount for all bets in the current round. See details below.

award_order_ids Parameter Description*

player_login_token

string optional

User Token provided by the integrator

OMG Platform Request Parameter Example

Integrator Response Parameter Example

Integrator Response Parameter Example Description

Name
Required
Type
Description

data

Yes

object

Response Data

balance

Yes

string (decimal)

User balance, supports up to 4 decimal places.

code

Yes

integer

Status Code

msg

Yes

string

Message

Error Code

circle-info

For more error codes, please refer to the General Error Codes page description.


*award_order_ids Parameter Description

circle-info

Type: Array of Objects

The fields of the object are as follows. For more details, please refer to the Game Payout example.

Name
Required
Type
Description

order_id

Yes

string

Bet Order ID

money

Yes

string(decimal)

Payout Amount

*type Parameter Description

circle-info

Each type corresponds to a separate HTTP call.

Process Example:

  • Game Bet → Game Payout → Game Round End

    • Corresponding type: 1 → 3 → 4

    • Description: The player places a bet in the game, wins, and the payout is processed, followed by validation of the game round ending. This flow applies to most game processes.

  • Game Bet → Cancel Bet

    • Corresponding type: 1 → 2

    • Description: The player places a bet in the game, but cancels it before the round starts. This scenario is typical in multi-player (e.g., hundreds of players) games or mini-games. The session_id for the cancellation matches the session_id of the bet.

  • Game Bet → No Win → Game Round End

    • Corresponding type: 1 → 4

    • Description: The player places a bet, but does not win in that round, which ends with validation of the game round’s completion.

  • Game Bet → Game Payout → Game Payout → Game Payout … → Game Round End

    • Corresponding type: 1 → 3 → 3 → … → 4

    • Description: The player places a bet and wins multiple times within the same round until the game round ends. This scenario is common in cascading slot games, slots with special features, or lottery-type games.

  • LUCKYWIN Treasure Chest Reward Distribution

    • Description: In LUCKYWIN, players can claim treasure chest rewards upon meeting turnover requirements at any time. *This action is independent of the game process.

  • WG brand game promotion payout

    • Description: In WG brand games, players who complete designated in-game tasks are eligible to enter a lucky draw, where they may win cash prizes of various amounts based on probability. *This action is independent of the game process.


Example Parameters for OMG ChangeBalance API Request

API Request (Type = 1: User Bet)

API Request (Type = 2: Cancel Bet)

API Request (Type = 3: Game Payout)

API Request (Type = 4: Game Round Ended)

API Request (Type = 5: LuckWin Treasure Chest Reward)

circle-info

Exclusive to LuckWin Game

API Request (Type = 7: WG brand game promotion payout)

circle-info

This promotion is exclusive to WG brand games.

Last updated