Difficulty generating valid transactionIDs for IAP

Greetings community!

  • A) I am trying to implement Apple In-App-Purchases for a new iOS app/game.
  • B) I have a client-server application, and the purchase validation and entitlement grant needs to happen on our game-server. As best as I can tell, I want to use Get Transaction History to validate the purchase on the game server.

I'm testing a sandbox app/APIs using TestFlight. My generated transactionID's are sequential integers starting at 0, but some documentation suggests it should be a UUID. So far, the integer transactionID/originalTransactionID have not yielded a valid response from GetTransactionHistory.

The errors I get are:

  • {"errorCode":4000008,"errorMessage":"Invalid original transaction id."}
  • {"errorCode":4040005,"errorMessage":"Original transaction id not found."}

I'm mostly stumped at this point, as I can't find any documentation describing what I may have missed, and there are no other forum posts or search results for those error codes.

So my questions:

  1. Will GetTransactionHistory ever this work with sequential integer transactionIDs?
  2. I've deployed the signed app through TestFlight, and I'm still getting sequential integer transactionIDs. Is that expected? What am I doing wrong?

Transaction ids are provided to the device upon a successful purchase. See https://developer.apple.com/documentation/storekit/transaction. You can send the signed transactions to your server and validate the JWS signature directly. If you are interested in getting the full user's history as well, you can then call the Get Transaction History endpoint with the original transaction id contained in the transaction.

Make sure you aren't testing with Xcode itself, but are using the Sandbox or TestFlight environment. Local Xcode testing will not create data that the App Store Server API will recognize.

The UUID you are likely referring to is the appAccountToken https://developer.apple.com/documentation/storekit/transaction/3749684-appaccounttoken.

Difficulty generating valid transactionIDs for IAP
 
 
Q