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 <CkRestW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
CkRestW rest;
bool success;
// URL: https://api.stripe.com/v1/customers?limit=3
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect(L"api.stripe.com",port,bTls,bAutoReconnect);
if (success != true) {
wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
wprintf(L"%s\n",rest.lastErrorText());
return;
}
rest.SetAuthBasic(L"STRIPE_SECRET_KEY",L"");
CkStringBuilderW sbResponseBody;
success = rest.FullRequestNoBodySb(L"GET",L"/v1/customers?limit=3",sbResponseBody);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
CkJsonObjectW jsonResponse;
jsonResponse.LoadSb(sbResponseBody);
const wchar_t *object = 0;
const wchar_t *url = 0;
bool has_more;
int i;
int count_i;
const wchar_t *id = 0;
int account_balance;
int created;
const wchar_t *currency = 0;
bool default_source;
bool delinquent;
bool description;
bool discount;
bool email;
bool livemode;
bool shipping;
const wchar_t *sourcesObject = 0;
bool sourcesHas_more;
int sourcesTotal_count;
const wchar_t *sourcesUrl = 0;
const wchar_t *subscriptionsObject = 0;
bool subscriptionsHas_more;
int subscriptionsTotal_count;
const wchar_t *subscriptionsUrl = 0;
int j;
int count_j;
object = jsonResponse.stringOf(L"object");
url = jsonResponse.stringOf(L"url");
has_more = jsonResponse.BoolOf(L"has_more");
i = 0;
count_i = jsonResponse.SizeOfArray(L"data");
while (i < count_i) {
jsonResponse.put_I(i);
id = jsonResponse.stringOf(L"data[i].id");
object = jsonResponse.stringOf(L"data[i].object");
account_balance = jsonResponse.IntOf(L"data[i].account_balance");
created = jsonResponse.IntOf(L"data[i].created");
currency = jsonResponse.stringOf(L"data[i].currency");
default_source = jsonResponse.IsNullOf(L"data[i].default_source");
delinquent = jsonResponse.BoolOf(L"data[i].delinquent");
description = jsonResponse.IsNullOf(L"data[i].description");
discount = jsonResponse.IsNullOf(L"data[i].discount");
email = jsonResponse.IsNullOf(L"data[i].email");
livemode = jsonResponse.BoolOf(L"data[i].livemode");
shipping = jsonResponse.IsNullOf(L"data[i].shipping");
sourcesObject = jsonResponse.stringOf(L"data[i].sources.object");
sourcesHas_more = jsonResponse.BoolOf(L"data[i].sources.has_more");
sourcesTotal_count = jsonResponse.IntOf(L"data[i].sources.total_count");
sourcesUrl = jsonResponse.stringOf(L"data[i].sources.url");
subscriptionsObject = jsonResponse.stringOf(L"data[i].subscriptions.object");
subscriptionsHas_more = jsonResponse.BoolOf(L"data[i].subscriptions.has_more");
subscriptionsTotal_count = jsonResponse.IntOf(L"data[i].subscriptions.total_count");
subscriptionsUrl = jsonResponse.stringOf(L"data[i].subscriptions.url");
j = 0;
count_j = jsonResponse.SizeOfArray(L"data[i].sources.data");
while (j < count_j) {
jsonResponse.put_J(j);
j = j + 1;
}
j = 0;
count_j = jsonResponse.SizeOfArray(L"data[i].subscriptions.data");
while (j < count_j) {
jsonResponse.put_J(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"
}
}
]
}