Type Library Revision Release 2022.3683 Keywords Google, IAP, in-app purchases Platforms Android
The Google IAP plugin allows you to support
For in-app purchasing on other platforms, see the documentation for Apple IAP, Samsung IAP or Amazon IAP.
The only code change between Google API Billing v2 and Billing v1 is changing to a publisherId in build.settings
To use Google IAP, begin by setting up your Google Payments Merchant Center account and linking it to the Google Play Developer Console.
Additional configuration must occur within the Google Play Developer Console. If you need assistance with this process, please see Google's documentation.
This plugin is a drop in replacement for previous IAP plugin. It would even respond to require( "plugin.google.iap.v3" )
code. But there are couple differences:
storeTransaction.transaction would not have data about purchase when error occurs.
storeTransaction.transaction event have additional values of state
field.
store.finishTransaction function is no longer no-op. It will acknowledge the purchase. If purchase is not acknowledged or consumed over three days it would be refunded to user.
local store = require( "plugin.google.iap.billing.v2" )
To use this plugin, add an entry into the plugins
table of build.settings
. When added, the build will integrate the plugin during the build phase.
settings = { plugins = { ["plugin.google.iap.billing.v2"] = { publisherId = "com.solar2d" }, }, }
This will add mandatory com.android.vending.BILLING
permission to your app.
Finally, the license
table may be added to the project config.lua
file if you want your purchases to be verified. Inside this table, the key
value should be set to the corresponding key obtained from the Google Play Developer Console. In the Console, select your app, then click on "Monetization setup" section. Copy key from the "Licensing" section.
application = { license = { google = { key = "YOUR_KEY", }, }, }