Prices
Everything is in cents
Section titled “Everything is in cents”Every money value in the API is an integer number of cents (or the smallest unit of the currency). 4599000 is $45,990.00. Divide by 100 to display.
Read a vehicle’s price
Section titled “Read a vehicle’s price”A vehicle’s prices live in pricing_config, a JSON object with one entry per state or country. Ask for one entry with path:
query VehiclePrice($id: uuid!) { stocked_vehicles_by_pk(id: $id) { id price: pricing_config(path: "AU_NSW") }}{ "version": "v2", "driveAwayPrice": 6890000, "isVariable": false, "isExclOnRoads": false, "lineItems": { "dutiable": [{ "code": "vehicle-price", "value": 6890000 }], "onRoad": [], "additional": [] }}| Field | Meaning |
|---|---|
driveAwayPrice |
The total the customer pays, in cents. Show this. |
isExclOnRoads |
true: the price excludes government charges. Label it “excl. on-road costs”, not “drive away”. |
isVariable |
true: price on application (for example, built to order). Don’t show a number. |
lineItems.dutiable |
The vehicle price and options that duty is charged on: vehicle-price, paint, accessories, discount… |
lineItems.onRoad |
Government and on-road charges: stamp-duty, registration, ctp, luxury-car-tax… |
lineItems.additional |
Charges and savings outside duty: freight, discount, cashback, grant… |
Discounts are line items with a negative value. driveAwayPrice already includes every line item, so you never need to add them up. Use the line items only if you want to show a breakdown.
Some older vehicles have a version: "v1" entry with totalAfterOnRoadCosts instead of driveAwayPrice. The Vyro storefront doesn’t show v1 prices, and you can skip them too.
Format it
Section titled “Format it”Round up to whole dollars, which is how dealers advertise. Use the currency for the state (see State pricing).
function formatPrice(price, { locale = 'en-AU', currency = 'AUD' } = {}) { if (!price || price.version !== 'v2') return null; if (price.isVariable) return 'Price on application';
const dollars = Math.ceil(price.driveAwayPrice / 100); const amount = new Intl.NumberFormat(locale, { style: 'currency', currency, maximumFractionDigits: 0, }).format(dollars);
return price.isExclOnRoads ? `${amount} excl. on-road costs` : `${amount} drive away`;}
formatPrice({ version: 'v2', driveAwayPrice: 6890000 }); // "$68,900 drive away"Filter and sort by price
Section titled “Filter and sort by price”min_price and max_price are the cheapest and dearest drive-away prices across all of a vehicle’s states, in cents. They are good enough for “under $40k” filters:
query Under40k($showroomId: uuid!) { stocked_vehicles( where: { showroom_stocked_vehicles: { showroom_id: { _eq: $showroomId } } min_price: { _lt: 4000000 } } order_by: [{ min_price: asc }, { id: asc }] limit: 20 ) { id min_price nsw: pricing_config(path: "AU_NSW") }}For an exact per-state filter or sort, read pricing_config(path: …).driveAwayPrice and sort in your code.
Discounts
Section titled “Discounts”Discounts are line items with the code discount and a negative value, in that state’s pricing_config. driveAwayPrice already has them taken off. To show “Save $2,000”, add them up for the state you’re showing:
function savings(price) { if (!price || price.version !== 'v2' || price.isVariable) return 0; const lines = [...(price.lineItems?.dutiable ?? []), ...(price.lineItems?.additional ?? [])]; const cents = lines.filter((l) => l.code === 'discount' && l.value < 0).reduce((sum, l) => sum - l.value, 0); return Math.floor(cents / 100); // whole dollars, e.g. 2000}The price before the discount is driveAwayPrice plus those savings.
has_discountistruewhen the vehicle has a discount in any state. Use it to filter, then work out each state’s saving withsavings.pricing_eventsis the vehicle’s price history across all states, so it suits a “was” price only for vehicles priced the same everywhere. The highest past price:
query WasPrice($id: uuid!) { stocked_vehicles_by_pk(id: $id) { pricing_events(order_by: { price: desc }, limit: 1) { price event_at } }}Quotes for a specific customer
Section titled “Quotes for a specific customer”pricing_config is the advertised price. To quote a customer exactly (their state, concessions, used-vehicle duty, registration transfer), use the Pricing API.