voltrue2 / in-app-purchase

A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
http://iap.gracenode.org
Other
1.04k stars 287 forks source link

Cannot Find Attribute "sandbox" in validate() result #300

Open BabyToy opened 4 years ago

BabyToy commented 4 years ago

As stated, I need to find out if the validated receipt is a sandboxed purchase, but I cannot find the attribute "sandbox".

This is my code:

validatedData = await iap.validate(receipt);
if (!iap.isValidated(validatedData)) {
  throw new Error("Purchase validation error");
}
if (validatedData.sandbox) {
  throw new Error("Sandbox receipt used in production");
}

I have read this issue but then I get the error Property 'sandbox' does not exist on type 'ValidationResponse'

Can anybody tell me what I am doing wrong?

[EDIT: typo]