lp_test_…
Sandbox quotes, isolated data, 1,000 monthly requests. Ideal for development and CI.
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.
Start with a TEST key. It uses isolated sandbox data and cannot consume LIVE allowance.
Store it in your server environment—never in frontend JavaScript.
LOCALPRICE_API_KEY="lp_test_your_key_here"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": 49,
"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: 49,
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_…Sandbox quotes, isolated data, 1,000 monthly requests. Ideal for development and CI.
lp_live_…Production quotes, paid allowance, completely isolated from TEST resources.
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.
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.id },
});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.
saasai_tooldeveloper_toolonline_coursecreator_tooldigital_productEnum values are case-sensitive. The only V1 target market is IN, and localized currency is always INR.
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 / INVALID / REVOKEDFix server credentials or replace the key.
EARLY_ACCESS_REQUIREDContact the LocalPrice administrator for approval.
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.
RATE_LIMIT_EXCEEDED / QUOTA_EXCEEDEDWait for Retry-After, then retry.
*_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 administrator can approve key creation and API access. No subscription payment is required.
Organization and project limits default to 10,000 successful creations and verifications per UTC calendar month. TEST and LIVE share these limits. Retrievals, failed requests, dashboard traffic, and idempotent replays do not consume quota.
Check remaining quota and reset date in Usage & Analytics. Exhaustion returns HTTP 429 QUOTA_EXCEEDED; this is separate from the short-term Redis rate limit.
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: 49,
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 verified = await localprice.quotes.verify(quote.id);
console.log(verified.checkout.amount, verified.checkout.currency);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