Hi guys,
So like most of us, I would like IAPs.
Here is where I am at, installed and got working Cordova (I can export from GDev, rebuild, export and it works on my tablet), I found a script that may work with simple IAP but I don’t know JavaScript. Hopefully someone can help if i post the script.
The script is in the right folder (and I have edited the index file to include the script) so it should just need editing. Happy to help others get to where I am, I will post the links I used.
So if we can get 1 script working, everyone can share it and work on it.
So all I would like to change is 1 GlobalVariable; ‘to add 1’.
Let see if we can do it.
Here is the script:
document.addEventListener(‘deviceready’, onDeviceReady);
function onDeviceReady() {
** store.when(‘cc.fovea.purchase.consumable1’)**
** .updated(refreshUI)**
** .approved(finishPurchase);**
** store.register({type: store.CONSUMABLE, id: ‘cc.fovea.purchase.consumable1’});**
** store.refresh();**
}
function finishPurchase(p) {
** localStorage.goldCoins = (localStorage.goldCoins | 0) + 10;**
** p.finish();**
}
function refreshUI() {
** const product = store.get(‘cc.fovea.purchase.consumable1’);**
** const button = <button onclick="store.order('cc.fovea.purchase.consumable1')">Purchase</button>
;**
** document.getElementsByTagName(‘body’)[0].innerHTML = `**
**
**
****
** Gold: ${localStorage.goldCoins | 0}**** Product.state: ${product.state}**
** .title: ${product.title}**
** .descr: ${product.description}**
** .price: ${product.price}****
** ${product.canPurchase ? button : ‘’}**
**
}
From here: Micro Example - Cordova In-App Purchases
Any help would be greatly appreciated.
Thanks
Jim