9 Replies
      Latest reply on Jun 17, 2018 4:26 AM by ttdung001
      cinesoft Level 1 Level 1 (0 points)

        Hello All,

        I need some help to display appropriate currency for my product based on logged in user’s country.

        My App invokes web service and gets the product price. Now I need to see if loggedin user’s country is part of In-App supported country. if yes display current country based currency along the converted product cost else display in USD.

        I am not sure whether the approach Im taking is right or not. I need all your help to get this sorted out.

        guys pls help.

         

        Regards ,

         

        Lijith Vipin

        • Re: Country-wise currency conversion in In App Purchase
          PBK Level 6 Level 6 (2,575 points)

          It may be best to get the price directly from the user's App Store and use that.

          You will want to use code described here:

          https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/ShowUI.html#//apple_ref/doc/uid/TP40008267-CH3-SW5

           

          An example of such code is this where the strings stored in productButtons are used in a UIAlertView (it's old code):

           

          
          -(void) productsRequest: (SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
            int count=(int)[response.products count];
              if(count>0 && [SKPaymentQueue canMakePayments] ){
                 NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                 [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
                 [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
                 [numberFormatter setLocale:[[response.products objectAtIndex:0] priceLocale]];
          
                 for (int buttonCounter=0; buttonCounter<count; buttonCounter++) {
                      [productButtons addObject:[[[response.products objectAtIndex:buttonCounter] localizedDescription]
                             stringByAppendingFormat:@" %@",
                             [numberFormatter stringFromNumber:[[response.products objectAtIndex:buttonCounter] price]]]];
                      [productButtons addObject:[response.products objectAtIndex:buttonCounter]];  /
                 }
          
            • Re: Country-wise currency conversion in In App Purchase
              cinesoft Level 1 Level 1 (0 points)

              Hi PBK,

              Thank you for your fast response. Your answer helped me. I have another doubt. I have a price label in my viewcontroller in that label I have to show price according to the country (like in US $0.99 , in canada $1.36 so on).Iam using price tier 1.  When I am using the method "-(void) productsRequest: (SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response", it will show the currency correctly.  But its take more time. How can i reduce this time of execution ?. Is there any another method to replace the above method(-(void) productsRequest: (SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response")?.

            • Re: Country-wise currency conversion in In App Purchase
              KMT Level 9 Level 9 (12,235 points)

                   >whether the approach Im taking is right or not

               

              Actually - not.

               

              The devs chooses the appropriate price tier in iTunes Connect and the store takes care of showing prices to the user. In the example where there is an unsupported currency, Apple also makes that decision for the dev as well.

               

              Also note devs are discouraged from displaying prices on their own, which Apple fears could lead to mistake and confusion if they make changes later.