I understand this but where would i award the player in game currency after he buys it IAP
would it be in if ( transaction.state == “purchased” )
also i have different levels of currency you can purchase such as 100,400,1000 how would i do that thank you
local function storeTransaction( event )
local transaction = event.transaction
if ( transaction.state == “purchased” ) then
–on Google Play, check and update all purchased items here
elseif ( transaction.state == “restored” ) then
–handle “restored” transactions here (iOS only)
print( “productIdentifier”, transaction.productIdentifier )
print( “originalReceipt”, transaction.originalReceipt )
print( “originalTransactionIdentifier”, transaction.originalIdentifier )
print( “originalDate”, transaction.originalDate )
end
store.finishTransaction( event.transaction )
end
local store
local v3 = false
if ( system.getInfo( “platformName” ) == “Android” ) then
store = require( “plugin.google.iap.v3” )
v3 = true
elseif ( system.getInfo( “platformName” ) == “iPhone OS” ) then
store = require( “store” )
else
native.showAlert( “Notice”, “In-app purchases are not supported in the Corona Simulator.”, { “OK” } )
end
local currentProductList = nil
local appleProductList = {
“com.domainname.ExampleInAppPurchase.ConsumableTier1”,
“com.domainname.ExampleInAppPurchase.NonConsumableTier1”,
“com.domainname.ExampleInAppPurchase.SubscriptionTier1”
}
local googleProductList = {
–these product IDs are for testing and are supported by all Android apps (purchasing these products will not bill your account)
“android.test.purchased”,
“android.test.canceled”,
“android.test.item_unavailable”
}
–utilize ‘store.availableStores’ function:
if ( store.availableStores.apple ) then
currentProductList = appleProductList
store.init( “apple”, storeTransaction )
elseif ( v3 == true or store.availableStores.google ) then
currentProductList = googleProductList
store.init( “google”, storeTransaction )
else
print( “In-app purchases are not supported on this system/device.” )
end
–OR utilize ‘store.target’ function:
if ( store.target == “apple” ) then
currentProductList = appleProductList
store.init( “apple”, storeTransaction )
elseif ( store.target == “google” ) then
currentProductList = googleProductList
store.init( “google”, storeTransaction )
else
print( “In-app purchases are not supported on this system/device.” )
end