Steps

  • the sample project in Bookshelf zip

    http://kwiksher.com/tutorials/Kwik4/BookShelf.zip

    • BookShelfPages project
    • copy the project to ~/Documents/Kwik
    • edit tmplt/components/store/model.lua for Host URL of yours

      local YourHost  = "http://localhost:4000/daily"
      M.URL           = YourHost.."/LibraryParent/"
      M.backgroundImg = "bg.png"
      
  • Book Shelf Tmplt project
    • Project Properties
      • Advanced > Book Shelf Type. Set it as pages
      • Monetization to set episode{Num}
    • TOC page
      • Episode{Num}Icon
      • downloadBtn
      • saveBtn
      • savingTxt
      • purchaseBtn
      • restoreBtn
      • infoTxt
      • Buy Product Action
    • Episode{Num} INFO page
      • Episode{Num}Icon
        • downloadBtn
        • saveBtn
        • savingTxt
        • purchaseBtn
        • infoTxt
        • hideOverlayBtn
        • Buy Product Action
    • Episode{Num} pages
      • page properties
        • prelaoding off
        • In-App Unlock to associate the product ID of episode{Num} of Monetizatin Tab
  • BookServer

    • copyright.txt
    • copy_pages.bat(Mac) or copy_pages.command
  • copy each assets.zip to book{Num} folder of the http server

  • corona simulator > show sand box folder, you need to clean the following folders if you want to recover the initial state.

    • Application Support
    • Documents
    • TemporaryFiles
  • Before device build, set the valid product IDs from apple, google or amazon.

Kwik pubishes it to build4/components/store/model.lua

M.debug     = false

M.episodes = {
            Episode02  ={name = "Episode02", startPage = 4, dir = "assets/images/p4", numOfPages = 2, info = "3"},
            Episode03  ={name = "Episode03", startPage = 6, dir = "assets/images/p6", numOfPages = 1, info = ""},
    }
--
M.catalogue = {
    products = {
            Episode02 = {
            productNames = { apple="com.kwiksher.bookshelf.episode02", google="com.kwiksher.bookshelf.episode02", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Episode02") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Episode02") end,
        },
            Episode03 = {
            productNames = { apple="com.kwiksher.bookshelf.episode03", google="com.kwiksher.bookshelf.episode03", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Episode03") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Episode03") end,
        },
    },

Debug mode

When you test it with debug as true for IAP on corona simulator. You need to set the episode names as dummies for the productNames. Don't use the official produtnames from apple, google or amaon. With offcial IDs, debug mode fails to return an episode name and IAP not work correctly.

fo instance, Episode02 and Episode03 are set

M.debug     = true
...
...
M.catalogue = {
    products = {
            Episode02 = {
            productNames = { apple="Episode02", google="", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Episode02") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Episode02") end,
        },
            Episode03 = {
            productNames = { apple="Episode03", google="", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Episode03") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Episode03") end,
        },
    },

build.settings

iOS

if you use http server instead of https, please set your domain in build.settings

NSExceptionDomains

https://docs.coronalabs.com/guide/hardware/appleATS/index.html

Android

  • config.lua needs google license key
  • build.settings needs the permissions

To do so, please enable expansion file and set the license key from goggle. Then config.lua and build.settings will be configured when publishing with Kwik

project properties > Advanced Settings.

results matching ""

    No results matching ""