Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

adjust/AEPriceMatrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AEPriceMatrix

Tier based currency conversion for iOS based on the App Store Pricing Matrix.

Overview

Example usage:

NSNumber *converted = [AEPriceMatrix convert:@0.99 from:@"USD" to:@"EUR"];
NSLog(@"converted to %@", converted);

Output:

converted to 0.89

In-App Purchase Tracking

This can be used for In-App Purchase tracking in a specific currency regardless of the local currency that the purchase was paid in. The following example tracks all revenue in EUR. See the In-App Purchase Programming Guide for details on how to implement a method like productForId: that finds an SKProduct by its product identifier.

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
    for (SKPaymentTransaction *transaction in transactions) {
        switch (transaction.transactionState) {
            case SKPaymentTransactionStatePurchased:
                [self finishTransaction:transaction];

                NSString *productId = transaction.payment.productIdentifier;
                SKProduct *product = [self productForId:productId];
                NSString *currency = [product.priceLocale objectForKey:NSLocaleCurrencyCode];
                NSNumber *price = product.price;

                NSNumber *revenue = [AEPriceMatrix convert:price from:currency to:@"EUR"];
                [self trackRevenue:revenue];

                break;
            // more cases
        }
    }
}

Available Currency Codes

Instead of plain currency code strings like @"USD" you can also use the following string constants:

kAECurrencyUSD    // U.S.
kAECurrencyCAD    // Canada
kAECurrencyMXN    // Mexico
kAECurrencyAUD    // Australia
kAECurrencyNZD    // New Zealand
kAECurrencyJPY    // Japan
kAECurrencyEUR    // Europe
kAECurrencyCHF    // Switzerland
kAECurrencyNOK    // Norway
kAECurrencyGBP    // U.K
kAECurrencyDKK    // Denmark
kAECurrencySEK    // Sweden
kAECurrencyCNY    // China
kAECurrencySGD    // Singapore
kAECurrencyHKD    // Hong Kong
kAECurrencyTWD    // Taiwan
kAECurrencyRUB    // Russia
kAECurrencyTRY    // Turkey
kAECurrencyINR    // India
kAECurrencyIDR    // Indonesia
kAECurrencyILS    // Isreal
kAECurrencyZAR    // South Africa
kAECurrencySAR    // Saudi Arabia
kAECurrencyAED    // UAE

About

Tier based currency conversion for iOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •