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

Python
import sys
import chilkat2

success = False

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

curl = chilkat2.HttpCurl()
cmd = chilkat2.StringBuilder()
json = chilkat2.JsonObject()

lookupKey = chilkat2.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):
    print("No HTTP response. Chilkat failure code: " + str(curl.FailReason))
    sys.exit()

success = curl.GetResponseJson(json)
if ((curl.StatusCode != 200) or (success != True)):
    print("Stripe HTTP " + str(curl.StatusCode) + "  Request-Id: " + curl.GetResponseHeaderField("Request-Id"))
    if (success == True):
        print(json.StringOf("error.message"))

    sys.exit()

if ((json.SizeOfArray("data") != 1) or (json.BoolOf("has_more") == True)):
    print("Expected one active price for this lookup key.")
    sys.exit()

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