A simple module that holds currencies and prices from the Apple's iOS App Store.
gem install app_store_pricing_matrix
v2.0.0 (July 18, 2012)
- Based on v13.
- Added SGD, HKD and TWD.
CURRENCY_MAPandREVERSE_CURRENCY_MAPare removed. They are all self-referential now.CUSTOMER_CURRENCIESandDEVELOPER_CURRENCIESare removed. UseCURRENCIESinstead.
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"]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"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:
- Select a column vertically using mouse / trackpad from tier 0 through tier 87, covering pairs of a currency and its commission
- Save it into a text file, naming with the currency - e.g. "usd.txt" under the "input" folder
- Run
rake aspm:generateto compile the input files into pricing data - Then run the spec to verify the generated content by
rake
