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

Stripe: Find a catalog price by its lookup key

See more Stripe Examples

Retrieve an active price by its catalog lookup key and read its price ID, currency, amount, and billing type.

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 lookupKey = new chilkat.StringBuilder();
    lookupKey.SetString("support_monthly_usd");

    //  curl -X GET "https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D={lookupKey}&limit=2" \
    //    -u "$STRIPE_API_KEY:" \
    //    -H "Stripe-Version: 2026-10-28.endive"
    cmd.SetString("curl -X GET \"https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D=@LOOKUP@&limit=2\"");
    cmd.Append(" -u \"@KEY@:\"");
    cmd.Append(" -H \"Stripe-Version: 2026-10-28.endive\"");
    replaced = cmd.Replace("@LOOKUP@",lookupKey.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;
    }

    if ((json.SizeOfArray("data") !== 1) || (json.BoolOf("has_more") == true)) {
        console.log("Expected one active price for this lookup key.");
        return;
    }

    console.log("id = " + json.StringOf("data[0].id"));
    console.log("lookup_key = " + json.StringOf("data[0].lookup_key"));
    console.log("currency = " + json.StringOf("data[0].currency"));
    console.log("unit_amount_decimal = " + json.StringOf("data[0].unit_amount_decimal"));
    console.log("type = " + json.StringOf("data[0].type"));

}

chilkatExample();