Tutorial: View user account wallets

In this tutorial, you view the wallets that are associated with each user account.

Allow about 10 minutes to complete this tutorial.

An account's wallets are the visible portion of the ledgers that track the tokens and fiat currency that move in and out of a user's account.

API operations in this tutorial

Tutorial interaction API operation used Scope Environment variables initialized
Get wallet info Get wallets by account read_wallets payers_wallet_id
recipients_wallet_id
creators_wallet_id
View wallet balances Get wallet balances read_wallets None

To complete this tutorial

This tutorial uses the _Manage user accounts collection from the shared workspace.

To complete this tutorial successfully:

  1. Make sure the software described in Get started with the tutorials has been installed on your system and configured.
  2. Complete Manage new user accounts , if you haven't already. The exercises in this tutorial use the user accounts that you create in that tutorial.
  3. In Postman:
    1. Open the Tilia tutorial workspace you created in Get started with the tutorials for this tutorial.
    2. Make sure you have the _Manage user accounts collection forked to your Tilia tutorial workspace .
    3. Make sure that you've selected the Tilia Client Info environment and confirmed that it has:
      1. Your Tilia developer credentials.
      2. The usernames, emails, and account IDs for your users: payer, recipient, and creator.
    4. In your Tilia tutorial workspace , open the list of Collections .
    5. In the list of Collections , expand the _Manage user accounts collection.
    6. If it's been more than an hour since you last got an access token for this collection, get a new one as described in Tutorial: User accounts overview , and then return to continue here.

Get wallet info

The requests in the Get wallet info folder demonstrate how to get information about a user's wallets. These requests also save the wallet ID of the user's wallet in environment variables for use in future transactions and include:

  • Get payer's wallets
  • Get recipient's wallets
  • Get creator's wallets

The requests are identical with the exception of the account ID, which is specific to the user.

Repeat this procedure for each user request in the Get wallet info folder.

For each user account to get wallet info from, in Postman:

  1. In the _Manage user accounts collection, in the Get wallet info folder, open the request for the user.
  2. In the URL field of this request, notice that the account ID field uses the user's account ID environment variable.
  3. In the request, choose Send .
  4. After the response returns, below the request, open the response Body tab to review the response body details.
  5. In the response body, in the payload , review the wallets' properties.
Show a typical response body with the properties of the wallets.
Copy
Copied
{
    "status": "Success",
    "message": [],
    "codes": [],
    "payload": {
        "wallets": {
            "2c6be416-5949-4f6b-9ec3-86a9a02c2f08": {
                "wallet_id": "2c6be416-5949-4f6b-9ec3-86a9a02c2f08",
                "description": "Convertible TIL wallet",
                "account_id": "acct_2ZB8jw5SS0NATzMDvn7NcG4XtVT",
                "currency": "TIL",
                "current_balance": 0,
                "active": true,
                "tags": [
                    "virtual",
                    "publisher_funds",
                    "convertible"
                ],
                "integrator": "tilia-test",
                "created": "2023-12-06T17:37:30.475632Z",
                "updated": "2023-12-06T17:37:30.475632Z"
            },
            "485d68b6-97a4-4d64-89ff-508c6a9df9b0": {
                "wallet_id": "485d68b6-97a4-4d64-89ff-508c6a9df9b0",
                "description": "Standard TIL wallet",
                "account_id": "acct_2ZB8jw5SS0NATzMDvn7NcG4XtVT",
                "currency": "TIL",
                "current_balance": 0,
                "active": true,
                "tags": [
                    "virtual",
                    "standard"
                ],
                "integrator": "tilia-test",
                "created": "2023-12-06T17:37:30.475632Z",
                "updated": "2023-12-06T17:37:30.475632Z"
            },
            "8251c4e0-2f7a-4bce-9978-e1371eb68656": {
                "wallet_id": "8251c4e0-2f7a-4bce-9978-e1371eb68656",
                "description": "Default USD Wallet",
                "account_id": "acct_2ZB8jw5SS0NATzMDvn7NcG4XtVT",
                "currency": "USD",
                "current_balance": 0,
                "active": true,
                "tags": [
                    "registration",
                    "publisher_funds"
                ],
                "integrator": "tilia-test",
                "created": "2023-12-06T17:37:30.475632Z",
                "updated": "2023-12-06T17:37:30.475632Z"
            }
        },
        "count": 3,
        "total": 3
    }
}

The response body that shows the wallets contain the current_balance property, which has the balance of the wallet. If you ran this request for the payer after buying tokens, the token balance should be reported in one of the wallet objects.

The response body contains a lot of different information about the wallets, such as the wallet's wallet_id property. If you need only the wallet balances and nothing else about a user's wallets, the next exercise demonstrates how to do that.

View wallet balances

The requests in this folder demonstrate how to get the balances of a user's wallets. These requests display the wallet balances and don't save any data. They include:

  • Get payer's wallet balances
  • Get recipient's wallet balances
  • Get creator's wallet balances

The requests are identical with the exception of the account ID, which is specific to the user.

Repeat this procedure for each user request in the Get wallet balances folder.

For each user to get only their wallet balances, in Postman:

  1. In the _Manage user accounts collection, open the Get wallet balances folder.
  2. Open the request for the user whose wallet balances you want to get.
  3. In the URL field of this request, notice that the account ID field uses the user's account ID environment variable.
  4. In the request, choose Send .
  5. After the response returns, open the response Body tab below the request to review the response body details.
  6. In the response body, in the Payload , review the wallets balances.

A typical response body looks like the following.

Copy
Copied
{
    "status": "Success",
    "message": [],
    "codes": [],
    "payload": {
        "account_id": "acct_2ZB8jw5SS0NATzMDvn7NcG4XtVT",
        "balances": {
            "TIL": {
                "spendable": {
                    "balance": 0,
                    "display": "TIL 0.00"
                },
                "convertible": {
                    "balance": 0,
                    "display": "TIL 0.00"
                }
            },
            "USD": {
                "spendable": {
                    "balance": 0,
                    "display": "$0.00"
                }
            }
        }
    }
}

The response body that shows the wallets' balances. If you ran this request for the payer after buying tokens, the token balance should be reported in the spendable wallet object.

Next steps

After you call the requests in the Get wallet info folder to initialize the environment variables, you can return to the folders in this tutorial to review the wallet balances before and after transactions. This can help you visualize how the different transactions affect the balances of accounts included in a transaction.

Before you're ready to start making transactions, however, there is one more tutorial to complete: Manage user account TOS and KYC