Sample code for 30+ languages & platforms
C# Requires Chilkat v11.7.0+

Stripe: Show available and pending balances by currency

See more Stripe Examples

Read the available and pending account balances for every currency returned by Stripe.

Stripe documentation and cURL example

Chilkat C# Downloads

C#
bool success = false;

//  Requires an unlocked Chilkat bundle. See Global Unlock Sample.
//  Supply a restricted sandbox key from merchant-controlled configuration.
string apiKey = "YOUR_STRIPE_TEST_KEY";

Chilkat.HttpCurl curl = new Chilkat.HttpCurl();
Chilkat.StringBuilder cmd = new Chilkat.StringBuilder();
Chilkat.JsonObject json = new Chilkat.JsonObject();

int replaced;

//  curl -X GET "https://api.stripe.com/v1/balance" \
//    -u "$STRIPE_API_KEY:" \
//    -H "Stripe-Version: 2026-10-28.endive"
cmd.SetString("curl -X GET \"https://api.stripe.com/v1/balance\"");
cmd.Append(" -u \"@KEY@:\"");
cmd.Append(" -H \"Stripe-Version: 2026-10-28.endive\"");
replaced = cmd.Replace("@KEY@",apiKey);
success = curl.DoYourThing(cmd.GetAsString());
if (success != true) {
    Debug.WriteLine("No HTTP response. Chilkat failure code: " + Convert.ToString(curl.FailReason));
    return;
}

success = curl.GetResponseJson(json);
if ((curl.StatusCode != 200) || (success != true)) {
    Debug.WriteLine("Stripe HTTP " + Convert.ToString(curl.StatusCode) + "  Request-Id: " + curl.GetResponseHeaderField("Request-Id"));
    if (success == true) {
        Debug.WriteLine(json.StringOf("error.message"));
    }

    return;
}

//  Amounts are integer minor units. Read them as text to preserve large balances.

int availableIndex = 0;
while ((availableIndex < json.SizeOfArray("available"))) {
    json.I = availableIndex;
    Debug.WriteLine("available: " + json.StringOf("available[i].amount") + " " + json.StringOf("available[i].currency"));
    availableIndex = availableIndex + 1;
}

int pendingIndex = 0;
while ((pendingIndex < json.SizeOfArray("pending"))) {
    json.I = pendingIndex;
    Debug.WriteLine("pending: " + json.StringOf("pending[i].amount") + " " + json.StringOf("pending[i].currency"));
    pendingIndex = pendingIndex + 1;
}