/stripe-guides

How to check Stripe account balance?

Learn how to check your Stripe account balance using the Dashboard, API, and code examples in Node.js, Python, PHP, Ruby, Java, and .NET. Secure, step-by-step guide.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to check Stripe account balance?

How to Check Your Stripe Account Balance: A Comprehensive Guide

 

In this tutorial, I'll show you several methods to check your Stripe account balance, including using the Stripe Dashboard, API, and various programming languages.

 

Step 1: Checking Balance via Stripe Dashboard

 

The simplest way to check your Stripe balance is through the web dashboard:

  1. Navigate to the Stripe Dashboard (https://dashboard.stripe.com)
  2. Log in with your credentials
  3. On the dashboard homepage, you'll see your available balance displayed prominently
  4. For more detailed information, click on "Balance" in the left sidebar
  5. Here you'll find:
    • Available balance (funds ready to be paid out)
    • Pending balance (funds being processed)
    • Reserved balance (funds held for potential disputes)
    • Breakdown by currency

 

Step 2: Using the Stripe API Directly

 

You can retrieve your balance using Stripe's REST API:

curl https://api.stripe.com/v1/balance \\
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY"

Replace sk_test_YOUR_SECRET_KEY with your actual Stripe secret key. Remember never to expose your secret key in client-side code.

 

Step 3: Checking Balance with Node.js

 

To check your Stripe balance using Node.js:

First, install the Stripe package:

npm install stripe

Then use the following code:

const stripe = require('stripe')('sk_test_YOUR_SECRET_KEY');

async function checkBalance() {
  try {
    const balance = await stripe.balance.retrieve();
    console.log('Available balance:', balance.available);
    console.log('Pending balance:', balance.pending);
    
    // For a detailed breakdown by currency
    balance.available.forEach(balanceItem => {
      console.log(`Available in ${balanceItem.currency}: ${balanceItem.amount / 100} ${balanceItem.currency.toUpperCase()}`);
    });
    
    return balance;
  } catch (error) {
    console.error('Error retrieving balance:', error);
  }
}

checkBalance();

 

Step 4: Checking Balance with Python

 

For Python, install the Stripe library first:

pip install stripe

Then use this code:

import stripe

# Set your API key
stripe.api_key = "sk_test_YOUR_SECRET\_KEY"

def check\_balance():
    try:
        balance = stripe.Balance.retrieve()
        
        print("Available balance:")
        for balance\_item in balance.available:
            print(f"{balance_item.amount / 100} {balance_item.currency.upper()}")
            
        print("\nPending balance:")
        for balance\_item in balance.pending:
            print(f"{balance_item.amount / 100} {balance_item.currency.upper()}")
            
        return balance
    except Exception as e:
        print(f"Error retrieving balance: {str(e)}")
        
if **name** == "**main**":
    check\_balance()

 

Step 5: Checking Balance with PHP

 

For PHP, first install the Stripe library:

composer require stripe/stripe-php

Then use this code:

available as $balanceItem) {
        $amount = $balanceItem->amount / 100;
        $currency = strtoupper($balanceItem->currency);
        echo "$amount $currency\n";
    }
    
    echo "\nPending balance:\n";
    foreach ($balance->pending as $balanceItem) {
        $amount = $balanceItem->amount / 100;
        $currency = strtoupper($balanceItem->currency);
        echo "$amount $currency\n";
    }
    
} catch (\Stripe\Exception\ApiErrorException $e) {
    echo "Error retrieving balance: " . $e->getMessage();
}

 

Step 6: Checking Balance with Ruby

 

For Ruby, install the Stripe gem:

gem install stripe

Then use this code:

require 'stripe'
Stripe.api_key = 'sk_test_YOUR_SECRET\_KEY'

begin
  balance = Stripe::Balance.retrieve
  
  puts "Available balance:"
  balance.available.each do |balance\_item|
    puts "#{balance_item.amount / 100.0} #{balance_item.currency.upcase}"
  end
  
  puts "\nPending balance:"
  balance.pending.each do |balance\_item|
    puts "#{balance_item.amount / 100.0} #{balance_item.currency.upcase}"
  end
  
rescue Stripe::StripeError => e
  puts "Error retrieving balance: #{e.message}"
end

 

Step 7: Checking Balance with Java

 

For Java, add the Stripe dependency to your project:

For Maven:


  com.stripe
  stripe-java
  22.9.0

For Gradle:

implementation 'com.stripe:stripe-java:22.9.0'

Then use this code:

import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.model.Balance;

