Google

https://docs.coronalabs.com/guide/monetization/IAP/index.html

https://developer.android.com/google/play/billing/billing_testing.html

Google Play > Developer Console

https://play.google.com/apps/publish/Home

click CREATE APPLICATION button and fill the mandatory data fields of each section with your answer

  • Pricing & Distribution
  • ContentRating
  • Store > listing
    • screenshots
    • Hi-res icon 512 x 512 PNG
    • Feature Graphic 1024 w x 500 h

2 screenshots are required. Minium dimension of 320 px and a maximum dimension of 2840 px, for instance

  • phone: 1080x1920
  • tablet 7": 1024 x 600
  • tablet 11": 1920 x 1200

Products

For instance, you are going to make IAP products like this

name type product id
book01 Managed com.kwiksher.bookshelf.book01
book02 Managed com.kwiksher.bookshelf.book02

Build apk

You need a keystore file for IAP and use it for building .apk with Corona simulator

keystore file

syntax

sudo keytool -genkey -v -keystore yourapp.keystore -alias yourapp -keyalg RSA -validity 10000

for example,

sudo keytool -genkey -v -keystore kwikbookshelf.keystore -alias kwikbookshelf -keyalg RSA -validity 10000
  • fist and last name: Naoya Yamamoto
  • origanizational unit: IT
  • orignization: Kwiksher
  • city or Locality: Akihabara
  • state or province: Tokyo
  • country code: jp

build.settings and config.lua

the IAP plugin and the permissions are added in build.settings

Your app's key must be added to the license table in config.lua. copy it from Google Play Console > Licensing & In-App Billing and paste it to config.lua

build.settings

settings = {
    plugins  =  {
        --Google in app billing v3
        ["plugin.google.iap.v3"] = {
            -- required
            publisherId = "com.coronalabs",
            supportedPlatforms = { android = true },
        },
    },
    android  = {
      usesPermissions  = {
          "android.permission.INTERNET",
          "android.permission.RECORD_AUDIO",
          "android.permission.WRITE_EXTERNAL_STORAGE",
          "com.android.vending.BILLING",
          },
    },

config.lua

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

Google Play > Developer Console

  • Upload apk

    • App releases > Alpha (Beta) > Edit Release
    • Google Play App Signing > OPT-OUT
    • Upload apk
  • In-app products > Add New Product

    • Managed Product
      • ID: com.kwiksher.bookshelf.book01
    • Managed Product
      • ID: com.kwiksher.bookshelf.book02

Roll out the APK release(alpha or beta) for google to approve it. The status will become published in minutes.

Make it active your In-App products.


Prepareing Test Account

Google Play Console

  • Settings > Account Details > License Testing
  • YourApp > App releases > alpha or beta > Manage testers
    • Opt-in URL will be availabe when you publish your app
    • It takes some minutes for Google to approve your release after you rollout the app

Browser Google

  • create a new gmail account

    [original] foo@gmail.com

    [test accounts]

    • foo+us@gmail.com
    • foo+uk@gmail.com
    • foo+jp@gmail.com

Device

  • Settings > Users
  • add new user with the new Gmail account
    • login the device with the new user
    • open the Opt-in URL in browser.
      • YourApp > App releases > alpha or beta > Manage testers > Opt-in URL
      • follow the instruction on the URL page to be the tester if the app
    • during the test purchase, it will be necessary to enter credit card information
  • adb install the apk with the same version number to the device
  • now you can test.
  • clear data of Play store app on device from settings > App if you like to refresh testing

http://www.techotopia.com/index.php/An_Android_Studio_Google_Play_In-app_Billing_Tutorial

Testing with Static Responses

you can build your .apk with the reserved product id of google to test IAP with the static responses before you use the commercail product IDs that you added in Google Play Console

Note

  • event.transaction.state with "refunded"

https://docs.coronalabs.com/guide/monetization/IAP/index.html#initialization

event.transaction.state within the transaction listener function will be "refunded" and, in this case, you can disable the content that was refunded and/or delete it from the app locally if it was downloaded. This features is not currently implemented with Kwik. You need to make external codes for it.

results matching ""

    No results matching ""