chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
892 stars 187 forks source link

Fix/missing currency code and country code #222

Closed monkora closed 4 years ago

monkora commented 4 years ago

Issues

What

This PR fixes two problems.

  1. We were using the countryCode provided by the SKStorefront API in iOS 13+ and combing it with the product information returned from the SKProduct API. However, there were occasions where SKStorefront would return nil, which would mean an empty string would be sent to our own backend service. SKProduct actually provides its own method for returning the countryCode for each product, and we already use this on versions of iOS < 13. We have not seen a situation where it was undefined or nil. As such, we have decided to use the countryCode provided by SKProduct in all versions.
  2. The second issue was a missing currencyCode on iOS < 10. This was because accessing the property directly is not available on lower versions, however the same value can be fetched using a method that is available on all lower versions.