amazon.iap.v3.*

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

Overview

The Amazon IAP plugin lets you sell digital content and subscriptions from within your apps, including in-game currency, expansion packs, upgrades, magazine issues, and more. The plugin also includes optional DRM support as well. See store.verify() for information on implementing Amazon DRM/Licensing.

Notes
  • This plugin now uses the Appstore SDK adds the api store.verify() to check DRM. No codes changes are required to use the Appstore SDK for IAP but you must include ‘AppstoreAuthenticationKey.pem’ in your project root to use IAP. This file can be found in your online Amazon Dev portal in your App APK File section by clicking on Public Key. See Legacy Plugin for use of Amazon IAP V2.

  • If you’re new to Amazon In-App Purchasing, read Amazon’s Understanding In-App Purchasing guide.

  • You must install the Amazon App Tester or publish your app in the Amazon Appstore to use this plugin. Details on testing can be found here.

For in-app purchasing on other platforms, see the documentation for Google IAP, Apple IAP, Samsung IAP, or Store API.

Registration

To use Amazon in-app purchasing, you must first register for an Amazon Developer account.

Syntax

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

Properties

store.target

store.isActive

Functions

store.init()

store.loadProducts()

store.purchase()

store.finishTransaction()

store.restore()

store.getUserId()

store.getUserData()

store.isSandboxMode()

store.verify()

Events

storeTransaction

productList

userData

licensing

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.amazon.iap.v3"] =
        {
            publisherId = "com.solar2d"
        },
    },
}

Solar2D Native

To use this plugin with Solar2D Native:

  1. Copy plugin.amazon.iap.v3.jar into the libs/ directory of your project and add implementation 'com.amazon.device:amazon-appstore-sdk:3.0.2' to your App Gradle dependencies.

  2. Add the following section into your AndroidManifest.xml file, inside the application tag:

<receiver android:name = "com.amazon.device.iap.ResponseReceiver">
    <intent-filter>
        <action android:name = "com.amazon.inapp.purchasing.NOTIFY"
            android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY"/>
    </intent-filter>
</receiver>
  1. Also, set targetedAppStore to "amazon" in your AndroidManifest.xml file:
<meta-data android:name="targetedAppStore" android:value="amazon"/>