Design tips for StoreKit in iPhone OS 3.0?
iphone, iphone-sdk-3.0, storekit
Solution
Things to think about when implementing StoreKit:
When you call `[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];` sometimes you get the `(void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue ` callback before (and sometimes long before) the `- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions` call back. (Also sometimes transactions are missing.)
Sometimes when you add a purchase to the Queue with `[[SKPaymentQueue defaultQueue] addPayment:payment];` the transaction is removed from the queue and the only feedback you get is: `- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray *)transactions`
User cancelations returns a wide variety of error messages and some error conditions return the SKErrorPaymentCancelled error code. Specifically:
- if the user hits cancel when prompted with 'You have already purchased this product' the transaction error is nil.
- if the user hits cancel when prompted with 'Sign in: [Use Existing Account] [Create New Account] [Cancel]' the error code is SKErrorUnknown.
- if the user hits [OK] instead of canceling when prompted to enter a password and hasn't entered a password, the error code is SKErrorPaymentCancelled.
Don't forget to implement other SKRequest callbacks:
`- (void)request:(SKRequest *)request didFailWithError:(NSError *)error;`
`- (void)requestDidFinish:(SKRequest *)request`
Problem
I am going to implement StoreKit in an iPhone application and wanted to know if there is any experience out there already that could point out any pitfalls or traps in using StoreKit? I know the API is new - but there is some premium content in my app that I would like to ask users to pay for and this seems an ideal way to do it - rather than directing them to a website for separate payment on their subscription. I also assume there are guidelines for how you list an app in the app store to make clear that the app is free to install - but you must upgrade for certain functionality. UPDATE (from comments): You cannot convert a FREE app into a paid app - so the user must first install it at the minimum cost before you can then use the StoreKit API to charge for additional software. 2ND UPDATE: You can now use the API in Free Apps - Apple changed the rules recently Can anyone recommend a good application that uses the StoreKit API that I might model the user interaction on?