Type Function Return value none Revision Release 2024.3703 Keywords Amazon, IAP, in-app purchases, init See also store.isActive store.*
This call is required and must be executed before making other Amazon IAP calls. This prepares the Amazon IAP library and, upon successful initialization, sets store.isActive to true
.
This also initiates the process to retrieve any pending/future purchases, dispatching a storeTransaction event to the listener defined as listener
.
store.init( listener )
Listener. The listener that will handle storeTransaction events.
local store = require( "plugin.amazon.iap" ) local json = require( "json" ) -- Transaction listener function local function transactionListener( event ) if not ( event.isError ) then -- Successful transaction print( json.prettify( event ) ) print( "event.transaction: " .. json.prettify( event.transaction ) ) else -- Unsuccessful transaction; output error details print( event.errorType ) print( event.errorString ) end -- Notify Amazon about the transaction being processed store.finishTransaction( event.transaction ) end -- Initialize Amazon IAP store.init( transactionListener )