Objective-C Requires Chilkat v11.7.0+
Objective-C
Stripe: Review invoices and outstanding amounts
See more Stripe Examples
List open invoices for a billing account and show outstanding amounts, due dates, and invoice links.
Stripe documentation and cURL example
Chilkat Objective-C Downloads
#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 *customerId = @"cus_FROM_BILLING_ACCOUNT";
// Remove status=open to show all invoice states.
CkoStringBuilder *pageSuffix = [[CkoStringBuilder alloc] init];
BOOL more = YES;
NSString *cursor = @"";
while ((more == YES)) {
// curl -X GET "https://api.stripe.com/v1/invoices?customer={customerId}&status=open&limit=100" \
// -u "$STRIPE_API_KEY:" \
// -H "Stripe-Version: 2026-10-28.endive"
[cmd SetString: @"curl -X GET \"https://api.stripe.com/v1/invoices?customer=@CUSTOMER@&status=open&limit=100@CURSOR@\""];
[cmd Append: @" -u \"@KEY@:\""];
[cmd Append: @" -H \"Stripe-Version: 2026-10-28.endive\""];
replaced = [[cmd Replace: @"@CURSOR@" replacement: [pageSuffix GetAsString]] intValue];
replaced = [[cmd Replace: @"@CUSTOMER@" replacement: customerId] 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;
}
int i = 0;
int count = [[json SizeOfArray: @"data"] intValue];
while ((i < count)) {
json.I = [NSNumber numberWithInt: i];
NSLog(@"%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@",[json StringOf: @"data[i].id"],@" | ",[json StringOf: @"data[i].number"],@" | ",[json StringOf: @"data[i].status"]
,@" | ",[json StringOf: @"data[i].due_date"],@" | ",[json StringOf: @"data[i].amount_remaining"],@" | ",[json StringOf: @"data[i].currency"],@" | ",[json StringOf: @"data[i].hosted_invoice_url"]
,@" | ",[json StringOf: @"data[i].invoice_pdf"]);
i = i + 1;
}
more = [json BoolOf: @"has_more"];
if (more == YES) {
NSString *next = [json StringOf: @"data[i].id"];
if ((count < 1) || (next == @"") || (next == cursor)) {
NSLog(@"%@",@"Invalid pagination cursor.");
return;
}
cursor = next;
[pageSuffix SetString: @"&starting_after="];
[pageSuffix Append: cursor];
}
}