Type Function Return value none Revision Release 2025.3721 Keywords ads, advertising, Appnext, setRewardsTransactionId See also appnext.getRewardsTransactionId() appnext.*
Effects rewarded ads only. Sets a transaction ID per ad view. Make sure this is a unique rewards ID.
appnext.setRewardsTransactionId( adKey, rewardsTransactionId )
String. The ad key returned for a previously created ad.
String. The rewards transaction ID to be sent for the ad.
local appnext = require( "plugin.appnext" )
local function adListener( event )
print( "Received " .. event.event .. " for " .. event.adKey .. " with message: " .. event.message )
end
-- Initialize the Appnext plugin
appnext.init( adListener )
-- Create your ads
local rewardedPlacementID
local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
rewardedPlacementID = "YOUR_IOS_REWARDED_PLACEMENT_ID"
elseif ( platform == "Android" ) then
rewardedPlacementID = "YOUR_ANDROID_REWARDED_PLACEMENT_ID"
end
local rewardedAdKey = appnext.createAd( "rewarded", rewardedPlacementID )
appnext.setRewardsTransactionId( rewardedAdKey, "YOUR_REWARDS_TRANSACTION_ID" )