Rust Requires Chilkat v11.7.0+
Rust
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 Rust Downloads
let mut success = false;
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
let api_key = "YOUR_STRIPE_TEST_KEY".to_string();
let curl = chilkat::HttpCurl::new();
let cmd = chilkat::StringBuilder::new();
let json = chilkat::JsonObject::new();
let lookup_key = chilkat::StringBuilder::new();
let _ = lookup_key.set_string("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"
let _ = cmd.set_string("curl -X GET \"https://api.stripe.com/v1/prices?active=true&lookup_keys%5B%5D=@LOOKUP@&limit=2\"");
let _ = cmd.append(" -u \"@KEY@:\"");
let _ = cmd.append(" -H \"Stripe-Version: 2026-10-28.endive\"");
let _ = cmd.replace("@LOOKUP@", &lookup_key.get_encoded("url_rfc3986", "utf-8").unwrap_or_default());
let _ = cmd.replace("@KEY@", &api_key);
success = curl.do_your_thing(&cmd.get_as_string().unwrap_or_default()).is_ok();
if !success {
println!("No HTTP response. Chilkat failure code: {}", curl.fail_reason());
return;
}
success = curl.get_response_json(&json).is_ok();
if (curl.status_code() != 200) || (!success) {
println!("Stripe HTTP {} Request-Id: {}", curl.status_code(), curl.get_response_header_field("Request-Id").unwrap_or_default());
if success {
println!("{}", json.string_of("error.message").unwrap_or_default());
}
return;
}
if (json.size_of_array("data") != 1) || (json.bool_of("has_more")) {
println!("Expected one active price for this lookup key.");
return;
}
println!("id = {}", json.string_of("data[0].id").unwrap_or_default());
println!("lookup_key = {}", json.string_of("data[0].lookup_key").unwrap_or_default());
println!("currency = {}", json.string_of("data[0].currency").unwrap_or_default());
println!("unit_amount_decimal = {}", json.string_of("data[0].unit_amount_decimal").unwrap_or_default());
println!("type = {}", json.string_of("data[0].type").unwrap_or_default());