Commerce Platform Patterns
Quantaprice is a specialised pricing engine, not a full commerce platform. It answers price queries and emits change events. The patterns below describe how to wire it into the systems that already exist in your stack.
Storefront (B2C and B2B self-serve)
On product page render, query POST /price/query with the SKU, pricelist, and quantity. Cache the result per SKU × pricelist combination with a short TTL (typically 1–5 minutes depending on your traffic and price volatility). When a price changes, Quantaprice emits a webhook; use the sku identifiers in the payload to invalidate only the affected cache keys rather than flushing the whole cache.
B2B self-serve storefronts follow the same pattern, but the pricelist identifier comes from the authenticated customer's account rather than a public default. Pass the customer-specific pricelist in every POST /price/query call. The engine resolves the correct price, including any customer-tier discounts or contracted rates, without any storefront-side logic.
Key calls: POST /price/query (render), webhook → targeted cache invalidation.
ERP Sync
ERP systems need prices to stay current with minimal latency but rarely need sub-second updates. Two approaches work well. Push: subscribe to webhooks, and on each price.changed event fetch the updated price with POST /price/query and write it into the ERP. Pull: poll GET /changelog every few minutes, apply changes in batch. Both approaches can coexist — use webhooks for intraday freshness and the changelog for reliable catch-up after downtime.
For period-close reconciliation or auditing, use the as_of parameter on POST /price/query to retrieve what the price was at any historical point in time. The changelog is append-only and ordered, so replaying it always produces a consistent view.
Key calls: GET /changelog (polling), POST /price/query with as_of (reconciliation).
CPQ (Configure, Price, Quote)
A CPQ system needs accurate prices at quote creation time and must be able to reproduce that price later. Query POST /price/query per quote line, passing the customer's pricelist, the specific SKU, and qty to trigger volume pricing if applicable. Record the as_of timestamp used at creation time alongside the quote.
To lock prices — so a quote issued today can be re-priced or audited tomorrow against what the engine said — repeat the same POST /price/query call with the original as_of value. The engine returns the same result regardless of what has changed since. This removes the need to snapshot prices inside the CPQ database.
Key calls: POST /price/query with pricelist, qty (line pricing); same call with as_of (price locking and audit).
Order Management and Checkout
At cart or order creation time, query POST /price/query for each line item with the correct pricelist, tax_area, and quantity. Quantaprice is the authoritative source for the base price. Your checkout system applies promotions or discount codes on top of that value — the engine does not manage promotions.
Treat the price returned at order submission as the committed price and store it on the order line. Do not re-query at fulfilment time unless your business rules require it; use as_of to look up what the price was at submission if you need to verify it later.
Key calls: POST /price/query with tax_area and qty per line item.
Data Warehouse and Analytics
The changelog at GET /changelog is an ordered, append-only event stream — it is a reliable source of truth for pricing history. Stream it into your warehouse by polling with a cursor; resume from the last processed cursor on restart. Use the entity_type field to route events to the right tables (pricelists, rules, SKU prices, and so on).
The content_hash field on each changelog entry deduplicates events in the case of reprocessing. Because the changelog is ordered and immutable, replaying it from the beginning always produces the same result, which makes backfills and schema migrations straightforward.
Key calls: GET /changelog with cursor-based pagination.
Pure Infrastructure Mode (Starting Simple)
You do not need to configure rules, hierarchies, or inheritance to get value from Quantaprice. Start by treating it as a fast, auditable price store: ingest raw prices via the API, query them. The full audit trail, effective-dating, multi-currency support, and webhook infrastructure are all available from day one, even without any pricing logic.
When your requirements grow — customer-tier pricing, volume breaks, inheritance from a parent pricelist — add rules incrementally. The API surface does not change. Existing integrations continue to work without modification.
Channel-Agnostic Design
Quantaprice does not know or care whether a query comes from a Shopify storefront, an ERP connector, a CPQ system, or a mobile app. The same POST /price/query endpoint and the same changelog serve all of them simultaneously. Adding a new integration — a new channel, a new internal system, a new third-party tool — requires no changes to the pricing engine. It requires only a new consumer of the same API and event stream. The engine stays stable; the integrations grow around it.