类型 事件 版本 版本 2024.3703 关键词 steam, steamworks, IAP, 应用内购买, 微交易, microtransactionAuthorization 另请参阅 steamworks.addEventListener() steamworks.*
当微交易
您可以通过 steamworks.addEventListener() 函数向插件添加监听器来接收这些事件。
Steam 仅通过 Web API 支持微交易,并且它不跟踪已购买的产品。 Steam 仅分派提供用户批准购买的订单 ID 的事件。订单 ID 由应用开发者在通过 Steam 的 Web API 发出请求时定义,并且由应用开发者通过这些订单 ID 跟踪已购买的产品。 请参阅 Steam 的微交易文档以了解更多详细信息。
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 )