A simple module that holds currencies and prices from the Apple's iOS App Store.
gem install app_store_pricing_matrix
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
andREVERSE_CURRENCY_MAP
are removed. They are all self-referential now.CUSTOMER_CURRENCIES
andDEVELOPER_CURRENCIES
are removed. UseCURRENCIES
instead.
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"
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:
- 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:generate
to compile the input files into pricing data - Then run the spec to verify the generated content by
rake