Skip to main content

PPP (Purchasing Power Parity)

A simple, lightweight, and dependency-free NPM package to calculate Purchasing Power Parity (PPP) adjusted fair prices in USD. This package allows you to calculate what a “fair” price would be in different countries, based on the Price Level Ratio of PPP conversion factor to market exchange rate from the World Bank.

Why Parity Pricing?

Charging the same USD price globally ignores the vast differences in purchasing power:
  • $10 in the US is a cheap lunch
  • $10 in a developing nation might be a day’s wage
By adjusting your pricing based on PPP, you make your product affordable to the rest of the world, potentially increasing your total revenue by unlocking new markets.

Installation

Get started by installing the package via npm, yarn, or pnpm

Quickstart

Calculate your first PPP-adjusted price in minutes

API Reference

Explore the full API documentation and parameters

Examples

See real-world use cases and implementation patterns

Key Features

Zero Dependencies

Lightweight package with no runtime dependencies for your application

World Bank Data

Uses official Price Level Ratio data from World Bank indicator PA.NUS.PPPC.RF

Flexible Rounding

Choose from precision, currency, or marketing-friendly rounding strategies

TypeScript Support

Fully typed with TypeScript definitions included

ISO Country Codes

Supports both 2-letter and 3-letter country codes

Smoothing Control

Adjust the discount level from raw PPP to original pricing

Quick Example

Calculate a fair price for a $10 product in Sri Lanka:
import ppp from '@sachithrrra/ppp';

// Default smoothing (0.2), no rounding
console.log(ppp(10, 'LK')); 
// Output: 4.3108...

// With currency rounding (2 decimal places)
console.log(ppp(10, 'LK', 0.2, 'currency')); 
// Output: 4.31

// With pretty rounding (marketing-friendly)
console.log(ppp(10, 'LK', 0.2, 'pretty')); 
// Output: 4.49
The package uses the World Bank’s Price Level Ratio (indicator: PA.NUS.PPPC.RF) to determine fair pricing across 200+ countries.

How It Works

The library calculates adjusted prices using the formula:
Fair_Price_USD = Original_USD_Price × (Ratio + (1 - Ratio) × Smoothing)
Where:
  • Ratio: The Price Level Ratio for the country (~0.29 for Sri Lanka, ~1.0 for USA)
  • Smoothing: A value between 0 and 1 to control the discount level (default: 0.2)
Start with the default smoothing of 0.2 for a balanced discount, then adjust based on your market testing.

Build docs developers (and LLMs) love