npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hahow/hh-pricing

v2.0.2

Published

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

Downloads

2

Readme

hh-pricing

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 @hahow/hh-pricing --save

Yarn:

yarn add @hahow/hh-pricing

Usage

import AppStorePricingMatrix from "@hahow/hh-pricing";

or

const AppStorePricingMatrix = require("@hahow/hh-pricing");
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);  // => "$"
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. "$".
  • 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. "$".
  • 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": "$",
//         "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": "$",
//         "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": "$",
//         "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: "$",
//   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