Amazon IAP Plugin v2 - Empty Product List

Hello,

I’m having problems trying to get the products information with Amazon IAP v2 plugin. After calling store.loadProducts() the productsList is always empty.

This is what I do:

local listOfProducts = {com.companyname.product1, com.companyname.product2, com.companyname.product3} store.loadProducts(listOfProducts, onLoadProducts) function onLoadProducts(event) print("[Catalog] -- EventName", event.name) print("[Catalog] -- isError", event.isError) print("[Catalog] -- errorType", event.errorType) print("[Catalog] -- Products", #event.products, event.products) print("[Catalog] -- invalidProducts", #event.invalidProducts, event.invalidProducts) end

And this is what it prints on the console:

[Catalog] -- EventName    productList [Catalog] -- isError    false [Catalog] -- errorType    nil [Catalog] -- Products    0    table: 0x640cd410 [Catalog] -- invalidProducts    0    table: 0x66a862e0

The product ids are valid. I have double checked them (and triple checked). And I can make purchases without any problem using the same product ids. I also have tried to write a wrong product id. Then the invalidProducts table is populated by this wrong product id. Any clue of what’s happening?

May it be a bug or I’m missing something. Than you!!!

Pau Ors

Try this in your onLoadProducts function:  

for k,v, in pairs(event.products) do print(k,v) end

Also are you testing this in the Simulator or on a Device?

If you’re testing it on a device have you installed the required testing app and copied over the required .json file of your products to your device as well?

Rob

@JonPM - Thank you, but it didn’t work. The event.products is always empty, but is not nil. It has 0 elements. The products list should be indexed with numbers, meaning I should be able to get it’s data using something like this event.products[i]. It works with the invalidProducts table. They should work in the same way.

@Rob Miracle - I’m testing it on a Kindle Fire HDD device. I have copied the required .json file. In fact, I can make purchases without any problem. Using the Amazon Test App I can test all purchasing situations. The only thing I can’t do is get the products information, which is necessary to get the product price and currency in the correct format.

The response is successful. I don’t get and error response. It looks like everything is ok, but I the products list is empty. If I use wrong productIds, then the invalidProducts list is populated by them… so the productIds are correct.

Normally when I’m stacked with such problems is always my fault… but in this case I start thinking it might be a bug of the plugin. Does anybody tried to get the products list from Amazon successfully with the Amazon Plugin v2?

Thank you!

Pau Ors.

I’m going to need you to file a bug report so I can get an engineer to look at it. What we need is a simple test case that demonstrates the problem. I would suspect that an .init() call and a call to .loadProducts() would be sufficient. Bundle up a main.lua, build.settings and config.lua and any other assets needed (in this case your .json file) so we can simply build it and run it on or device. This needs to be in a .zip file (no other formats please).

When you have that, use the “Report a bug” link at the top. When filling out the description (be descriptive!), also include a link to this forum thread to give the developer more context. Attach your .zip file and submit. You will get an email confirming the submission. Please post the CaseID number from the subject of the email back here as a reference.

Thanks

Rob

Hello,

@Rob Miracle - I’ve submitted the (possible) bug as you told me to do. I don’t know how long it takes before they can take a look at it, but I really would appreciate a fast answer as my company has done a big effort to migrate the apps to Amazon and this is the last step. Could you please keep me informed about the progress? Thank you for your help.

Pau Ors.

Do you have the caseID #?

Hi pau7,

Amazon App Tester sometimes doesn’t work properly. Please test your app using Live App Testing. That way you will get behavior that is much closer to the real thing.
https://developer.amazon.com/public/resources/development-tools/live-app-testing

@Rob Miracle - Case 46175. Thank you!

@Lerg - I’m going to test it as soon as I can. Thank you! If you are right, it’s unbelievable that the Amazon official testing app is not useful for testing. Somebody of Amazon should test the testing app. :slight_smile:

I’ll keep you informed about my progress.

Pau Ors.

@pau7, were you able to test it?

Hello,

Sorry for the delay, it was a busy week. I’ve tried it in live testing and things went worst. Now I can’t get the product list and I cannot make purchases due “an internal error”. As I have to upload a new version and wait until it is ready every time I make a change, it will take some time until I can give you more details. Now I’m making a “debug version” that will print every single action on the console. Let’s see if I can understand what’s going on… It’s very frustrating all this process. I wish I had a farm far from computers…

Pau Ors.

Hello,

Ok, finally everything works. My conclusions:

  1. Amazon App Tester doesn’t work as expected. It never populates the product list. The purchases work and is useful to test the purchase process, but not to test the loadProducts function. I don’t know if it only happens with Corona plugin or it happens with all engines, but is very sad that the tool to find errors it’s an error itself.

  2. The live test works as expected, but the Amazon console is (under my opinion) very bad designed and slow. Even when you have everything with fancy green check marks, check things manually. It might be that something is not submitted or ok.

Thank you all for your help. I hope this will help other developers.

Pau Ors.

Try this in your onLoadProducts function:  

for k,v, in pairs(event.products) do print(k,v) end

Also are you testing this in the Simulator or on a Device?

If you’re testing it on a device have you installed the required testing app and copied over the required .json file of your products to your device as well?

Rob

@JonPM - Thank you, but it didn’t work. The event.products is always empty, but is not nil. It has 0 elements. The products list should be indexed with numbers, meaning I should be able to get it’s data using something like this event.products[i]. It works with the invalidProducts table. They should work in the same way.

@Rob Miracle - I’m testing it on a Kindle Fire HDD device. I have copied the required .json file. In fact, I can make purchases without any problem. Using the Amazon Test App I can test all purchasing situations. The only thing I can’t do is get the products information, which is necessary to get the product price and currency in the correct format.

The response is successful. I don’t get and error response. It looks like everything is ok, but I the products list is empty. If I use wrong productIds, then the invalidProducts list is populated by them… so the productIds are correct.

Normally when I’m stacked with such problems is always my fault… but in this case I start thinking it might be a bug of the plugin. Does anybody tried to get the products list from Amazon successfully with the Amazon Plugin v2?

Thank you!

Pau Ors.

I’m going to need you to file a bug report so I can get an engineer to look at it. What we need is a simple test case that demonstrates the problem. I would suspect that an .init() call and a call to .loadProducts() would be sufficient. Bundle up a main.lua, build.settings and config.lua and any other assets needed (in this case your .json file) so we can simply build it and run it on or device. This needs to be in a .zip file (no other formats please).

When you have that, use the “Report a bug” link at the top. When filling out the description (be descriptive!), also include a link to this forum thread to give the developer more context. Attach your .zip file and submit. You will get an email confirming the submission. Please post the CaseID number from the subject of the email back here as a reference.

Thanks

Rob

Hello,

@Rob Miracle - I’ve submitted the (possible) bug as you told me to do. I don’t know how long it takes before they can take a look at it, but I really would appreciate a fast answer as my company has done a big effort to migrate the apps to Amazon and this is the last step. Could you please keep me informed about the progress? Thank you for your help.

Pau Ors.

Do you have the caseID #?

Hi pau7,

Amazon App Tester sometimes doesn’t work properly. Please test your app using Live App Testing. That way you will get behavior that is much closer to the real thing.
https://developer.amazon.com/public/resources/development-tools/live-app-testing

@Rob Miracle - Case 46175. Thank you!

@Lerg - I’m going to test it as soon as I can. Thank you! If you are right, it’s unbelievable that the Amazon official testing app is not useful for testing. Somebody of Amazon should test the testing app. :slight_smile:

I’ll keep you informed about my progress.

Pau Ors.