Giter VIP home page Giter VIP logo

purchasing-power-parity's Introduction

Purchasing Power Parity

Build Status

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:

screen shot 2017-11-02 at 08 40 54

How to use it?

Install:

npm install purchasing-power-parity

Use:

import fetchPPP from 'purchasing-power-parity';

let originalPrice = 99.99;
let discountPrice;

fetchPPP().then(response => {
  discountPrice = response.ppp.pppConversionFactor * originalPrice;
});

If you don't want to use this library, you can also use the API directly where you are able to pass the country code yourself. Otherwise, this library will figure out the location of the user itself.

After all, 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": "AR",
  "currenciesCountry": {
    "ARS": {
      "name": "Argentine peso",
      "symbol": "$"
    }
  },
  "countryCodeIsoAlpha3": "ARG",
  "currencyMain": {
    "exchangeRate": 99.148857,
    "name": "Argentine peso",
    "symbol": "$"
  },
  "ppp": 26.526,
  "pppConversionFactor": 0.2675371234990636
}

The currencyMain.exchangeRate and ppp property are used to compute the pppConversionFactor.

Limitations

  • runs only in the browser
  • takes only USD as baseline

Who uses PPP?

This node package was inspired by Wes Bos 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:

Contribution

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

purchasing-power-parity's People

Contributors

deadcoder0904 avatar raquelxmoss avatar rwieruch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.