Skip to Content
Cobalt

cobalt_banking

Personal, shared and society accounts, with every money movement in one transaction.

ExportSideWhat it does
GetAccountServerThe account behind an account id or a citizenid.
GetBalanceServer0 when the account doesn't exist.
DepositServer
WithdrawServerRefuses when the balance can't cover it.
TransferServerMoves money between two accounts in one transaction, without a fee or a permission check; player-initiated transfers go through SendTransfer.
AdjustBalanceServerCredits or debits an account and logs it to FiveMesh.
GetNextPaydayServerWhen the next paycheck cycle runs.
GetAccessibleAccountsServerAccounts the character can see, with their role.
GetStatementServerA page of an account's entries with counterparty and initiator names, for a character with any role on it.
GetStatementEntryServerOne entry, for a character with any role on its account.
FindRecipientServerThe account behind an account number or citizen ID.
GetRecentRecipientsServerOther people's accounts the character sent money to, latest first.
SendTransferServerMoves money in one transaction with the configured fee, for a character with member or higher on the source.
GetAccountMembersServerMembers of a shared account, or the org roster of a society account.
InviteMemberServerAdds a character to a shared account as member; the caller needs admin or higher.
RevokeMemberServerRemoves a member other than the owner from a shared account; the caller needs admin or higher.
CreateInvoiceServerSends a character an invoice that pays into society_<issuer> unless payee says otherwise.
GetInvoiceServer
GetInvoicesServerInvoices matching every filter given, newest first.
GetInvoiceTotalsServerWhat's owed, overdue, billed and paid across the invoices matching the filter.
PayInvoiceServerPays an unpaid invoice into its payee in one transaction, as bill_paid and bill_received statement entries with the receipt INV-<id>.
DeclineInvoiceServerRecords that the payer turned an unpaid invoice down; it stays unpaid with declinedAt set.
VoidInvoiceServerCancels an unpaid invoice.
FindNearestCashPointClientThe closest streamed-in ATM or bank branch to the player.

GetAccount

Server

The account behind an account id or a citizenid.

exports.cobalt_banking:GetAccount(account)
ParameterTypeOptionalDescription
accountBankingAccountRefNo
ReturnsDescription
BankingAccount?
Example
local account = exports.cobalt_banking:GetAccount('CB 1234 5678')

GetBalance

Server

0 when the account doesn't exist. Cash is not a bank balance: read it from cobalt_core's player.

exports.cobalt_banking:GetBalance(account)
ParameterTypeOptionalDescription
accountBankingAccountRefNo
ReturnsDescription
integer
Example
local balance = exports.cobalt_banking:GetBalance('CB 1234 5678')

Deposit

Server
exports.cobalt_banking:Deposit(account, amount, details)
ParameterTypeOptionalDescription
accountBankingAccountRefNo
amountnumberNoa whole amount from 1 to 1000000000
detailsBankingDetailsYes
ReturnsDescription
booleanok
integer | stringbalanceOrError
Example
local ok, balanceOrError = exports.cobalt_banking:Deposit(
    'CB 1234 5678',
    100,
    { note = 'Vehicle repair', initiator = 'ABC12345' }
)

Withdraw

Server

Refuses when the balance can't cover it.

exports.cobalt_banking:Withdraw(account, amount, details)
ParameterTypeOptionalDescription
accountBankingAccountRefNo
amountnumberNoa whole amount from 1 to 1000000000
detailsBankingDetailsYes
ReturnsDescription
booleanok
integer | stringbalanceOrError
Example
local ok, balanceOrError = exports.cobalt_banking:Withdraw(
    'CB 1234 5678',
    100,
    { note = 'Vehicle repair', initiator = 'ABC12345' }
)

Transfer

Server

Moves money between two accounts in one transaction, without a fee or a permission check; player-initiated transfers go through SendTransfer.

exports.cobalt_banking:Transfer(from, to, amount, details)
ParameterTypeOptionalDescription
fromBankingAccountRefNo
toBankingAccountRefNo
amountnumberNoa whole amount from 1 to 1000000000
detailsBankingTransferDetailsYes
ReturnsDescription
booleanok
integer | stringfromBalanceOrError
Example
local ok, fromBalanceOrError = exports.cobalt_banking:Transfer(
    'CB 1234 5678',
    'CB 8765 4321',
    100,
    { note = 'Rent', initiator = 'ABC12345' }
)

