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
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Boolean iBTls
Integer iPort
Boolean iBAutoReconnect
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJsonResponse
String sObject
String sUrl
Boolean iHas_more
Integer i
Integer iCount_i
String sId
Integer iAmount
Integer iAvailable_on
Integer iCreated
String sCurrency
Boolean iDescription
Boolean iExchange_rate
Integer iFee
Integer iNet
String sSource
String sStatus
String sType
Integer j
Integer iCount_j
String sTemp1
Integer iTemp1
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
// URL: https://api.stripe.com/v1/balance/history?limit=3
Move True To iBTls
Move 443 To iPort
Move True To iBAutoReconnect
Get ComConnect Of hoRest "api.stripe.com" iPort iBTls iBAutoReconnect To iSuccess
If (iSuccess <> True) Begin
Get ComConnectFailReason Of hoRest To iTemp1
Showln "ConnectFailReason: " iTemp1
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComSetAuthBasic Of hoRest "STRIPE_SECRET_KEY" "" To iSuccess
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComFullRequestNoBodySb Of hoRest "GET" "/v1/balance/history?limit=3" vSbResponseBody To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
If (Not(IsComObjectCreated(hoJsonResponse))) Begin
Send CreateComObject of hoJsonResponse
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJsonResponse vSbResponseBody To iSuccess
Get ComStringOf Of hoJsonResponse "object" To sObject
Get ComStringOf Of hoJsonResponse "url" To sUrl
Get ComBoolOf Of hoJsonResponse "has_more" To iHas_more
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "data" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "data[i].id" To sId
Get ComStringOf Of hoJsonResponse "data[i].object" To sObject
Get ComIntOf Of hoJsonResponse "data[i].amount" To iAmount
Get ComIntOf Of hoJsonResponse "data[i].available_on" To iAvailable_on
Get ComIntOf Of hoJsonResponse "data[i].created" To iCreated
Get ComStringOf Of hoJsonResponse "data[i].currency" To sCurrency
Get ComIsNullOf Of hoJsonResponse "data[i].description" To iDescription
Get ComIsNullOf Of hoJsonResponse "data[i].exchange_rate" To iExchange_rate
Get ComIntOf Of hoJsonResponse "data[i].fee" To iFee
Get ComIntOf Of hoJsonResponse "data[i].net" To iNet
Get ComStringOf Of hoJsonResponse "data[i].source" To sSource
Get ComStringOf Of hoJsonResponse "data[i].status" To sStatus
Get ComStringOf Of hoJsonResponse "data[i].type" To sType
Move 0 To j
Get ComSizeOfArray Of hoJsonResponse "data[i].fee_details" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJsonResponse To j
Move j + 1 To j
Loop
Move i + 1 To i
Loop
End_Procedure
{
"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"
}
]
}