Hello!
I want to test IAP in my game. On iTunesconnect I've created a record for the game (without uploading binaries there) and created 1 in-app-purchase items for this game (right now the status of it "Waiting for screenshot").
In my app everything is pretty simple:
1. Calling store.init( onInappPurchase )
2. On button press calling store.purchase{ inapp_id }
3. Waiting for transaction end
My debug string shows me that store.purchase() is called OK. But my onInappPurchase () handler never called.
So it looks like in-app-purchase doesnt work like this.
Is therer any way how I can text it in other way?
Any help will be really appreciated!!!!
Thanks!
P.S.
Here tis the code I have for all this purchasing process:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | store.init( onInAppPurchase ) --[[ ................. ]] function onItemBuy( event ) if( store.canMakePurchases ) then if( event.target.isVisible == true ) then local item = event.target.item print( "onItemBuy", item.type_id ) --dbg.text = "Buying "..item.inapp_id --dbg:toFront() native.showAlert( "Buying "..item.inapp_id, { "OK" } ) store.purchase{ item.inapp_id } end end end --[[ ................. ]] function onInAppPurchase( event ) local transaction = event.transaction --dbg.text = transaction.state --dbg:toFront() native.showAlert( transaction.state, { "OK" } ) if( transaction ~= nil and transaction.state == "purchased" ) then local item = getItemByInAppId( transaction.productIdentifier ) if( item ~= nil ) then local isOK = markItemPurchased( item ) if( isOK == true ) then hideBuyButtons( event.target.parent ) end end end end |
It may be worth reviewing the sample code for IAP.
Assuming you're hooked up to Xcode are you getting anything unexpected (or errors) in the console?