In-App purchase server for iPhone App
My company is looking to implement a large-scale In-App purchase model for an iPhone app. Our biggest issue is that we don't want to go with a service like Urban Airship because it doesn't integrate well with our business model and the nature of the application itself.
So now we're looking to set up our own server to handle the In-开发者_开发百科App purchase communication as well as serving down the purchased content. We are not unlocking content that already exists in the app and will be downloading relatively large add-on content.
Are there any good resources for learning more about the server side component to this. I'm very familiar with how StoreKit works but the server side communication is an enigma to me.
Any help would be very much appreciated!
I implemented this by doing a simple plist + zip file download for purchasable content. The plist has a list of products available in it. There is a plist file for each version of the app, as in my case there are sometimes differences in content based on the version that the user has.
This scheme also supports versioning of individual content items, since sometimes you want to change one of the items in your store.
I do NOT follow Apple's guideline of purchase-then-download. I do download-purchase-unlock. I'm too nervous about someone purchasing the content, then having to wait for it to download. (My content files are pretty big).
Here's how it works:
- App downloads .plist for itself. (MyApp_2.1.plist)
- Opens up .plist, checks to see what version of each content item it has. Let's say the app currently has version 1 of content A, and version 5 of content B. The plist file above tells it that the current storefront should have version 1 of A, version 6 of B, and version 7 of C. So the app downloads content for B and C.
- Content is stored in a zip file. In my case, these are game levels with XML files, audio, and graphical content. There is also a .plist with metadata for that game level, that includes the version number, and the AppStore ID for that item. The app unzips the content and then presents it in the storefront as a locked item. If the user has purchased it already, then they get the updated content automatically. If they purchase it, then I unlock the content at that time.
This is simple, can be done with any CMS (even a plain file-based web server), and supports multiple versions of content across multiple versions of your app.
If you want to see the UI, the app I did this for is a game called Lexitect, you can see how it all is put together from a UI perspective there. (It's free)
精彩评论