Retrieves the current account balance, based on the authentication that was used to make the request.
curl https://api.stripe.com/v1/balance \
-u STRIPE_SECRET_KEY:
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkRest rest = new CkRest();
boolean success;
// URL: https://api.stripe.com/v1/balance
boolean bTls = true;
int port = 443;
boolean bAutoReconnect = true;
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect);
if (success != true) {
System.out.println("ConnectFailReason: " + rest.get_ConnectFailReason());
System.out.println(rest.lastErrorText());
return;
}
rest.SetAuthBasic("STRIPE_SECRET_KEY","");
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = rest.FullRequestNoBodySb("GET","/v1/balance",sbResponseBody);
if (success != true) {
System.out.println(rest.lastErrorText());
return;
}
CkJsonObject jsonResponse = new CkJsonObject();
jsonResponse.LoadSb(sbResponseBody);
String object;
boolean livemode;
int i;
int count_i;
String currency;
int amount;
int source_typesCard;
object = jsonResponse.stringOf("object");
livemode = jsonResponse.BoolOf("livemode");
i = 0;
count_i = jsonResponse.SizeOfArray("available");
while (i < count_i) {
jsonResponse.put_I(i);
currency = jsonResponse.stringOf("available[i].currency");
amount = jsonResponse.IntOf("available[i].amount");
source_typesCard = jsonResponse.IntOf("available[i].source_types.card");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("pending");
while (i < count_i) {
jsonResponse.put_I(i);
currency = jsonResponse.stringOf("pending[i].currency");
amount = jsonResponse.IntOf("pending[i].amount");
source_typesCard = jsonResponse.IntOf("pending[i].source_types.card");
i = i+1;
}
}
}
{
"object": "balance",
"available": [
{
"currency": "usd",
"amount": 0,
"source_types": {
"card": 0
}
}
],
"livemode": false,
"pending": [
{
"currency": "usd",
"amount": 0,
"source_types": {
"card": 0
}
}
]
}