If Google Play doesn't use store.loadProducts() how do you get the item prices?

Hi im using the plugin v3 etc but when I try to get the tittle of the item

print( event.products[i].title )

I recibe the title but with a (name of the app) anyone know why is that? I just want the

tittle of the product not

“tittle (name of the app)”

jonjonson’s response helped me a lot. I think the tutorial needs to be updated to reflect this for single item purchase, otherwise, other users will encounter exact the same problem when they use table for the product ID in the purchase call.

We are updating the IAP guide to reflect Google Play IAP3.  It should be available some time this week.  I submitted the updates yesterday and it has to go through editing and get pushed.  Perhaps we should go back and update the tutorial too, but IAP V2 is still valid.

Rob

Hello Everyone,

Checking logcat after doing a loadProduct using Google Play IAP v3, in the “SkuDetails” table that is returned to the IabHelper, there are 2 information that I’d like to access in lua but haven’t found them in event callback, “price_amount_micros” and “price_currency_code”.

Is there way for me to get these information, or is it possible to expose them in future versions of the plugin ?

Theres a field in the transaction callback called originalJson.  You can try reading that to see if it has the information you need.

For example it would look like:

local store = require("plugin.google.iap.v3") function transactionCallback( event ) local transaction = event.transaction print(transaction.originalJson) end store.init( transactionCallback ) store.restore()

Hey dchan,

I checked the originalJson returned after a transaction, but it doesn’t include information about price. The only information I found there was in relation to ids of the transaction (ids of the app and iap, purchase token, etc.). Thanks for the suggestion tough.

So, I’m guessing I can’t access this info for now ? Is this something that Corona could expose in future versions of the plugin ?

You’re right its not accessible for now.  It is something that we can expose later on though.

Hopefully soon, was a bit of a PITA. As far as I remember I overcame this by getting the product list and storing the prices from there along with the product identifier.

Ya, I want to avoid that, since we would need to change the code whenever we changed the price of an iap on Google.

@dchan You have any idea how soon we could get this on the plugin, if it is on the list of features to add ?

We have no eta on when it will be added.  If it gets enough votes on feedback.coronalabs.com we’ll move it up the list though.

Sorry I was not clear. 

If  you use store.loadProducts you get the list of products you have added on Google along with localized price. 

Oh ya, sorry i misunderstood you.

We can get the localized through the loadProducts, and are using on some apps. Although localized price are fine if you are using them only to display them to the user, we need to download the price of items to make internal analytics and use them to measure how much each user is spending. 

We currently do this in iOS, and this information would allow us to do the same in Android. It should be a small enough change, seeing as this is already provided through the IabHelper class that Corona seems to be using. If this feature could be moved up the priority list it would help us a lot.

Just wanted to mention it here. I’ve opened a request for this information to be exposed in the iap plugin. Hopefully this will be implemented soon.

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/6425326-expose-all-price-information-from-google-iap-v3-pl

jonjonson’s response helped me a lot. I think the tutorial needs to be updated to reflect this for single item purchase, otherwise, other users will encounter exact the same problem when they use table for the product ID in the purchase call.

We are updating the IAP guide to reflect Google Play IAP3.  It should be available some time this week.  I submitted the updates yesterday and it has to go through editing and get pushed.  Perhaps we should go back and update the tutorial too, but IAP V2 is still valid.

Rob

This is done and has been pushed to the plugin.  View more details here: http://docs.coronalabs.com/daily/plugin/google-iap-v3/loadProducts.html

more specifically:

print( event.products[i].priceAmountMicros ) --string
print( event.products[i].priceCurrencyCode ) --string
print( event.products[i].originalJson ) --string

Hello Everyone,

Checking logcat after doing a loadProduct using Google Play IAP v3, in the “SkuDetails” table that is returned to the IabHelper, there are 2 information that I’d like to access in lua but haven’t found them in event callback, “price_amount_micros” and “price_currency_code”.

Is there way for me to get these information, or is it possible to expose them in future versions of the plugin ?

Theres a field in the transaction callback called originalJson.  You can try reading that to see if it has the information you need.

For example it would look like:

local store = require("plugin.google.iap.v3") function transactionCallback( event ) local transaction = event.transaction print(transaction.originalJson) end store.init( transactionCallback ) store.restore()

Hey dchan,

I checked the originalJson returned after a transaction, but it doesn’t include information about price. The only information I found there was in relation to ids of the transaction (ids of the app and iap, purchase token, etc.). Thanks for the suggestion tough.

So, I’m guessing I can’t access this info for now ? Is this something that Corona could expose in future versions of the plugin ?

You’re right its not accessible for now.  It is something that we can expose later on though.