Sample code for 30+ languages & platforms
Objective-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 Objective-C Downloads

Objective-C
#import <NSString.h>
#import <CkoHttpCurl.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>

BOOL success = NO;

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

CkoHttpCurl *curl = [[CkoHttpCurl alloc] init];
CkoStringBuilder *cmd = [[CkoStringBuilder alloc] init];
CkoJsonObject *json = [[CkoJsonObject alloc] init];

int replaced;

NSString *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@" replacement: refundId] intValue];
replaced = [[cmd Replace: @"@KEY@" replacement: apiKey] intValue];
success = [curl DoYourThing: [cmd GetAsString]];
if (success != YES) {
    NSLog(@"%@%d",@"No HTTP response. Chilkat failure code: ",[curl.FailReason intValue]);
    return;
}

success = [curl GetResponseJson: json];
if (([curl.StatusCode intValue] != 200) || (success != YES)) {
    NSLog(@"%@%d%@%@",@"Stripe HTTP ",[curl.StatusCode intValue],@"  Request-Id: ",[curl GetResponseHeaderField: @"Request-Id"]);
    if (success == YES) {
        NSLog(@"%@",[json StringOf: @"error.message"]);
    }

    return;
}

NSLog(@"%@%@",@"id = ",[json StringOf: @"id"]);
NSLog(@"%@%@",@"status = ",[json StringOf: @"status"]);
NSLog(@"%@%@",@"amount = ",[json StringOf: @"amount"]);
NSLog(@"%@%@",@"currency = ",[json StringOf: @"currency"]);

if ([json StringOf: @"status"] == @"failed") {
    NSLog(@"%@%@",@"Failure reason: ",[json StringOf: @"failure_reason"]);
}

if ([json StringOf: @"status"] == @"pending") {
    NSLog(@"%@%@",@"Pending reason: ",[json StringOf: @"pending_reason"]);
}