Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
curl -X POST https://api.stripe.com/v1/customers/cus_CBbgVLJqv487Oq \
-u STRIPE_SECRET_KEY: \
-d description="Customer for isabella.williams@example.com"
#include <C_CkRestW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
const wchar_t *strResponseBody;
HCkJsonObjectW jsonResponse;
const wchar_t *id;
const wchar_t *object;
int account_balance;
int created;
const wchar_t *currency;
BOOL default_source;
BOOL delinquent;
const wchar_t *description;
BOOL discount;
BOOL email;
BOOL livemode;
BOOL shipping;
const wchar_t *sourcesObject;
BOOL sourcesHas_more;
int sourcesTotal_count;
const wchar_t *sourcesUrl;
const wchar_t *subscriptionsObject;
BOOL subscriptionsHas_more;
int subscriptionsTotal_count;
const wchar_t *subscriptionsUrl;
int i;
int count_i;
rest = CkRestW_Create();
// URL: https://api.stripe.com/v1/customers/cus_CBbgVLJqv487Oq
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRestW_Connect(rest,L"api.stripe.com",port,bTls,bAutoReconnect);
if (success != TRUE) {
wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
return;
}
CkRestW_SetAuthBasic(rest,L"STRIPE_SECRET_KEY",L"");
CkRestW_AddQueryParam(rest,L"description",L"Customer for isabella.williams@example.com");
strResponseBody = CkRestW_fullRequestFormUrlEncoded(rest,L"POST",L"/v1/customers/cus_CBbgVLJqv487Oq");
if (CkRestW_getLastMethodSuccess(rest) != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
return;
}
jsonResponse = CkJsonObjectW_Create();
CkJsonObjectW_Load(jsonResponse,strResponseBody);
id = CkJsonObjectW_stringOf(jsonResponse,L"id");
object = CkJsonObjectW_stringOf(jsonResponse,L"object");
account_balance = CkJsonObjectW_IntOf(jsonResponse,L"account_balance");
created = CkJsonObjectW_IntOf(jsonResponse,L"created");
currency = CkJsonObjectW_stringOf(jsonResponse,L"currency");
default_source = CkJsonObjectW_IsNullOf(jsonResponse,L"default_source");
delinquent = CkJsonObjectW_BoolOf(jsonResponse,L"delinquent");
description = CkJsonObjectW_stringOf(jsonResponse,L"description");
discount = CkJsonObjectW_IsNullOf(jsonResponse,L"discount");
email = CkJsonObjectW_IsNullOf(jsonResponse,L"email");
livemode = CkJsonObjectW_BoolOf(jsonResponse,L"livemode");
shipping = CkJsonObjectW_IsNullOf(jsonResponse,L"shipping");
sourcesObject = CkJsonObjectW_stringOf(jsonResponse,L"sources.object");
sourcesHas_more = CkJsonObjectW_BoolOf(jsonResponse,L"sources.has_more");
sourcesTotal_count = CkJsonObjectW_IntOf(jsonResponse,L"sources.total_count");
sourcesUrl = CkJsonObjectW_stringOf(jsonResponse,L"sources.url");
subscriptionsObject = CkJsonObjectW_stringOf(jsonResponse,L"subscriptions.object");
subscriptionsHas_more = CkJsonObjectW_BoolOf(jsonResponse,L"subscriptions.has_more");
subscriptionsTotal_count = CkJsonObjectW_IntOf(jsonResponse,L"subscriptions.total_count");
subscriptionsUrl = CkJsonObjectW_stringOf(jsonResponse,L"subscriptions.url");
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jsonResponse,L"sources.data");
while (i < count_i) {
CkJsonObjectW_putI(jsonResponse,i);
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jsonResponse,L"subscriptions.data");
while (i < count_i) {
CkJsonObjectW_putI(jsonResponse,i);
i = i + 1;
}
CkRestW_Dispose(rest);
CkJsonObjectW_Dispose(jsonResponse);
}
{
"id": "cus_CBbgVLJqv487Oq",
"object": "customer",
"account_balance": 0,
"created": 1516662781,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": "Customer for isabella.williams@example.com",
"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"
}
}