store.loadProducts() mixes the item prices on Android > 5.0

Hello guys, I’m using the store.loadProduct() API to build my game store.

However, it is working fine on iOS and Android <5.0, but, from 5.0 and above, the prices on the store are not referring to the right item.

To be more precise, if item #1 is 1.00$ , item #2 is 2.00$ and item #3 is 3.00$,  on Android 5.0 and above

item #1 is 3.00$, item #2 is 1.00$ and item #3 is 2.00$.

The code I’m using is the follow:

local function productCallback( event ) print( "Showing valid products:", #event.products ) for i = 1,#event.products do print( event.products[i].title ) print( event.products[i].description ) print( event.products[i].price ) print( event.products[i].localizedPrice ) print( event.products[i].priceLocale ) print( event.products[i].productIdentifier ) end if ( system.getInfo( "platformName" ) == "Android" ) then storeBTN[1073].text = event.products[4].localizedPrice storeBTN[1074].text = event.products[2].localizedPrice storeBTN[1075].text = event.products[5].localizedPrice storeBTN[1076].text = event.products[3].localizedPrice storeBTN[1077].text = event.products[6].localizedPrice storeBTN[1078].text = event.products[1].localizedPrice end if ( system.getInfo( "platformName" ) == "iPhone OS" ) then storeBTN[1073].text = event.products[6].localizedPrice storeBTN[1074].text = event.products[3].localizedPrice storeBTN[1075].text = event.products[4].localizedPrice storeBTN[1076].text = event.products[1].localizedPrice storeBTN[1077].text = event.products[2].localizedPrice storeBTN[1078].text = event.products[5].localizedPrice end if(storeBTN[1087])then for i=1087,1098 do storeBTN[i].isVisible = false end end priceLoaded = true Runtime:removeEventListener("enterFrame", moveLoadingIAP) eventListenerLoadingIAPAdded = false print( "Showing invalid products:", #event.invalidProducts ) for i = 1,#event.invalidProducts do print( event.invalidProducts[i] ) end end

I’ve even tried to put an if statement to check the Android version in use, right after  

if ( system.getInfo( "platformName" ) == "Android" ) then&nbsp;

but, at that point, nothing happens and prices are not loading.

Is there something I’m missing?

Thanks and have a nice day.

I think the problem here is that loadProducts does not necessarily return information for your products in the same order as the table you passed in your original loadProducts call.

So, in pseudo-Corona, although you may call:

myProducts = { "product1", "product2", "product3" } store.loadProducts(myProducts)

… your event.products table may be in the order: product3, product1, product2.

This means you’ll need to loop through the event.products table, checking each item’s product identifier in turn, and then using that to work out which index in storeBTN needs to be updated.

I think the problem here is that loadProducts does not necessarily return information for your products in the same order as the table you passed in your original loadProducts call.

So, in pseudo-Corona, although you may call:

myProducts = { "product1", "product2", "product3" } store.loadProducts(myProducts)

… your event.products table may be in the order: product3, product1, product2.

This means you’ll need to loop through the event.products table, checking each item’s product identifier in turn, and then using that to work out which index in storeBTN needs to be updated.