AutoIt Requires Chilkat v11.7.0+
AutoIt
Stripe: Find customer records by billing email
See more Stripe Examples
Find all customers with a given billing email, including addresses with a plus sign. Display the internal account reference so the operator can select the right record.
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
$oEmail = ObjCreate("Chilkat.StringBuilder")
$oEmail.SetString("billing+east@example.com")
; Show every match so the operator can check the internal account reference.
$oPageSuffix = ObjCreate("Chilkat.StringBuilder")
Local $bMore = True
Local $sCursor = ""
While ($bMore = True)
; curl -X GET "https://api.stripe.com/v1/customers?email={email}&limit=100" \
; -u "$STRIPE_API_KEY:" \
; -H "Stripe-Version: 2026-10-28.endive"
$oCmd.SetString("curl -X GET ""https://api.stripe.com/v1/customers?email=@EMAIL@&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("@EMAIL@",$oEmail.GetEncoded("url_rfc3986","utf-8"))
$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].name") & " | " & $oJson.StringOf("data[i].email") & " | " & $oJson.StringOf("data[i].metadata.account_ref") & @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