Delphi ActiveX Requires Chilkat v11.7.0+
Delphi ActiveX
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 Delphi ActiveX Downloads
var
success: Integer;
apiKey: WideString;
curl: TChilkatHttpCurl;
cmd: TChilkatStringBuilder;
json: TChilkatJsonObject;
replaced: Integer;
refundId: WideString;
begin
success := 0;
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
apiKey := 'YOUR_STRIPE_TEST_KEY';
curl := TChilkatHttpCurl.Create(Self);
cmd := TChilkatStringBuilder.Create(Self);
json := TChilkatJsonObject.Create(Self);
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 <> 1) then
begin
Memo1.Lines.Add('No HTTP response. Chilkat failure code: ' + IntToStr(curl.FailReason));
Exit;
end;
success := curl.GetResponseJson(json.ControlInterface);
if ((curl.StatusCode <> 200) or (success <> 1)) then
begin
Memo1.Lines.Add('Stripe HTTP ' + IntToStr(curl.StatusCode) + ' Request-Id: ' + curl.GetResponseHeaderField('Request-Id'));
if (success = 1) then
begin
Memo1.Lines.Add(json.StringOf('error.message'));
end;
Exit;
end;
Memo1.Lines.Add('id = ' + json.StringOf('id'));
Memo1.Lines.Add('status = ' + json.StringOf('status'));
Memo1.Lines.Add('amount = ' + json.StringOf('amount'));
Memo1.Lines.Add('currency = ' + json.StringOf('currency'));
if (json.StringOf('status') = 'failed') then
begin
Memo1.Lines.Add('Failure reason: ' + json.StringOf('failure_reason'));
end;
if (json.StringOf('status') = 'pending') then
begin
Memo1.Lines.Add('Pending reason: ' + json.StringOf('pending_reason'));
end;