B4X Requires Chilkat v11.7.0+
B4X
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 B4X Downloads
Dim success As Boolean = False
' Requires an unlocked Chilkat bundle. See Global Unlock Sample.
' Supply a restricted sandbox key from merchant-controlled configuration.
Dim apiKey As String = "YOUR_STRIPE_TEST_KEY"
Dim curl As ChilkatHttpCurl
curl.Initialize("curl")
Dim cmd As ChilkatStringBuilder
cmd.Initialize
Dim json As ChilkatJsonObject
json.Initialize
Dim replaced As Int
Dim lookupKey As ChilkatStringBuilder
lookupKey.Initialize
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 " & Chr(34) & "https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D=@LOOKUP@&limit=2" & Chr(34))
cmd.Append(" -u " & Chr(34) & "@KEY@:" & Chr(34))
cmd.Append(" -H " & Chr(34) & "Stripe-Version: 2026-10-28.endive" & Chr(34))
replaced = cmd.Replace("@LOOKUP@", lookupKey.GetEncoded("url_rfc3986", "utf-8"))
replaced = cmd.Replace("@KEY@", apiKey)
success = curl.DoYourThing(cmd.GetAsString)
If success <> True Then
Log("No HTTP response. Chilkat failure code: " & curl.FailReason)
Return
End If
success = curl.GetResponseJson(json)
If (curl.StatusCode <> 200) Or (success <> True) Then
Log("Stripe HTTP " & curl.StatusCode & " Request-Id: " & curl.GetResponseHeaderField("Request-Id"))
If success = True Then
Log(json.StringOf("error.message"))
End If
Return
End If
If (json.SizeOfArray("data") <> 1) Or (json.BoolOf("has_more") = True) Then
Log("Expected one active price for this lookup key.")
Return
End If
Log("id = " & json.StringOf("data[0].id"))
Log("lookup_key = " & json.StringOf("data[0].lookup_key"))
Log("currency = " & json.StringOf("data[0].currency"))
Log("unit_amount_decimal = " & json.StringOf("data[0].unit_amount_decimal"))
Log("type = " & json.StringOf("data[0].type"))