1

I'm trying to use StoreKit 2 and everything seems to work fine, except that the prices are always displayed in US$ (I've tried both simulator and the actual device).

I use StoreKit configuration file in Xcode and even when I try to print the product details its in US$.

{
"attributes" : {
"description" : {
  "standard" : ""
},
"isFamilyShareable" : 0,
"kind" : "Non-Consumable",
"name" : "",
"offerName" : "com.product.ticket-5",
"offers" : [
  {
    "currencyCode" : "USD",
    "price" : "5.0",
    "priceFormatted" : "$5.00"
  }
]
},
"href" : "\/v1\/catalog\/usa\/in-apps\/7C7207CC",
"id" : "7C7207CC",
"type" : "in-apps"
}

How can I display the local currency based on my phone settings? For example, I am based in the UK and would like to see the amount in £ GBP.

Thanks in advance!

UPDATE: There is no way to choose the currency; however I aspect that I can set my default currency (maybe with NSNumberFormatter idk?); also, I'd like that it change to local currency based on AppStore user settings or is this done automatically?

enter image description here

  • I don’t know StoreKit but my guess is that you need to give a price in GBP if that is what you want to display. At least it makes sense to me, how would the library know what 5 USD should be converted to in GBP? – Joakim Danielson Mar 14 '22 at 14:30
  • I've updated my question. I can't find a way to change the currency with UI. I suppose there is a way to do that programmatically. – Sebastijan B. Mar 14 '22 at 15:28
  • https://stackoverflow.com/a/46554728/2303865 – Leo Dabus Mar 14 '22 at 15:29
  • Thanks. however there is no priceLocale for me to change, is it possible that all prices are in US$ if you use StoreKit configuration file in Xcode? – Sebastijan B. Mar 14 '22 at 15:38
  • https://developer.apple.com/forums/thread/689978 – Sebastijan B. Mar 14 '22 at 16:15
  • 1
    also, changing settings in simulator doesn't help, I've tried this: Settings -> General -> Language & Region -> United Kingdom – Sebastijan B. Mar 14 '22 at 16:22
  • 5
    I found a solution; I need to select StoreKit configuration file, and go under menu Editor -> Default Storefront and select the prefferred currency. – Sebastijan B. Mar 14 '22 at 16:32

1 Answers1

1

I'm not sure if you're trying to change the currency only for testing purposes or for production. If you're only testing, then this is fine. Otherwise, the price string provided by StoreKit isn't meant to be modified and must be displayed as is.

The displayed currency doesn't depend on the user's locale settings, so you didn't see any effects when you changed these settings in the Settings app. Instead, the price and currency solely depends on the Storefront that the user is currently using. If their Storefront is the US App Store, they will see the price in USD. If their Storefront is the UK App Store, they will see the GBP price etc. The displayed price is the same price that the user will be billed on purchase. If you try to do any currency conversion, the result will very likely be wrong and will lead to confusion, user complaints and refunds.

Theo
  • 3,826
  • 30
  • 59
  • Sorry, I just noticed your answer. I sort out on the end by changing the currency for testing purposes in Editor / Default Storefront. – Sebastijan B. May 28 '22 at 21:42