All packsApp Store MachinerySolve
app store server api sandbox production 4040010 transactionidnotfound
TestFlight transactions 404 against the production Server API
Calling the App Store Server API's production endpoint for a sandbox (TestFlight) transaction returns an undocumented TransactionIdNotFound -- code has to retry against sandbox itself.
What goes wrong
A TestFlight or sandbox purchase's transaction id genuinely does not exist against the App Store Server API's production endpoint -- calling it there returns error code 4040010 (TransactionIdNotFound), which reads like a real error, not a routing hint. Code that treats this as a hard failure (log it, surface an error to the tester) never actually resolves a huge share of pre-release testing transactions, because nothing tells it to simply try the sandbox endpoint instead.
Why agents get it wrong
There's no documentation stating plainly "if production 404s with this exact code, retry against sandbox" in a way that surfaces before someone hits it -- it's the kind of undocumented operational gap that's typically discovered by trial and error during TestFlight testing, not something derivable from reading the API reference in isolation.
What App Store Machinery pre-decides
Decision 6 hardcodes the exact routing rule: call the production Server API first, and specifically on APIException error code 4040010, retry the identical call against the sandbox endpoint. Notifications take a parallel but distinct approach -- App Store Connect lets you register both a production and a sandbox URL pointing at the same service path, which reads data.environment from the payload itself to pick the matching verifier instance, so the client side of this needs no special handling at all.
Source: ARCHITECTURE.md decision 6