Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
curl https://api.stripe.com/v1/customers?limit=3 \
-u STRIPE_SECRET_KEY: \
-G
#import <CkoRest.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>
CkoRest *rest = [[CkoRest alloc] init];
BOOL success;
// URL: https://api.stripe.com/v1/customers?limit=3
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"api.stripe.com" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
NSLog(@"%@",rest.LastErrorText);
return;
}
[rest SetAuthBasic: @"STRIPE_SECRET_KEY" password: @""];
CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/v1/customers?limit=3" sb: sbResponseBody];
if (success != YES) {
NSLog(@"%@",rest.LastErrorText);
return;
}
CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init];
[jsonResponse LoadSb: sbResponseBody];
NSString *object = 0;
NSString *url = 0;
BOOL has_more;
int i;
int count_i;
NSString *id = 0;
int account_balance;
int created;
NSString *currency = 0;
BOOL default_source;
BOOL delinquent;
BOOL description;
BOOL discount;
BOOL email;
BOOL livemode;
BOOL shipping;
NSString *sourcesObject = 0;
BOOL sourcesHas_more;
int sourcesTotal_count;
NSString *sourcesUrl = 0;
NSString *subscriptionsObject = 0;
BOOL subscriptionsHas_more;
int subscriptionsTotal_count;
NSString *subscriptionsUrl = 0;
int j;
int count_j;
object = [jsonResponse StringOf: @"object"];
url = [jsonResponse StringOf: @"url"];
has_more = [jsonResponse BoolOf: @"has_more"];
i = 0;
count_i = [[jsonResponse SizeOfArray: @"data"] intValue];
while (i < count_i) {
jsonResponse.I = [NSNumber numberWithInt: i];
id = [jsonResponse StringOf: @"data[i].id"];
object = [jsonResponse StringOf: @"data[i].object"];
account_balance = [[jsonResponse IntOf: @"data[i].account_balance"] intValue];
created = [[jsonResponse IntOf: @"data[i].created"] intValue];
currency = [jsonResponse StringOf: @"data[i].currency"];
default_source = [jsonResponse IsNullOf: @"data[i].default_source"];
delinquent = [jsonResponse BoolOf: @"data[i].delinquent"];
description = [jsonResponse IsNullOf: @"data[i].description"];
discount = [jsonResponse IsNullOf: @"data[i].discount"];
email = [jsonResponse IsNullOf: @"data[i].email"];
livemode = [jsonResponse BoolOf: @"data[i].livemode"];
shipping = [jsonResponse IsNullOf: @"data[i].shipping"];
sourcesObject = [jsonResponse StringOf: @"data[i].sources.object"];
sourcesHas_more = [jsonResponse BoolOf: @"data[i].sources.has_more"];
sourcesTotal_count = [[jsonResponse IntOf: @"data[i].sources.total_count"] intValue];
sourcesUrl = [jsonResponse StringOf: @"data[i].sources.url"];
subscriptionsObject = [jsonResponse StringOf: @"data[i].subscriptions.object"];
subscriptionsHas_more = [jsonResponse BoolOf: @"data[i].subscriptions.has_more"];
subscriptionsTotal_count = [[jsonResponse IntOf: @"data[i].subscriptions.total_count"] intValue];
subscriptionsUrl = [jsonResponse StringOf: @"data[i].subscriptions.url"];
j = 0;
count_j = [[jsonResponse SizeOfArray: @"data[i].sources.data"] intValue];
while (j < count_j) {
jsonResponse.J = [NSNumber numberWithInt: j];
j = j + 1;
}
j = 0;
count_j = [[jsonResponse SizeOfArray: @"data[i].subscriptions.data"] intValue];
while (j < count_j) {
jsonResponse.J = [NSNumber numberWithInt: j];
j = j + 1;
}
i = i + 1;
}
{
"object": "list",
"url": "/v1/customers",
"has_more": false,
"data": [
{
"id": "cus_CBbgVLJqv487Oq",
"object": "customer",
"account_balance": 0,
"created": 1516662781,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": null,
"livemode": false,
"metadata": {},
"shipping": null,
"sources": {
"object": "list",
"data": [
],
"has_more": false,
"total_count": 0,
"url": "/v1/customers/cus_CBbgVLJqv487Oq/sources"
},
"subscriptions": {
"object": "list",
"data": [
],
"has_more": false,
"total_count": 0,
"url": "/v1/customers/cus_CBbgVLJqv487Oq/subscriptions"
}
}
]
}