Sample code for 30+ languages & platforms
Unicode C++ Requires Chilkat v11.7.0+

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 Unicode C++ Downloads

Unicode C++
#include <CkHttpCurlW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>

void ChilkatSample(void)
    {
    bool success = false;

    //  Requires an unlocked Chilkat bundle. See Global Unlock Sample.
    //  Supply a restricted sandbox key from merchant-controlled configuration.
    const wchar_t *apiKey = L"YOUR_STRIPE_TEST_KEY";

    CkHttpCurlW curl;
    CkStringBuilderW cmd;
    CkJsonObjectW json;

    int replaced;

    const wchar_t *refundId = L"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(L"curl -X GET \"https://api.stripe.com/v1/refunds/@ID@\"");
    cmd.Append(L" -u \"@KEY@:\"");
    cmd.Append(L" -H \"Stripe-Version: 2026-10-28.endive\"");
    replaced = cmd.Replace(L"@ID@",refundId);
    replaced = cmd.Replace(L"@KEY@",apiKey);
    success = curl.DoYourThing(cmd.getAsString());
    if (success != true) {
        wprintf(L"No HTTP response. Chilkat failure code: %d\n",curl.get_FailReason());
        return;
    }

    success = curl.GetResponseJson(json);
    if ((curl.get_StatusCode() != 200) || (success != true)) {
        wprintf(L"Stripe HTTP %d  Request-Id: %s\n",curl.get_StatusCode(),curl.getResponseHeaderField(L"Request-Id"));
        if (success == true) {
            wprintf(L"%s\n",json.stringOf(L"error.message"));
        }

        return;
    }

    wprintf(L"id = %s\n",json.stringOf(L"id"));
    wprintf(L"status = %s\n",json.stringOf(L"status"));
    wprintf(L"amount = %s\n",json.stringOf(L"amount"));
    wprintf(L"currency = %s\n",json.stringOf(L"currency"));

    if (json.stringOf(L"status") == L"failed") {
        wprintf(L"Failure reason: %s\n",json.stringOf(L"failure_reason"));
    }

    if (json.stringOf(L"status") == L"pending") {
        wprintf(L"Pending reason: %s\n",json.stringOf(L"pending_reason"));
    }
    }