Delphi DLL Requires Chilkat v11.7.0+
Delphi DLL
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 Delphi DLL Downloads
var
success: Boolean;
apiKey: PWideChar;
curl: HCkHttpCurl;
cmd: HCkStringBuilder;
json: HCkJsonObject;
replaced: Integer;
lookupKey: HCkStringBuilder;
begin
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 := CkHttpCurl_Create();
cmd := CkStringBuilder_Create();
json := CkJsonObject_Create();
lookupKey := CkStringBuilder_Create();
CkStringBuilder_SetString(lookupKey,'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"
CkStringBuilder_SetString(cmd,'curl -X GET "https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D=@LOOKUP@&limit=2"');
CkStringBuilder_Append(cmd,' -u "@KEY@:"');
CkStringBuilder_Append(cmd,' -H "Stripe-Version: 2026-10-28.endive"');
replaced := CkStringBuilder_Replace(cmd,'@LOOKUP@',CkStringBuilder__getEncoded(lookupKey,'url_rfc3986','utf-8'));
replaced := CkStringBuilder_Replace(cmd,'@KEY@',apiKey);
success := CkHttpCurl_DoYourThing(curl,CkStringBuilder__getAsString(cmd));
if (success <> True) then
begin
Memo1.Lines.Add('No HTTP response. Chilkat failure code: ' + IntToStr(CkHttpCurl_getFailReason(curl)));
Exit;
end;
success := CkHttpCurl_GetResponseJson(curl,json);
if ((CkHttpCurl_getStatusCode(curl) <> 200) or (success <> True)) then
begin
Memo1.Lines.Add('Stripe HTTP ' + IntToStr(CkHttpCurl_getStatusCode(curl)) + ' Request-Id: ' + CkHttpCurl__getResponseHeaderField(curl,'Request-Id'));
if (success = True) then
begin
Memo1.Lines.Add(CkJsonObject__stringOf(json,'error.message'));
end;
Exit;
end;
if ((CkJsonObject_SizeOfArray(json,'data') <> 1) or (CkJsonObject_BoolOf(json,'has_more') = True)) then
begin
Memo1.Lines.Add('Expected one active price for this lookup key.');
Exit;
end;
Memo1.Lines.Add('id = ' + CkJsonObject__stringOf(json,'data[0].id'));
Memo1.Lines.Add('lookup_key = ' + CkJsonObject__stringOf(json,'data[0].lookup_key'));
Memo1.Lines.Add('currency = ' + CkJsonObject__stringOf(json,'data[0].currency'));
Memo1.Lines.Add('unit_amount_decimal = ' + CkJsonObject__stringOf(json,'data[0].unit_amount_decimal'));
Memo1.Lines.Add('type = ' + CkJsonObject__stringOf(json,'data[0].type'));
CkHttpCurl_Dispose(curl);
CkStringBuilder_Dispose(cmd);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(lookupKey);