In App Purchasing server model
I want to enable in app purchasing for an ipad application. What I want to sell is mp3s which I believe should be a non consumable product type.
After reading through the apple guide it seems that the best way to achieve this would b开发者_开发百科e not to use the built in model because it would require me to re submit the the app re bundled every time I have new content. This leaves me with the server model which appears to have a greater level of complexity.
Most article's I've googled upon deal primarily with the built in model.
Can anybody suggest some good articles on implementing server model in app purchasing? Could you describe the preocess at a high level with some do's and don'ts?
As I understand it so far I need to register my product id both on the apple store and on my own server and need to track the purchases myself.
I think it would go a little something like this.
Display list of products to the user by first getting the ids from my server & then sending them to the app store.
I send the selected product ID to the app store & the store returns the product information.
When the user chooses to purchase the store returns a receipt to me which I then pass to my server.
I have to send the receipt back to apple for verification and then back to my server..... then my server passes on the content.
Is the above summary correct? How exactly would I associate a purchase/ receipt with a user on a device and keep track of who has bought what?
Again a pointer towards a decent article would be great and maybe a description of how best to implment this.
Thanks
This is a big question!
Luckily, when a user purchases a non-consumable in-app purchase, the purchase remains associated with that user's Apple ID. You can easily recover content in the app by asking Apple for a list of product identifiers that the user has purchased.
I've set up a server content delivery system using ruby on rails. Every product on the server has an ios_product_identifier attribute that corresponds to an in-app purchase product created on iTunes connect.
Here's the timeline:
- The user makes an in-app purchase from within the app
- The purchase is confirmed in the app
- The app records the purchase locally
- The app sends the purchased product ID to my server
- My server authenticates the request, receives the product ID, and responds with the matching content
Your server doesn't have to keep track of who has purchased what because Apple does that. You just have to ensure that your app only requests data from your server when the product has been purchased (or is being recovered after having previously been purchased).
You can read about restoring products at the bottom of this documentation page. You basically send a message to one of Apple's StoreKit objects, and it sort of reenacts the purchase process for already-purchased non-consumable products.
Does this help?
精彩评论