Java Requires Chilkat v11.7.0+
Java
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 Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.HttpCurl;
import com.chilkatsoft.chilkat2.JsonObject;
import com.chilkatsoft.chilkat2.StringBuilder;
public class ChilkatExample {
public static void main(String[] args) {
boolean success = false;
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
String apiKey = "YOUR_STRIPE_TEST_KEY";
HttpCurl curl = new HttpCurl();
StringBuilder cmd = new StringBuilder();
JsonObject json = new JsonObject();
String 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\"");
int replaced = cmd.replace("@ID@", refundId);
replaced = cmd.replace("@KEY@", apiKey);
try {
curl.doYourThing(cmd.getAsString());
} catch (ChilkatException e) {
System.out.println("No HTTP response. Chilkat failure code: " + curl.getFailReason());
return;
}
try {
curl.getResponseJson(json);
success = true;
} catch (ChilkatException e) {
success = false;
}
if ((curl.getStatusCode() != 200) || (!success)) {
System.out.println("Stripe HTTP " + curl.getStatusCode() + " Request-Id: " + curl.getResponseHeaderField("Request-Id"));
if (success) {
System.out.println(json.stringOf("error.message"));
}
return;
}
System.out.println("id = " + json.stringOf("id"));
System.out.println("status = " + json.stringOf("status"));
System.out.println("amount = " + json.stringOf("amount"));
System.out.println("currency = " + json.stringOf("currency"));
if ("failed".equals(json.stringOf("status"))) {
System.out.println("Failure reason: " + json.stringOf("failure_reason"));
}
if ("pending".equals(json.stringOf("status"))) {
System.out.println("Pending reason: " + json.stringOf("pending_reason"));
}
}
}