store.verify()

类型 函数
返回值 Boolean
版本 发行 2024.3703
关键词 亚马逊,IAP,应用内购买,验证,drm
另请参见 store.*

语法

store.verify(listener)
listener (必需)

Listener. 将处理 许可证 事件的监听器。

示例

``````lua
local store = require( "plugin.amazon.iap.v3" )
local json = require( "json" )

local function transactionListener( event )

    if not ( event.isError ) then  -- Successful transaction
        print( json.prettify( event ) )     
        print( "event.transaction: " .. json.prettify( event.transaction ) )

    else  -- Unsuccessful transaction; output error details
        print( event.errorType )
        print( event.errorString )
    end

end

-- Initialize Amazon IAP
store.init( transactionListener )


local function licensingListener( event )

    print( event.provider )    -- Provider for this DRM instance ("amazon")
print( event.isVerified )  -- Boolean of true if DRM has been verified, otherwise false
print( event.isError )     -- Boolean of true if there was an error during verification
print( event.response )    -- Translated response from the licensing server    

if ( event.isVerified ) then
    -- License successfully verified
    print( "Verified!" )
else
    -- Failed to verify app from Amazon
    print( "Failed!" )
end

end

--Verify Licensing
store.verify(licensingListener)


``````