Skip to content

clayton/AppStorePriceLocalizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

App Store Price Localizer

This project was vibe coded using Claude with input and oversight from clayton

Automatically adjust App Store in-app purchase and subscription prices across territories using purchasing power parity (PPP) pricing, with USD as the anchor currency. Uses the Big Mac Index to determine fair pricing based on local purchasing power.

Overview

This Ruby CLI tool helps you maintain fair pricing across different countries by adjusting prices based on purchasing power parity. Instead of using simple exchange rates, this tool considers the relative cost of living in different countries to set more equitable prices.

The tool uses the Big Mac Index from The Economist as its PPP data source, covering ~50 countries with the most active app markets.

How It Works

  1. Uses your USD pricing as the anchor
  2. Fetches PPP data from the Big Mac Index
  3. Calculates PPP ratios for each country (local_big_mac_price / us_big_mac_price)
  4. Adjusts your product prices proportionally: local_price = usd_price Γ— ppp_ratio
  5. Matches calculated prices to Apple's available price tiers for each territory
  6. Previews changes or applies them to your App Store products

Setup

Prerequisites

  • Ruby 2.7 or higher
  • App Store Connect API credentials
  • Bundler (gem install bundler)

Installation

  1. Clone or download this project:
cd AppStorePriceLocalizer
  1. Install dependencies:
bundle install
  1. Configure your credentials:
cp .env.example .env
  1. Edit .env and add your App Store Connect API credentials:
    • APP_STORE_KEY_ID - Your API Key ID
    • APP_STORE_ISSUER_ID - Your Issuer ID
    • APP_STORE_PRIVATE_KEY - Your .p8 private key content (including BEGIN/END lines)

Getting App Store Connect API Credentials

  1. Go to App Store Connect
  2. Navigate to Users and Access > Keys
  3. Generate a new key with "Admin" or "App Manager" role
  4. Download the .p8 file and note the Key ID and Issuer ID
  5. Copy the contents of the .p8 file to your .env file

Usage

Basic Commands

Preview price changes (dry run - default):

./price_localizer.rb YOUR_APP_ID

Apply price changes:

./price_localizer.rb YOUR_APP_ID --apply

Process specific products only:

./price_localizer.rb YOUR_APP_ID --products product_id_1,product_id_2

Enable debug output:

./price_localizer.rb YOUR_APP_ID --debug

Force refresh of PPP data:

./price_localizer.rb YOUR_APP_ID --force

Options

  • APP_ID - (Required) Your App Store app ID (positional argument or --app-id flag)
  • --products ID1,ID2 - (Optional) Comma-separated list of specific product IDs to process
  • --apply - Actually make the price changes (default is dry-run preview)
  • --force - Force recalculation even if data is cached
  • --debug - Enable verbose debug output
  • -h, --help - Show help message

Examples

1. Preview all price changes for an app:

./price_localizer.rb 6747396799

2. Apply changes to specific subscription:

./price_localizer.rb 6747396799 --products com.myapp.premium --apply

3. Update all prices with fresh data:

./price_localizer.rb 6747396799 --force --apply

Output Example

πŸš€ App Store Price Localizer
App ID: 6747396799
Mode: πŸ‘€ DRY RUN (preview only)
================================================================================

πŸ“± Fetching app information...
App: My Awesome App
Bundle ID: com.example.myapp

πŸ“¦ Fetching in-app purchases and subscriptions...
Found:
  - 2 subscription(s)
  - 3 in-app purchase(s)

🌍 Territory Coverage:
  πŸ” Big Mac Index data: ~48 countries

================================================================================
πŸ“± Subscription: Premium Monthly (com.myapp.premium.monthly)
Fetching current prices...
Fetching available price points...
US Price (anchor): $9.99

πŸ“Š Price Comparison:
-------------------------------------------------------------------------------------------------------------------
Territory Country              Current       Proposed      Change     PPP        Source
-------------------------------------------------------------------------------------------------------------------
USA      United States        $9.99         $9.99         anchor     1.00x      anchor
AUS      Australia            14.99         8.49          -43.4%     0.85x      Big Mac
BRA      Brazil               N/A           6.99          new        0.70x      Big Mac
CAN      Canada               13.99         9.49          -32.2%     0.95x      Big Mac
GBR      Britain              9.99          9.99          0.0%       1.00x      Big Mac
JPN      Japan                1200          1150          -4.2%      1.15x      Big Mac
...
-------------------------------------------------------------------------------------------------------------------

