How to tell if the receipt was created in sandbox or production with validating receipts on the device?

I'm currently working on in-app-purchase. I want to post receipt to my backend server and verify on server(not post to apple server) like this page.

But take a look at Receipt Fields, there's no way to know the environment this receipt generated in.

Is there any way to determine the environment the receipt generated in?

Replies

Why do you want to know if it is a sandbox or production receipt?

I do this just for statistics, and I check (on the device) whether the path to the receipt file contains the string "sandbox". This is undocumented and you shouldn't rely on it for anything critical.

You can also look at the original app purchase version field in the receipt; this is always 1.0 in the sandbox. Of course for this to work you need to give a different version number to your first app store version, and you can't go back in time and change that if you've already released the app.