PowerBuilder Requires Chilkat v11.7.0+
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
long li_Success
string ls_ApiKey
oleobject loo_Curl
oleobject loo_Cmd
oleobject loo_Json
long li_Replaced
oleobject loo_LookupKey
li_Success = 0
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
ls_ApiKey = "YOUR_STRIPE_TEST_KEY"
loo_Curl = create oleobject
li_rc = loo_Curl.ConnectToNewObject("Chilkat.HttpCurl")
if li_rc < 0 then
destroy loo_Curl
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Cmd = create oleobject
li_rc = loo_Cmd.ConnectToNewObject("Chilkat.StringBuilder")
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_LookupKey = create oleobject
li_rc = loo_LookupKey.ConnectToNewObject("Chilkat.StringBuilder")
loo_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"
loo_Cmd.SetString("curl -X GET ~"https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D=@LOOKUP@&limit=2~"")
loo_Cmd.Append(" -u ~"@KEY@:~"")
loo_Cmd.Append(" -H ~"Stripe-Version: 2026-10-28.endive~"")
li_Replaced = loo_Cmd.Replace("@LOOKUP@",loo_LookupKey.GetEncoded("url_rfc3986","utf-8"))
li_Replaced = loo_Cmd.Replace("@KEY@",ls_ApiKey)
li_Success = loo_Curl.DoYourThing(loo_Cmd.GetAsString())
if li_Success <> 1 then
Write-Debug "No HTTP response. Chilkat failure code: " + string(loo_Curl.FailReason)
destroy loo_Curl
destroy loo_Cmd
destroy loo_Json
destroy loo_LookupKey
return
end if
li_Success = loo_Curl.GetResponseJson(loo_Json)
if (loo_Curl.StatusCode <> 200) OR (li_Success <> 1) then
Write-Debug "Stripe HTTP " + string(loo_Curl.StatusCode) + " Request-Id: " + loo_Curl.GetResponseHeaderField("Request-Id")
if li_Success = 1 then
Write-Debug loo_Json.StringOf("error.message")
end if
destroy loo_Curl
destroy loo_Cmd
destroy loo_Json
destroy loo_LookupKey
return
end if
if (loo_Json.SizeOfArray("data") <> 1) OR (loo_Json.BoolOf("has_more") = 1) then
Write-Debug "Expected one active price for this lookup key."
destroy loo_Curl
destroy loo_Cmd
destroy loo_Json
destroy loo_LookupKey
return
end if
Write-Debug "id = " + loo_Json.StringOf("data[0].id")
Write-Debug "lookup_key = " + loo_Json.StringOf("data[0].lookup_key")
Write-Debug "currency = " + loo_Json.StringOf("data[0].currency")
Write-Debug "unit_amount_decimal = " + loo_Json.StringOf("data[0].unit_amount_decimal")
Write-Debug "type = " + loo_Json.StringOf("data[0].type")
destroy loo_Curl
destroy loo_Cmd
destroy loo_Json
destroy loo_LookupKey