store.*

Type Library
Revision 2015.2703
Keywords store, IAP, Google IAP
Platforms Android

Overview

This plugin allows you to support in-app purchases using Google's in-app billing service.

For more information see the In-App Purchases (IAP) guide.

Syntax

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

Functions

Migration

From Google's Android IAB Overview "The In-app Billing Version 2 API is deprecated and [has been] discontinued [as of] January 2015. If you have an existing In-app Billing implementation that uses API Version 2 or earlier, you must migrate to In-app Billing Version 3."

This means migration to this plugin is required for your app to be published.

If you are migrating from Google IAP v2 (which was integrated into Corona's original store.* library), please see the Migration Guide for an overview of key differences between each version.

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",
            supportedPlatforms = { android=true }
        },
    },
}

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

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

Project Configuration

To use Google IAP, 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",
        },
    },
}

Implementation

For guidelines on how to implement and use Google IAP, please see the In-App Purchases (IAP) guide.