Search code examples
iosstorekit

How to show the monthly price of a yearly subscription in StoreKit 2?


I can show the total yearly (or 6-month) auto renewable subscription price using displayPrice just fine, but I also want to show how much that would be per month, as I think its more enticing.

I could just use price and divide by 12 (or 6), but then I wouldn't know how to show the local currency symbol next to the price.

According to my googling this is easy to do in StoreKit 1 using SKProduct, but how do I do it in StoreKit 2 using Product?

Thanks!

PD: Is there a way to be able to test the different locales to make sure their prices/currency symbols are showing correctly?


Solution

  • Yeah, it is annoying that priceLocale is not available on the SKProduct object in StoreKit 2. Apparently priceLocale was removed in StoreKit 2 because it was not used very often!

    To show your monthly price - you are correct - you will have to just use price and divide by 12 or 6. That's what they say in their docs:

    Use this property to perform arithmetic calculations with the price of the product. For a localized string representation of the price to display to customers, use the displayPrice property instead.

    To know what to show the as local currency symbol next to the price, you will have to rely on priceFormatStyle and then extract the currency

    As for testing, the only thing I do is to have multiple sandbox testers created with different regions to see the prices displayed in their locale.

    But know this - if you are using just displayPrice - you have to worry about nothing. The price will always be in the locale of that App Store. These complications come in because you want to perform operations on your price (here - translating it to monthly) and then show it.