Hello everyone,
i used storekit 2.1.2 but i have to change it, updating with the new one for 64 bits.
My previous is still working but n the console i get like message =>
[WARN] : Passing individual args to purchase is DEPRECATED. Call purchase passing in a dictionary of arguments.
[WARN] : addTransactionObserver should be called before purchase.
I guess if i don't change it, isnt working anymore soon.
I dont really understand how you implement the new code since it just show for one product , and in my case its multiple products.
My previous code is: (and its working perctly, i just delete some infos not needed to solve my problem, just the necessary)
var Storekit = require('ti.storekit'); Storekit.addEventListener('transactionState', function (evt) { //hideLoading(); switch (evt.state) { case Storekit.FAILED: break; case Storekit.PURCHASED: case Storekit.RESTORED: if(evt.productIdentifier==='350coins'){money+=350}; if(evt.productIdentifier==='750coins'){money+=750}; if(evt.productIdentifier==='2000coins'){money+=2000}; if(evt.productIdentifier==='4500coins'){money+=4500}; if(evt.productIdentifier==='10000coins'){money+=10000}; Ti.App.Properties.setInt('money', money); self.topCoinsBtn.title = money; break; } }); //products var products=[]; var numCoins=[]; products.push('350coins');numCoins.push(350); products.push('750coins');numCoins.push(750); products.push('2000coins');numCoins.push(2000); products.push('4500coins');numCoins.push(4500); products.push('10000coins');numCoins.push(10000); /////////////////// recuperation des variables de session /////////////////// var money = Ti.App.Properties.getInt('money'); //store var tempPurchasedStore={}; if (!Storekit.canMakePayments) customAlert(L('noPurchasePossible')); else { for(var k=0;k<products.length;k++){ requestProduct(products[k],k, function (product,kk) { var shopBtn = Ti.UI.createButton({ title: '',//product.title, width: 30, height: 30, }); shopBtn.addEventListener('singletap', function () { purchaseProduct(product); }); function showLoading() { loadingCount += 1; if (loadingCount == 1) { loading.show(); } } function hideLoading() { loadingCount -= 1; if (loadingCount == 0) { loading.hide(); } } function requestProduct(identifier,k, success) { showLoading(); Storekit.requestProducts([identifier], function (evt) { hideLoading(); if (!evt.success) { alert(L('failTalkApple')); } else if (evt.invalid) { alert(L('invalidProduct')); } else { success(evt.products[0],k); } }); } function purchaseProduct(product) { //showLoading(); Storekit.purchase({ product:product }); }
Thanks forward.