# How can I create Amazon IAP function in the prject?

**URL:** <https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770>\
**Category:** Amazon IAP\
**Created:** [January 21, 2014, 12:35am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770 "2014-01-21T00:35:33Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 12:35am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/1 "2014-01-21T00:35:33Z")

</div>

Hi there! I have developed Corona SDK project using amazon IAP function.

I think I have done all required, but IAP doesnt work.

Here is the all code and settings I hade.

* * *

in “build.settings” fine

* * *

&nbsp;&nbsp; plugins =  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; – key is the name passed to Lua’s ‘require()’  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [“plugin.amazon.iap”] =  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; – required  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; publisherId = “com.amazon”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },  
&nbsp;&nbsp;&nbsp; },&nbsp;&nbsp;&nbsp;&nbsp;

* * *

in main.lua

* * *

local amazonProductList =  
{  
&nbsp;&nbsp;&nbsp; “comstormyweatherlightning”,  
&nbsp;&nbsp;&nbsp; “comstormyweatherrainbow”,  
&nbsp;&nbsp;&nbsp; “comstormyweatherhotcold”,  
&nbsp;&nbsp;&nbsp; “comstormyweatherbonusmoves”,  
&nbsp;&nbsp;&nbsp; “comstormyweatherbuyall”,  
}

local function storeListener( event )  
&nbsp;&nbsp;&nbsp; local transaction = event.transaction  
&nbsp;&nbsp;&nbsp; if transaction.state == “purchased” then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“productIdentifier”, transaction.productIdentifier)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“receipt”, transaction.receipt)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“transactionIdentifier”, transaction.identifier)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print (“The user who made the purchase was”, transaction.userId)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Entitle this SKU here:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(transaction.productIdentifier == “comstormyweatherbonusmoves”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.MoveBonus = \_G.MoveBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherlightning”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.LightningBonus = \_G.LightningBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherrainbow”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.RainbowBonus = \_G.RainbowBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherhotcold”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(HotCold) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm1Bonus = \_G.Therm1Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm2Bonus = \_G.Therm2Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherbuyall”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.MoveBonus = \_G.MoveBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.RainbowBonus = \_G.RainbowBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.LightningBonus = \_G.LightningBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm1Bonus = \_G.Therm1Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm2Bonus = \_G.Therm2Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end

&nbsp;&nbsp;&nbsp; elseif&nbsp; transaction.state == “restored” then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“productIdentifier”, transaction.productIdentifier)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“receipt”, transaction.receipt)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“transactionIdentifier”, transaction.identifier)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print (“The user who made the purchase was”, transaction.userId)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Entitle this SKU here:

&nbsp;&nbsp;&nbsp; elseif&nbsp; transaction.state == “revoked” then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“productIdentifier”, transaction.productIdentifier)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“receipt”, transaction.receipt)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“transactionIdentifier”, transaction.identifier)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print (“The user who has a revoked purchase is”, transaction.userId)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Revoke this SKU here:

&nbsp;&nbsp;&nbsp; elseif transaction.state == “failed” then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(“Transaction failed”, transaction.errorType, transaction.errorString)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --display an error message here  
&nbsp;&nbsp;&nbsp; end  
end

local function loadProductsListener( event )  
&nbsp;&nbsp;&nbsp; local products = event.products  
&nbsp;&nbsp;&nbsp; for i=1, #event.products do  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(event.products[i].title)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(event.products[i].description)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(event.products[i].localizedPrice)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(event.products[i].productIdentifier)  
&nbsp;&nbsp;&nbsp; end  
&nbsp;&nbsp;&nbsp; for i=1, #event.invalidProducts do  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(event.invalidProducts[i])  
&nbsp;&nbsp;&nbsp; end  
end

store = require “store”

if system.getInfo(“targetAppStore”) == “amazon”&nbsp; or system.getInfo(“environment”) == “simulator” then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp;&nbsp; store = require “plugin.amazon.iap”

&nbsp;&nbsp;&nbsp; store.init( storeListener )  
&nbsp;&nbsp;&nbsp; print("The currently logged in user is: ", store.getUserId())  
&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp;&nbsp; store.restore()  
&nbsp;&nbsp;&nbsp; store.loadProducts(amazonProductList, loadProductsListener)

end

* * *

purchase calling

* * *

…

store.purchase(“comstormyweatherbonusmoves”)  
…

store.purchase(“comstormyweatherbuyall”)

…

store.purchase(“comstormyweatherlightning”)

…

store.purchase(“comstormyweatherrainbow”)

* * *

Please help me why it doesn not work?

where I made mistake?

PS: I add amazon app tester’s json file

amazon.sdktester.json

* * *

