FOR MOD AUTHORS
Scripting API
Other mods use GTG Banking through GTG_BankingManager. Everything runs server-side and asynchronously: a method sends the HTTP request and returns immediately, the result arrives through a ScriptInvoker event.
Getting the instance
GTG_BankingManager mgr = GTG_BankingManager.GetInstance();
if (!mgr)
return;
mgr.m_OnDepositComplete.Insert(OnDepositDone);
GetInstance() returns null until the server is initialised. Subscribe in OnPostInit of your own component and unsubscribe in OnDelete.
Methods
| Method | Result event |
|---|---|
RegisterPlayer(playerUid, displayName) | m_OnPlayerRegistered |
FetchPlayerByUid(playerUid) | m_OnPlayerFetched |
GetOrFetchPlayerId(playerUid) | returns cached id or "" + m_OnPlayerFetched |
LoadPlayerAccounts(playerId) | m_OnAccountsLoaded |
FetchAccount(accountId) | m_OnAccountFetched |
CreateAccount(ownerId, bankId, accountType) | m_OnAccountCreated |
Deposit(toAccountId, amount, initiatedBy, note) | m_OnDepositComplete |
Withdraw(fromAccountId, amount, initiatedBy, note) | m_OnWithdrawComplete |
WithdrawWithCard(fromAccountId, amount, cardId, pin) | m_OnWithdrawComplete |
Transfer(fromAccountId, toAccountId, amount, initiatedBy, note) | m_OnTransferComplete |
TransferWithCard(fromAccountId, toAccountId, amount, cardId, pin, note) | m_OnTransferComplete |
LoadTransactions(accountId, requestingPlayerId) | m_OnTransactionsLoaded |
LoadCards(accountId, requestingPlayerId) | m_OnCardsLoaded |
CreateCard(accountId, requestingPlayerId, pin, label) | m_OnCardCreated |
Errors of any call are reported through m_OnApiError(string endpoint, ERestResult result, string errorMsg).
Amounts
Amounts are passed as int in cents. Balances and amounts in result data come back as strings in cents ("2500" = 25.00 €) – convert with .ToInt().
Account roles
| Role | Can |
|---|---|
VIEWER | View balance and transactions |
WITHDRAWER | Withdraw |
OPERATOR | Transfer, plus everything of WITHDRAWER |
MANAGER | Assign roles, plus everything of OPERATOR |
| Owner | Full access, close account |
Card operations (WithdrawWithCard, TransferWithCard) skip the role check – a valid card and the correct PIN are enough.
Still stuck? Report an issue