Unless you want to implement a licensing check (to verify that a paid app was in fact downloaded from Google Play), or you want to verify that an in app billing transaction receipt is valid, I don’t think there’s anything you need to do. If you want to do licensing, check out the licensing section of the documentation – you do need to out the key in your config.lua file. I haven’t looked into in app billing receipt validation. - Andrew
In the sample app, I changed the Product list to from android.test.purchase to my own company.com.product . Even though the product is live, I still get “The item you were attempting to purchase could not be found” .
In Google Play, you can set up multiple in app products . How does Corona know which in-app products you are selling when you only specify 1 package name (ie: android.test.purchase) ?
thanks
I’m not sure I follow you exactly, but in general, the value you pass to store.purchase() must *exactly* match the product ID you entered in the Google Play Developer Console. Many developers mistakenly think that their package name gets inserted automatically, but that’s not the case. If you named your product “myproduct” then that’s the value you use for store.purchase(). If you named it “company.com.product” then that’s the value you use.
thanks aukStudios ,
In the example that included in the Corona directory. I do see the variable productId, but I do not see what the value is . Do you know what is the value of productId in that example ?
thanks
I haven’t used the IAP sample app, but I’ve heard that it’s quite a messy sample, so you might be better off simply following the store documentation at http://docs.coronalabs.com/api/library/store/index.html, which is very straightforward.
- Andrew
thanks . I agree that the IAP sample app is messy. Just a *last* quick question about the store.purchase() function . In Google Play, you can have multiple in-app products for an app . For example, you have 3 products in a app called “My Cool App” (the package name is mycoolapp.com.myapp ) . 3 products are :
product1
product2
product 3
To buy product 1, you would have to call
store.purchase( {“mycoolapp.com.myapp.product1”} )
Is that correct ? I appreciate your help .
No, if the products are named product1, product2, and product3, then to purchase product1, you would call store.purchase({“product1”}). That’s what I meant earlier when I said it must *exactly* match. Your package name doesn’t matter.
That said, many developers *choose* to name their products with their app’s package name in front. This ensures that their product names don’t interfere with the product names of other developers. But that’s your choice, it’s not required.
- Andrew
Thank you very much . I was able to code AIP based on the documentations you suggested . I have 1 last question: Do you have any example or point me to the right direction with the issue below ? I have this button (below) . How do I hide this button if the users have already purchased the product “fullversion” ? In another word, I only want to show the button to users who have not yet brought the "“ullversion” product so they can buy the product ?
thanks
local function handleButtonEvent( event )
local phase = event.phase
if “ended” == phase then
store.init( storeTransaction )
store.purchase( {“fullversion”} )
end
end
– Create a group
local group = display.newGroup()
– Create the button
local myButton = widget.newButton
{
defaultFile = “BuyFullVersion.png”,
id = “button_1”,
label = “Buy Full Version”,
onEvent = handleButtonEvent,
}
group:insert( myButton )
After they buy the product the first time, you should save that fact by writing to a file you create in the Documents Directory. That way, you can check that file next time to see if they’ve already purchased the product, and if so, don’t show the button.
- Andrew
Thanks . Do you have any examples ?
thank you very much
I’d suggest looking at this guide: http://docs.coronalabs.com/guide/data/readWriteFiles/index.html
- Andrew
Unless you want to implement a licensing check (to verify that a paid app was in fact downloaded from Google Play), or you want to verify that an in app billing transaction receipt is valid, I don’t think there’s anything you need to do. If you want to do licensing, check out the licensing section of the documentation – you do need to out the key in your config.lua file. I haven’t looked into in app billing receipt validation. - Andrew
In the sample app, I changed the Product list to from android.test.purchase to my own company.com.product . Even though the product is live, I still get “The item you were attempting to purchase could not be found” .
In Google Play, you can set up multiple in app products . How does Corona know which in-app products you are selling when you only specify 1 package name (ie: android.test.purchase) ?
thanks
I’m not sure I follow you exactly, but in general, the value you pass to store.purchase() must *exactly* match the product ID you entered in the Google Play Developer Console. Many developers mistakenly think that their package name gets inserted automatically, but that’s not the case. If you named your product “myproduct” then that’s the value you use for store.purchase(). If you named it “company.com.product” then that’s the value you use.
thanks aukStudios ,
In the example that included in the Corona directory. I do see the variable productId, but I do not see what the value is . Do you know what is the value of productId in that example ?
thanks
I haven’t used the IAP sample app, but I’ve heard that it’s quite a messy sample, so you might be better off simply following the store documentation at http://docs.coronalabs.com/api/library/store/index.html, which is very straightforward.
- Andrew
thanks . I agree that the IAP sample app is messy. Just a *last* quick question about the store.purchase() function . In Google Play, you can have multiple in-app products for an app . For example, you have 3 products in a app called “My Cool App” (the package name is mycoolapp.com.myapp ) . 3 products are :
product1
product2
product 3
To buy product 1, you would have to call
store.purchase( {“mycoolapp.com.myapp.product1”} )
Is that correct ? I appreciate your help .
No, if the products are named product1, product2, and product3, then to purchase product1, you would call store.purchase({“product1”}). That’s what I meant earlier when I said it must *exactly* match. Your package name doesn’t matter.
That said, many developers *choose* to name their products with their app’s package name in front. This ensures that their product names don’t interfere with the product names of other developers. But that’s your choice, it’s not required.
- Andrew
Thank you very much . I was able to code AIP based on the documentations you suggested . I have 1 last question: Do you have any example or point me to the right direction with the issue below ? I have this button (below) . How do I hide this button if the users have already purchased the product “fullversion” ? In another word, I only want to show the button to users who have not yet brought the "“ullversion” product so they can buy the product ?
thanks
local function handleButtonEvent( event )
local phase = event.phase
if “ended” == phase then
store.init( storeTransaction )
store.purchase( {“fullversion”} )
end
end
– Create a group
local group = display.newGroup()
– Create the button
local myButton = widget.newButton
{
defaultFile = “BuyFullVersion.png”,
id = “button_1”,
label = “Buy Full Version”,
onEvent = handleButtonEvent,
}
group:insert( myButton )
After they buy the product the first time, you should save that fact by writing to a file you create in the Documents Directory. That way, you can check that file next time to see if they’ve already purchased the product, and if so, don’t show the button.
- Andrew