Browse docs

Currency

Currency formatting on both sides and authoritative balance operations on the server.

Formatting — client and server

ExportReturns
FormatCurrency(value, formatter)Formatted string using the named formatter
GetCurrencyFormatter(formatter)Formatter configuration table
GetCurrencyNuiConfig()NUI-safe configuration: defaultFormatter, defaultCurrency, formatters, currencies
GetDefaultCurrency()Default currency name
FormatCurrencyAmount(value, currency, symbol?)Formatted string using the currency's formatter; optional display-symbol override
local currency = exports["sky_base"]:GetDefaultCurrency()
local label = exports["sky_base"]:FormatCurrencyAmount(1250, currency)

Formatting changes the display only. It does not transfer money or select a society account.

Player balances — server only

ExportReturns
GetCurrencyBalance(source, currency)Numeric balance
HasCurrency(source, currency, amount)Boolean
AddCurrency(source, currency, amount)Boolean success
RemoveCurrency(source, currency, amount)Boolean success

source is the player's server ID. currency identifies a configured currency. Your server integration must authorize the operation and determine the amount itself.

server.lua
local currency = exports["sky_base"]:GetDefaultCurrency()
local paid = exports["sky_base"]:RemoveCurrency(playerId, currency, 100)
if not paid then
    print("Payment was not completed")
end

Use the configured currency for your server. For shared job accounts use Jobs Base society money; for invoices use Sky Billing.