Problem With Example Code Of In-App Purchase

Hi!

 

the problem is the following:

I went down the following draft your page. When I export the project to iPhone Simulator for testing “in-app purchase” I get the following:

 

http://img401.imageshack.us/img401/4927/20130320141206.png

 

Why not show all content correctly?

It does not show the buttons. The code is as it is downloaded.

 

thank you very much for your help!

Hi!

 

the problem is the following:

I went down the following draft your page. When I export the project to iPhone Simulator for testing “in-app purchase” I get the following:

 

http://img401.imageshack.us/img401/4927/20130320141206.png

 

Why not show all content correctly?

It does not show the buttons. The code is as it is downloaded.

 

thank you very much for your help!

This is the file inAppDemo.zip http://developer.coronalabs.com/reference/in-app-purchases

Hello @informaticavelasco,

Instead of that zip file, can you please test the project in your local Corona SDK “SampleCode” folder?

 

Corona SDK > SampleCode > Networking > InAppPurchase

 

Let me know if that behaves differently or not.

 

Thanks,

Brent

 

Hello Brent Sorrentino,

 

I tried what you mention.

 

For now do not see that error but it looks like this:

 

“Sorry!, In-App Purchase will not supported on this device”.

 

I use the Xcode  iOS simulator. What can it be? The in-app purchase of xcode worked but these seem not.

A cap http://img32.imageshack.us/img32/6848/20130320185319.png

Hi @informaticavelasco,

Sorry for the delayed response. IAP does not work in the Corona Simulator; you need to build for a device to test.

Brent

Hi!

I tried and I get the same on my device (iphone and iPod touch):

“NOTICE: In-app-purchase is not supported on this device”

What could be or what I’m doing wrong?

Thanks for your help!

Did you enter all of your required store/product info into the sample app code? You need to put this info in; it doesn’t just run “as is” without this core information. The sample app code is commented quite thoroughly, and indicates the place to enter your product info from iTunes Connect, etc.

Ok it worked!

Thank you very much for your help, it was very useful!

I have a question. Once committed to the test user … Condiconal what I do for the system to detect it as “already purchased”.?

Everything works OK, however, if I press the button again realizarme purchase. How I can do it right?

Thank you very much for your help!

Hi there,

For iOS, if you want to make a product so that it can only be purchased once, you should create it in iTunes Connect as a “non-consumable” item.  This type of product is meant for things that are bought with a permanent effect, like unlocking content within an app, removing ads, etc.  If you classify your product that way, and a user tries to buy it again, iOS will indicate that they’ve already purchased it.  Non-consumable items can also be restored to a user after they wipe/reset their device (using store.restore()).

Hope this helps!

  • Andrew

ok, problem solved! :smiley:

One last question, how should I do the conditional so that if it was bought to change the picture to one that says for example “already purchased”? Let me explain:

I have the main.lua and test2.lua. The  test2.lua file is locked until you buy the product. How do I create a conditional that says … “if bought … unlock and create link to test2.lua”?

I searched documentation but I have hardly found anything.

Thanks for your help!

Hi there,

In your callback listener function (which you passed to store.init()), you could include code that unlocks the test2.lua content in response to a “purchased” event.  You would probably also want to store the fact that the user has unlocked the test.lua content in a file.  That way, you keep a permanent record that the new content is unlocked (i.e., every time the app is started or resumed, your code would check that file to see if the test2.lua content should be unlocked).

  • Andrew

Hi Andrew!

I understand. But should be 4 different products … How do I identify the product purchased has not been purchased? I’m a little confused on this point. Sorry for the inconvenience.

Thanks!

Aitor

Hi there,

Your transaction callback function will receive a table that includes a field called productIdentifier, which is the product ID that you used in store.purchase(), and that you registered in iTunes Connect.

So, in your transaction callback listener, you can test whether the state is “purchased”, and then for each possible product identifier, take a different action (unlock test2.lua, unlock test3.lua, etc.).

Hope this helps.

  • Andrew

I could get a brief example to understand better?

thanks!

Hi!

 

the problem is the following:

I went down the following draft your page. When I export the project to iPhone Simulator for testing “in-app purchase” I get the following:

 

http://img401.imageshack.us/img401/4927/20130320141206.png

 

Why not show all content correctly?

It does not show the buttons. The code is as it is downloaded.

 

thank you very much for your help!

This is the file inAppDemo.zip http://developer.coronalabs.com/reference/in-app-purchases

Hello @informaticavelasco,

Instead of that zip file, can you please test the project in your local Corona SDK “SampleCode” folder?

 

Corona SDK > SampleCode > Networking > InAppPurchase

 

Let me know if that behaves differently or not.

 

Thanks,

Brent

 

Hello Brent Sorrentino,

 

I tried what you mention.

 

For now do not see that error but it looks like this:

 

“Sorry!, In-App Purchase will not supported on this device”.

 

I use the Xcode  iOS simulator. What can it be? The in-app purchase of xcode worked but these seem not.

A cap http://img32.imageshack.us/img32/6848/20130320185319.png

I think I understood what quisistes mean, I’ll try and keep you posted on the progress.

In the meantime could check this other post I emerged from this?

http://forums.coronalabs.com/topic/33279-in-app-purchase-with-two-image/

Thanks in advanced