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
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkRest.pb"
Procedure ChilkatExample()
rest.i = CkRest::ckCreate()
If rest.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; URL: https://api.stripe.com/v1/balance/history?limit=3
bTls.i = 1
port.i = 443
bAutoReconnect.i = 1
success = CkRest::ckConnect(rest,"api.stripe.com",port,bTls,bAutoReconnect)
If success <> 1
Debug "ConnectFailReason: " + Str(CkRest::ckConnectFailReason(rest))
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
ProcedureReturn
EndIf
CkRest::ckSetAuthBasic(rest,"STRIPE_SECRET_KEY","")
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkRest::ckFullRequestNoBodySb(rest,"GET","/v1/balance/history?limit=3",sbResponseBody)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
jsonResponse.i = CkJsonObject::ckCreate()
If jsonResponse.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jsonResponse,sbResponseBody)
object.s
url.s
has_more.i
i.i
count_i.i
id.s
amount.i
available_on.i
created.i
currency.s
description.i
exchange_rate.i
fee.i
net.i
source.s
status.s
type.s
j.i
count_j.i
object = CkJsonObject::ckStringOf(jsonResponse,"object")
url = CkJsonObject::ckStringOf(jsonResponse,"url")
has_more = CkJsonObject::ckBoolOf(jsonResponse,"has_more")
i = 0
count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"data")
While i < count_i
CkJsonObject::setCkI(jsonResponse, i)
id = CkJsonObject::ckStringOf(jsonResponse,"data[i].id")
object = CkJsonObject::ckStringOf(jsonResponse,"data[i].object")
amount = CkJsonObject::ckIntOf(jsonResponse,"data[i].amount")
available_on = CkJsonObject::ckIntOf(jsonResponse,"data[i].available_on")
created = CkJsonObject::ckIntOf(jsonResponse,"data[i].created")
currency = CkJsonObject::ckStringOf(jsonResponse,"data[i].currency")
description = CkJsonObject::ckIsNullOf(jsonResponse,"data[i].description")
exchange_rate = CkJsonObject::ckIsNullOf(jsonResponse,"data[i].exchange_rate")
fee = CkJsonObject::ckIntOf(jsonResponse,"data[i].fee")
net = CkJsonObject::ckIntOf(jsonResponse,"data[i].net")
source = CkJsonObject::ckStringOf(jsonResponse,"data[i].source")
status = CkJsonObject::ckStringOf(jsonResponse,"data[i].status")
type = CkJsonObject::ckStringOf(jsonResponse,"data[i].type")
j = 0
count_j = CkJsonObject::ckSizeOfArray(jsonResponse,"data[i].fee_details")
While j < count_j
CkJsonObject::setCkJ(jsonResponse, j)
j = j + 1
Wend
i = i + 1
Wend
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jsonResponse)
ProcedureReturn
EndProcedure
{
"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"
}
]
}