App Store Pricing Matrix ======================== [![Build Status](https://secure.travis-ci.org/kenn/app_store_pricing_matrix.png)](http://travis-ci.org/kenn/app_store_pricing_matrix) A simple module that holds currencies and prices from the Apple's iOS App Store. Install ------- gem install app_store_pricing_matrix Changelog --------- v2.0.0 * 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. ```objc 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: ```ruby AppStorePricingMatrix::CURRENCIES => ["USD", "CAD", "MXN", "AUD", "NZD", "JPY", "EUR", "DKK", "SEK", "CHF", "NOK", "GBP", "CNY", "SGD", "HKD", "TWD"] ``` To retrieve a customer price, query with the currency and the tier number: ```ruby AppStorePricingMatrix::CUSTOMER_PRICES['USD'][1] => "0.99" AppStorePricingMatrix::CUSTOMER_PRICES['JPY'][1] => "85" ``` For developer proceeds: ```ruby 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 July 18, 2012, it was versioned as v13. 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, including a pair of 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 into pricing data 4. Then run the spec to verify the generated content by `rake` The data needed tweaks in several places: 1. Currencies that don't have a decimal point causes "00", namely JPY and TWD. Replace "00" with "0 0" 2. Tier 86 and 87 in MXN is broken. Fix the misplacement as appropriate. 3. Tier 67 for in CHF and Tier 1 in SGD were broken. "103.7" and "0.9" were replaced with "103.70" and "0.90" respectively