Skip to main content

Balances

Balances are global and apply to every Wallet. When a new Balance is created, it is immediately available to all Wallets with an initial amount of 0 if not otherwise specified.

The Balance Object


id string

A slug of the balance or some other unique identifier. Used to easily reference the balance.

Examples: "cash", "pendingCash", "credits", "goldCoins", "gems". Must be unique.


name string

The name of the balance for display purposes.

Examples: "Cash", "Pending Cash", "Credits", "Gold Coins", or "Gems". Must be unique.


currencyCode enum

An ISO 4217 ↗ or custom code. Custom codes must not be an ISO 4217 code.


initialAmount string

The initial amount set for all wallets. (Default: 0)


createdAt string

ISO 8601


updatedAt string

ISO 8601

Create a Balance

let balance = await solidtx.balances.create({
id: 'gems',
name: 'Gems',
currencyCode: 'GEM',
initialAmount: '1000'
})

Parameters


id stringRequired
A slug of the balance or some other unique identifier

name stringRequired
A name to more easily identify the wallet

currencyCode stringRequired

The currency code for the balance.


initialAmount string

An initial amount to set for all wallets. (Default: 0)

Returns

Creates and returns a new Balance object.

{
"id": "gems",
"name": "Gems",
"currencyCode": "GEM",
"initialAmount": "1000"
}

Get a Balance

let balance = await solidtx.balances.get('gems')

Parameters

No Parameters

Returns

Returns the Balance object.

{
"id": "gems",
"name": "Gems",
"currencyCode": "GEM",
"initialAmount": "1000"
}

Update a Balance

let balance = await solidtx.balances.update({
id: 'gems',
initialAmount: '1000'
})

Parameters


id stringRequired

initialAmount string

The amount new Wallets will receive

Returns

Returns the Balance object.

{
"id": "gems",
"name": "Gems",
"currencyCode": "GEM",
"initialAmount": "1000"
}