Skip to content

Instantly share code, notes, and snippets.

@vovs03
Created April 18, 2023 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vovs03/6ae215f530e031a07604d591a6444628 to your computer and use it in GitHub Desktop.
Save vovs03/6ae215f530e031a07604d591a6444628 to your computer and use it in GitHub Desktop.
Lua ads coins

Lua ads coins

Если сейва нет на устройстве, а сообщение про инап пришло, значит это человек когда-то делал покупки и это новая установка, активирую заново, выдаю монетки, это по сути авторестор покупки на андроиде.

ну и листнер в зависимости от ОС, для андроида дебаг режим еще, чтобы тестировать покупки много раз.

 elseif transaction.state == iap.TRANS_STATE_PURCHASED then
            print("Purchased! iap.TRANS_STATE_PURCHASED", transaction.ident)
            broadcast.send(game.IAPPURCHASED, {id=transaction.ident})
            if game.platform == game.iOS then
                iap.finish(transaction)
            end

            if game.platform == game.Android then
                if game.is_debug then
                    iap.finish(transaction)
                else
                    iap.acknowledge(transaction)
                end
            end

https://forum.defold.com/t/in-app-purchases-workflow-on-android/73098

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment