Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(C# UWP/WinRT) 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. Chilkat.Http http = 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"); string jsonResponse = await http.QuickGetStrAsync("https://api.stripe.com/v1/balance"); if (http.LastMethodSuccess != true) { Debug.WriteLine(http.LastErrorText); return; } Chilkat.JsonObject json = new Chilkat.JsonObject(); json.Load(jsonResponse); json.EmitCompact = false; if (http.LastStatus != 200) { // The request failed. Show the error. Debug.WriteLine(json.Emit()); Debug.WriteLine("Error status returned."); return; } // Show the successful response. Debug.WriteLine(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: int amountAvailable = json.IntOf("available[0].amount"); Debug.WriteLine("available amount = " + Convert.ToString(amountAvailable)); int amountPending = json.IntOf("pending[0].amount"); Debug.WriteLine("pending amount = " + Convert.ToString(amountPending)); |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.