AdjustBalance

Server

Credits or debits an account and logs it to FiveMesh. Refuses a debit the balance can't cover.

exports.cobalt_banking:AdjustBalance(account, delta, details)
ParameterTypeOptionalDescription
accountBankingAccountRefNo
deltanumberNoa whole amount; positive credits, negative debits
detailsBankingDetailsYesinitiator defaults to system
ReturnsDescription
booleanok
integer | stringbalanceOrError
Example
local ok, balanceOrError = exports.cobalt_banking:AdjustBalance(
    'CB 1234 5678',
    -250,
    { note = 'Vehicle repair', initiator = 'ABC12345' }
)

GetNextPayday

Server

When the next paycheck cycle runs. Society orgs pay it from their society account.

exports.cobalt_banking:GetNextPayday()
ReturnsDescription
integerepoch seconds
integerminutes between paydays
Example
local epoch, minutes = exports.cobalt_banking:GetNextPayday()

GetAccessibleAccounts

Server

Accounts the character can see, with their role. Society accounts need the character online.

exports.cobalt_banking:GetAccessibleAccounts(citizenid)
ParameterTypeOptionalDescription
citizenidstringNo
ReturnsDescription
BankingAccessibleAccount[]
Example
local accessibleAccounts = exports.cobalt_banking:GetAccessibleAccounts('ABC12345')

GetStatement

Server

A page of an account's entries with counterparty and initiator names, for a character with any role on it.

exports.cobalt_banking:GetStatement(citizenid, accountId, query)
ParameterTypeOptionalDescription
citizenidstringNo
accountIdBankingAccountIdNo
queryBankingStatementQueryYes
ReturnsDescription
BankingStatementPage | BankingRefusal
Example
local statementPage = exports.cobalt_banking:GetStatement(
    'ABC12345',
    'CB 1234 5678',
    { limit = 20, direction = 'out' }
)

GetStatementEntry

Server

One entry, for a character with any role on its account.

exports.cobalt_banking:GetStatementEntry(citizenid, transactionId)
ParameterTypeOptionalDescription
citizenidstringNo
transactionIdintegerNo
ReturnsDescription
table | BankingRefusal
Example
local statementEntry = exports.cobalt_banking:GetStatementEntry('ABC12345', 1)

FindRecipient

Server

The account behind an account number or citizen ID.

exports.cobalt_banking:FindRecipient(query)
ParameterTypeOptionalDescription
querystringNo
ReturnsDescription
BankingRecipient?
Example
local recipient = exports.cobalt_banking:FindRecipient('CB 8765 4321')

GetRecentRecipients

Server

Other people's accounts the character sent money to, latest first.

exports.cobalt_banking:GetRecentRecipients(citizenid, limit)
ParameterTypeOptionalDescription
citizenidstringNo
limitintegerYesdefault 5
ReturnsDescription
BankingRecipient[]
Example
local recipients = exports.cobalt_banking:GetRecentRecipients('ABC12345', 10)

SendTransfer

Server

Moves money in one transaction with the configured fee, for a character with member or higher on the source. Logs to FiveMesh.

exports.cobalt_banking:SendTransfer(citizenid, request)
ParameterTypeOptionalDescription
citizenidstringNo
requestBankingTransferRequestNo
ReturnsDescription
BankingTransferResult
Example
local transferResult = exports.cobalt_banking:SendTransfer(
    'ABC12345',
    { from = 'CB 1234 5678', to = 'CB 8765 4321', amount = 250, note = 'Rent' }
)

GetAccountMembers

Server

Members of a shared account, or the org roster of a society account.

exports.cobalt_banking:GetAccountMembers(citizenid, accountId)
ParameterTypeOptionalDescription
citizenidstringNo
accountIdBankingAccountIdNo
ReturnsDescription
BankingMemberList | BankingRefusal
Example
local memberList = exports.cobalt_banking:GetAccountMembers('ABC12345', 'CB 1234 5678')

