My getTransactionInfo call resulted in apiError: 4040010, errorMessage: 'Transaction id not found.'

Hi, I am testing a consumable in-app purchase on my app, with a Sandbox account on an iPad device.

The transaction was successful, as I saw "You're all set. Your purchase was successful. [Environment: Sandbox].

I set a break point in Xcode after the line await transaction.finish() in following code
private func handle(transactionVerification result: VerificationResult <Transaction>) async {
    switch result {
    case let .verified(transaction):
        guard
            let product = self.products.first(where: {
                $0.id == transaction.productID
            })
        else {
            return
        }
        self.addPurchased(product)
        await transaction.finish()
        return.    <----- breakpoint

And I saw those property values for the transaction

id UInt64 88*****848 originalID UInt64 437****2496 .

Then I use the originalID value 437*****2496 in a server library call in node.js

.... const environment = Environment.SANDBOX .... const client = new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment) .... const response = await client.getTransactionInfo("4379072496")

I got

apiError: 4040010, errorMessage: 'Transaction id not found.'

Could someone please tell me if I use the library call correctly with the right id? And why I got the error?

Thank you very much!

Kind regards, Shih-Chin Yang

[Edited by Moderator]

Can you please file a ticket via https://feedbackassistant.apple.com/ and let us know the FB# ticket number? Thank you!

FB13803893 (getTransactionInfo resulted in apiError: 4040010, errorMessage: 'Transaction id not found.')

Hi, app assistant closed my feedback saying not able to reproduce. So I reported another feedback -

FB13804937 (App Store Server Library for Node.js - getTransactionInfo resulted in apiError: 4040010, errorMessage: 'Transaction id not found.')

Could you kindly please help, thank you very much!

Hi, please take a look at the following screenshot. The value of id and original id are not the same as what prints out on the console. Can someone please give an explanation? If I use the printed id value from the console, then getTransactionInfo call succeeds.

@ShihChinYang Hey. Are you able to find the root cause? I'm getting the same error

Not sure if this is the same issue but I've also run into the error 'Transaction id not found'. In my case it turns out I used the transactionId.formatted() function which adds dots to the string representation of the transaction Id, e.g. 2.000.000.123.123.123.

The apple server can't find the transaction id formatted like that. So after switching to a regular string representation of the number using String(transaction.transactionId) it works fine.

Hello, did you solved this, i got the same problem

My getTransactionInfo call resulted in apiError: 4040010, errorMessage: 'Transaction id not found.'
 
 
Q