Type Library Revision Release 2022.3683 Keywords Google, IAP, in-app purchases Platforms Android
This plugin is deprecated. Please migrate to Google Billing v2.
The Google Play Billing plugin allows you to support
For in-app purchasing on other platforms, see the documentation for Apple IAP or Amazon IAP.
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" )
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"] = { publisherId = "com.coronalabs" }, }, }
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", }, }, }