InviteMember

Server

Adds a character to a shared account as member; the caller needs admin or higher.

exports.cobalt_banking:InviteMember(citizenid, accountId, targetCitizenid)
ParameterTypeOptionalDescription
citizenidstringNo
accountIdBankingAccountIdNo
targetCitizenidstringNo
ReturnsDescription
table | BankingRefusal
Example
local result = exports.cobalt_banking:InviteMember('ABC12345', 'CB 1234 5678', 'XYZ67890')

RevokeMember

Server

Removes a member other than the owner from a shared account; the caller needs admin or higher.

exports.cobalt_banking:RevokeMember(citizenid, accountId, targetCitizenid)
ParameterTypeOptionalDescription
citizenidstringNo
accountIdBankingAccountIdNo
targetCitizenidstringNo
ReturnsDescription
table | BankingRefusal
Example
local result = exports.cobalt_banking:RevokeMember('ABC12345', 'CB 1234 5678', 'XYZ67890')

CreateInvoice

Server

Sends a character an invoice that pays into society_<issuer> unless payee says otherwise. Notifies no one.

exports.cobalt_banking:CreateInvoice(invoice)
ParameterTypeOptionalDescription
invoiceBankingInvoiceInputNo
ReturnsDescription
BankingInvoiceResult
Example
local invoiceResult = exports.cobalt_banking:CreateInvoice(
    { issuer = 'ABC12345', citizenid = 'ABC12345', amount = 100 }
)

GetInvoice

Server
exports.cobalt_banking:GetInvoice(id)
ParameterTypeOptionalDescription
idintegerNo
ReturnsDescription
BankingInvoice?
Example
local invoice = exports.cobalt_banking:GetInvoice(1)

GetInvoices

Server

Invoices matching every filter given, newest first. A malformed filter matches nothing.

exports.cobalt_banking:GetInvoices(filter)
ParameterTypeOptionalDescription
filterBankingInvoiceQueryYes
ReturnsDescription
BankingInvoice[]
Example
local invoices = exports.cobalt_banking:GetInvoices({})

GetInvoiceTotals

Server

What's owed, overdue, billed and paid across the invoices matching the filter.

exports.cobalt_banking:GetInvoiceTotals(filter)
ParameterTypeOptionalDescription
filterBankingInvoiceTotalsQueryYes
ReturnsDescription
BankingInvoiceTotals
Example
local invoiceTotals = exports.cobalt_banking:GetInvoiceTotals({})

PayInvoice

Server

Pays an unpaid invoice into its payee in one transaction, as bill_paid and bill_received statement entries with the receipt INV-<id>. Logs to FiveMesh and triggers the server event cobalt_banking:invoicePaid with the paid BankingInvoice and its BankingInvoicePaidWith.

exports.cobalt_banking:PayInvoice(id, payment)
ParameterTypeOptionalDescription
idintegerNo
paymentBankingInvoicePaymentYes
ReturnsDescription
BankingInvoiceResult
Example
local invoiceResult = exports.cobalt_banking:PayInvoice(1, {})

DeclineInvoice

Server

Records that the payer turned an unpaid invoice down; it stays unpaid with declinedAt set.

exports.cobalt_banking:DeclineInvoice(id)
ParameterTypeOptionalDescription
idintegerNo
ReturnsDescription
BankingInvoiceResult
Example
local invoiceResult = exports.cobalt_banking:DeclineInvoice(1)

VoidInvoice

Server

Cancels an unpaid invoice.

exports.cobalt_banking:VoidInvoice(id, reason)
ParameterTypeOptionalDescription
idintegerNo
reasonstringNoup to 255 characters
ReturnsDescription
BankingInvoiceResult
Example
local invoiceResult = exports.cobalt_banking:VoidInvoice(1, 'Parking in a red zone')

FindNearestCashPoint

Client

The closest streamed-in ATM or bank branch to the player.

exports.cobalt_banking:FindNearestCashPoint()
ReturnsDescription
BankingCashPointView?
Example
local cashPointView = exports.cobalt_banking:FindNearestCashPoint()

On this page