I have got few questions about In-App Purchase server model.
I have got my DB, and a table in which I store item description. For example, I've got a Sword priced $0.49 and a Mace priced $0.99. So table with fields - id, name, price, info(description). I want to display this items in my iOs application, and allow users to buy them. My server-side is written on php.
It seems that there is no normal tutorial on server-model for in-app purchase. So I was reading http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/APIOverview/OverviewoftheStoreKitAPI.html (figure 1.3), and it seems that I have to:
- Send request to my server and receive this items data. What is product identifier, and where can I get it?
- Application sends request to app store to get information for the products. What kind of request? Any sample code? What this request will return?
- Ok, now i'm displaying this info to user, he picks item he wants to buy, and app sends payment request to the appstore. Again, what request, any examples?
- Then app receives receipt data. And it must send it to my server. And my server must send this data to app store server to verify the purchase, how can I do it?
- Apple server returns answer to my server, and I add item to users inventory(f.e).
Now, about testing in-app purchase. As far as I understand I need to go to itunes connect, and add new application there, and add in-app monetization for this application, and test user, is it correct?
This tutorial provides clear step by step means to implement in-app purchases from scratch... After going through countless others, the examples here should cover your questions.
http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/
There are a couple of good frameworks written by developers to help you on inAppPurchases. These frameworks are designed for all types of products (consumables, non consumables and subscriptions) along with a server model to validate the receipt.
https://github.com/MugunthKumar/MKStoreKit - Good One
https://github.com/anystone/AnystoneStoreKit - Another good wrapper. uses better delegates.
There is a third very easy tutorial (only for non consumables)
http://www.raywenderlich.com/2797/introduction-to-in-app-purchases
This one explains every question you have and gets you started with an example..