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"
var
rest: HCkRest;
success: Boolean;
bTls: Boolean;
port: Integer;
bAutoReconnect: Boolean;
strResponseBody: PWideChar;
jsonResponse: HCkJsonObject;
id: PWideChar;
object: PWideChar;
account_balance: Integer;
created: Integer;
currency: PWideChar;
default_source: Boolean;
delinquent: Boolean;
description: PWideChar;
discount: Boolean;
email: Boolean;
livemode: Boolean;
shipping: Boolean;
sourcesObject: PWideChar;
sourcesHas_more: Boolean;
sourcesTotal_count: Integer;
sourcesUrl: PWideChar;
subscriptionsObject: PWideChar;
subscriptionsHas_more: Boolean;
subscriptionsTotal_count: Integer;
subscriptionsUrl: PWideChar;
i: Integer;
count_i: Integer;
begin
rest := CkRest_Create();
// URL: https://api.stripe.com/v1/customers/cus_CBbgVLJqv487Oq
bTls := True;
port := 443;
bAutoReconnect := True;
success := CkRest_Connect(rest,'api.stripe.com',port,bTls,bAutoReconnect);
if (success <> True) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
CkRest_SetAuthBasic(rest,'STRIPE_SECRET_KEY','');
CkRest_AddQueryParam(rest,'description','Customer for isabella.williams@example.com');
strResponseBody := CkRest__fullRequestFormUrlEncoded(rest,'POST','/v1/customers/cus_CBbgVLJqv487Oq');
if (CkRest_getLastMethodSuccess(rest) <> True) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
jsonResponse := CkJsonObject_Create();
CkJsonObject_Load(jsonResponse,strResponseBody);
id := CkJsonObject__stringOf(jsonResponse,'id');
object := CkJsonObject__stringOf(jsonResponse,'object');
account_balance := CkJsonObject_IntOf(jsonResponse,'account_balance');
created := CkJsonObject_IntOf(jsonResponse,'created');
currency := CkJsonObject__stringOf(jsonResponse,'currency');
default_source := CkJsonObject_IsNullOf(jsonResponse,'default_source');
delinquent := CkJsonObject_BoolOf(jsonResponse,'delinquent');
description := CkJsonObject__stringOf(jsonResponse,'description');
discount := CkJsonObject_IsNullOf(jsonResponse,'discount');
email := CkJsonObject_IsNullOf(jsonResponse,'email');
livemode := CkJsonObject_BoolOf(jsonResponse,'livemode');
shipping := CkJsonObject_IsNullOf(jsonResponse,'shipping');
sourcesObject := CkJsonObject__stringOf(jsonResponse,'sources.object');
sourcesHas_more := CkJsonObject_BoolOf(jsonResponse,'sources.has_more');
sourcesTotal_count := CkJsonObject_IntOf(jsonResponse,'sources.total_count');
sourcesUrl := CkJsonObject__stringOf(jsonResponse,'sources.url');
subscriptionsObject := CkJsonObject__stringOf(jsonResponse,'subscriptions.object');
subscriptionsHas_more := CkJsonObject_BoolOf(jsonResponse,'subscriptions.has_more');
subscriptionsTotal_count := CkJsonObject_IntOf(jsonResponse,'subscriptions.total_count');
subscriptionsUrl := CkJsonObject__stringOf(jsonResponse,'subscriptions.url');
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'sources.data');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
i := i + 1;
end;
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'subscriptions.data');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
i := i + 1;
end;
CkRest_Dispose(rest);
CkJsonObject_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"
}
}