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

Visual FoxPro
LOCAL lnSuccess
LOCAL lcApiKey
LOCAL loCurl
LOCAL loCmd
LOCAL loJson
LOCAL lnReplaced
LOCAL loLookupKey

lnSuccess = 0

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

loCurl = CreateObject('Chilkat.HttpCurl')
loCmd = CreateObject('Chilkat.StringBuilder')
loJson = CreateObject('Chilkat.JsonObject')

loLookupKey = CreateObject('Chilkat.StringBuilder')
loLookupKey.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"
loCmd.SetString('curl -X GET "https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D=@LOOKUP@&limit=2"')
loCmd.Append(' -u "@KEY@:"')
loCmd.Append(' -H "Stripe-Version: 2026-10-28.endive"')
lnReplaced = loCmd.Replace("@LOOKUP@",loLookupKey.GetEncoded("url_rfc3986","utf-8"))
lnReplaced = loCmd.Replace("@KEY@",lcApiKey)
lnSuccess = loCurl.DoYourThing(loCmd.GetAsString())
IF (lnSuccess <> 1) THEN
    ? "No HTTP response. Chilkat failure code: " + STR(loCurl.FailReason)
    RELEASE loCurl
    RELEASE loCmd
    RELEASE loJson
    RELEASE loLookupKey
    CANCEL
ENDIF

lnSuccess = loCurl.GetResponseJson(loJson)
IF ((loCurl.StatusCode <> 200) OR (lnSuccess <> 1)) THEN
    ? "Stripe HTTP " + STR(loCurl.StatusCode) + "  Request-Id: " + loCurl.GetResponseHeaderField("Request-Id")
    IF (lnSuccess = 1) THEN
        ? loJson.StringOf("error.message")
    ENDIF

    RELEASE loCurl
    RELEASE loCmd
    RELEASE loJson
    RELEASE loLookupKey
    CANCEL
ENDIF

IF ((loJson.SizeOfArray("data") <> 1) OR (loJson.BoolOf("has_more") = 1)) THEN
    ? "Expected one active price for this lookup key."
    RELEASE loCurl
    RELEASE loCmd
    RELEASE loJson
    RELEASE loLookupKey
    CANCEL
ENDIF

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

RELEASE loCurl
RELEASE loCmd
RELEASE loJson
RELEASE loLookupKey