store.target in google iap v3

Hi,

I’m having a few problems with my in app purchases and am trying to sort it out:

  1. Is store.target included in the iap plugin?

  2. The documentation says to require the store as:

local store = require( “store” )
if store.target == “google” then
    store = require(“plugin.google.iap.v3”)
end

Can I not just declare:

    store = require(“plugin.google.iap.v3”)   ?

3.  Where do I find LogCat?  Does it run on an android device?

Thanks, Greg

Can someone look at this code and see if something stands out? It looks like it store.target never returns true

function buyUpgrade(upgradeItem)

 
–    if ( store.availableStores.apple ) then
–        store.init( “apple”, storeTransaction )
–    if ( store.availableStores.google ) then

     if ( store.target == “google” ) then
        store.init( “google”, storeTransaction )
–        local alert =native.showAlert(“Made it here!”…tostring(smessage), {“Okay”})
    else
        showMessage(“In-app purchases are not available on this device.”)
        do return end
    end

    if upgradeItem == “CMD_100” then
       store.purchase( “crystals”)
    elseif upgradeItem == “CMD_200” then
        store.purchase( “200crystals” )        
    end    
end

function storeTransaction( event )

    local transaction = event.transaction
    local upgradeitem = event.transaction.productIdentifier
    local tstate = event.transaction.state
    
  
     if tstate == “purchased” then
        –  local timeStamp = utility.makeTimeStamp(transaction.date,“ctime”)
–          if timeStamp + 360 < os.time() then  – if the time stamp is older than 5 minutes, we will assume a restore.
–             showMessage(“map this purchase to a restore”)
–             tstate = “restored”
    
–          else  – its a  purchase

             if upgradeItem == “crystals” then

                – purchase code here

             elseif upgradeItem == “200crystals” then

                – purchase code here
             end        
    
             local alert =native.showAlert(“Purchase Complete!”, “Your support is greatly appreciated!”, {“Okay”})
–      end
    end
         
    store.finishTransaction( event.transaction )

end

For future reference,  I was able to get my store running by not using store.target and using this instead:

   if system.getInfo( “targetAppStore” ) ==“google” then
        store.init( “google”, storeTransaction )

logcat is part of ADB.  basically you run the command ‘adb logcat’ from a terminal while your device is connected over usb 

this link may point you in right direction

http://forums.coronalabs.com/topic/35018-easiest-detailed-way-to-debug-corona-app-on-android-device/

I don’t see a mention of target as being made available by the plugin in the documenation - thanks for the heads up on that

Thanks jflowers45!  Just what I needed.

Greg

Can someone look at this code and see if something stands out? It looks like it store.target never returns true

function buyUpgrade(upgradeItem)

 
–    if ( store.availableStores.apple ) then
–        store.init( “apple”, storeTransaction )
–    if ( store.availableStores.google ) then

     if ( store.target == “google” ) then
        store.init( “google”, storeTransaction )
–        local alert =native.showAlert(“Made it here!”…tostring(smessage), {“Okay”})
    else
        showMessage(“In-app purchases are not available on this device.”)
        do return end
    end

    if upgradeItem == “CMD_100” then
       store.purchase( “crystals”)
    elseif upgradeItem == “CMD_200” then
        store.purchase( “200crystals” )        
    end    
end

function storeTransaction( event )

    local transaction = event.transaction
    local upgradeitem = event.transaction.productIdentifier
    local tstate = event.transaction.state
    
  
     if tstate == “purchased” then
        –  local timeStamp = utility.makeTimeStamp(transaction.date,“ctime”)
–          if timeStamp + 360 < os.time() then  – if the time stamp is older than 5 minutes, we will assume a restore.
–             showMessage(“map this purchase to a restore”)
–             tstate = “restored”
    
–          else  – its a  purchase

             if upgradeItem == “crystals” then

                – purchase code here

             elseif upgradeItem == “200crystals” then

                – purchase code here
             end        
    
             local alert =native.showAlert(“Purchase Complete!”, “Your support is greatly appreciated!”, {“Okay”})
–      end
    end
         
    store.finishTransaction( event.transaction )

end

For future reference,  I was able to get my store running by not using store.target and using this instead:

   if system.getInfo( “targetAppStore” ) ==“google” then
        store.init( “google”, storeTransaction )

logcat is part of ADB.  basically you run the command ‘adb logcat’ from a terminal while your device is connected over usb 

this link may point you in right direction

http://forums.coronalabs.com/topic/35018-easiest-detailed-way-to-debug-corona-app-on-android-device/

I don’t see a mention of target as being made available by the plugin in the documenation - thanks for the heads up on that

Thanks jflowers45!  Just what I needed.

Greg