Skip to content

mohound/app_store_pricing_matrix

 
 

Repository files navigation

App Store Pricing Matrix

Build Status

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

Install

gem install app_store_pricing_matrix

Changelog

v2.1.0 (October 26, 2012)

  • Based on v14.
  • Added RUB, TRY, INR, IDR, ILS, ZAR, SAR and AED

v2.0.0 (July 18, 2012)

  • Based on v13.
  • Added SGD, HKD and TWD.
  • CURRENCY_MAP and REVERSE_CURRENCY_MAP are removed. They are all self-referential now.
  • CUSTOMER_CURRENCIES and DEVELOPER_CURRENCIES are removed. Use CURRENCIES instead.

Usage

Suppose you find a device locale by NSLocale on an iOS device.

NSString* currency = [[NSLocale currentLocale] objectForKey:NSLocaleCurrencyCode];

That will give you the currency string like USD or EUR, and this library expects them as a key.

Some constants, useful for validation:

AppStorePricingMatrix::CURRENCIES
 => ["USD", "CAD", "MXN", "AUD", "NZD", "JPY", "EUR", "DKK", "SEK", "CHF", "NOK", "GBP", "CNY", "SGD", "HKD", "TWD", "RUB", "TRY", "INR", "IDR", "ILS", "ZAR", "SAR", "AED"]

To retrieve a customer price, query with the currency and the tier number:

AppStorePricingMatrix::CUSTOMER_PRICES['USD'][1]
 => "0.99"

AppStorePricingMatrix::CUSTOMER_PRICES['JPY'][1]
 => "85"

For developer proceeds:

AppStorePricingMatrix::DEVELOPER_PROCEEDS['GBP'][30]
 => "12.78"

Updating the price table

The price table was generated by parsing the exhibit C part of the paid app contract PDF file. As of October 26, 2012, it was versioned as v14.

Since the PDF file was malformed, PDF parsing wasn't feasible. My current method to extract out the data semi-automatically is as follows, using Mac OS X 10.7:

  1. Select a column vertically using mouse / trackpad from tier 0 through tier 87, covering pairs of a currency and its commission
  2. Save it into a text file, naming with the currency - e.g. "usd.txt" under the "input" folder
  3. Run rake aspm:generate to compile the input files into pricing data
  4. Then run the spec to verify the generated content by rake