google.iap.billing.*

Type Library
Revision Release 2020.3619
Keywords Google, IAP, in-app purchases
Platforms Android

Overview

The Google Play Billing plugin allows you to support in-app purchasing on Android, including in-game currency, upgrades, and more.

For in-app purchasing on other platforms, see the documentation for Apple IAP or Amazon IAP.

Notes
Compatibility with IAPv3

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:

Syntax

local store = require( "plugin.google.iap.billing" )

Properties

Functions

Events

Project Settings

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",
        },
    },
}