AutoIt Requires Chilkat v11.7.0+
AutoIt
Stripe: Review invoices and outstanding amounts
See more Stripe Examples
List open invoices for a billing account and show outstanding amounts, due dates, and invoice links.
Stripe documentation and cURL example
Chilkat AutoIt Downloads
Local $bSuccess = False
; Requires an unlocked Chilkat bundle. See Global Unlock Sample.
; Supply a restricted sandbox key from merchant-controlled configuration.
Local $sApiKey = "YOUR_STRIPE_TEST_KEY"
$oCurl = ObjCreate("Chilkat.HttpCurl")
$oCmd = ObjCreate("Chilkat.StringBuilder")
$oJson = ObjCreate("Chilkat.JsonObject")
Local $iReplaced
Local $sCustomerId = "cus_FROM_BILLING_ACCOUNT"
; Remove status=open to show all invoice states.
$oPageSuffix = ObjCreate("Chilkat.StringBuilder")
Local $bMore = True
Local $sCursor = ""
While ($bMore = True)
; curl -X GET "https://api.stripe.com/v1/invoices?customer={customerId}&status=open&limit=100" \
; -u "$STRIPE_API_KEY:" \
; -H "Stripe-Version: 2026-10-28.endive"
$oCmd.SetString("curl -X GET ""https://api.stripe.com/v1/invoices?customer=@CUSTOMER@&status=open&limit=100@CURSOR@""")
$oCmd.Append(" -u ""@KEY@:""")
$oCmd.Append(" -H ""Stripe-Version: 2026-10-28.endive""")
$iReplaced = $oCmd.Replace("@CURSOR@",$oPageSuffix.GetAsString())
$iReplaced = $oCmd.Replace("@CUSTOMER@",$sCustomerId)
$iReplaced = $oCmd.Replace("@KEY@",$sApiKey)
$bSuccess = $oCurl.DoYourThing($oCmd.GetAsString())
If ($bSuccess <> True) Then
ConsoleWrite("No HTTP response. Chilkat failure code: " & $oCurl.FailReason & @CRLF)
Exit
EndIf
$bSuccess = $oCurl.GetResponseJson($oJson)
If (($oCurl.StatusCode <> 200) Or ($bSuccess <> True)) Then
ConsoleWrite("Stripe HTTP " & $oCurl.StatusCode & " Request-Id: " & $oCurl.GetResponseHeaderField("Request-Id") & @CRLF)
If ($bSuccess = True) Then
ConsoleWrite($oJson.StringOf("error.message") & @CRLF)
EndIf
Exit
EndIf
Local $i = 0
Local $iCount = $oJson.SizeOfArray("data")
While ($i < $iCount)
$oJson.I = $i
ConsoleWrite($oJson.StringOf("data[i].id") & " | " & $oJson.StringOf("data[i].number") & " | " & $oJson.StringOf("data[i].status") & " | " & $oJson.StringOf("data[i].due_date") _
& " | " & $oJson.StringOf("data[i].amount_remaining") & " | " & $oJson.StringOf("data[i].currency") & " | " & $oJson.StringOf("data[i].hosted_invoice_url") & " | " _
& $oJson.StringOf("data[i].invoice_pdf") & @CRLF)
$i = $i + 1
Wend
$bMore = $oJson.BoolOf("has_more")
If ($bMore = True) Then
Local $sNext = $oJson.StringOf("data[i].id")
If (($iCount < 1) Or ($sNext = "") Or ($sNext = $sCursor)) Then
ConsoleWrite("Invalid pagination cursor." & @CRLF)
Exit
EndIf
$sCursor = $sNext
$oPageSuffix.SetString("&starting_after=")
$oPageSuffix.Append($sCursor)
EndIf
Wend