Python Requires Chilkat v11.7.0+
Python
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 Python Downloads
import sys
import chilkat2
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 = chilkat2.HttpCurl()
cmd = chilkat2.StringBuilder()
json = chilkat2.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 != True):
print("No HTTP response. Chilkat failure code: " + str(curl.FailReason))
sys.exit()
success = curl.GetResponseJson(json)
if ((curl.StatusCode != 200) or (success != True)):
print("Stripe HTTP " + str(curl.StatusCode) + " Request-Id: " + curl.GetResponseHeaderField("Request-Id"))
if (success == True):
print(json.StringOf("error.message"))
sys.exit()
print("id = " + json.StringOf("id"))
print("status = " + json.StringOf("status"))
print("amount = " + json.StringOf("amount"))
print("currency = " + json.StringOf("currency"))
if (json.StringOf("status") == "failed"):
print("Failure reason: " + json.StringOf("failure_reason"))
if (json.StringOf("status") == "pending"):
print("Pending reason: " + json.StringOf("pending_reason"))