Sure,
this is the majority of what is used:
--Function to handle store transactions function transactionCallback( event ) local transaction = event.transaction if transaction.state == "purchased" then print("Transaction succuessful!") --Save the volume(s) as purchased if global.isBundlePurchase == false then purchaseData:set(tostring(global.volumeToPurchase), true) volumeLocks[global.volumeToPurchase]:removeSelf() volumeLocks[global.volumeToPurchase]=nil global.volumeDownloadQueue[1] = global.volumeToPurchase else for i=1, #iapData:get("offerVolumes"), 1 do purchaseData:set(tostring(i), true) volumeLocks[i]:removeSelf() volumeLocks[i]=nil if i ~= 1 then global.volumeDownloadQueue[#global.volumeDownloadQueue + 1] = i end end --Remove the "deal pane" from the volume scroller require("scripts.logic").dealPane.isVisible = false require("scripts.logic").volumeScroller:scrollToPosition{ x = 300, y = 0, time = 100 } end purchaseData:save() ---[[if global.volumeToPurchase ~= 1 then native.showAlert("Success", "Purchase successful! Your new content will be downloaded automatically.", {"Okay"}) if fileMan.doesFileExist( "volume".. global.volumeToPurchase .."/images/story1/page1/page1.png", system.DocumentsDirectory ) == false then global.volumeToDownload = global.volumeDownloadQueue[1] local downloadEvent = { action="clicked", index = 1 } require("scripts.logic").downloadChoice( downloadEvent ) end else native.showAlert("Success", "Purchase successful, thank you!", {"You're welcome"}) end --]] local closeEvent = { phase="ended" } global.canTouch = true require("scripts.logic").closePurchasePane( closeEvent ) elseif transaction.state == "restored" then print("Transaction restored (from previous session)") print("productIdentifier", transaction.productIdentifier) print("receipt", transaction.receipt) print("transactionIdentifier", transaction.identifier) print("date", transaction.date) print("originalReceipt", transaction.originalReceipt) print("originalTransactionIdentifier", transaction.originalIdentifier) print("originalDate", transaction.originalDate) elseif transaction.state == "cancelled" then print("User cancelled transaction") native.showAlert("Alert", "Purchase was cancelled.", {"Okay"}) global.canTouch = true elseif transaction.state == "failed" then print("Transaction failed, type:", transaction.errorType, transaction.errorString) native.showAlert(transaction.errorType, transaction.errorString, {"Okay"}) native.showAlert("Alert", "Purchase failed, please try again.", {"Okay"}) global.canTouch = true else native.showAlert("Alert", "An unknown error occured, purchase failed.", {"Okay"}) print("unknown event") global.canTouch = true end -- Once we are done with a transaction, call this to tell the store -- we are done with the transaction. -- If you are providing downloadable content, wait to call this until -- after the download completes. store.finishTransaction( transaction ) end --utilize 'store.availableStores' function: if ( store.availableStores.apple ) then --currentProductList = appleProductList store.init( "apple", storeTransaction ) elseif ( store.availableStores.google ) then --currentProductList = googleProductList store.init( "google", storeTransaction ) else print( "In-app purchases are not supported on this system/device." ) end --Restore any purchases the user has made M.restorePurchases = function() store.restore() end --Purchase a volume from the store M.purchaseVolume = function( event ) local target = event.target if event.phase == "ended" and global.canTouch == true then global.canTouch = false --store.purchase( {iapData:get("volumeID"..target.id)} ) store.purchase( {"android.test.purchased"} ) end end