Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1744] Ti.Storekit: receiptVerificationSandbox always TRUE if set

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2013-05-22T21:41:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsstore, storekit
ReporterFokke Zandbergen
AssigneeShak Hossain
Created2013-05-22T14:43:33.000+0000
Updated2016-03-08T07:40:37.000+0000

Description

Consider the following tests:
var Storekit = require('ti.storekit');
Ti.API.error('Storekit.receiptVerificationSandbox: (' + (typeof Storekit.receiptVerificationSandbox) + ') ' + Storekit.receiptVerificationSandbox);        

Storekit.receiptVerificationSandbox = false;
Ti.API.error('Storekit.receiptVerificationSandbox: (' + (typeof Storekit.receiptVerificationSandbox) + ') ' + Storekit.receiptVerificationSandbox);        

Storekit.receiptVerificationSandbox = true;
Ti.API.error('Storekit.receiptVerificationSandbox: (' + (typeof Storekit.receiptVerificationSandbox) + ') ' + Storekit.receiptVerificationSandbox);        

Storekit.receiptVerificationSandbox = 0;
Ti.API.error('Storekit.receiptVerificationSandbox: (' + (typeof Storekit.receiptVerificationSandbox) + ') ' + Storekit.receiptVerificationSandbox);        

Storekit.receiptVerificationSandbox = 1;
Ti.API.error('Storekit.receiptVerificationSandbox: (' + (typeof Storekit.receiptVerificationSandbox) + ') ' + Storekit.receiptVerificationSandbox);       
Resulting in the following outcome:
May 22 16:09:19 iPad VerhaaltjesApp[9707] <Warning>: [ERROR] Storekit.receiptVerificationSandbox: (number) 0
May 22 16:09:19 iPad VerhaaltjesApp[9707] <Warning>: [ERROR] Storekit.receiptVerificationSandbox: (boolean) true
May 22 16:09:19 iPad VerhaaltjesApp[9707] <Warning>: [ERROR] Storekit.receiptVerificationSandbox: (boolean) true
May 22 16:09:19 iPad VerhaaltjesApp[9707] <Warning>: [ERROR] Storekit.receiptVerificationSandbox: (boolean) true
May 22 16:09:19 iPad VerhaaltjesApp[9707] <Warning>: [ERROR] Storekit.receiptVerificationSandbox: (boolean) true
In the docs and example code of the module it says receiptVerificationSandbox is a boolean and defaults to false. The tests above show it's a number, that defaults to 0 but changes to a boolean with value TRUE if you change it to *whatever* value! This means if you do something like:
Storekit.receiptVerificationSandbox = (Ti.App.deployType !== 'production');
Storekit.receiptVerificationSandbox = Alloy.CFG.receiptVerificationSandbox;
Receipts will *always* be verified against the sandbox! Since you will not know this before the app has been approved (and yes, it will be) this is an extremely critical issue that should be fixed soon. Although it is advised by both Apple and Appcelerator to verify receipts on your own back-end server, the in-app verification should and must work - correctly.

Comments

  1. Jeff English 2013-05-22

    Fixed issue in module with incorrect property type. Updated module (version 2.0.2) will be in the MarketPlace shortly.
  2. Fokke Zandbergen 2013-05-23

    Thanks for your quick response. I see you now have this line in the app.js:
       Storekit.receiptVerificationSandbox = (Ti.App.deployType !== 'production');
       
    You probably took this from my example, but this test is not valid :) The Ti.App.deployType can also be production if the app is *not* distributed via the App Store, e.g. Ad Hoc. I don't know if there is any way to detect if the app is distributed via the App Store. If so, then the receiptVerificationSandbox could be removed completely and handled internally.
  3. jammer 2013-06-14

    Hi, So, now Storekit.receiptVerificationSandbox is real boolean. Good :) But, did you manage how to make it work during Apple's review??
  4. Fokke Zandbergen 2013-06-25

    I just removed setting receiptVerificationSandbox, since its default is false.
  5. Shak Hossain 2014-01-03

    Hi Fokke Zandbergen, I believe this is fixed. Please let me know if this ticket can be closed. Thanks, Shak
  6. Fokke Zandbergen 2014-01-04

    Yeo, was fixed indeed

JSON Source