public class CheckStripeBalance {
    public static void main(String[] args) {
        Stripe.apiKey = "sk_test_YOUR_SECRET_KEY";
        
        try {
            Balance balance = Balance.retrieve();
            
            System.out.println("Available balance:");
            balance.getAvailable().forEach(balanceItem -> {
                double amount = balanceItem.getAmount() / 100.0;
                String currency = balanceItem.getCurrency().toUpperCase();
                System.out.printf("%.2f %s%n", amount, currency);
            });
            
            System.out.println("\nPending balance:");
            balance.getPending().forEach(balanceItem -> {
                double amount = balanceItem.getAmount() / 100.0;
                String currency = balanceItem.getCurrency().toUpperCase();
                System.out.printf("%.2f %s%n", amount, currency);
            });
            
        } catch (StripeException e) {
            System.out.println("Error retrieving balance: " + e.getMessage());
        }
    }
}

 

Step 8: Checking Balance with .NET/C#

 

For .NET, install the Stripe.net NuGet package:

Install-Package Stripe.net

Then use this code:

using Stripe;
using System;

class Program
{
    static void Main()
    {
        StripeConfiguration.ApiKey = "sk_test_YOUR_SECRET_KEY";
        
        try
        {
            var balanceService = new BalanceService();
            var balance = balanceService.Get();
            
            Console.WriteLine("Available balance:");
            foreach (var balanceItem in balance.Available)
            {
                decimal amount = balanceItem.Amount / 100m;
                string currency = balanceItem.Currency.ToUpper();
                Console.WriteLine($"{amount} {currency}");
            }
            
            Console.WriteLine("\nPending balance:");
            foreach (var balanceItem in balance.Pending)
            {
                decimal amount = balanceItem.Amount / 100m;
                string currency = balanceItem.Currency.ToUpper();
                Console.WriteLine($"{amount} {currency}");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error retrieving balance: {ex.Message}");
        }
    }
}

 

Step 9: Understanding the Balance Response

 

Regardless of which method you use, the balance response will contain these key components:

  • available: Funds that are available to be paid out
  • pending: Funds that are being processed and not yet available
  • connect\_reserved: For Connect accounts, funds held in reserve

Each of these contains an array of objects with:

  • amount: The amount in the smallest currency unit (e.g., cents for USD)
  • currency: The three-letter ISO currency code
  • source\_types: Breakdown of balance by source (card, bank transfer, etc.)

 

Step 10: Implementing Automated Balance Checks

 

For ongoing monitoring, you might want to automate balance checks. Here's a simple Node.js implementation that checks your balance daily and sends an email notification:

const stripe = require('stripe')('sk_test_YOUR_SECRET_KEY');
const nodemailer = require('nodemailer');

// First, install nodemailer: npm install nodemailer

const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: '[email protected]',
    pass: 'your-app-password'
  }
});

async function checkAndNotifyBalance() {
  try {
    const balance = await stripe.balance.retrieve();
    
    // Format the balance for email
    let emailContent = 'Stripe Balance Report:\n\n';
    
    emailContent += 'Available Balance:\n';
    balance.available.forEach(item => {
      emailContent += `${(item.amount / 100).toFixed(2)} ${item.currency.toUpperCase()}\n`;
    });
    
    emailContent += '\nPending Balance:\n';
    balance.pending.forEach(item => {
      emailContent += `${(item.amount / 100).toFixed(2)} ${item.currency.toUpperCase()}\n`;
    });
    
    // Send email
    await transporter.sendMail({
      from: '[email protected]',
      to: '[email protected]',
      subject: 'Daily Stripe Balance Report',
      text: emailContent
    });
    
    console.log('Balance check completed and email sent');
  } catch (error) {
    console.error('Error in balance check:', error);
  }
}

// Run daily at 9:00 AM
const scheduleBalanceCheck = () => {
  const now = new Date();
  const scheduledTime = new Date(
    now.getFullYear(),
    now.getMonth(),
    now.getDate(),
    9, 0, 0 // 9:00:00 AM
  );
  
  // If it's already past 9 AM, schedule for tomorrow
  if (now > scheduledTime) {
    scheduledTime.setDate(scheduledTime.getDate() + 1);
  }
  
  const timeUntilRun = scheduledTime.getTime() - now.getTime();
  
  // Schedule the first run
  setTimeout(() => {
    checkAndNotifyBalance();
    // Then schedule it to run daily
    setInterval(checkAndNotifyBalance, 24 _ 60 _ 60 \* 1000);
  }, timeUntilRun);
}

scheduleBalanceCheck();

 

Conclusion

 

Checking your Stripe balance is essential for financial management. Whether you prefer the visual dashboard or API-based solutions, Stripe provides multiple ways to monitor your funds. Remember to keep your secret API keys secure and never expose them in client-side code.

For production environments, consider implementing proper error handling, logging, and security measures when accessing your Stripe account programmatically.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022