PowerShell Requires Chilkat v11.7.0+
PowerShell
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 PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
# Requires an unlocked Chilkat bundle. See Global Unlock Sample.
# Supply a restricted sandbox key from merchant-controlled configuration.
$apiKey = "YOUR_STRIPE_TEST_KEY"
$curl = New-Object Chilkat.HttpCurl
$cmd = New-Object Chilkat.StringBuilder
$json = New-Object Chilkat.JsonObject
$refundId = "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"
$cmd.SetString("curl -X GET `"https://api.stripe.com/v1/refunds/@ID@`"")
$cmd.Append(" -u `"@KEY@:`"")
$cmd.Append(" -H `"Stripe-Version: 2026-10-28.endive`"")
$replaced = $cmd.Replace("@ID@",$refundId)
$replaced = $cmd.Replace("@KEY@",$apiKey)
$success = $curl.DoYourThing($cmd.GetAsString())
if ($success -ne $true) {
$("No HTTP response. Chilkat failure code: " + $curl.FailReason)
exit
}
$success = $curl.GetResponseJson($json)
if (($curl.StatusCode -ne 200) -or ($success -ne $true)) {
$("Stripe HTTP " + $curl.StatusCode + " Request-Id: " + $curl.GetResponseHeaderField("Request-Id"))
if ($success -eq $true) {
$($json.StringOf("error.message"))
}
exit
}
$("id = " + $json.StringOf("id"))
$("status = " + $json.StringOf("status"))
$("amount = " + $json.StringOf("amount"))
$("currency = " + $json.StringOf("currency"))
if ($json.StringOf("status") -eq "failed") {
$("Failure reason: " + $json.StringOf("failure_reason"))
}
if ($json.StringOf("status") -eq "pending") {
$("Pending reason: " + $json.StringOf("pending_reason"))
}