{  
&nbsp; “comstormyweatherlightning” : {  
&nbsp;&nbsp;&nbsp; “itemType”: “CONSUMABLE”,  
&nbsp;&nbsp;&nbsp; “price”: 0.99,  
&nbsp;&nbsp;&nbsp; “title”: “LightningBolt”,  
&nbsp;&nbsp;&nbsp; “description”: “Gain 3 Lightning Bolts”  
&nbsp; },  
&nbsp; “comstormyweatherrainbow” : {  
&nbsp;&nbsp;&nbsp; “itemType”: “CONSUMABLE”,  
&nbsp;&nbsp;&nbsp; “price”: 0.99,  
&nbsp;&nbsp;&nbsp; “title”: “Rainbow”,  
&nbsp;&nbsp;&nbsp; “description”: “Gain 3 Rainbow bonuses”  
&nbsp; },  
&nbsp; “comstormyweatherhotcold” : {  
&nbsp;&nbsp;&nbsp; “itemType”: “CONSUMABLE”,  
&nbsp;&nbsp;&nbsp; “price”: 0.99,  
&nbsp;&nbsp;&nbsp; “title”: “HotCold”,  
&nbsp;&nbsp;&nbsp; “description”: " Gain 3 of Hot or Cold bonuses"  
&nbsp; },  
&nbsp; “comstormyweatherbonusmoves” : {  
&nbsp;&nbsp;&nbsp; “itemType”: “CONSUMABLE”,  
&nbsp;&nbsp;&nbsp; “price”: 0.99,  
&nbsp;&nbsp;&nbsp; “title”: “BonusMoves”,  
&nbsp;&nbsp;&nbsp; “description”: “Gain 3 Bonus Moves (each adding 5 extra moves)”  
&nbsp; },  
&nbsp; “comstormyweatherbuyall” : {  
&nbsp;&nbsp;&nbsp; “itemType”: “CONSUMABLE”,  
&nbsp;&nbsp;&nbsp; “price”: 2.99,  
&nbsp;&nbsp;&nbsp; “title”: “BuyAll”,  
&nbsp;&nbsp;&nbsp; “description”: “Gain 3 additional of ALL bonuses”  
&nbsp; }  
}  
&nbsp;

* * *

---

<div class="post-metadata">

**Author:** ![tamkinp](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@tamkinp](https://forums.solar2d.com/u/tamkinp)\
**Post date:** [January 21, 2014, 12:48am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/2 "2014-01-21T00:48:24Z")

</div>

Hi lstar99999,

Can you expand a little bit on what you mean when you say it does not work? Are you getting an error message? Does the application just not respond?

Are you able to provide a copy of logcat when you run your application?

Can you confirm that you have the Amazon SDK Tester installed?

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:01am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/3 "2014-01-21T01:01:38Z")

</div>

I installed AmazonSDK tester, but when I click transaction button, there are no availible item in it, I search on google, finded that consumable item doesnt appear in transaction, so I have changed “itemType”: “CONSUMABLE” to “itemType”: “ENTITLED”,but it’s the same result.

I think the code is correct, but the application doesnt respond at all.

I want to know if my code correct or not.

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:02am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/4 "2014-01-21T01:02:36Z")

</div>

I have not getting message, just not respond

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:09am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/5 "2014-01-21T01:09:39Z")

</div>

Would you please review my code concretly?

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:09am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/6 "2014-01-21T01:09:53Z")

</div>

where I have mistake?

---

<div class="post-metadata">

**Author:** ![tamkinp](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@tamkinp](https://forums.solar2d.com/u/tamkinp)\
**Post date:** [January 21, 2014, 1:12am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/7 "2014-01-21T01:12:49Z")

</div>

Hi&nbsp;lstar99999,

Are you able to provide a copy of the logcat from your device when you run your app? This forum post will help you get this if you have not done it before:&nbsp;[http://forums.coronalabs.com/topic/16702-how-to-use-adb-logcat/](http://forums.coronalabs.com/topic/16702-how-to-use-adb-logcat/)

Your code looks correct, but is obviously not exactly what you have so it’s difficult to help without the log.

For example, you have some print statements in your code. What is the last print statement that you see?

What kind of device do you have? This is a shot in the dark, but try restarting your device. Sometimes the Amazon IAP SDK in your app and the Amazon SDK Tester have trouble communicating and a restart fixes this.

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:15am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/8 "2014-01-21T01:15:51Z")

</div>

ok. I’ll catch logcat and send you. thank you

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 5:26am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/9 "2014-01-21T05:26:45Z")

</div>

I cannot catch logcat.

is this code right? on Buy section

* * *

