StoreKit in-app purchase always fails the first time with sandbox user, succeeds on retry

I've got an iOS app with an add-on non-consumable. In sandbox testing, the purchase attempt *always* shows an extra Buy prompt, and then fails if the sandbox account is new. Then, it always succeeds if you just try again. Is this normal?

Details: Test begins with a brand new Sandbox tester account, in USA region and verified via email invitation. Device iTunes & App Store SANDBOX ACCOUNT is logged in with this new account. App is completely deleted from device, then build/deployed with Xcode.

Note that launching the app initially always prompts to enter the password if this is the first time I've used this sandbox test account. This prompt doesn't say anything about sandbox, but it uses the sandbox email as Apple ID and sandbox login works.
  • Receipt retrieval and local validation works in the app, as does initial retrieval of the add-on product information with SKProductsRequest

  • Requesting purchase of add-on with SKPaymentQueue.add() correctly puts up the "Confirm Your In-App Purchase" modal, showing [Environment: Sandbox].

  • A paymentQueue:upatedTransactions invocation happens, with transactionState .purchasing.

  • After entering correct password and clicking Buy, there's a brief pause, then a second purchase confirmation modal appears exactly the same way, again with [Environment: Sandbox] and again requiring password

  • When I enter the password and click Buy again, the transaction fails. I get a .failed transaction paymentQueue update and the failure alert comes up saying try again later.

At this point, however, all I have to do is try again - immediately, or after quitting the app and restarting - and everything works perfectly and the purchase succeeds.

The success in the second case makes me think that the code is correct, and the problem with the first attempt is just some known sandbox or configuration issue. The double prompt seems especially weird since there's no transaction update between them. Do others see this behavior? Is there any way to make a sandbox purchase attempt succeed on the first attempt in this kind of environment?

Xcode 12.2, running on Intel 11.0.1; device running iOS 13.7.

Replies

Just adding a note this also happens testing the app under iOS 14, and it happens with a production-build app deployed through TestFlight. Not good!
I'm also seeing this exact same behaviour in both Sandbox and Beta testing through Test Flight. THe first time a use purchases my in-app purchase they get the double prompt to buy. After that, the user only get's it once.

Same issue. Sadly no fix.