4 min read

Documentation for the getBalance Logic

Purpose

This node serves as a bridge between the Vantage platform and the Stripe API, allowing users to retrieve the current balance of their Stripe account. This is essential for businesses that require real-time insights into their financial status, enabling them to make informed decisions regarding cash flow and operational management.

Settings

The node accepts several settings that determine how the integration behaves. Below are the detailed explanations for each setting:

  1. inputs

    • Input Type: Object
    • Description: This setting contains the input parameters necessary for the function to operate. These inputs may include information such as account identifiers or authentication tokens.
    • Effect of Change: Modifying the input parameters can alter the behavior of the logic, including which Stripe account's balance is queried. Incorrect or incomplete inputs may lead to failed calls or erroneous results.
    • Default Value: N/A (the specific structure and required fields within the inputs object would be dependent on the implementation context).
  2. config

    • Input Type: Object
    • Description: This configuration object may hold additional settings for connection, timeout thresholds, or request formatting.
    • Effect of Change: Changes to this configuration can affect the stability and responsiveness of the logic. For instance, increasing the timeout can prevent premature failures if the Stripe API is slow to respond.
    • Default Value: N/A (the specific fields would depend on the implementation context).
  3. context

    • Input Type: Object (optional)
    • Description: This provides context for the execution environment, which may contain authentication credentials or environment-specific settings (e.g., development vs. production).
    • Effect of Change: Adjusting this object can enable or restrict access to certain Stripe accounts or affect operational parameters. Incomplete or incorrect context information could lead to authorization issues.
    • Default Value: An empty object {} if no context is provided.

How It Works

The node is an asynchronous method that performs the following operations:

  1. Builds the Stripe Connection: The function invokes the integration connection with the 'stripe' integration type and the execution context. This step establishes a connection to the Stripe API, ensuring that the logic can interact with the user's Stripe account effectively.

  2. Retrieves Balance Data: Once the connection is successfully established, it calls the getBalance method from the Stripe integration. This method fetches the current balance data from the user's Stripe account.

  3. Returns the Output: If the balance retrieval is successful, the function returns the output in an object with the key output1. If any error occurs during these processes, the function catches the error and returns a structured error message indicating an internal error.

Data Expectations

The node is expected to receive the following data:

Use Cases & Examples

Use Cases

  1. Financial Monitoring: Businesses can use getBalance to create dashboards that provide real-time insights into their Stripe account balance, essential for financial health monitoring.

  2. Automated Alerts: Using this function, companies can set up automated alerts that notify stakeholders when the balance drops below a certain threshold, enabling proactive cash flow management.

  3. Integration with Accounting Software: This function can be part of a workflow where balance information is sent to accounting software, ensuring that revenue tracking is always up-to-date and accurate.

Example Configuration

Use Case: Financial Monitoring Dashboard

To set up the node for a financial monitoring dashboard, the user would configure the inputs and context as follows:

json
{
  "inputs": {
    "accountId": "acct_1GqjNE2eZvKYlo2C" 
  },
  "config": {
    "queryType": "current_balance"
  },
  "context": {
    "apiKey": "your-stripe-api-key",   
    "environment": "production"
  }
}

In this configuration:

This setup allows the dashboard to continuously monitor and display the user's balance in real-time, contributing to informed financial decision-making.