Smart and dynamic pricing engine for global applications, supporting real-time currency conversion, quantity, discounts, tax calculations, and formatted output.
- 🌐 Supports 160+ currencies
- 🔄 Auto-fetches latest exchange rates
- 🧾 VAT / GST / custom tax support
- 💸 Discount by percentage or fixed value
- 📦 Quantity multiplier
- 🪙 Currency symbol & locale-aware formatting
- 🧠 Works offline using cached or fallback rates
- 🔐
.envsupport for premium API keys
npm install globalpriceconst{ calculatePrice, updateRates }=require("globalprice");awaitupdateRates();// optional, updates latest ratesconstresult=awaitcalculatePrice({basePrice: 100,quantity: 2,currency: "LKR",discount: {type: "percent",value: 10},tax: {type: "VAT",rate: 12},format: true});console.log(result.formatted);// 'Rs 7320.00'npm testAdd .env for custom API keys:
EXCHANGE_API_KEY=your_api_key_hereglobalprice/
├── src/
│ ├── index.js
│ ├── rates.js
│ └── currencies.js
├── cache/
│ └── exchangeRates.json
├── test/
│ └── globalprice.test.js
├── .env
├── package.json
├── LICENSE
└── README.md
MIT © Menula De Silva