Is there any status code indicate that transactionId is from sandbox?

In the old verifyReceipt endpoint doc, there is an important desc

As a best practice, always call the production URL https://buy.itunes.apple.com/verifyReceipt first and proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you don’t have to switch between URLs while your app is in testing, in review by App Review, or live in the App Store.

So I can know the transactionId is for sandbox if return back 21007.

And I am about to access to new App Store Server API, so the same, I wonder how can I recognize the transactionId is from sandbox by status code?

The most likely desc is this:

If you don’t have environment information, follow these steps:

  1. Call the endpoint using the production URL. If the call succeeds, the original transaction identifier belongs to the production environment.
  2. If you receive an [errorCode 4040005] with errorMessage as OriginalTransactionIdNotFoundError, (or HTTP response code 404 from the Send Consumption Information endpoint), call the endpoint using the sandbox environment.
  3. If the call succeeds, the original transaction identifier belongs to the sandbox environment. If the call fails with the same error code, the original transaction identifier isn’t present in either environment.

And I have a try for Get Transaction Info API, but actually get 4040010, Transaction id not found. as return.

So I just wanna clear that is there any doc clarify this point that I miss?

Looking forward to your response, sincerely!! :)

Accepted Reply

The procedure outlined in that doc is correct, but the error information is out of date. Version 1.8 of the App Store Server API included this change:

The following endpoints changed their path parameters from originalTransactionId to transactionId: Get All Subscription Statuses, Get Transaction History, Get Refund History, and Send Consumption Information. These endpoints now accept any transaction identifier, including original transaction identifiers.

You should now expect to receive a TransactionIdNotFoundError / errorCode 4040010 in this case.

Thanks for reaching out about this issue, the doc will be updated.

  • @App Store Commerce Engineer So can I draw a conclusion that if I receive a TransactionIdNotFoundError / errorCode 4040010, I can handle it as 21007 status code as before?

    Looking forward to your response, thank you :)

  • @daydaylw3 Yes, using the procedure outlined in the doc you can implement the same functionality with errorCode 4040010 as you formerly implemented with the 21007/21008 status codes.

  • Thank you so much, that's very helpful!! :)

Replies

The procedure outlined in that doc is correct, but the error information is out of date. Version 1.8 of the App Store Server API included this change:

The following endpoints changed their path parameters from originalTransactionId to transactionId: Get All Subscription Statuses, Get Transaction History, Get Refund History, and Send Consumption Information. These endpoints now accept any transaction identifier, including original transaction identifiers.

You should now expect to receive a TransactionIdNotFoundError / errorCode 4040010 in this case.

Thanks for reaching out about this issue, the doc will be updated.

  • @App Store Commerce Engineer So can I draw a conclusion that if I receive a TransactionIdNotFoundError / errorCode 4040010, I can handle it as 21007 status code as before?

    Looking forward to your response, thank you :)

  • @daydaylw3 Yes, using the procedure outlined in the doc you can implement the same functionality with errorCode 4040010 as you formerly implemented with the 21007/21008 status codes.

  • Thank you so much, that's very helpful!! :)