Currency & Pricing
Currency configuration and price formatting.
Updated
On this page
Overview
Currency and pricing settings are configured at the organization level and returned in the global data.
Reading Currency
import dash from "@/lib/dash"
const { global } = await dash.getGlobalData()
console.log(global.currency) // "USD"
Formatting Prices
function formatPrice(price: string, currency = "USD") {
return new Intl.NumberFormat("en-US", {
style: "currency",
currency,
}).format(Number(price))
}
formatPrice("29.99") // "$29.99"
formatPrice("29.99", "EUR") // "€29.99"
Price Fields
All prices in the API are returned as strings to avoid floating-point precision issues:
{
"price": "29.99",
"discounted_price": "24.99",
"subtotal": "59.98"
}
Tip: Always use
Number(price) or parseFloat(price) when doing math with prices, and convert back to a fixed-point string for display.
Next Steps
- getGlobalData() — Full global settings
- List Products — Product pricing