Outputting balances to your end user

To show your end user their crypto balance you'll need to use the Get Wallet endpoint and the Get exchange rates endpoint.

You'll request the balance of the wallet on the Get Wallet endpoint:

curl --request GET \
     --url https://api.sandbox.bvnk.com/api/wallet/255861 \
     --header 'Accept: application/json' \
     --header 'Authorization: Hawk id="B9jnE1U8eLblzHtNeJZRxfcq03CQKcmcP9FOrACMzXb1HfrxrePWsTfuP70JNns9", ts="1633010032", nonce="guGXrD", mac="uKeg+w1qXqzaF/8mOQGv8Y9IlRxyxTT+iINLe03EQ60="'

and the response will contain an availableBalance:

{
  "id": 313675,
  "description": "customer123",
  "currency": {
    "id": 1773,
    "code": "ETH",
    "fiat": true,
    "icon": null,
    "name": "Ethereum",
    "withdrawalParameters": [],
    "options": {},
    "withdrawalFee": 0.4,
    "depositFee": 0,
    "supportsDeposits": true,
    "supportsWithdrawals": true,
    "quantityPrecision": 2,
    "pricePrecision": 2,
    "protocols": []
  },
  "supportsWithdrawals": true,
  "supportsDeposits": true,
  "custodianWallet": false,
  "protocol": ERC20,
  "address": "0xEa61651823dEc1027565AFB908A0c5C06662cdBf",
  "lookup": null,
  "balance": 0,
  "available": 0,
  "withdrawalFee": 0,
  "depositFee": 0,
  "alternatives": null,
  "approxAvailable": "1",
  "approxBalance": "1"
}

You'll next use the exchange end point to convert that balance into a fiat balance to display to your end user with real time mid-market rates:

curl --request GET \
     --url 'https://api.sandbox.bvnk.com/api/currency/convert/ETH/USD?amount=1' \
     --header 'Accept: application/json'

You can find more about this endpoint in the API reference for Get exchange rates.


Did this page help you?