Price a real product with a rule, saved or not
POST
/api/v1/workspaces/{workspaceId}/channel-connections/{connectionId}/pricing/preview
const url = 'https://api.crossmart.io/api/v1/workspaces/example/channel-connections/example/pricing/preview';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"rule":{"adjustmentPercent":"15","fixedAmount":"0","rounding":"none","floor":{"minMarginPercent":"30"},"compareAt":"adjust","fixedExchangeRate":"0.92"},"productId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.crossmart.io/api/v1/workspaces/example/channel-connections/example/pricing/preview \ --header 'Content-Type: application/json' \ --data '{ "rule": { "adjustmentPercent": "15", "fixedAmount": "0", "rounding": "none", "floor": { "minMarginPercent": "30" }, "compareAt": "adjust", "fixedExchangeRate": "0.92" }, "productId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Without productId, the first product of the selection is priced.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspaceId
required
string
connectionId
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
rule
required
The rule to try, saved or not; null shows catalog prices
object
adjustmentPercent
required
Markup (positive) or discount (negative), -90 to 500
string
Example
15fixedAmount
required
Added after the percentage; may be negative
string
Example
0rounding
required
string
floor
required
object
minMarginPercent
required
Never price below cost plus this percentage (0 to 1000)
string
Example
30compareAt
required
string
fixedExchangeRate
Store-currency units per catalog-currency unit, used instead of the ECB daily rate. Only applies when the store sells in another currency than the workspace.
string
Example
0.92productId
The product to price; defaults to the first selected product
string format: uuid
Responses
Section titled “Responses”Media typeapplication/json
object
currencyCode
required
string
product
required
object
id
required
string format: uuid
title
required
string
variants
required
Array<object>
object
variantId
required
string format: uuid
title
required
string
basePrice
required
string
cost
required
string
resolved
required
object
price
required
string
compareAtPrice
required
string
source
required
string
steps
required
Array<object>
object
kind
required
string
label
required
string
amount
required
The price after this step
string
explanation
required
string
warnings
required
Array<string>
unitCost
required
The variant cost in the channel currency, converted like the price
string
Example
{ "currencyCode": "USD", "variants": [ { "title": "Blue / Large", "basePrice": "89.00", "resolved": { "price": "102.99", "source": "override", "steps": [ { "kind": "base", "label": "+15%", "amount": "102.35" } ], "explanation": "$89.00 → +15% → .99 = $102.99", "warnings": [ "missing_cost" ] } } ]}