Go Requires Chilkat v11.7.0+
Go
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 Go Downloads
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 := chilkat.NewHttpCurl()
cmd := chilkat.NewStringBuilder()
json := chilkat.NewJsonObject()
var replaced int
// 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 {
fmt.Println("No HTTP response. Chilkat failure code: ", curl.FailReason())
curl.DisposeHttpCurl()
cmd.DisposeStringBuilder()
json.DisposeJsonObject()
return
}
success = curl.GetResponseJson(json)
if (curl.StatusCode() != 200) || (success != true) {
fmt.Println("Stripe HTTP ", curl.StatusCode(), " Request-Id: ", *curl.GetResponseHeaderField("Request-Id"))
if success == true {
fmt.Println(*json.StringOf("error.message"))
}
curl.DisposeHttpCurl()
cmd.DisposeStringBuilder()
json.DisposeJsonObject()
return
}
// Amounts are integer minor units. Read them as text to preserve large balances.
availableIndex := 0
for (availableIndex < json.SizeOfArray("available")) {
json.SetI(availableIndex)
fmt.Println("available: ", *json.StringOf("available[i].amount"), " ", *json.StringOf("available[i].currency"))
availableIndex = availableIndex + 1
}
pendingIndex := 0
for (pendingIndex < json.SizeOfArray("pending")) {
json.SetI(pendingIndex)
fmt.Println("pending: ", *json.StringOf("pending[i].amount"), " ", *json.StringOf("pending[i].currency"))
pendingIndex = pendingIndex + 1
}
curl.DisposeHttpCurl()
cmd.DisposeStringBuilder()
json.DisposeJsonObject()