Products & Pricing
Calculate Pricing
Calculate localized pricing without a product.
GET
Documentation Index
Fetch the complete documentation index at: https://docs.khaime.com/llms.txt
Use this file to discover all available pages before exploring further.
Calculate Pricing
Convert an amount from the merchant’s baseline currency to a target currency using Khaime’s exchange rates. Useful for displaying localized prices before creating a charge. Iftarget_currency is not provided, Khaime auto-detects the customer’s currency from their IP address.
If product_id is provided, any active price discrimination rule for the customer’s country is applied to the amount before currency conversion.
Query Parameters
Amount in the merchant’s baseline currency (smallest unit: cents, kobo, etc.).
Target currency code (e.g.,
NGN, EUR). If omitted, auto-detected from the customer’s IP address.Source currency to convert from. Defaults to the merchant’s baseline currency.
Optional. When provided, Khaime looks up any active price discrimination rule for the product and applies it before converting. The customer’s country is derived from
target_currency (e.g., NGN → NG) unless customer_country is explicitly set.Override for the customer’s country used in rule lookup. 2-letter ISO code (e.g.,
NG). Only needed when target_currency is ambiguous (e.g., USD is used in many countries) and you know the customer’s exact location.For marketplace integrations. When provided, pricing uses the sub-merchant’s baseline currency instead of the marketplace’s.
Response
Response Fields
| Field | Type | Description |
|---|---|---|
pricing.base | object | Original amount in merchant’s baseline currency |
pricing.local | object | Converted amount in the target currency (after any discrimination) |
pricing.local.formatted | string | Human-readable formatted price (e.g., "₦166,750.00") |
pricing.conversion.rate | number | Exchange rate applied |
pricing.conversion.source | string | Rate source: wise_api, custom, api, or none |
pricing.conversion.applied | boolean | true if conversion was applied |
price_discrimination | object | null | Discrimination breakdown if a rule matched; null otherwise |
price_discrimination.original_base_price | integer | Amount before the adjustment |
price_discrimination.discrimination_amount | integer | Amount added or subtracted |
price_discrimination.discrimination_percentage | number | Decimal percentage (e.g., 0.15 for +15%) |
price_discrimination.adjusted_base_price | integer | Amount after discrimination, before conversion |
price_discrimination.country_triggered | string | ISO-2 country code that matched the rule |
customer.location | object | Geo-detected location (present when target_currency is omitted) |
customer.currency.detected | boolean | true if currency was auto-detected from IP |
How country is determined
Whenproduct_id is provided, Khaime resolves the customer’s country in this order:
- Explicit
customer_countryquery parameter - Country mapped from
target_currency(e.g.,NGN→NG,GHS→GH) - IP geolocation fallback
customer_country — the currency alone is sufficient.
price_discrimination is only included in the response when product_id is provided. Without a product, Khaime has no rule context to evaluate.When
target_currency matches the merchant’s baseline currency, conversion.applied is false and pricing.base equals pricing.local.