Sample code for 30+ languages & platforms
JavaScript 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

Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
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 CkHttpCurl();
var cmd = new CkStringBuilder();
var json = new CkJsonObject();

var replaced;

var lookupKey = new CkStringBuilder();
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"));