I'm trying to test in-app purchases in my app in the sandbox environment. I've purchased a one-time purchase in the app, but no purchases are visible under "Manage Transactions..." in Xcode. Deleting the app from the device as well as deleting the directories ~/Library/Caches/com.apple.appstoreagent and ~/Library/Caches/com.apple.storekitagent does not remove the purchase from the app. This makes it impossible to fully test purchases in the app.
StoreKit purchases not visible under "Manage Transactions..." in Xcode
The sandbox and StoreKit Testing in Xcode allow you to test in-app purchases. For more information, see Testing at all stages of development with Xcode and the sandbox.
but no purchases are visible under "Manage Transactions..." in Xcode
Xcode provides a transaction manager that you use with StoreKit Testing in Xcode. The Manage Transactions window lists transactions that take place in the local test environment. It doesn't show transactions occurring in the sandbox. For more information, see Testing in-app purchases with StoreKit transaction manager in Xcode.
To inspect transactions with the transaction manager, enable StoreKit Testing in Xcode in your Xcode project before starting to test your in-app purchases.
does not remove the purchase from the app.
To remove purchases made with the same Sandbox Apple ID in the sandbox, clear it in App Store Connect. In the local test environment, delete their related transactions in the Manage Transactions window.