How to test in-app purchases on a Kotlin Multiplatform Mac app
There are 2 ways of testing an in-app purchase: (1) using a local storekit config and (2) using a sandbox testing account.
Using a local StoreKit config requires an xcode project. Since a Kotlin Multiplatform Mac app doesn't generate one, we cannot use this approach. A KMP Mac app is different from a KMP iOS project which generates an xcode project.
Using a sandbox testing account requires the following 3 things in place:
- You must build an .app file and test on it as opposed to a
./gradlew run. - Your in-app product must be in the "ready to review" state. A lot of people including me had an issue getting it to be in the "ready to review" state because:
- We didn't know that the screenshot of "Review Information" was required.
- We didn't know the screenshot of "Review Information" needed to be 1280x800. This information isn't present anywhere on the App Store Connect and its documentation.
- There are some other sizes that work as well. Please see: https://stackoverflow.com/questions/39683170/in-app-purchases-stuck-in-missing-metadata-state
- Now we know...
- Your Paid App Agreement needs to be in the "Active" state. This means you will need to connect your bank account and provide tax-related information.
With the above 3 in place, you will be able to fetch a in-app product using a sandbox testing account.