Get balance

Retrieving User Balance

The Clinch SDK requires you to provide the user's current balance for display within the Clinch web app. You can do this by using the getBalance callback function, which should return the user's balance and currency when requested by the iframe.

Implementing the getBalance Callback

The getBalance function should retrieve the user's balance from your system and return it to the Clinch web app.

Here’s an example which returns $1.00:

  function async getBalance() {
    return {
      balance: 100,
      currency: "cents", // Must be either - sats, btc, or cents (USD)
    };
  }