Sample code for 30+ languages & platforms
VB.NET Requires Chilkat v11.7.0+

Stripe: Match an automatic bank payout to its transactions

See more Stripe Examples

Reconcile a selected automatic payout by comparing its amount with the sum of its settlement entries across all result pages.

Stripe documentation and cURL example

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

'  Requires an unlocked Chilkat bundle. See Global Unlock Sample.
'  Supply a restricted sandbox key from merchant-controlled configuration.
Dim apiKey As String = "YOUR_STRIPE_TEST_KEY"

Dim curl As New Chilkat.HttpCurl
Dim cmd As New Chilkat.StringBuilder
Dim json As New Chilkat.JsonObject

Dim replaced As Integer

'  Example UTC interval: 1 October 2026 inclusive through 1 November exclusive.
Dim fromTime As String = "1790812800"
Dim untilTime As String = "1793491200"

Dim selectedPayout As String = "po_SELECTED_BANK_DEPOSIT"

Dim expectedAmount As String = ""
Dim currency As String = ""

Dim pageSuffix As New Chilkat.StringBuilder
Dim more As Boolean = True
Dim cursor As String = ""
While (more = True)
    '  curl -X GET "https://api.stripe.com/v1/payouts?created%5Bgte%5D={fromTime}&created%5Blt%5D={untilTime}&limit=100" \
    '    -u "$STRIPE_API_KEY:" \
    '    -H "Stripe-Version: 2026-10-28.endive"
    cmd.SetString("curl -X GET ""https://api.stripe.com/v1/payouts?created%5Bgte%5D=@FROM@&created%5Blt%5D=@UNTIL@&limit=100@CURSOR@""")
    cmd.Append(" -u ""@KEY@:""")
    cmd.Append(" -H ""Stripe-Version: 2026-10-28.endive""")
    replaced = cmd.Replace("@CURSOR@",pageSuffix.GetAsString())
    replaced = cmd.Replace("@FROM@",fromTime)
    replaced = cmd.Replace("@UNTIL@",untilTime)
    replaced = cmd.Replace("@KEY@",apiKey)
    success = curl.DoYourThing(cmd.GetAsString())
    If (success <> True) Then
        Debug.WriteLine("No HTTP response. Chilkat failure code: " & curl.FailReason)
        Exit Sub
    End If

    success = curl.GetResponseJson(json)
    If ((curl.StatusCode <> 200) Or (success <> True)) Then
        Debug.WriteLine("Stripe HTTP " & curl.StatusCode & "  Request-Id: " & curl.GetResponseHeaderField("Request-Id"))
        If (success = True) Then
            Debug.WriteLine(json.StringOf("error.message"))
        End If

        Exit Sub
    End If


    Dim i As Integer = 0
    Dim count As Integer = json.SizeOfArray("data")
    While (i < count)
        json.I = i
        Debug.WriteLine(json.StringOf("data[i].id") & " | " & json.StringOf("data[i].amount") & " | " & json.StringOf("data[i].currency") & " | " & json.StringOf("data[i].reconciliation_status"))
        If (json.StringOf("data[i].id") = selectedPayout) Then
            If ((json.BoolOf("data[i].automatic") <> True) Or (json.StringOf("data[i].reconciliation_status") <> "completed")) Then
                Debug.WriteLine("Select an automatic payout with completed reconciliation.")
                Exit Sub
            End If

            expectedAmount = json.StringOf("data[i].amount")
            currency = json.StringOf("data[i].currency")
        End If

        i = i + 1
    End While
    more = json.BoolOf("has_more")
    If (more = True) Then
        Dim next As String = json.StringOf("data[i].id")
        If ((count < 1) Or (next = "") Or (next = cursor)) Then
            Debug.WriteLine("Invalid pagination cursor.")
            Exit Sub
        End If

        cursor = next
        pageSuffix.SetString("&starting_after=")
        pageSuffix.Append(cursor)
    End If

End While

If (expectedAmount = "") Then
    Debug.WriteLine("The selected payout was not in this date range.")
    Exit Sub
End If

