Question

I'm finishing up work on an iOS app that allows users to browse, purchase, and download items from a large multimedia library hosted online in a rails application. The library has hundreds of purchaseable items right now, and it will likely expand greatly in the future.

At first, I intended to create an insidivual in-app purchase item (on iTunes Connect) for each item in the library. However, I decided that it would be a pain to create all of those hundreds of in-app purchase items. Moreover, I want to be able to make additions and changes to the purchasable items via my CMS without having to also make changes on iTunesConnect.

Instead, I now have the app user create an account with the rails app. When they go to purchase an item, they first purchase a generic in-app purchase item. Once that transaction is completed, the app connects to my rails app, records the purchase, and downloads the purchased content.

One thing that makes me nervous about this approach is that the user might successfully make the in-app purchase with Apple but then somehow fail to successfully connect to the rails app. In that case, the purchase would not be recorded and the content would not be downloaded, even though the user did make a payment. Furthermore, Apple's built-in purchase recovery methods won't work, because the purchase item is generic. Only my rails app will remember what items the user has purchased.

So, I'm going to add a lot of error checking and state-recovery around that whole process. To make sure that it can recover if it runs into trouble.

I just wanted to put this out there in case anyone has an opinion or some advice to share.

Thanks!

Charlie

UPDATE

It's been a long time now, but I ended up NOT using a generic in-app purchase. It just seemed like too big a risk. After all, with individual in-app purchases, Apple keeps track of the purchases and provides a way for restoring them. So it made sense to take advantage of that rather than forcing myself to maintain my own database of users and their purchases.

It was a real pain in the ass to add all of those in app purchase items to iTC. the iTC interface is so horrible. I ran into a lot of problems. But eventually they all got in there, and now things are working more or less smoothly.

So in the end, I'd say that even though it's a pain to create all of those purchases, it's worth it. Or rather it should be worth it. If creating that purchase record in iTC seems not to be worth the trouble for what you expect to make by selling it, then you've probably got bigger problems with your business model!

Was it helpful?

Solution

Once the successful in-App message returned from apple...

1.Its better to store the ProductID in a dictionary and delete the ProductID from dictionary once you successfully update the server.

2.Ignore any events till the transaction is complete.

3.Better to keep track of transactions i.e., storing the transaction information(ProductID,user,transaction recipt) in server side.

3.Optionally you can provide service from website, so user can mail you if he lost his money during in app purchase.

OTHER TIPS

One thing you can do, as soon as the transaction is complete, is to save the purchase receipt locally (to NSUserDefaults or whatever persistence method you're using) so that if you're unable to "complete the purchase" (i.e. record it and download your content from the server) you can always resume it later.

If you're still worried that this (i.e. saving the purchase receipt locally before updating the server) could fail for some reason, or even that the user may delete/reinstall the app after paying and before being able to record it on your server, you can always record on your server that the user initiated an in-app purchase before actually doing it, and then update its state after he completes/cancels it.

Btw, you didn't mention it but just to be safe: you're only passing the purchase receipt from your client to the server, right? That's the only thing you need from the transaction, as you can (and should) then verify the receipt with Apple and use that to extract all other purchase information (like product id, etc).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top