help in code for in app purchase

hello everyone
 
i want to build an app with iap there. i already follow all documentation for iap. the build.setting, the config.lua and the code for android and iPhone platform
 
my code be like

purchasing.lua : 

[lua] local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local screen = nil function scene:createScene( event ) screen = self.view local globals = require("globals") globals.sceneNya = "main" local alert alert = native.showAlert( "Corona", "masuk", { "OK" } ) local function storeTransaction( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then print( "productIdentifier", transaction.productIdentifier ) print( "receipt", transaction.receipt ) print( "signature:", transaction.signature ) print( "transactionIdentifier", transaction.identifier ) print( "date", transaction.date ) elseif ( transaction.state == "cancelled" ) then --handle a cancelled transaction here elseif ( transaction.state == "failed" ) then --handle a failed transaction here end store.finishTransaction( event.transaction ) end local function productCallback( event ) alert = native.showAlert( "Corona", "Showing valid products:", #event.products, { "OK" } ) print( "Showing valid products:", #event.products ) for i = 1,#event.products do print( event.products[i].title ) print( event.products[i].description ) print( event.products[i].price ) print( event.products[i].localizedPrice ) print( event.products[i].priceLocale ) print( event.products[i].productIdentifier ) end alert = native.showAlert( "Corona", "Showing invalid products:", #event.invalidProducts, { "OK" } ) print( "Showing invalid products:", #event.invalidProducts ) for i = 1,#event.invalidProducts do print( event.invalidProducts[i] ) end end local store local googleIAP = false local currentProductList = nil local appleProductList = { "com.domainname.ExampleInAppPurchase.ConsumableTier1", "com.domainname.ExampleInAppPurchase.NonConsumableTier1", "com.domainname.ExampleInAppPurchase.SubscriptionTier1" } local googleProductList = { "com.kliklabs.luckyyou", } print(system.getInfo("platformName")) if ( system.getInfo( "platformName" ) == "Android" ) then store = require( "plugin.google.iap.v3" ) googleIAP = true currentProductList = googleProductLis local bg = display.newRect(0,0, 360, 570 ) bg:setFillColor( 255,255,255 ) bg.y = display.contentHeight/2 bg.x = display.contentWidth/2 screen:insert( bg ) store.init( "google", storeTransaction ) if ( store.isActive ) then alert = native.showAlert( "Corona","masuk store aktif", { "OK" } ) store.loadProducts( currentProductList, productCallback ) end elseif ( system.getInfo( "platformName" ) == "iPhone OS" ) then store = require( "store" ) currentProductList = appleProductList store.init( "apple", storeTransaction ) else --native.showAlert( "Notice", "In-app purchases are not supported in the Corona Simulator.", { "OK" } ) end end function scene:enterScene( event ) storyboard.removeAll() end function scene:exitScene( event ) end function scene:destroyScene( event ) end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene [/lua]

config.lua :

[lua] if ( string.sub( system.getInfo("model"), 1, 4 ) == "iPad" ) then application = { content = { graphicsCompatibility = 1, width = 360, height = 480, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, } elseif ( string.sub( system.getInfo("model"), 1, 2 ) == "iP" and display.pixelHeight \> 960 ) then application = { content = { graphicsCompatibility = 1, width = 320, height = 568, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, } elseif ( string.sub( system.getInfo("model"), 1, 2 ) == "iP" ) then application = { content = { graphicsCompatibility = 1, width = 320, height = 480, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, } elseif ( display.pixelHeight / display.pixelWidth \> 1.72 ) then application = { content = { graphicsCompatibility = 1, width = 320, height = 570, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, license = { google = { key = "MIIB....", policy = "serverManaged", }, }, } else application = { content = { graphicsCompatibility = 1, width = 320, height = 512, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, license = { google = { key = "MIIB...", policy = "serverManaged", }, }, } end --application = { -- content = { -- graphicsCompatibility = 1, -- width = 320, -- height = 570, -- scale = "letterBox", -- xAlign = "center", -- yAlign = "center", -- imageSuffix = -- { -- ["@2x"] = 1.5, -- ["@4x"] = 3.0, -- }, -- fps = 30, -- }, --[[-- Push notifications notification = { iphone = { types = { "badge", "sound", "alert", "newsstand" } } } --]] --} [/lua]

build.settings :  

[lua] -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait", supported = { "portrait", } }, android = { versionCode = "1", usesPermissions = { "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.VIBRATE", "android.permission.INTERNET", "com.android.vending.BILLING", "com.android.vending.CHECK\_LICENSE", "com.android.vending.CHECK\_LICENSE", "android.permission.ACCESS\_NETWORK\_STATE", }, }, iphone = { plist = { UIAppFonts = { "Multicolore.otf", "Soup of Justice.ttf" }, UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = false, UIStatusBarHidden = true, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png" }, --MinimumOSVersion = "5.1.0", }, skipPNGCrush = false, }, -- iphone = { -- plist = { -- UIStatusBarHidden = true, -- UIPrerenderedIcon = true, -- set to false for "shine" overlay -- --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend-- -- --[[-- -- iOS app URL schemes: -- CFBundleURLTypes = -- { -- { -- CFBundleURLSchemes = -- { -- "fbXXXXXXXXXXXXXX", -- example scheme for facebook -- "coronasdkapp", -- example second scheme -- } -- } -- } -- --]] -- } -- }, -- enable the admob plugin plugins = { ["CoronaProvider.ads.admob"] = { -- required publisherId = "com.coronalabs", }, ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, } [/lua]

and it’s always freeze when i click from my game.lua to this purchasing.lua