Rust Requires Chilkat v11.7.0+
Rust
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 Rust Downloads
let mut success = false;
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
let api_key = "YOUR_STRIPE_TEST_KEY".to_string();
let curl = chilkat::HttpCurl::new();
let cmd = chilkat::StringBuilder::new();
let json = chilkat::JsonObject::new();
let refund_id = "re_FROM_REFUND_RECORD".to_string();
// curl -X GET "https://api.stripe.com/v1/refunds/{refundId}" \
// -u "$STRIPE_API_KEY:" \
// -H "Stripe-Version: 2026-10-28.endive"
let _ = cmd.set_string("curl -X GET \"https://api.stripe.com/v1/refunds/@ID@\"");
let _ = cmd.append(" -u \"@KEY@:\"");
let _ = cmd.append(" -H \"Stripe-Version: 2026-10-28.endive\"");
let _ = cmd.replace("@ID@", &refund_id);
let _ = cmd.replace("@KEY@", &api_key);
success = curl.do_your_thing(&cmd.get_as_string().unwrap_or_default()).is_ok();
if !success {
println!("No HTTP response. Chilkat failure code: {}", curl.fail_reason());
return;
}
success = curl.get_response_json(&json).is_ok();
if (curl.status_code() != 200) || (!success) {
println!("Stripe HTTP {} Request-Id: {}", curl.status_code(), curl.get_response_header_field("Request-Id").unwrap_or_default());
if success {
println!("{}", json.string_of("error.message").unwrap_or_default());
}
return;
}
println!("id = {}", json.string_of("id").unwrap_or_default());
println!("status = {}", json.string_of("status").unwrap_or_default());
println!("amount = {}", json.string_of("amount").unwrap_or_default());
println!("currency = {}", json.string_of("currency").unwrap_or_default());
if json.string_of("status").unwrap_or_default() == "failed" {
println!("Failure reason: {}", json.string_of("failure_reason").unwrap_or_default());
}
if json.string_of("status").unwrap_or_default() == "pending" {
println!("Pending reason: {}", json.string_of("pending_reason").unwrap_or_default());
}