&nbsp; if(transaction.productIdentifier == “comstormyweatherbonusmoves”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.MoveBonus = \_G.MoveBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherlightning”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.LightningBonus = \_G.LightningBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherrainbow”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.RainbowBonus = \_G.RainbowBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherhotcold”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(HotCold) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm1Bonus = \_G.Therm1Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm2Bonus = \_G.Therm2Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherbuyall”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.MoveBonus = \_G.MoveBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.RainbowBonus = \_G.RainbowBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.LightningBonus = \_G.LightningBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm1Bonus = \_G.Therm1Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm2Bonus = \_G.Therm2Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end

* * *

---

<div class="post-metadata">

**Author:** ![tamkinp](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@tamkinp](https://forums.solar2d.com/u/tamkinp)\
**Post date:** [January 21, 2014, 6:28pm UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/10 "2014-01-21T18:28:29Z")

</div>

Hi&nbsp;lstar99999,

This looks like it could be correct, but it is not your complete source code so I cannot determine for sure that the problem isn’t elsewhere.

Before the code you posted above, can you do a print() or popup() of ‘transaction.productIdentifier’ to make sure you know what value you’re getting? Are you sure your callback is being called?

---

<div class="post-metadata">

**Author:** ![tamkinp](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@tamkinp](https://forums.solar2d.com/u/tamkinp)\
**Post date:** [January 21, 2014, 12:48am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/11 "2014-01-21T00:48:24Z")

</div>

Hi lstar99999,

Can you expand a little bit on what you mean when you say it does not work? Are you getting an error message? Does the application just not respond?

Are you able to provide a copy of logcat when you run your application?

Can you confirm that you have the Amazon SDK Tester installed?

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:01am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/12 "2014-01-21T01:01:38Z")

</div>

I installed AmazonSDK tester, but when I click transaction button, there are no availible item in it, I search on google, finded that consumable item doesnt appear in transaction, so I have changed “itemType”: “CONSUMABLE” to “itemType”: “ENTITLED”,but it’s the same result.

I think the code is correct, but the application doesnt respond at all.

I want to know if my code correct or not.

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:02am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/13 "2014-01-21T01:02:36Z")

</div>

I have not getting message, just not respond

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:09am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/14 "2014-01-21T01:09:39Z")

</div>

Would you please review my code concretly?

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:09am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/15 "2014-01-21T01:09:53Z")

</div>

where I have mistake?

---

<div class="post-metadata">

**Author:** ![tamkinp](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@tamkinp](https://forums.solar2d.com/u/tamkinp)\
**Post date:** [January 21, 2014, 1:12am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/16 "2014-01-21T01:12:49Z")

</div>

Hi&nbsp;lstar99999,

Are you able to provide a copy of the logcat from your device when you run your app? This forum post will help you get this if you have not done it before:&nbsp;[http://forums.coronalabs.com/topic/16702-how-to-use-adb-logcat/](http://forums.coronalabs.com/topic/16702-how-to-use-adb-logcat/)

Your code looks correct, but is obviously not exactly what you have so it’s difficult to help without the log.

For example, you have some print statements in your code. What is the last print statement that you see?

What kind of device do you have? This is a shot in the dark, but try restarting your device. Sometimes the Amazon IAP SDK in your app and the Amazon SDK Tester have trouble communicating and a restart fixes this.

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 1:15am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/17 "2014-01-21T01:15:51Z")

</div>

ok. I’ll catch logcat and send you. thank you

---

<div class="post-metadata">

**Author:** ![medianlinetech](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@medianlinetech](https://forums.solar2d.com/u/medianlinetech)\
**Post date:** [January 21, 2014, 5:26am UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/18 "2014-01-21T05:26:45Z")

</div>

I cannot catch logcat.

is this code right? on Buy section

* * *

&nbsp; if(transaction.productIdentifier == “comstormyweatherbonusmoves”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.MoveBonus = \_G.MoveBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherlightning”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.LightningBonus = \_G.LightningBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherrainbow”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.RainbowBonus = \_G.RainbowBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherhotcold”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(HotCold) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm1Bonus = \_G.Therm1Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm2Bonus = \_G.Therm2Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif(transaction.productIdentifier == “comstormyweatherbuyall”) then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.MoveBonus = \_G.MoveBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.RainbowBonus = \_G.RainbowBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.LightningBonus = \_G.LightningBonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm1Bonus = \_G.Therm1Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \_G.Therm2Bonus = \_G.Therm2Bonus + 3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end

* * *

---

<div class="post-metadata">

**Author:** ![tamkinp](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@tamkinp](https://forums.solar2d.com/u/tamkinp)\
**Post date:** [January 21, 2014, 6:28pm UTC](https://forums.solar2d.com/t/how-can-i-create-amazon-iap-function-in-the-prject/321770/19 "2014-01-21T18:28:29Z")

</div>

Hi&nbsp;lstar99999,

This looks like it could be correct, but it is not your complete source code so I cannot determine for sure that the problem isn’t elsewhere.

Before the code you posted above, can you do a print() or popup() of ‘transaction.productIdentifier’ to make sure you know what value you’re getting? Are you sure your callback is being called?
