Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
curl https://api.stripe.com/v1/balance/history?limit=3 \
-u STRIPE_SECRET_KEY: \
-G
var
rest: HCkRest;
success: Boolean;
bTls: Boolean;
port: Integer;
bAutoReconnect: Boolean;
sbResponseBody: HCkStringBuilder;
jsonResponse: HCkJsonObject;
object: PWideChar;
url: PWideChar;
has_more: Boolean;
i: Integer;
count_i: Integer;
id: PWideChar;
amount: Integer;
available_on: Integer;
created: Integer;
currency: PWideChar;
description: Boolean;
exchange_rate: Boolean;
fee: Integer;
net: Integer;
source: PWideChar;
status: PWideChar;
type: PWideChar;
j: Integer;
count_j: Integer;
begin
rest := CkRest_Create();
// URL: https://api.stripe.com/v1/balance/history?limit=3
bTls := True;
port := 443;
bAutoReconnect := True;
success := CkRest_Connect(rest,'api.stripe.com',port,bTls,bAutoReconnect);
if (success <> True) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
CkRest_SetAuthBasic(rest,'STRIPE_SECRET_KEY','');
sbResponseBody := CkStringBuilder_Create();
success := CkRest_FullRequestNoBodySb(rest,'GET','/v1/balance/history?limit=3',sbResponseBody);
if (success <> True) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
jsonResponse := CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
object := CkJsonObject__stringOf(jsonResponse,'object');
url := CkJsonObject__stringOf(jsonResponse,'url');
has_more := CkJsonObject_BoolOf(jsonResponse,'has_more');
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'data');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
id := CkJsonObject__stringOf(jsonResponse,'data[i].id');
object := CkJsonObject__stringOf(jsonResponse,'data[i].object');
amount := CkJsonObject_IntOf(jsonResponse,'data[i].amount');
available_on := CkJsonObject_IntOf(jsonResponse,'data[i].available_on');
created := CkJsonObject_IntOf(jsonResponse,'data[i].created');
currency := CkJsonObject__stringOf(jsonResponse,'data[i].currency');
description := CkJsonObject_IsNullOf(jsonResponse,'data[i].description');
exchange_rate := CkJsonObject_IsNullOf(jsonResponse,'data[i].exchange_rate');
fee := CkJsonObject_IntOf(jsonResponse,'data[i].fee');
net := CkJsonObject_IntOf(jsonResponse,'data[i].net');
source := CkJsonObject__stringOf(jsonResponse,'data[i].source');
status := CkJsonObject__stringOf(jsonResponse,'data[i].status');
type := CkJsonObject__stringOf(jsonResponse,'data[i].type');
j := 0;
count_j := CkJsonObject_SizeOfArray(jsonResponse,'data[i].fee_details');
while j < count_j do
begin
CkJsonObject_putJ(jsonResponse,j);
j := j + 1;
end;
i := i + 1;
end;
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
{
"object": "list",
"url": "/v1/balance/history",
"has_more": false,
"data": [
{
"id": "txn_1BnETJGswQrCoh0XxO2tGYr7",
"object": "balance_transaction",
"amount": 100,
"available_on": 1516662781,
"created": 1516662781,
"currency": "usd",
"description": null,
"exchange_rate": null,
"fee": 0,
"fee_details": [
],
"net": 100,
"source": "ch_1BnETJGswQrCoh0XTs0EERBj",
"status": "pending",
"type": "charge"
}
]
}