voltrue2/in-app-purchase

How to tell if the receipt is for production or sandbox?

Closed this issue · 12 comments

After calling validate function and validation is successful, is there a way to tell if the receipt is validated with prod or sanbox? If not, can this be added?

You can set whether the receipt you are validating is prod or sandbox by using test: true for sandbox or false for production on iap.config(). See README in the docs for an example.

For iOS, when trying to validate with prod, it can still fall back to validate with sandbox.

@comtaler Yes it does fallback to sandbox validation if the first production validation fails.
Would you give me an insight as to why you need to know whether the validation was sandbox or production?

Cheers

No response. Closing.

jpoag commented

The problem is that there is information lost: did you use sandbox or production? If we could specify to ONLY use production or ONLY use sandbox this wouldn't be an issue as we could use settings to deduce this information.

Ideally, just add a field to the response object IF (and only if) you used sandbox.

We use this information to throw away Analytics. Or to catch someone trying to use a sandbox receipt who is obviously not a tester.

We need to filter sandbox purchases too. Is it possible to make update on this?

I am for the same reason as @jpoag. Need to filter out for analytics and flagging the user if the receipt eventually validated on sandbox instead. And we don't want to prevent it from validating with sandbox on prod environment just in case we need testing on prod.

That works for me

jpoag commented

Thank you all for brining this up! The new property in validated data sandbox has been added to Apple and Amazon!
Defaults to false or undefined.

b7bd5a8

jpoag commented

Thank you so much!