In-App Purchase:No Token Available When Expected.What is this token?

ERROR: 💰 Product purchase for '***' failed with error: Error Domain=RevenueCat.ErrorCode Code=2 "There was a problem with the App Store." UserInfo={source_file=RevenueCat/SKError+Extensions.swift:64, NSUnderlyingError=0x600000c91890 {Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x600000c68570 {Error Domain=ASDServerErrorDomain Code=1003 "No Token Available When Expected." UserInfo={NSLocalizedFailureReason=No Token Available When Expected.}}}}, readable_error_code=STORE_PROBLEM, NSLocalizedDescription=There was a problem with the App Store., source_function=asPurchasesError}

And, I have also tested with SwiftyStoreKit and encountered the same issue.

Replies

Hi @birdmichael,

Have you figured out the issue? I started getting the same kind of error on my Apple TV when testing the payment through the TestFlight build.

Hi @birdmichael and @marcin1989,

We are also seeing this issue in TestFlight and Debug builds, with and without Sandbox users. We are using React Native IAP as an intermediary library (v10.1.3)

We have managed to get some successful purchases, notably on a Debug build from Xcode 15.2 with a new sandbox user on a tvOS 17 device. Unclear whether that is related, but I figure more info is better.

We have tried to test out Xcode 15.3 and it seems that the issue still occurs. tvOS 17.2

Found the issue and the solution!

Basically, Apple TV logs in the sandbox user to be the default user on Apple TV automatically. That means, that a non-sandbox user gets logged and tries to make a sandbox purchase, which causes the error.

To solve this:

  1. Settings
  2. Users and Accounts
  3. Sign out the Sandbox Account
  4. Login with a normal sandbox user
  5. Do the purchase.

Hope this helps!

Thanks @mantasoff, that worked.

For clarity, signing out the default user and the sandbox user, then signing in the default user to another account which has been added to testflight allowed us to make purchases again.

Still unclear as to why the original user is having issues, will try to update if we get to the bottom of it.