Dim totalNet As Integer = 0
'  This portable example uses int for arithmetic. Reject an out-of-range entry
'  or sum before adding. A larger ledger can sum the exact strings using decimal arithmetic.
Dim number As New Chilkat.StringBuilder

Dim pageSuffixTxn As New Chilkat.StringBuilder
Dim moreTxn As Boolean = True
Dim cursorTxn As String = ""
While (moreTxn = True)
    '  curl -X GET "https://api.stripe.com/v1/balance_transactions?payout={selectedPayout}&limit=100" \
    '    -u "$STRIPE_API_KEY:" \
    '    -H "Stripe-Version: 2026-10-28.endive"
    cmd.SetString("curl -X GET ""https://api.stripe.com/v1/balance_transactions?payout=@PAYOUT@&limit=100@CURSOR@""")
    cmd.Append(" -u ""@KEY@:""")
    cmd.Append(" -H ""Stripe-Version: 2026-10-28.endive""")
    replaced = cmd.Replace("@CURSOR@",pageSuffixTxn.GetAsString())
    replaced = cmd.Replace("@PAYOUT@",selectedPayout)
    replaced = cmd.Replace("@KEY@",apiKey)
    success = curl.DoYourThing(cmd.GetAsString())
    If (success <> True) Then
        Debug.WriteLine("No HTTP response. Chilkat failure code: " & curl.FailReason)
        Exit Sub
    End If

    success = curl.GetResponseJson(json)
    If ((curl.StatusCode <> 200) Or (success <> True)) Then
        Debug.WriteLine("Stripe HTTP " & curl.StatusCode & "  Request-Id: " & curl.GetResponseHeaderField("Request-Id"))
        If (success = True) Then
            Debug.WriteLine(json.StringOf("error.message"))
        End If

        Exit Sub
    End If


    Dim iTxn As Integer = 0
    Dim countTxn As Integer = json.SizeOfArray("data")
    While (iTxn < countTxn)
        json.I = iTxn
        Debug.WriteLine(json.StringOf("data[i].id") & "  " & json.StringOf("data[i].net"))
        If (json.StringOf("data[i].currency") <> currency) Then
            Debug.WriteLine("Currency mismatch.")
            Exit Sub
        End If

        '  Exclude the bank withdrawal itself if it appears in this batch.
        If (json.StringOf("data[i].source") <> selectedPayout) Then
            Dim netText As String = json.StringOf("data[i].net")
            Dim entryNet As Integer = json.IntOf("data[i].net")
            number.IntValue = entryNet
            If (number.GetAsString() <> netText) Then
                Debug.WriteLine("Entry exceeds the supported int range: " & netText)
                Exit Sub
            End If

            If (entryNet > 0) Then
                If (totalNet > (2147483647 - entryNet)) Then
                    Debug.WriteLine("Total exceeds the supported int range.")
                    Exit Sub
                End If

            End If

            If (entryNet < 0) Then
                If (totalNet < ((0 - 2147483647) - (entryNet + 1))) Then
                    Debug.WriteLine("Total exceeds the supported int range.")
                    Exit Sub
                End If

            End If

            totalNet = totalNet + entryNet
        End If

        iTxn = iTxn + 1
    End While
    moreTxn = json.BoolOf("has_more")
    If (moreTxn = True) Then
        Dim nextTxn As String = json.StringOf("data[i].id")
        If ((countTxn < 1) Or (nextTxn = "") Or (nextTxn = cursorTxn)) Then
            Debug.WriteLine("Invalid pagination cursor.")
            Exit Sub
        End If

        cursorTxn = nextTxn
        pageSuffixTxn.SetString("&starting_after=")
        pageSuffixTxn.Append(cursorTxn)
    End If

End While

number.IntValue = totalNet
Debug.WriteLine("Settlement net: " & totalNet & "  Bank payout: " & expectedAmount & " " & currency)
If (number.GetAsString() = expectedAmount) Then
    Debug.WriteLine("Payout reconciled.")
Else
    Debug.WriteLine("Investigate the difference.")
End If