Classic ASP Stripe: Retrieve a Balance Transaction

Back to Index

Retrieves the balance transaction with the given ID.

Documentation: https://stripe.com/docs/api/curl#balance_transaction_retrieve

CURL Command

curl https://api.stripe.com/v1/balance/history/txn_1BnETJGswQrCoh0XxO2tGYr7 \
   -u STRIPE_SECRET_KEY:

Classic ASP Example

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set rest = Server.CreateObject("Chilkat_9_5_0.Rest")

'  URL: https://api.stripe.com/v1/balance/history/txn_1BnETJGswQrCoh0XxO2tGYr7
bTls = 1
port = 443
bAutoReconnect = 1
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "ConnectFailReason: " & rest.ConnectFailReason) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"

End If

success = rest.SetAuthBasic("STRIPE_SECRET_KEY","")

set sbResponseBody = Server.CreateObject("Chilkat_9_5_0.StringBuilder")
success = rest.FullRequestNoBodySb("GET","/v1/balance/history/txn_1BnETJGswQrCoh0XxO2tGYr7",sbResponseBody)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"

End If

set jsonResponse = Server.CreateObject("Chilkat_9_5_0.JsonObject")
success = jsonResponse.LoadSb(sbResponseBody)

id = jsonResponse.StringOf("id")
object = jsonResponse.StringOf("object")
amount = jsonResponse.IntOf("amount")
available_on = jsonResponse.IntOf("available_on")
created = jsonResponse.IntOf("created")
currency = jsonResponse.StringOf("currency")
description = jsonResponse.IsNullOf("description")
exchange_rate = jsonResponse.IsNullOf("exchange_rate")
fee = jsonResponse.IntOf("fee")
net = jsonResponse.IntOf("net")
source = jsonResponse.StringOf("source")
status = jsonResponse.StringOf("status")
type = jsonResponse.StringOf("type")
i = 0
count_i = jsonResponse.SizeOfArray("fee_details")
Do While i < count_i
    jsonResponse.I = i
    i = i + 1
Loop

%>
</body>
</html>

Sample JSON Response Body

{
  "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"
}