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
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkStringBuilder sbResponseBody;
HCkJsonObject jsonResponse;
const char *object;
const char *url;
BOOL has_more;
int i;
int count_i;
const char *id;
int account_balance;
int created;
const char *currency;
BOOL default_source;
BOOL delinquent;
BOOL description;
BOOL discount;
BOOL email;
BOOL livemode;
BOOL shipping;
const char *sourcesObject;
BOOL sourcesHas_more;
int sourcesTotal_count;
const char *sourcesUrl;
const char *subscriptionsObject;
BOOL subscriptionsHas_more;
int subscriptionsTotal_count;
const char *subscriptionsUrl;
int j;
int count_j;
rest = CkRest_Create();
// URL: https://api.stripe.com/v1/customers?limit=3
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRest_Connect(rest,"api.stripe.com",port,bTls,bAutoReconnect);
if (success != TRUE) {
printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
CkRest_SetAuthBasic(rest,"STRIPE_SECRET_KEY","");
sbResponseBody = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"GET","/v1/customers?limit=3",sbResponseBody);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
object = CkJsonObject_stringOf(jsonResponse,"object");
url = CkJsonObject_stringOf(jsonResponse,"url");
has_more = CkJsonObject_BoolOf(jsonResponse,"has_more");
i = 0;
count_i = CkJsonObject_SizeOfArray(jsonResponse,"data");
while (i < count_i) {
CkJsonObject_putI(jsonResponse,i);
id = CkJsonObject_stringOf(jsonResponse,"data[i].id");
object = CkJsonObject_stringOf(jsonResponse,"data[i].object");
account_balance = CkJsonObject_IntOf(jsonResponse,"data[i].account_balance");
created = CkJsonObject_IntOf(jsonResponse,"data[i].created");
currency = CkJsonObject_stringOf(jsonResponse,"data[i].currency");
default_source = CkJsonObject_IsNullOf(jsonResponse,"data[i].default_source");
delinquent = CkJsonObject_BoolOf(jsonResponse,"data[i].delinquent");
description = CkJsonObject_IsNullOf(jsonResponse,"data[i].description");
discount = CkJsonObject_IsNullOf(jsonResponse,"data[i].discount");
email = CkJsonObject_IsNullOf(jsonResponse,"data[i].email");
livemode = CkJsonObject_BoolOf(jsonResponse,"data[i].livemode");
shipping = CkJsonObject_IsNullOf(jsonResponse,"data[i].shipping");
sourcesObject = CkJsonObject_stringOf(jsonResponse,"data[i].sources.object");
sourcesHas_more = CkJsonObject_BoolOf(jsonResponse,"data[i].sources.has_more");
sourcesTotal_count = CkJsonObject_IntOf(jsonResponse,"data[i].sources.total_count");
sourcesUrl = CkJsonObject_stringOf(jsonResponse,"data[i].sources.url");
subscriptionsObject = CkJsonObject_stringOf(jsonResponse,"data[i].subscriptions.object");
subscriptionsHas_more = CkJsonObject_BoolOf(jsonResponse,"data[i].subscriptions.has_more");
subscriptionsTotal_count = CkJsonObject_IntOf(jsonResponse,"data[i].subscriptions.total_count");
subscriptionsUrl = CkJsonObject_stringOf(jsonResponse,"data[i].subscriptions.url");
j = 0;
count_j = CkJsonObject_SizeOfArray(jsonResponse,"data[i].sources.data");
while (j < count_j) {
CkJsonObject_putJ(jsonResponse,j);
j = j + 1;
}
j = 0;
count_j = CkJsonObject_SizeOfArray(jsonResponse,"data[i].subscriptions.data");
while (j < count_j) {
CkJsonObject_putJ(jsonResponse,j);
j = j + 1;
}
i = i + 1;
}
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
}
{
"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"
}
}
]
}