πŸ‘€ Dry run complete. No changes were made.
   Run with --apply flag to make these changes.

How Pricing Works

PPP-Based Pricing

The tool uses the Big Mac Index from The Economist to determine fair pricing across territories:

  1. Big Mac Index: Compares the price of a Big Mac in different countries
  2. PPP Ratio: local_big_mac_price / us_big_mac_price
  3. Localized Price: usd_price Γ— ppp_ratio
  4. Coverage: ~48 countries (major app markets)
  5. Update Frequency: Bi-annual, cached for 7 days

Example:

  • US Big Mac: $5.79
  • UK Big Mac: $5.72
  • PPP Ratio: 5.72 / 5.79 = 0.99
  • If US subscription is $9.99, UK price would be: $9.99 Γ— 0.99 = $9.89

This approach provides pricing that reflects local purchasing power rather than just currency exchange rates.

Apple Price Tiers

Apple uses predefined price tiers for each territory. The tool automatically finds the closest available price tier to your calculated price.

Territory Coverage

The Big Mac Index covers ~48 territories including major app markets:

  • Americas: US, Canada, Brazil, Mexico, Argentina, Chile, Colombia, Costa Rica, etc.
  • Europe: UK, Switzerland, Sweden, Norway, Poland, Czech Republic, Hungary, Romania, etc.
  • Asia-Pacific: Japan, Australia, China, Hong Kong, Singapore, Thailand, South Korea, Taiwan, etc.
  • Middle East: UAE, Saudi Arabia, Israel, Kuwait, Jordan, Qatar, Egypt, Lebanon, etc.
  • Africa: South Africa

Countries not in the Big Mac Index will not have prices automatically set.

Data Sources

Data caching:

  • Big Mac Index data is cached locally for 7 days
  • Use --force to refresh cached data

Project Structure

AppStorePriceLocalizer/
β”œβ”€β”€ price_localizer.rb           # Main CLI script
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ app_store_connect.rb     # Apple API client
β”‚   β”œβ”€β”€ big_mac_index.rb         # Big Mac Index PPP data handler
β”‚   β”œβ”€β”€ world_bank_ppp.rb        # World Bank data (currently disabled)
β”‚   β”œβ”€β”€ territory_mapper.rb      # ISO3 β†’ Apple territory mapping
β”‚   └── price_calculator.rb      # Price calculation logic
β”œβ”€β”€ Gemfile                      # Ruby dependencies
β”œβ”€β”€ .env.example                 # Environment variables template
β”œβ”€β”€ .gitignore
└── README.md

Important Notes

Dry Run by Default

The tool runs in dry-run mode by default and will only preview changes. You must explicitly use --apply to make actual price changes.

Price Change Threshold

The tool skips applying prices that change by less than 1% to avoid unnecessary API calls.

Rate Limiting

Be aware of Apple's API rate limits. The tool processes products sequentially to avoid hitting rate limits.

Subscription Pricing Considerations

  • Existing subscribers may be grandfathered at old prices depending on your settings
  • Price changes may require user consent in some regions
  • Consider testing with a single product first

Data Source Considerations

Big Mac Index

  • Informal but widely-recognized PPP indicator
  • Covers ~48 major app markets
  • Updated bi-annually by The Economist
  • Good for relative price comparisons across countries
  • Based on consumer prices (Big Mac = standardized consumer good)

Limitations

  • PPP may not reflect all local economic factors
  • Limited to countries where McDonald's operates
  • Some territories use the same currency (e.g., Eurozone) but have different purchasing power
  • Data updates have inherent delays (bi-annual)

Troubleshooting

"Missing APP_STORE_KEY_ID environment variable"

Make sure you've created a .env file from .env.example and filled in your credentials.

"Could not find US price for this subscription"

Ensure your product has a price set for the US territory in App Store Connect.

"No products found to process"

Verify your app ID is correct and that the app has in-app purchases or subscriptions configured.

API Authentication Errors

  • Check that your API key is still valid
  • Ensure your API key has sufficient permissions (Admin or App Manager)
  • Verify the key hasn't expired

Contributing

This tool was inspired by the AppStoreTranslator project and follows similar patterns for Apple API integration.

Related Tools

License

See LICENSE file for details.

Disclaimer

This tool makes changes to your App Store pricing. Always preview changes carefully before applying. The authors are not responsible for any pricing errors or issues that may result from using this tool.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages