app-store-pricing-matrix

A simple module that holds currencies and prices from the Apple's iOS App Store.

Usage no npm install needed!

<script type="module">
  import appStorePricingMatrix from 'https://cdn.skypack.dev/app-store-pricing-matrix';
</script>

README

app-store-pricing-matrix

NPM version Build Status Coverage Status

A simple module that holds currencies and prices from the Apple's iOS App Store.

Install

npm:

npm i app-store-pricing-matrix

Yarn:

yarn add app-store-pricing-matrix

Usage

import AppStorePricingMatrix from "app-store-pricing-matrix";

or

const AppStorePricingMatrix = require("app-store-pricing-matrix");
const pricing = AppStorePricingMatrix.findBy({
  tier: "1",
  country: "US"
});

console.log(pricing.tierStem);        // => "1"
console.log(pricing.countryCode);     // => "US"
console.log(pricing.currencyCode);    // => "USD"
console.log(pricing.retailPrice);     // => 0.99
console.log(pricing.wholesalePrice);  // => 0.70
console.log(pricing.currencySymbol);  // => "quot;
console.log(pricing.fRetailPrice);    // => "$ 0.99"
console.log(pricing.fWholesalePrice); // => "$ 0.70"

API

Table of Contents

PricingInfo

Type: Object

Properties

  • countryCode string The country code, e.g. "US".
  • currencyCode string The currency code, e.g. "USD".
  • currencySymbol string The currency symbol, e.g. "quot;.
  • fRetailPrice string The retail price with currency symbol, e.g. "$0.99".
  • fWholesalePrice string The wholesale price with currency symbol, e.g. "$0.70".
  • retailPrice number The wholesale price, e.g. 0.99.
  • wholesalePrice number The wholesale price, e.g. 0.70.

Tier

Type: Object

Properties

FlattenedTier

Type: Object

Properties

  • countryCode string The country code, e.g. "US".
  • currencyCode string The currency code, e.g. "USD".
  • currencySymbol string The currency symbol, e.g. "quot;.
  • fRetailPrice string The retail price with currency symbol, e.g. "$0.99".
  • fWholesalePrice string The wholesale price with currency symbol, e.g. "$0.70".
  • retailPrice number The wholesale price, e.g. 0.99.
  • tierName string The name of tier, e.g. "Tier 1".
  • tierStem string The stem of tier, e.g. "1".
  • wholesalePrice number The wholesale price, e.g. 0.70.

tiers

Get all items of tier.

Examples

// returns
// [
//   {
//     "tierStem": "0",
//     "tierName": "Free",
//     "pricingInfo": [
//       {
//         "countryCode": "TW",
//         "currencyCode": "TWD",
//         "wholesalePrice": 0,
//         "retailPrice": 0,
//         "currencySymbol": "N",
//         "fRetailPrice": "NT$ 0",
//         "fWholesalePrice": "NT$ 0"
//       },
//       {
//         "countryCode": "US",
//         "currencyCode": "USD",
//         "wholesalePrice": 0.00,
//         "retailPrice": 0.00,
//         "currencySymbol": "quot;,
//         "fRetailPrice": "$0.00",
//         "fWholesalePrice": "$0.00"
//       },
//       {
//         "countryCode": "MY",
//         "currencyCode": "MYR",
//         "wholesalePrice": 0.00,
//         "retailPrice": 0.00,
//         "currencySymbol": "R",
//         "fRetailPrice": "RM0.00",
//         "fWholesalePrice": "RM0.00",
//       },
//       ...
//     ]
//   },
//   {
//     "tierStem": "1",
//     "tierName": "Tier 1",
//     "pricingInfo": [
//       {
//         "countryCode": "TW",
//         "currencyCode": "TWD",
//         "wholesalePrice": 20,
//         "retailPrice": 30,
//         "currencySymbol": "N",
//         "fRetailPrice": "NT$ 30",
//         "fWholesalePrice": "NT$ 20"
//       },
//       {
//         "countryCode": "US",
//         "currencyCode": "USD",
//         "wholesalePrice": 0.70,
//         "retailPrice": 0.99,
//         "currencySymbol": "quot;,
//         "fRetailPrice": "$0.99",
//         "fWholesalePrice": "$0.70"
//       },
//       {
//         "countryCode": "MY",
//         "currencyCode": "MYR",
//         "wholesalePrice": 2.73,
//         "retailPrice": 3.90,
//         "currencySymbol": "R",
//         "fRetailPrice": "RM3.90",
//         "fWholesalePrice": "RM2.73",
//       },
//       ...
//     ]
//   },
//   ...
//   {
//     "tierStem": "590",
//     "tierName": "Alternate Tier 5",
//     "pricingInfo": [
//       {
//         "countryCode": "TW",
//         "currencyCode": "TWD",
//         "wholesalePrice": 100,
//         "retailPrice": 150,
//         "currencySymbol": "N",
//         "fRetailPrice": "NT$ 150",
//         "fWholesalePrice": "NT$ 100"
//       },
//       {
//         "countryCode": "US",
//         "currencyCode": "USD",
//         "wholesalePrice": 3.50,
//         "retailPrice": 4.99,
//         "currencySymbol": "quot;,
//         "fRetailPrice": "$4.99",
//         "fWholesalePrice": "$3.50"
//       },
//       {
//         "countryCode": "MY",
//         "currencyCode": "MYR",
//         "wholesalePrice": 13.93,
//         "retailPrice": 19.90,
//         "currencySymbol": "R",
//         "fRetailPrice": "RM19.90",
//         "fWholesalePrice": "RM13.93",
//       },
//       ...
//     ]
//   }
// ]
AppStorePricingMatrix.tiers;

Returns Array<Tier> An array

stems

Get all stems of tier.

Examples

// returns ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "510", "530", "550", "560", "570", "580", "590"]
AppStorePricingMatrix.stems;

Returns Array<string> An array of tier stems.

countries

Get all country code of tier.

Examples

// returns ["HK", "PT", "HN", "PY", "HR", "HU", "QA", "ID", "IE", "IL", "AE", "IN", "ZA", "IS", "AL", "IT", "AM", "AR", "AT", "AU", "RO", "RU", "BE", "BG", "JP", "BH", "BO", "SA", "BR", "SE", "SG", "SI", "BY", "SK", "CA", "SV", "CH", "KR", "CL", "CN", "CO", "CR", "KZ", "TH", "CY", "CZ", "TR", "DE", "TW", "TZ", "DK", "LT", "LU", "LV", "DO", "UA", "EC", "US", "EE", "EG", "MT", "MX", "MY", "ES", "VN", "NG", "NI", "NL", "NO", "FI", "NZ", "FR", "GB", "GR", "GT", "PA", "PE", "PH", "PK", "PL"]
AppStorePricingMatrix.countries

Returns Array<string> An array of country code.

currencies

Get all currency code of tier.

Examples

// returns ["HKD", "EUR", "USD", "HRK", "HUF", "QAR", "IDR", "ILS", "AED", "INR", "ZAR", "AUD", "RON", "RUB", "BGN", "JPY", "SAR", "BRL", "SEK", "SGD", "CAD", "CHF", "KRW", "CLP", "CNY", "COP", "KZT", "THB", "CZK", "TRY", "TWD", "TZS", "DKK", "EGP", "MXN", "MYR", "VND", "NGN", "NOK", "NZD", "GBP", "PEN", "PHP", "PKR", "PLN"]
AppStorePricingMatrix.currencies

Returns Array<string> An array of currency code.

findBy

Find pricing information by country code and tier stem.

Parameters

  • pricing Object
    • pricing.country string The country code, e.g. "TW", "US", "MY".
    • pricing.tier string The stem of tier.

Examples

"Tier 1" for USA

// returns
// {
//   countryCode: "US",
//   currencyCode: "USD",
//   currencySymbol: "quot;,
//   fRetailPrice: "$0.99",
//   fWholesalePrice: "$0.7",
//   retailPrice: 0.99,
//   tierStem: "1",
//   wholesalePrice: 0.7
//  }
AppStorePricingMatrix.findBy({ country: "US", tier: "1" });

"Tier 1" for Taiwan

// returns
// {
//   countryCode: "TW",
//   currencyCode: "TWD",
//   currencySymbol: "N",
//   fRetailPrice: "NT$ 30",
//   fWholesalePrice: "NT$ 20",
//   retailPrice: 30,
//   tierStem: "1",
//   wholesalePrice: 20
//  }
AppStorePricingMatrix.findBy({ country: "TW", tier: "1" });

"Tier 1" for Malaysia

// returns
// {
//   countryCode: "MY",
//   currencyCode: "MYR",
//   currencySymbol: "R",
//   fRetailPrice: "RM3.90",
//   fWholesalePrice: "RM2.73",
//   retailPrice: 3.90,
//   tierStem: "1",
//   wholesalePrice: 2.73
//  }
AppStorePricingMatrix.findBy({ country: "MY", tier: "1" });

Returns FlattenedTier The pricing information.

Updating the price

The pricing matrix JSON is taken from Apple's hidden API at the following URL.

https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/#{AppStoreID}/pricing/matrix

The URL is accessible when you are logged in to Apple Connect with your browser.

When you need to update the pricing matrix,

  1. Login to Apple Connect with your developer account.
  2. Enter any App Store ID that you own.
  3. Your default browser will launch and load the JSON. Copy the entire content and paste into input/pricing_matrix.json.
  4. Run npm test to check if anything is broken.
  5. Send a pull request with updated input/pricing_matrix.json.

Reference

Special thanks to @kenn kenn/app_store_pricing_matrix

License

MIT © Amo Wu