.NET API
PricingApi
Headless pricing facade for scripts and Flow Studio. It wraps the SAME engine the Breakdown panel uses (BreakdownService -> BreakdownObject.Compute), so the number the chat reports and the number the panel shows can never diverge.
from ArtisanPlugin.Scripting import PricingApi
See also the guide, Pricing, and the Python package, ra.pricing.
Methods
| Method | |
|---|---|
Calculate | Recomputes the price for the current document using the active manufacturer / market and returns the totals plus the per-category breakdown. |
CalculateDetailed | Like Calculate(), but returning the SAME line-level detail the Breakdown panel shows: one line per metal (weight, waste, price), per certified diamond, per gem group (count, carats, sieve, price per carat, setting type), per process (metal processes, setting labor, additionals) and per extra component. |
GetSettingsJson | The settings as indented JSON — the whole manufacturer, or just the node at path (dot-separated, case-insensitive, [n] for list items: “Markets”, “Diamonds.CertificateFromCt”, “Cfp.Items[2]”). |
SetSetting | Updates ONE cost value by path and persists the manufacturer file — e.g. |
ShowPanel | Opens the Breakdown (price details) panel. |
Calculate
PriceResult PricingApi.Calculate(bool quoteCertified = true, bool? export = null)
Recomputes the price for the current document using the active manufacturer / market and returns the totals plus the per-category breakdown. Use it to answer “what’s the price?” without opening the panel. quoteCertified false = skip the live Nivoda quotes for the certified diamonds (every diamond above the manufacturer’s CertificateFromCt threshold): fast and offline, but those stones price as 0. Default true = quote them live with your saved Nivoda filter, like the panel. export true = export sale: metal is costed without the import duty / levy set in Breakdown Settings; false = domestic (duty included); null keeps the document’s current choice.
| Parameter | Type | Default |
|---|---|---|
quoteCertified | bool | true |
export | bool? | null |
Returns PriceResult.
CalculateDetailed
PriceBreakdownDetails PricingApi.CalculateDetailed(
bool quoteCertified = true,
bool? export = null)
Like Calculate(), but returning the SAME line-level detail the Breakdown panel shows: one line per metal (weight, waste, price), per certified diamond, per gem group (count, carats, sieve, price per carat, setting type), per process (metal processes, setting labor, additionals) and per extra component. Read-only.
| Parameter | Type | Default |
|---|---|---|
quoteCertified | bool | true |
export | bool? | null |
Returns PriceBreakdownDetails.
GetSettingsJson
string PricingApi.GetSettingsJson(string path = null)
The settings as indented JSON — the whole manufacturer, or just the node at path (dot-separated, case-insensitive, [n] for list items: “Markets”, “Diamonds.CertificateFromCt”, “Cfp.Items[2]”). Read-only.
| Parameter | Type | Default |
|---|---|---|
path | string | null |
Returns string.
SetSetting
void PricingApi.SetSetting(string path, string value)
Updates ONE cost value by path and persists the manufacturer file — e.g. SetSetting(“Markets.Gold”, “68.5”) or SetSetting(“Diamonds.CertificateFromCt”, “0.30”). The value string is converted to the target type (number, bool, string or enum name). The next Calculate() prices with the new value.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
value | string | required |
ShowPanel
void PricingApi.ShowPanel()
Opens the Breakdown (price details) panel. Call after Calculate() so the panel shows the freshly computed totals. Must run on the UI thread (Flow Studio’s Apply does).