Status Code 21007 being returned by App Store Sandbox verify receipt endpoint

Similar to what appears to have happened last year, the Sandbox verifyReceipt endpoint is returning the 21007 status code that should only be returned by the production URL and indicates that the receipt in question should instead be sent ... to the sandbox URL.

Here's the documentation:

Verify your receipt first with the production URL; proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you do not have to switch between URLs while your application is tested, reviewed by App Review, or live in the App Store.

We are sending a valid sandbox receipt (validated locally on device already), along with the shared secret / password parameter, and not getting any receipt info back, just this bogus status that should only be returned by the production URL.

We could mitigate this by returning something like a failure status to our own client's request, but how are we supposed to test our code for parsing the response object when a receipt is valid? What's going on?

Ah ha! Here's what's going on: there's the HTTP status code, and then the responseObject status code, and that's not at all clear in the documentation.

The HTTP status code will come back 200, from the production URL when you are supposed to retry with sandbox URL, because that's not the status to check: the 21007 code is the status inside the response object with the status code 200.

Status Code 21007 being returned by App Store Sandbox verify receipt endpoint
 
 
Q