google.iap.v3.*

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

This plugin is deprecated. Please migrate to Google Billing. For more information and key differences see its documentation.

Overview

The Google IAP 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, Amazon IAP or Store API.

Notes

Syntax

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

Properties

store.target

store.isActive

store.canLoadProducts

Functions

store.init()

store.loadProducts()

store.purchase()

store.restore()

store.consumePurchase()

Events

init

storeTransaction

productList

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    plugins =
    {
        ["plugin.google.iap.v3"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}

In addition, you must enable the BILLING permission in build.settings:

settings =
{
    android =
    {
        usesPermissions =
        {
            "com.android.vending.BILLING",
        },
    },
}

Finally, the license table must be added to the project config.lua file. Inside this table, the key value should be set to the corresponding key obtained from the Google Play Developer Console.

application = 
{
    license =
    {
        google =
        {
            key = "YOUR_KEY",
        },
    },
}