Cannot test IAP on development build using sandbox

Ok, so I've been following the directions in Apple's documentation here: https://developer.apple.com/documentation/storekit/testing-in-app-purchases-with-sandbox?language=objc

It lists a bunch of requirements all of which I have done. I have verified the strings exactly match for the bundle names and the IAP bundle names between my code and AppStoreConnect.

The docs continue, saying to prepare to test:

During developement[sic], build and run your app from Xcode. At this stage, you don’t need to upload your app binary to App Store Connect to test it in the sandbox environment.

When the app loads, I see this error on the console in Xcode:

[IAPManager] Store init failed: PurchasingUnavailable - Retrieve Products failed, and could not retrieve any products.
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
IAPManager:OnInitializeFailed(InitializationFailureReason, String)

Unity documentation indicates that my app is reaching AppStore successfully but it is not responding with any products.

The app exists in app store connect, but it has not been submitted for review. The IAP is created and showing as "Ready to Submit", and it is linked to the app. Xcode is NOT configured to use StoreKit (StoreKit settings set to "None").

Edit: I actually figured out how to sign-on using the sandbox account in Developer settings on my test device, but it didn't make any difference.

I am using Unity Purchasing 5.1.2. Incidentally, I was able to successfully test the IAP flow for Android through Google Play. I think the problem is something with my app store connect configuration. I can't understand why following the documentation instructions isn't working for me. If I can't get this to work then I guess my next step will be to try to get TestFlight working instead. I don't see how I can submit an app for review if I can't test IAP process first locally.

Thanks in advance for any help.

Answered by lmcwil in 880308022

FOLLOWUP: By enabling SKDebugLogging and looking at console output coming from my Tablet using the Console app on my computer, i was able to see that the Unity code was actually sending the wrong identifier for the IAP- it was using the Android-specific one instead of the Apple one. Not sure why, but by using prepro directives to basically manually tell Unity which Identifier to use, i was able to get it working for App Store.

Now I just need to rebuild and retest for Android to make sure that still works.

Just posting this here in case anyone else hits this same problem. Because there are a TON of threads out there about people having issues with Apple IAP but nobody reported this as the reason.

Accepted Answer

FOLLOWUP: By enabling SKDebugLogging and looking at console output coming from my Tablet using the Console app on my computer, i was able to see that the Unity code was actually sending the wrong identifier for the IAP- it was using the Android-specific one instead of the Apple one. Not sure why, but by using prepro directives to basically manually tell Unity which Identifier to use, i was able to get it working for App Store.

Now I just need to rebuild and retest for Android to make sure that still works.

Just posting this here in case anyone else hits this same problem. Because there are a TON of threads out there about people having issues with Apple IAP but nobody reported this as the reason.

Hello -

Additional troubleshooting tips for testing IAP and product(s) availability in Xcode and in Sandbox can be found in the linked pages.

Please let us know if you have any other questions. Thank you.

Cannot test IAP on development build using sandbox
 
 
Q