Apple added price
field on StoreKit's Transaction
with Xcode 15.1 and I adopted immediately. What I saw was that when the app was run in debug or TestFlight, the values for price
were the same as they were displayed to the user e.g. $29.99 would be returned as 29.99
but in production I got values multiplied by 1000. They do multiply values by 1000 for App Store Server Notifications and APIs though but it is not documented as such for StoreKit's Transaction price field.
I am afraid to make this change again and deploy it to production. Has anybody experienced anything like this?
There was a known issue with the price
property on Transaction
when building with Xcode 15.1 and 15.2. This issue was resolved in Xcode 15.3. If you build your app using Xcode 15.3 or later, the price
property will provide consistent results.
The issue was within the Xcode tools, so as long as you build your app using Xcode 15.3 or later, the API will work correctly regardless of which operating system version your app is running on.
To answer your question directly:
- StoreKit Swift API: The
price
property onTransaction
is aDecimal
number representing units of thecurrency
property. These are single units, i.e. ifprice
is 2.99 andcurrency
is EUR, the price is €2.99. - App Store Server API: The
price
property on the transaction information JWS payload is a JSON number representing milliunits of thecurrency
property. i.e. ifprice
is 2990 andcurrency
is EUR, the price is €2.99.