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 a21007
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:
- Call the endpoint using the production URL. If the call succeeds, the original transaction identifier belongs to the production environment.
- If you receive an [errorCode
4040005
] witherrorMessage
asOriginalTransactionIdNotFoundError
, (or HTTP response code404
from the Send Consumption Information endpoint), call the endpoint using the sandbox environment.- 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!! :)
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.