Type Function Return value none Revision 2017.3060 Keywords Apple, IAP, in-app purchases, init See also store.isActive store.*
This call is required and must be executed before making other Apple IAP calls. This prepares the Apple IAP library and, upon successful initialization, sets store.isActive to true
.
This also allows you to detect storeTransaction events to the listener defined as listener
.
store.init( listener )
Listener. The listener that will handle storeTransaction events.
local store = require( "store" ) local json = require( "json" ) -- Transaction listener function local function transactionListener( event ) if not ( event.transaction.state == "failed" ) then -- Successful transaction print( json.prettify( event ) ) print( "event.transaction: " .. json.prettify( event.transaction ) ) else -- Unsuccessful transaction; output error details print( event.transaction.errorType ) print( event.transaction.errorString ) end -- Tell the store that the transaction is finished store.finishTransaction( event.transaction ) end -- Initialize Apple IAP store.init( transactionListener )