General IAP questions

Hey guys,
I am new to the IAP scene but i think many of you seasoned developers can answer some of my basic questions about IAP.

  1. Does corona have the ability to download external content from an IAP? (new level content) If so, does this work hand in hand with apple? or does the developer have to store this data on a server?

  2. Many forum posts here talk about “consumable” purchases, i assume this would be something like “coins” for a game that can be spent? If my app just downloads new levels with a IAP, would i be able to use store.restore() on this type of IAP if the user deletes the app and re installs?

If anyone could give me a link to any documents on setting up IAP it would be appreciated, i can’t seem to find any official documentation.

Thank you very much!

[import]uid: 19620 topic_id: 21233 reply_id: 321233[/import]

  1. You’d have to store this yourself, Apple doesn’t do any of that for you - personally I find it easier to ship an app with everything then unlock it. (Although that is just a personal preference.)

  2. I don’t believe Apple lets you restore consumables but here’s the docs which may help; http://developer.anscamobile.com/reference/in-app-purchases

Peach :slight_smile: [import]uid: 52491 topic_id: 21233 reply_id: 84143[/import]

Thanks peach, so if I were to take the route of having downloadable content that does not come when it ships, is there any documentation on how corona handles that? Were do the files get stored and how do they then get integrated into the app? I would want to take this route because I am looking to start a series of episodes of a book, so i would like the user to download new episodes as they come out via in app purchases… [import]uid: 19620 topic_id: 21233 reply_id: 84148[/import]

I haven’t personally used the download method - I’m not certain how saving a .lua file in the local directory works, it’s something I may test later on tonight if I get the chance. (It is certainly worth learning more about.)

I did see a user post sometime back about something similar, I haven’t been able to locate the post though. (Yet.)

Hrm. How are you displaying your book “episodes”? Are they normal scenes, pdfs, popups? (I know popups might sound odd, I’m imaging something like the HTML help doc in Tilt Monster.)

Peach :slight_smile: [import]uid: 52491 topic_id: 21233 reply_id: 84180[/import]

Well at this point nothing is set in stone on how i will handle things, I am trying to get a good plan laid out before i put so much work into a project.

At this point I plan to use director class for scene changing,I will have a “logic” file that can be a shell of sorts to run my episodes. So the hope is that when a new one comes out, the user could download a single lua file ( that contains placement of the visual objects for that episode ) As well as PNG images for that episode. The png images for the episodes could get rather large in size so for that reason i want to make it possible to externally download these via IAP.

Does that make sense? Let me know what else i need to explain better, thanks peach. [import]uid: 19620 topic_id: 21233 reply_id: 84230[/import]

rxmarccall,

There are two main types of in-app purchases you can offer: consumable & non-consumable. Non-consumable products are the only type that you can use the restore functionality with. You use that for things like transforming a free ‘basic’ app into a paid ‘pro’ app. In that case you want to be able to provide the customer a way to restore his/her purchase should they have to reinstall the app (or upgrade their phone!).

Consumables, however, are tied to the device. Once purchased there is no way to restore the purchase. You have to be very careful how you track the purchase within your app.

Apple essentially only provides the billing infrastructure and nothing else. If you want to provide the user the ability to track consumables between devices (such as between an iPhone & iPad) you would have to provide the back-end server with accounts for each user to keep track of the balances. Likewise, if you want to provide downloadable content, you have to provide that from your own servers (see this page for an initial primer on downloading files: http://developer.anscamobile.com/reference/index/networkdownload). If your total including all potentially IAPed downloaded content is less than 20MB in size then you probably just want to include everything in the app package and unlock as purchased. If you basic content without the IAP content is less than 20 MB and the IAP content would push it over, then you may want seriously consider downloading any IAP content.

  • Stephen
    Kigra Software, Corona Ambasssador

* The are now some additional types of purchases such as subscriptions, etc.
** The 20 MB limit is because you have to be on a wi-fi connection to download apps larger that (at least that used to be the limit; not sure if they have upped it recently)
*** You will not be able to download & use *.lua files for two reasons: Corona actually compiles those files and does not provide a way to run a randomly downloaded file and Apple would not allow Corona apps in the store if it did! [import]uid: 4639 topic_id: 21233 reply_id: 86771[/import]

@rxmarccall

If you want the user to have access to downloadable content in the form of media (images, videos, etc.) use the caches directory to save content instead of the documents or resource directories. Otherwise your app will be rejected.

If you want to provide the user with downloadable content in the form of new “levels”, you need to design your game to do that from the beginning by defining levels via XML (or other definition language) and then parsing/building levels from the XML files. This has the added side benefit of allowing you to create levels without code changes (unless you desire to add new features). I almost always use this approach in my games.

  • Sam
    Corona Ambassador

P.S. I only put that there cause Stephen started it, haha :slight_smile: [import]uid: 36054 topic_id: 21233 reply_id: 86783[/import]

I concur with the above.

  • Peach
    Ansca Staff

(Sorry, couldn’t resist ;)) [import]uid: 52491 topic_id: 21233 reply_id: 86820[/import]

Thank you for the responses! So when you say to use XML files, does that mean the app would grab an xml file from a server and parse the data? Do you have any links to tutorials or resources on how to work with xml in this manner? i havnen’t done this before. It makes sense that i wouldnt be able to download new .lua files, but is it safe to say that i could download png images and art assets ok? Then if i work with the idea of using the XML files maybe i could make this all work out huh? Thanks for your time! [import]uid: 19620 topic_id: 21233 reply_id: 86882[/import]