Unicode C++ Requires Chilkat v11.7.0+
Unicode C++
Stripe: Find customer records by billing email
See more Stripe Examples
Find all customers with a given billing email, including addresses with a plus sign. Display the internal account reference so the operator can select the right record.
Stripe documentation and cURL example
Chilkat Unicode C++ Downloads
#include <CkHttpCurlW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
const wchar_t *apiKey = L"YOUR_STRIPE_TEST_KEY";
CkHttpCurlW curl;
CkStringBuilderW cmd;
CkJsonObjectW json;
int replaced;
CkStringBuilderW email;
email.SetString(L"billing+east@example.com");
// Show every match so the operator can check the internal account reference.
CkStringBuilderW pageSuffix;
bool more = true;
const wchar_t *cursor = L"";
while ((more == true)) {
// curl -X GET "https://api.stripe.com/v1/customers?email={email}&limit=100" \
// -u "$STRIPE_API_KEY:" \
// -H "Stripe-Version: 2026-10-28.endive"
cmd.SetString(L"curl -X GET \"https://api.stripe.com/v1/customers?email=@EMAIL@&limit=100@CURSOR@\"");
cmd.Append(L" -u \"@KEY@:\"");
cmd.Append(L" -H \"Stripe-Version: 2026-10-28.endive\"");
replaced = cmd.Replace(L"@CURSOR@",pageSuffix.getAsString());
replaced = cmd.Replace(L"@EMAIL@",email.getEncoded(L"url_rfc3986",L"utf-8"));
replaced = cmd.Replace(L"@KEY@",apiKey);
success = curl.DoYourThing(cmd.getAsString());
if (success != true) {
wprintf(L"No HTTP response. Chilkat failure code: %d\n",curl.get_FailReason());
return;
}
success = curl.GetResponseJson(json);
if ((curl.get_StatusCode() != 200) || (success != true)) {
wprintf(L"Stripe HTTP %d Request-Id: %s\n",curl.get_StatusCode(),curl.getResponseHeaderField(L"Request-Id"));
if (success == true) {
wprintf(L"%s\n",json.stringOf(L"error.message"));
}
return;
}
int i = 0;
int count = json.SizeOfArray(L"data");
while ((i < count)) {
json.put_I(i);
wprintf(L"%s | %s | %s | %s\n",json.stringOf(L"data[i].id"),json.stringOf(L"data[i].name"),json.stringOf(L"data[i].email"),json.stringOf(L"data[i].metadata.account_ref"));
i = i + 1;
}
more = json.BoolOf(L"has_more");
if (more == true) {
const wchar_t *next = json.stringOf(L"data[i].id");
if ((count < 1) || (next == L"") || (next == cursor)) {
wprintf(L"Invalid pagination cursor.\n");
return;
}
cursor = next;
pageSuffix.SetString(L"&starting_after=");
pageSuffix.Append(cursor);
}
}
}