Clean my device (or apple id?) from old sandbox users and their subscriptions

I have massive problems testing the in app purchase in my app. The product is an auto-renewing subscription.

Now I tested the process many times with one sandbox account. After days of testing I now have hundreds of transactions in there. Hence I removed this sandbox account. Now I wanted to test again with a new sandbox user. Of course, I logged out of my real Apple ID on my iPhone in the settings app.

The problem now is that everytime I open the purchase page and restore purchases in my app, the iOS dialog with the old account already prefilled in there pops up. That means, somewhere this reference is stored in my device or even in my apple ID because even if I restart my device or delete and reinstall the app, the email address of my old sandbox apple id is prefilled within the dialog.

Since this is a massive pain for testing, I want to get rid of this information. How can I completely wipe this data?

This is called ‘the endless loop’. You have Transactions in the queue of that device from that test user. You did not call finishedTransactions on those transactions so they will continue to present themselves sometimes daily sometimes weekly until you call finishTransactions. If you deleted the test user you can’t call finishTransactions. Only Apple technical support can delete such transactions.

If I could clean up such transaction from the test user accounts, I would do so. However this can only be handled by the iTunes Server engineers. They will instead advise you to stop using that test user account, create and use a new test user account.

The problem is that even if I started using a new account, the login dialog pops up for old test accounts. As PBK stated, it could be that there are unfinished transactions (I need to do further investigation on that), but if I understood correctly, I cannot finish transactions of users I deleted, right?

So I contacted iTunes Connect support for doing so and in the future I try to finish also the products that (for whatever reason) have not been finished, yet.

You should delete the app, then clear the iTunes and App Store user setting. Restart the device, then re-install the sandbox app using Xcode. There shouldn't be any user for the transactionObserver to check for incompleteTransactions.

Didn't work :-( Today I got a purchase token (app receipt id) and after server validation "c" did NOT contained the latest receipt info but some *very* old data from May 2017 which must have been from an already deleted sandbox user becuase the one I currently use didn't exist back then.

I even tried to check the receipt data by validating the app receipt id stored in "latest_receipt", but if I query this one I get a 21002 Exception : com.apple.jingle.mzfairplay.validators.DrmInvalidArgumentException.

All in all this is *very* frustrating. Escpecially compared to Android where everything just worked out of the box

Where do this old app receipt ids come from? And how can I ensure to *always* get the latest receipt data?

I expected that. See my earlier post above regarding the endless loop. You most likely failed to call finishTransactions and now you have a zombie transaction from a dead test user. The 21002 means you did not (or did) include an autorenewable password for a receipt with (or without) an autorenewable purchase.

Going to Settings -> iTunes & App Store -> scroll all the way to the botom and you'll see a section called SANDBOX ACCOUNT. The dead user will still be logged in. Log it out. The next time you try to purchase a product, it will prompt you for both an email & password. (iOS 12)

Even if you can't solve it, you can do a couple things that may help somewhat to keep you making progress.

In the func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) of your PaymentTransactionObserver as you loop over your transactions, first filter and (try to) finish any old transactions. For example, you could possibly skip transactions before a certain date (though I haven’t needed to filter by date myself).

This could reduce the noise a bit or even a lot depending on your situation. This is obviously a temporary measure so that you aren't blocked.

The other thing that helps is to put a switch somewhere that allows you to simulate in-app purchases during debug. For example, I can turn on and off subscriptions manually during debug. I have a section only present during debug in the table for my settings for things like this. This may or may not be useful depending on your setup. Obviously, make sure the switch is not there in the release version.

For me, it has been really helpful to settle a lot of the peripheral stuff around the UI and various other aspects of being subscribed or not.

More Like This

Retrieving data ...

This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Developer Forums Participation Agreement.