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

Objective-C
#import <NSString.h>
#import <CkoHttpCurl.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>

BOOL success = NO;

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

CkoHttpCurl *curl = [[CkoHttpCurl alloc] init];
CkoStringBuilder *cmd = [[CkoStringBuilder alloc] init];
CkoJsonObject *json = [[CkoJsonObject alloc] init];

int replaced;

CkoStringBuilder *lookupKey = [[CkoStringBuilder alloc] init];
[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@" replacement: [lookupKey GetEncoded: @"url_rfc3986" charset: @"utf-8"]] intValue];
replaced = [[cmd Replace: @"@KEY@" replacement: apiKey] intValue];
success = [curl DoYourThing: [cmd GetAsString]];
if (success != YES) {
    NSLog(@"%@%d",@"No HTTP response. Chilkat failure code: ",[curl.FailReason intValue]);
    return;
}

success = [curl GetResponseJson: json];
if (([curl.StatusCode intValue] != 200) || (success != YES)) {
    NSLog(@"%@%d%@%@",@"Stripe HTTP ",[curl.StatusCode intValue],@"  Request-Id: ",[curl GetResponseHeaderField: @"Request-Id"]);
    if (success == YES) {
        NSLog(@"%@",[json StringOf: @"error.message"]);
    }

    return;
}

if (([[json SizeOfArray: @"data"] intValue] != 1) || ([json BoolOf: @"has_more"] == YES)) {
    NSLog(@"%@",@"Expected one active price for this lookup key.");
    return;
}

NSLog(@"%@%@",@"id = ",[json StringOf: @"data[0].id"]);
NSLog(@"%@%@",@"lookup_key = ",[json StringOf: @"data[0].lookup_key"]);
NSLog(@"%@%@",@"currency = ",[json StringOf: @"data[0].currency"]);
NSLog(@"%@%@",@"unit_amount_decimal = ",[json StringOf: @"data[0].unit_amount_decimal"]);
NSLog(@"%@%@",@"type = ",[json StringOf: @"data[0].type"]);