StoreKit Transaction Price values

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?

Answered by Frameworks Engineer in 791648022

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 on Transaction is a Decimal number representing units of the currency property. These are single units, i.e. if price is 2.99 and currency 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 the currency property. i.e. if price is 2990 and currency is EUR, the price is €2.99.
Accepted Answer

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 on Transaction is a Decimal number representing units of the currency property. These are single units, i.e. if price is 2.99 and currency 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 the currency property. i.e. if price is 2990 and currency is EUR, the price is €2.99.

Ok great. Glad to hear it was an issue that is now fixed. Thank you.

StoreKit Transaction Price values
 
 
Q