Not everyone is able to pay for the default pricings of the western world. Online products should be made affordable for everyone around the world. This package is a simple way to make Purchasing Power Parity available in your browser. See how it could look like in your application for someone buying your product from another country:
Install:
npm install purchasing-power-parity
- get your OpenExchangeRates API Key
- get your Quandl API Key
Use:
import getPpp from 'purchasing-power-parity';
let originalPrice = 99.99;
let discountPrice;
getPpp(OPEN_EXCHANGE_RATES_API_KEY, QUANDL_API_KEY).then((ppp) => {
discountPrice = ppp.pppConversionFactor * originalPrice;
});
So you can adjust your prices when the pppConversionFactor
goes below 1 and add an optional banner for your customers to make them aware of it. What other information is in the returned PPP object?
ppp-object:
{
countryCodeIsoAlpha2: "IN",
countryCodeIsoAlpha3: "IND",
countryName: "India",
currenciesCountry: [{
code: "INR",
name: "Indian rupee",
symbol: "โน"
}],
currencyMain: {
exchangeRate: 65.06,
code: "INR",
name: "Indian rupee",
symbol: "โน"
},
ppp: 17.536,
pppConversionFactor: 0.2695358130956041,
}
The currencyMain
property with its exchangeRate
property is used to compute the pppConversionFactor
by using the ppp
.
- runs only in the browser
- takes only USD as baseline
This node package was inspired by Wesbos who sells his courses with PPP. There are other people which make their products affordable to everyone around the world by using PPP. You can add your project/company/product/service/... to the list when you are using this package:
- Road to React
- ...
The project is in an early stage, so please feel free to contribute to it. It works, but it could be more robust and improved. If you want to know how PPP works, you can read up this short article. I would love to see you contributing to it:
- create an Issue
- discuss with maintainers and contributors about the issue
- create a Pull Request if the issue should be solved