Python Requires Chilkat v11.7.0+
Python
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 Python Downloads
import sys
import chilkat2
success = False
# Requires an unlocked Chilkat bundle. See Global Unlock Sample.
# Supply a restricted sandbox key from merchant-controlled configuration.
apiKey = "YOUR_STRIPE_TEST_KEY"
curl = chilkat2.HttpCurl()
cmd = chilkat2.StringBuilder()
json = chilkat2.JsonObject()
# 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):
print("No HTTP response. Chilkat failure code: " + str(curl.FailReason))
sys.exit()
success = curl.GetResponseJson(json)
if ((curl.StatusCode != 200) or (success != True)):
print("Stripe HTTP " + str(curl.StatusCode) + " Request-Id: " + curl.GetResponseHeaderField("Request-Id"))
if (success == True):
print(json.StringOf("error.message"))
sys.exit()
# Amounts are integer minor units. Read them as text to preserve large balances.
availableIndex = 0
while (availableIndex < json.SizeOfArray("available")) :
json.I = availableIndex
print("available: " + json.StringOf("available[i].amount") + " " + json.StringOf("available[i].currency"))
availableIndex = availableIndex + 1
pendingIndex = 0
while (pendingIndex < json.SizeOfArray("pending")) :
json.I = pendingIndex
print("pending: " + json.StringOf("pending[i].amount") + " " + json.StringOf("pending[i].currency"))
pendingIndex = pendingIndex + 1