Retrieves the details of an existing customer. You need only supply the unique customer identifier that was returned upon customer creation.
curl https://api.stripe.com/v1/customers/cus_CBbgVLJqv487Oq \
-u STRIPE_SECRET_KEY:
#include <CkRestW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
CkRestW rest;
bool success;
// URL: https://api.stripe.com/v1/customers/cus_CBbgVLJqv487Oq
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/cus_CBbgVLJqv487Oq",sbResponseBody);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
CkJsonObjectW jsonResponse;
jsonResponse.LoadSb(sbResponseBody);
const wchar_t *id = 0;
const wchar_t *object = 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 i;
int count_i;
id = jsonResponse.stringOf(L"id");
object = jsonResponse.stringOf(L"object");
account_balance = jsonResponse.IntOf(L"account_balance");
created = jsonResponse.IntOf(L"created");
currency = jsonResponse.stringOf(L"currency");
default_source = jsonResponse.IsNullOf(L"default_source");
delinquent = jsonResponse.BoolOf(L"delinquent");
description = jsonResponse.IsNullOf(L"description");
discount = jsonResponse.IsNullOf(L"discount");
email = jsonResponse.IsNullOf(L"email");
livemode = jsonResponse.BoolOf(L"livemode");
shipping = jsonResponse.IsNullOf(L"shipping");
sourcesObject = jsonResponse.stringOf(L"sources.object");
sourcesHas_more = jsonResponse.BoolOf(L"sources.has_more");
sourcesTotal_count = jsonResponse.IntOf(L"sources.total_count");
sourcesUrl = jsonResponse.stringOf(L"sources.url");
subscriptionsObject = jsonResponse.stringOf(L"subscriptions.object");
subscriptionsHas_more = jsonResponse.BoolOf(L"subscriptions.has_more");
subscriptionsTotal_count = jsonResponse.IntOf(L"subscriptions.total_count");
subscriptionsUrl = jsonResponse.stringOf(L"subscriptions.url");
i = 0;
count_i = jsonResponse.SizeOfArray(L"sources.data");
while (i < count_i) {
jsonResponse.put_I(i);
i = i + 1;
}
i = 0;
count_i = jsonResponse.SizeOfArray(L"subscriptions.data");
while (i < count_i) {
jsonResponse.put_I(i);
i = i + 1;
}
}
{
"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"
}
}