Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Xojo Plugin) Stripe: Retrieve BalanceRetrieves the current Stripe.com account balance.
// This example assumes the Chilkat HTTP API to have been previously unlocked. // See Global Unlock Sample for sample code. Dim http As New Chilkat.Http // 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 <> True) Then System.DebugLog(http.LastErrorText) Return End If Dim json As New Chilkat.JsonObject success = json.Load(jsonResponse) json.EmitCompact = False If (http.LastStatus <> 200) Then // The request failed. Show the error. System.DebugLog(json.Emit()) System.DebugLog("Error status returned.") Return End If // Show the successful response. System.DebugLog(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 Int32 amountAvailable = json.IntOf("available[0].amount") System.DebugLog("available amount = " + Str(amountAvailable)) Dim amountPending As Int32 amountPending = json.IntOf("pending[0].amount") System.DebugLog("pending amount = " + Str(amountPending)) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.