I'm using SwiftyStoreKit to handle IAP in my app. The issue is prices for IAP products will always show in USD currency like this: $9.99. No matter in what country people test the app.
I'm trying to change locale in Simulator like this (in scheme edit window). Using custom location won't give me another currency as well while Locale.current shows changed locale.
Trying both:
product.localizedPrice
And directly from product object (which localizedPrice is actually is as extension to SKProduct)
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .currency
numberFormatter.locale = product.priceLocale
let price = numberFormatter.string(from: product.price)
price still $9.99 here in Denmark or Japan
Am I missing some magic locale setting in the project properties?
The price and the price locale is determined by the store association of the purchasing account, not the device locale.
i.e. Someone with an account linked to the US store will always see $US since that is how they will be charged, regardless of where they are physically in the world or the locale of their device.
To test internationalisation of the price you will need to use a sandbox tester with an appropriate App Store territory.
If you run the app before you have logged in with a Sandbox tester then you will see the $US price by default. Also, note that you can't really test IAP in the simulator; You need to use a real device.
Sandbox accounts got handled differently since iOS 12. When you're running a development build from Xcode, the app will prompt for a fake sandbox AppleID as soon you initiate a purchase. After that first login, the app will know the right locale and therefore can display the appropriate prices for your in-app purchases. Before that, it will always display the prices in USD.
Source: https://developer.apple.com/documentation/storekit/in-app_purchase/testing_in-app_purchases_with_sandbox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With