Sample code for 30+ languages & platforms
Visual Basic 6.0

Stripe: Retrieve Balance

Retrieves the current Stripe.com account balance.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

' This example assumes the Chilkat HTTP API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim http As New ChilkatHttp

' Set the Authorization header using your secret key, 
' which looks something like this: sk_test_Oxo7a3Atz3UMRz5IRiafjkf7
http.SetRequestHeader "Authorization","Bearer STRIPE_SECRET_KEY"

Dim jsonResponse As String
jsonResponse = http.QuickGetStr("https://api.stripe.com/v1/balance")
If (http.LastMethodSuccess <> 1) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Dim json As New ChilkatJsonObject
success = json.Load(jsonResponse)
json.EmitCompact = 0

If (http.LastStatus <> 200) Then
    ' The request failed.  Show the error.
    Debug.Print json.Emit()
    Debug.Print "Error status returned."
    Exit Sub
End If

' Show the successful response.
Debug.Print json.Emit()

' A sample result:

' 	{
' 	  "object": "balance",
' 	  "available": [
' 	    {
' 	      "currency": "usd",
' 	      "amount": 0,
' 	      "source_types": {
' 	        "card": 0
' 	      } 
' 	    } 
' 	  ],
' 	  "livemode": false,
' 	  "pending": [
' 	    {
' 	      "currency": "usd",
' 	      "amount": 0,
' 	      "source_types": {
' 	        "card": 0
' 	      } 
' 	    } 
' 	  ]
' 	} 

' To get some information from the JSON:
Dim amountAvailable As Long
amountAvailable = json.IntOf("available[0].amount")
Debug.Print "available amount = " & amountAvailable

Dim amountPending As Long
amountPending = json.IntOf("pending[0].amount")
Debug.Print "pending amount = " & amountPending