Skip to content
On this page

Balance API

EndpointMethodDescription
balance:getTransactionswebsocketGet balance transactions
balance:getTokenActionwebsocketGet token action
balance:getTokenActionListwebsocketGet token action list
balance:donateTokenwebsocketDonate token
balance:addUserBalanceByAdminwebsocketAdd user balance by admin
balance:getCurrencyExchangeRatewebsocketGet currency exchange rate
balance:getProductSubscriptionOptionswebsocketGet product subscription options
balance:createRoomSubscriptionwebsocketCreate room subscription
balance:expireRoomSubscriptionwebsocketExpire room subscription
user:balancewebsocketEventUser balance event

Get balance transactions

Method: websocket

Endpoint: balance:getTransactions

Request:

{ empty }

Response:

{
    "data": {
        "transactions": {
            "spending": map[string]float
            "mining": map[string]float
            "buying": map[string]float
        }
    }
    "error": { "status": bool, "code": int, "message": string }
}

Get token action

Method: websocket

Endpoint: balance:getTokenAction

Request:

{
    "data": {
        "action": string
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "actions": {
            "type": string  // token type, one of mining / spending / buying
            "action": string
            "token": float
            "price": float
            "category": string  // token category, one of event / product / subscription
            "description": string
        }
        "actionName": string
    }
    "error": { "status": bool, "code": int, "message": string }
}

Get token action list

Method: websocket

Endpoint: balance:getTokenActionList

Request:

{ empty }

Response:

{
    "data": {
        "actions": [{
            "type": string  // token type, one of mining / spending / buying
            "action": string
            "token": float
            "price": float
            "category": string  // token category, one of event / product / subscription
            "description": string
        }]
    }
    "error": { "status": bool, "code": int, "message": string }
}

Method: websocket

Endpoint: balance:donateToken

Request:

{
    "data": {
        "targetUser": string
        "token": float
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "error": { "status": bool, "code": int, "message": string }
}

Add user balance by admin

Method: websocket

Endpoint: balance:addUserBalanceByAdmin

Description: Api is available only for admin users. Balance could also be withdrawn if amount is provided with negative value.

Request:

{
    "data": {
        "targetUser": string
        "amount": float
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "error": { "status": bool, "code": int, "message": string }
}

Get currency exchange rate

Method: websocket

Endpoint: balance:getCurrencyExchangeRate

Request:

{
    "data": {
        "currency": string  // rents/roomi/valu
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "currencyExchangeRate": float
    }
    "error": { "status": bool, "code": int, "message": string }
}

Get product subscription options

Method: websocket

Endpoint: balance:getProductSubscriptionOptions

Description: Api returns subscription options for product. If request contains non default currency, endpoint will return corresponding altPrice and altCurrency in result. Currency could be one of: roomi (Roomful crypto currency), Valu (ValuVerse crypto currency).

Request:

{
    "data": {
        "productType": string  // type of target product (room/styleAsset)
        "productId": string  // id of target product (e.g. roomId, assetId)
        "currency": string  // rents/roomi
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "subscriptionOptions": [{
            "plan": string  // free/one_time_payment/subscription_week/subscription_month/subscription_6_months/subscription_year
            "price": float  // price in valuverse tokens (rents)
            "altCurrency": string  // alternative currency, if provided (e.g. roomi)
            "altPrice": float  // price in alternative currency
        }]
        "altCurrencyExchangeRate": float
    }
    "error": { "status": bool, "code": int, "message": string }
}

Create room subscription

Method: websocket

Endpoint: balance:createRoomSubscription

Request:

{
    "data": {
        "roomId": string
        "subscriptionPlan": string  // free/one_time_payment/subscription_week/subscription_month/subscription_6_months/subscription_year
        "walletAddress": string  // wallet address (in case of crypto currency payment)
        "currency": string  // rents (default) / roomi (Roomful crypto currency) / Valu (ValuVerse crypto currency)
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "error": { "status": bool, "code": int, "message": string }
}

Expire room subscription

Method: websocket

Endpoint: balance:expireRoomSubscription

Description: Api is available only for network admin users

Request:

{
    "data": {
        "roomId": string
        "subscriptionPlan": string  // free/one_time_payment/subscription_week/subscription_month/subscription_6_months/subscription_year
        "walletAddress": string  // wallet address (in case of crypto currency payment)
        "currency": string  // rents (default) / roomi (Roomful crypto currency) / Valu (ValuVerse crypto currency)
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "error": { "status": bool, "code": int, "message": string }
}

User balance event

Event: user:balance

Data:

{
    "data": {
        "token": float
        "transactions": {  // Deprecated
            "spending": map[string]float
            "mining": map[string]float
            "buying": map[string]float
        }
    }
    "error": { "status": bool, "code": int, "message": string }
}