Sample code for 30+ languages & platforms
Node.js Requires Chilkat v11.7.0+

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 Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    //  Requires an unlocked Chilkat bundle. See Global Unlock Sample.
    //  Supply a restricted sandbox key from merchant-controlled configuration.
    var apiKey = "YOUR_STRIPE_TEST_KEY";

    var curl = new chilkat.HttpCurl();
    var cmd = new chilkat.StringBuilder();
    var json = new chilkat.JsonObject();

    var replaced;

    var email = new chilkat.StringBuilder();
    email.SetString("billing+east@example.com");

    //  Show every match so the operator can check the internal account reference.

    var pageSuffix = new chilkat.StringBuilder();
    var more = true;
    var cursor = "";
    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("curl -X GET \"https://api.stripe.com/v1/customers?email=@EMAIL@&limit=100@CURSOR@\"");
        cmd.Append(" -u \"@KEY@:\"");
        cmd.Append(" -H \"Stripe-Version: 2026-10-28.endive\"");
        replaced = cmd.Replace("@CURSOR@",pageSuffix.GetAsString());
        replaced = cmd.Replace("@EMAIL@",email.GetEncoded("url_rfc3986","utf-8"));
        replaced = cmd.Replace("@KEY@",apiKey);
        success = curl.DoYourThing(cmd.GetAsString());
        if (success !== true) {
            console.log("No HTTP response. Chilkat failure code: " + curl.FailReason);
            return;
        }

        success = curl.GetResponseJson(json);
        if ((curl.StatusCode !== 200) || (success !== true)) {
            console.log("Stripe HTTP " + curl.StatusCode + "  Request-Id: " + curl.GetResponseHeaderField("Request-Id"));
            if (success == true) {
                console.log(json.StringOf("error.message"));
            }

            return;
        }

        var i = 0;
        var count = json.SizeOfArray("data");
        while ((i < count)) {
            json.I = i;
            console.log(json.StringOf("data[i].id") + " | " + json.StringOf("data[i].name") + " | " + json.StringOf("data[i].email") + " | " + json.StringOf("data[i].metadata.account_ref"));
            i = i+1;
        }

        more = json.BoolOf("has_more");
        if (more == true) {
            var next = json.StringOf("data[i].id");
            if ((count < 1) || (next == "") || (next == cursor)) {
                console.log("Invalid pagination cursor.");
                return;
            }

            cursor = next;
            pageSuffix.SetString("&starting_after=");
            pageSuffix.Append(cursor);
        }

    }


}

chilkatExample();