Recently I spent some time adding In App Purchase to Mathemagics 2.0. The Apple documentation covering In App Purchase (IAP) is quite good so I’m not going to cover a lot of the low-level technical details. I do however, want to enumerate some lessons learned. Things I would do again and others that I would do differently.
StoreKit is the workhorse underlying In App Purchase. It handles the details of an IAP transaction starting with retrieving product details all the way to transaction processing. Fulfillment on the other hand is up to you. Your app will be notified if a transaction was successful, or if it failed, and it’s up to you to make sure your user gets the content or feature that they purchased. Therein lies the first tip, which is clearly documented in the dev docs but in an easily overlooked way.
Tip 1 – Add your SKPaymentTransactionObserver as soon as the app launches. The transaction payment observer will watch for completed transactions and notify you to deliver the goods. StoreKit transactions are persistent. So, even if your app quits in the middle of a transaction it will still be notified upon next launch that a transaction has been completed. Thus, you need to add your transaction observer right away in order to catch any completed but not yet notified transactions.
Tip 2 –
Tip 3 –
Tip 4 –
Tip 5 –
Tip Summary
- Add your SKPaymentTransactionObserver as soon as the app launches.
- Tip 2
Good Luck with your In App Purchase efforts.
Until Next Time.