How do I call/use the Amazon IAP?

Hi,

I have been having problems on how to use the Amazon plug-in in corona, and I was wondering if anybody can give me an idea on how to use it. I have tried the Google Play in-app, but I just don’t get how I should call the in-app for Amazon. Thank you

Hi czartezadev,

Have you reviewed the documentation at http://docs.coronalabs.com/daily/plugin/amazon.iap/index.html?

What are you having problems with?

Hi tamkinp,

I currently have a live version of the app on Amazon and the in-app purchase that I have created has been approved as well. My problem is that how should I call the in-app of Amazon. Below is my code for calling it, I am not sure if I did it correctly because upon testing it on the device, my phone just freezes. 

local removeAds = widget.newButton

            {

            defaultFile = “images/removeAds2.png”,

            overFile = “images/removeAdsOver2.png”,

            id = “remove ads”,

            onRelease = function(event)

                if event.phase == “ended” then

                    if system.getInfo(“targetAppStore”) == “amazon”  or system.getInfo(“environment”) == “simulator” then 

                        store = require “plugin.amazon.iap” 

                        store.init( storeListener ) 

                        print("The currently logged in user is: ", store.getUserId())

                        store.restore() 

                        if store.canLoadProducts == true then 

                            store.loadProducts({“my.product.removeads”}, loadProductsListener) 

                        end 

                        if store.isSandboxMode() == true then 

                            store.purchase(“my.product.removeads”) 

                        else 

                            store.purchase(“my.product.removeads”) 

                        end 

                    end 

                end

            end,

            }

        removeAds:setReferencePoint(display.TopRightReferencePoint)    

        removeAds.x = display.contentWidth

        removeAds.y = -removeAds.height * 0.3

Hi czartezadev,

Did you install and configure the Amazon SDK Tester as per Amazon’s documentation?

https://developer.amazon.com/sdk/in-app-purchasing/documentation/testing-iap.html

Yes I have. Did I call it correctly based from my code? I have also added the json file to my sdcard as well, but the same output.

Are you able to post the logcat from the time your application starts until the time it hangs?

I use the device for testing so I couldn’t figure out what was wrong? Am I able to test it using the simulator?

It is not possible to test the Amazon IAP plugin using the CoronaSDK simulator. Do you know how to connect logcat to your device?

I actually don’t know how. I will try to download one. How do you use it after? 

@tampkinp

I checked the logs on logcat, and I have posted it here, please help me on this,

Thanks,

Hi czartezadev,

Have you reviewed the documentation at http://docs.coronalabs.com/daily/plugin/amazon.iap/index.html?

What are you having problems with?

Hi tamkinp,

I currently have a live version of the app on Amazon and the in-app purchase that I have created has been approved as well. My problem is that how should I call the in-app of Amazon. Below is my code for calling it, I am not sure if I did it correctly because upon testing it on the device, my phone just freezes. 

local removeAds = widget.newButton

            {

            defaultFile = “images/removeAds2.png”,

            overFile = “images/removeAdsOver2.png”,

            id = “remove ads”,

            onRelease = function(event)

                if event.phase == “ended” then

                    if system.getInfo(“targetAppStore”) == “amazon”  or system.getInfo(“environment”) == “simulator” then 

                        store = require “plugin.amazon.iap” 

                        store.init( storeListener ) 

                        print("The currently logged in user is: ", store.getUserId())

                        store.restore() 

                        if store.canLoadProducts == true then 

                            store.loadProducts({“my.product.removeads”}, loadProductsListener) 

                        end 

                        if store.isSandboxMode() == true then 

                            store.purchase(“my.product.removeads”) 

                        else 

                            store.purchase(“my.product.removeads”) 

                        end 

                    end 

                end

            end,

            }

        removeAds:setReferencePoint(display.TopRightReferencePoint)    

        removeAds.x = display.contentWidth

        removeAds.y = -removeAds.height * 0.3

Hi czartezadev,

Did you install and configure the Amazon SDK Tester as per Amazon’s documentation?

https://developer.amazon.com/sdk/in-app-purchasing/documentation/testing-iap.html

Yes I have. Did I call it correctly based from my code? I have also added the json file to my sdcard as well, but the same output.

Are you able to post the logcat from the time your application starts until the time it hangs?

I use the device for testing so I couldn’t figure out what was wrong? Am I able to test it using the simulator?

It is not possible to test the Amazon IAP plugin using the CoronaSDK simulator. Do you know how to connect logcat to your device?

I actually don’t know how. I will try to download one. How do you use it after? 

@tampkinp

I checked the logs on logcat, and I have posted it here, please help me on this,

Thanks,