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

Stripe: Check where a refund stands

See more Stripe Examples

Read the current status of a saved refund, including the reason for a pending or failed refund when available.

Stripe documentation and cURL example

Chilkat AutoIt Downloads

AutoIt
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 $sRefundId = "re_FROM_REFUND_RECORD"

;  curl -X GET "https://api.stripe.com/v1/refunds/{refundId}" \
;    -u "$STRIPE_API_KEY:" \
;    -H "Stripe-Version: 2026-10-28.endive"
$oCmd.SetString("curl -X GET ""https://api.stripe.com/v1/refunds/@ID@""")
$oCmd.Append(" -u ""@KEY@:""")
$oCmd.Append(" -H ""Stripe-Version: 2026-10-28.endive""")
$iReplaced = $oCmd.Replace("@ID@",$sRefundId)
$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

ConsoleWrite("id = " & $oJson.StringOf("id") & @CRLF)
ConsoleWrite("status = " & $oJson.StringOf("status") & @CRLF)
ConsoleWrite("amount = " & $oJson.StringOf("amount") & @CRLF)
ConsoleWrite("currency = " & $oJson.StringOf("currency") & @CRLF)

If ($oJson.StringOf("status") = "failed") Then
    ConsoleWrite("Failure reason: " & $oJson.StringOf("failure_reason") & @CRLF)
EndIf

If ($oJson.StringOf("status") = "pending") Then
    ConsoleWrite("Pending reason: " & $oJson.StringOf("pending_reason") & @CRLF)
EndIf