microtransactionAuthorization

Type Event
Revision Release 2022.3683
Keywords steam, steamworks, IAP, in-app purchases, microtransaction, microtransactionAuthorization
See also steamworks.addEventListener()
steamworks.*

Overview

This event occurs when a microtransaction (in-app purchase) has been approved or denied by the currently logged in user.

You can receive these events by adding a listener to the plugin via the steamworks.addEventListener() function.

Note

Steam only supports microtransactions via web APIs and it does not track purchased products. Steam only dispatches events providing the order ID of approved purchases made by the user. The order ID is defined by the app developer when issuing a request via Steam's web APIs and it's up to the app developer to track purchased products via these order IDs. Please see Steam's microtransaction documentation for more details.

Properties

Example

local steamworks = require( "plugin.steamworks" )

-- Called when a microtransaction has been approved/denied by user
local function onMicrotransactionAuthorization( event )
    if ( event.authorized ) then
        -- User has made a purchase
        -- It's up to the app developer to finalize purchase with received order ID
        local orderId = event.orderId
    else
        -- User has canceled the purchase
    end
end

-- Set up a listener to be invoked when a microtransaction has been made
steamworks.addEventListener( "microtransactionAuthorization", onMicrotransactionAuthorization )