How to use Sandbox for IAP testing

Need some help here.

I've got an iPhone 11 PM on 16.6.1 and I'm trying to test Family Sharing IAPs. However, I can't seem to test via the Sandbox environment (which I need to validate receipt handling for Family Sharing). The app is running locally on my device and was built straight from Xcode.

When I tap to make a purchase in my app (which uses StoreKit2, if that makes any difference) a sheet pops up with a purchase button which, when tapped, immediately completes and I get the following dialog box:

"Your purchase was successful"

[Environment: Xcode]

How do I get my app to use the Sandbox environment? All documentation suggestions when I tap my purchase button I should simply be presented with a login modal and then, after the purchase has completed, be able to see my Sandbox credentials under Settings -> App Store. At the moment no dialog is presented (the purchase completes immediately) and the entire "Sandbox Account" section is missing from Settings -> App Store. Any help will be greatly appreciated!

I had the same problem (with Storekit 1 though. Not sure if that makes a difference). As long as you have your StoreKit file in your project it will always use this method. If you want to switch to Sandbox testing with the In App purchases (already set up in app store connect) from the app store just remove the StoreKit file from your project and also do not forget to remove it from Run configuration "Edit Scheme" where you added you Storekit before.

From now on you should be presented with the same modal but the title should say "Sandbox" instead of "Xcode".

How to use Sandbox for IAP testing
 
 
Q