lp_test_…
Development quotes with project-scoped TEST isolation. Approved access is required.
LocalPrice turns a global product price into a deterministic INR recommendation, stores the result as a secure quote, and lets your backend verify the exact amount before creating checkout.
Keep lp_test_… and lp_live_… keys on your server. Send only the public quote ID through browser or mobile clients.
price("$49", "USD").to("INR") → "₹1,499"
verifyBeforeCheckout();Early access is currently available to selected early users while we are validating the pricing engine.
Request Early Access → organization starts PENDING → operator approves → create a project → generate a project-scoped TEST key → integrate the REST API or Node SDK. Random signups do not receive active API access immediately.
Install with npm install @localprice/node. Store the key in your server environment—never in frontend JavaScript.
LOCALPRICE_API_KEY="lp_test_your_key_here"
LOCALPRICE_BASE_URL="https://www.localpriceapi.online"Use a unique idempotency key for each logical pricing operation.
curl -X POST "$LOCALPRICE_BASE_URL/v1/prices/quote" \
-H "Authorization: Bearer $LOCALPRICE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: product-pro-annual-v1" \
-d '{
"amount": 40,
"currency": "USD",
"targetMarket": "IN",
"productType": "saas",
"pricingMode": "localized"
}'import { LocalPrice } from '@localprice/node';
const localprice = new LocalPrice({
apiKey: process.env.LOCALPRICE_API_KEY!,
});
const quote = await localprice.quotes.create({
amount: 40,
currency: 'USD',
targetMarket: 'IN',
productType: 'saas',
pricingMode: 'localized',
}, { idempotencyKey: 'product-pro-annual-v1' });Display localizedAmount to the customer and save quoteId for checkout verification. Money is returned as decimal strings to prevent floating-point loss.
{
"data": {
"quoteId": "quote_kN0cRjTQY0wJ8A6wE5b5FDzQ",
"status": "ACTIVE",
"mode": "TEST",
"pricingMode": "localized",
"sourceAmount": "49.0000",
"sourceCurrency": "USD",
"localizedAmount": "1499.00",
"localizedCurrency": "INR",
"targetMarket": "IN",
"productType": "saas",
"pricingModelVersion": "v1",
"expiresAt": "2026-09-01T12:00:00.000Z"
}
}Send the API key as a Bearer token on every pricing endpoint.
Authorization: Bearer lp_test_your_key_herelp_test_…Development quotes with project-scoped TEST isolation. Approved access is required.
lp_live_…Production quotes, separately keyed and isolated from TEST resources. Approved access is required.
Do not embed a LocalPrice API key in a browser, mobile app, public repository, log line, URL, or analytics event. Route calls through your backend.
/v1/prices/quoteAuthenticatedChoose localized for an India-optimized recommendation or fx for direct market-rate conversion. Omitting the mode preserves the localized default. Both create the same secure, project-scoped quote.
{
"amount": 40,
"currency": "USD",
"targetMarket": "IN",
"pricingMode": "fx"
}{
"amount": 40,
"currency": "USD",
"targetMarket": "IN",
"pricingMode": "localized",
"productType": "saas"
}amountnumber · requiredPositive source price. Use a JSON number, not a formatted currency string.
currencyenum · requiredUSD, EUR, JPY, KRW, or AED.
targetMarketenum · requiredMust be IN in V1.
pricingModeenum · optionallocalized (default) or fx.
productTypeenum · conditionalRequired for localized unless the project supplies a default; optional for FX.
sellerConstraintsobject · localized onlyFX requests containing constraints return CONSTRAINT_NOT_SUPPORTED_FOR_FX_MODE.
AuthorizationrequiredBearer lp_test_… or Bearer lp_live_…
Idempotency-KeyrecommendedUnique per logical quote creation; makes retries safe.
X-Request-IdoptionalYour trace ID: letters, digits, ., _, or -; maximum 64 characters.
Return only display-safe quote data to the frontend. Keep the source input and LocalPrice key server-side.
₹1,499Displays quotequote_01J…Owns API keyINR 1499Stores quoteThe displayed amount is presentation data. Never accept an INR amount submitted by the client as the checkout authority.
/v1/prices/quotes/:quoteId/verifyAuthenticatedFrom your backend, verify the quote immediately before creating a payment-provider session. Use the returned checkout.amount and checkout.currency exactly.
const verified = await localprice.quotes.verify(quoteId);
const checkoutSession = await payments.checkout.create({
currency: verified.checkout.currency, // "INR"
amount: verified.checkout.amount, // 1499
metadata: { localpriceQuoteId: verified.quoteId },
});LocalPrice does not process the customer's payment and does not integrate into or control the payment provider. The boundary is: source price → LocalPrice quote → verified INR amount → your backend → your Stripe, Razorpay, PayPal, or other gateway.
Use the stored, verified checkout values returned by LocalPrice.
Recalculate, round, convert, or trust an amount supplied by the browser.
/v1/prices/quotes/:quoteIdAuthenticatedRetrieve the stored quote for display refreshes or server-side inspection. Quotes remain isolated by project and mode; a quote created with a TEST key is invisible to LIVE keys.
const stored = await localprice.quotes.retrieve(quote.id);saasai_tooldeveloper_toolonline_coursecreator_toolgamingEnum values are case-sensitive. The only V1 target market is IN, and target currency is always INR. LocalPrice obtains FX data from Frankfurter; clients configure no FX key and do not call Frankfurter directly.
localized applies FX, affordability, category, constraints, price-point rounding, and a recommendation range. fx applies only source amount × current FX rate and normal two-decimal INR rounding. Optional constraints keep a localized recommendation inside your commercial boundaries. Precedence is evaluated per field: request value > project default > LocalPrice default.
{
"maximumRegionalDiscountPercent": 70,
"minimumRevenueRetentionPercent": 30,
"minimumLocalizedPriceINR": 1299,
"maximumLocalizedPriceINR": 2999,
"sellerCostAmount": 8,
"sellerCostCurrency": "USD",
"minimumGrossMarginPercent": 40
}maximumRegionalDiscountPercent0–100Caps discount relative to direct FX price.
minimumRevenueRetentionPercent0–100Protects the minimum source-price revenue retained.
minimumLocalizedPriceINRpositive INRSets an explicit floor.
maximumLocalizedPriceINRpositive INRSets an explicit ceiling.
sellerCostAmount + 2 moreall required togetherCost amount, cost currency, and minimum gross margin form one constraint group.
An impossible combination returns 422 CONSTRAINT_CONFLICT. LocalPrice never silently ignores a seller limit.
Safe to display and eligible for verification.
Create a fresh quote. Returns 410.
Create a fresh quote. Returns 409.
Always check the verification response at checkout time. Do not infer validity from a timestamp cached in the client.
Branch on error.code and HTTP status—not the human-readable message. Every error includes a request ID for support and tracing.
{
"requestId": "req_01J…",
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": {}
}
}VALIDATION_ERRORFix the payload; do not retry unchanged.
API_KEY_MISSING / API_KEY_INVALID / API_KEY_REVOKEDFix server credentials or replace the key.
EARLY_ACCESS_REQUIRED / PROJECT_ARCHIVEDWait for operator approval or restore permitted access.
RESOURCE_NOT_FOUNDCheck quote ID, project, and TEST/LIVE mode.
IDEMPOTENCY_KEY_CONFLICT / QUOTE_INVALIDATEDUse the original payload/new key, or create a new quote.
QUOTE_EXPIREDCreate and display a new quote.
CONSTRAINT_CONFLICTCorrect incompatible seller constraints.
QUOTA_EXCEEDEDWait until the returned reset time or contact the operator.
RATE_LIMIT_EXCEEDEDWait for Retry-After; this is separate from quota.
*_UNAVAILABLERetry later; preserve the same idempotency key.
Reuse the same key and normalized payload after a timeout. A replay returns the original response with Idempotency-Replayed: true. Completed responses are stored durably in PostgreSQL with the quote and quota. Durable identities do not expire automatically.
Inspect RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset. Respect Retry-After on 429.
Log X-Request-Id from every response and include it in support requests. You may supply your own safe trace identifier.
A Redis cache failure after commit does not invalidate your quote: retry with the same key to recover the original response. Redis remains required for the separate short-term rate limiter. Use a new key for a new quote after expiry.
Early access is currently available to selected early users while we are validating the pricing engine.
New organizations start PENDING. Only a LocalPrice operator can approve project-scoped TEST and LIVE key creation and API access.
Organization and project limits default to 10,000 successful creations and verifications per UTC calendar month. TEST and LIVE share both limits. Retrievals, failed validation/authentication, dashboard traffic, and idempotent replays do not consume quota. A new UTC calendar-month counter is used automatically; unused quota does not roll over.
Check remaining quota and reset date in Usage & Analytics. Exhaustion returns HTTP 429 QUOTA_EXCEEDED. The separate default short-term limit is 100 requests per 60 seconds per project and mode; it returns RATE_LIMIT_EXCEEDED with Retry-After.
quoteId through the browser.verified.checkout.amount and .currency without recalculation.X-Request-Id and configure quota alerts.GET /health for liveness and GET /ready for dependency readiness.npm install @localprice/nodeThe TypeScript-first client supports apiKey, baseUrl, timeout, requestId, and conservative maxRetries. Quote creation is retried only when you provide an idempotency key; retrieval and verification are safe to retry.
import { LocalPrice, generateIdempotencyKey } from '@localprice/node';
const localprice = new LocalPrice({
apiKey: process.env.LOCALPRICE_API_KEY!,
timeout: 5_000,
maxRetries: 2,
});
const quote = await localprice.quotes.create({
amount: 40,
currency: 'USD',
targetMarket: 'IN',
productType: 'saas',
pricingMode: 'localized',
}, {
idempotencyKey: generateIdempotencyKey('pricing-page'),
});
// Send quote.id and display-safe fields to the browser.
// Later, on your checkout route:
const stored = await localprice.quotes.retrieve(quote.id);
const verified = await localprice.quotes.verify(stored.id);
console.log(verified.checkout.amount, verified.checkout.currency);The production API base URL is https://www.localpriceapi.online. SDK errors expose name, message, code, status, requestId, and optional retryAfter.
LocalPrice publishes concise machine-readable context alongside the full API schema. Give both files to your coding assistant before asking it to build an integration.
Implement LocalPrice using the contract in /docs/llms.txt and
/docs/openapi.yaml. Keep the API key server-side. Create quotes with a
unique Idempotency-Key, return only display-safe quote data to the client,
and pass only quoteId back at checkout. Verify the quote on the server and
use verified.checkout.amount and verified.checkout.currency exactly when
creating payment checkout. Handle stable error.code values, respect
Retry-After, and log X-Request-Id. Do not recalculate or trust client prices.Never paste a real LocalPrice key, customer data, or payment-provider secret into an AI prompt. Use environment-variable placeholders and TEST keys in generated examples.
/healthProcess livenessGET/readyDatabase and Redis readinessPOST/v1/prices/quoteCreate a quoteGET/v1/prices/quotes/:quoteIdRetrieve a quotePOST/v1/prices/quotes/:quoteId/verifyVerify for checkout