MG+ Agent Guide for Single Wallet Integrations
Breadcrumbs

Update Balance

This API is an idempotent request to update the player’s balance.

For offline transactions the balance can only be credited (i.e., retried transactions, tournament, or promotion payouts).

As this method is idempotent, it is important that any duplicate calls return exactly the same as the first successful response.


POST {base_url}/updatebalance


Request Data

Name

Required

Data Type

Description

txnType

Yes

String

ENUM must be one of [DEBIT, CREDIT].

txnEventType

Yes

String (50)

Additional detail on the transaction.

[GAME, TOURNAMENT, PROMOTION, ACHIEVEMENT, STORE]

playerId

Yes

String (50)

System ID of the player.

amount

Yes

Number

Amount to be adjusted from the player account.

Amount may be 0 in certain cases but will never be negative.

currency

Yes

String (3)

Use ISO 4217 currency codes when specifying currencies, excluding cryptocurrencies.

txnId

Yes

String (256)

Unique MG+ transaction ID. Also used as the idempotency key.

creationTime

Yes

Number

Deprecated - use creationTimeMs.

contentCode

Yes

String (50)

MG+ content code which shows which event (i.e., game, tournament) this transaction belongs to.

betId

Optional

String (256)

Bet ID for this particular transaction. This ID is helpful to refer different transactions to a single bet.

roundId

Optional

String (256)

Round ID for this particular transaction. This ID is helpful when a game type has multiple bets per game round.

metaData

Optional

Object

Optional and additional information for this transaction which do not fit in other fields (i.e., if it’s a Free Game). Refer to Metadata for more details.

deviceType

Optional

String

Optional ENUM that identifies the type of device that initiated this transaction.

[DESKTOP, TABLET, MOBILE]

platformType

Optional

String

Optional ENUM that identifies the application platform.

[H5, NATIVE]

completed

Yes

Boolean

Flag to show if this is the last transaction for this game round. When this flag is true, the agent can consider it as equivalent to ending a game round.

When set to true the txnId value in the request will be the same as the betId.

transNum

Optional

String

Deprecated - This is sent when completed is TRUE and identifies the user transaction number for Playcheck.

channel

Optional

String (50)

The MG+ channel of the game. This is sent when txnEventType = GAME.

creationTimeMs     

Yes

Number

Timestamp when the transaction was created in Epoch milliseconds.

extOperatorToken

Optional

String (150)

Optional tracking identifier for this player, if a value was provided during the last login call response and during gameplay.

If MG+ calls outside of gameplay, then this parameter may not be present.


Example Request

JSON
{
    "txnType": "DEBIT",
    "txnEventType": "GAME",
    "playerId": "freegamesplayertest0002",
    "amount": 0.0,
    "currency": "CNY",
    "txnId": "AIBQAAQA3ECA2AAAAAAABUWANFHRQAAAAAAA",
    "contentCode": "SMG_luckyTwinsWilds",
    "betId": "AIBQAAQA3ECA2AAAAAAAADAAAAAA",
    "metaData": {
        "isFreeGame": true,
        "freeGame": {
            "played": 3,
            "remaining": 4,
            "offerGuid": "68baeed7-84ca-4850-a99f-f37edcaed415",
            "instanceGuid": "9fa222a4-77f1-46ad-80a1-3849ab8deb9c"
        }
    },
    "deviceType": "DESKTOP",
    "platformType": "H5",
    "completed": false,
    "channel": "SLOTS",
    "creationTimeMs": 1727178301630
}


Response Data

Name

Required

Data Type

Description

extTxnId

Optional

String (512)

ID of this transaction as stored in the Agent system.

balance

Yes

Number

New player balance after the transaction has been performed.

currency

Yes

String (3)

Currency code assigned to the player.

extCreationTimeMs

Optional

Number

The timestamp of this transaction as stored in the Agent system (in Epoch milliseconds).


Example Response

JSON
{
  "extTxnId": "QEFR-SUWE-OALC-SPUF",
  "currency": "CNY",  
  "balance": 2050.50,
  "extCreationTimeMs": 1673436250448
}


HTTP Response Codes

Status Code

Description

Explanation

200

OK

Returning 200 OK confirms the operator has validated the player's balance and accepted the transaction. The system does not inspect the response body - the HTTP status code alone determines success.

400

Bad request

The request format is invalid or contains unsupported parameters (e.g., unsupported transaction type). The transaction is rejected.

402

Not enough available balance

The player does not have sufficient balance to complete the transaction. The transaction is rejected.

404

Player not found

The player ID does not exist in the operator's system. The transaction is rejected.

500

Internal server error

An unexpected error occurred on the operator's side. The transaction is rejected and a retry may apply.