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:
var
rest: TChilkatRest;
success: Integer;
bTls: Integer;
port: Integer;
bAutoReconnect: Integer;
sbResponseBody: TChilkatStringBuilder;
jsonResponse: TChilkatJsonObject;
object: WideString;
livemode: Integer;
i: Integer;
count_i: Integer;
currency: WideString;
amount: Integer;
source_typesCard: Integer;
begin
rest := TChilkatRest.Create(Self);
// URL: https://api.stripe.com/v1/balance
bTls := 1;
port := 443;
bAutoReconnect := 1;
success := rest.Connect('api.stripe.com',port,bTls,bAutoReconnect);
if (success <> 1) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(rest.ConnectFailReason));
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
rest.SetAuthBasic('STRIPE_SECRET_KEY','');
sbResponseBody := TChilkatStringBuilder.Create(Self);
success := rest.FullRequestNoBodySb('GET','/v1/balance',sbResponseBody.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
jsonResponse := TChilkatJsonObject.Create(Self);
jsonResponse.LoadSb(sbResponseBody.ControlInterface);
object := jsonResponse.StringOf('object');
livemode := jsonResponse.BoolOf('livemode');
i := 0;
count_i := jsonResponse.SizeOfArray('available');
while i < count_i do
begin
jsonResponse.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;
end;
i := 0;
count_i := jsonResponse.SizeOfArray('pending');
while i < count_i do
begin
jsonResponse.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;
end;
{
"object": "balance",
"available": [
{
"currency": "usd",
"amount": 0,
"source_types": {
"card": 0
}
}
],
"livemode": false,
"pending": [
{
"currency": "usd",
"amount": 0,
"source_types": {
"card": 0
}
}
]
}