Join Ron Buencamino for an in-depth discussion in this video Take a look at the StoreKit framework, part of Implementing In-App Purchases in iOS 10 with Swift 3.
- [Instructor] When working with StoreKit,…the first thing you'll need to do is grab a pointer…to the default payment queue on the device…when starting your app.…You do this by calling SKPaymentQueue.default.…To receive callbacks, you're going to need to implement…the SKPaymentQueueDelegate protocol.…SKPaymentQueueDelegate has a callback called…paymentQueue:updatedTransactions,…which is called whenever a change…in a transaction status occurs.…The different transaction statuses are purchasing,…deferred,…failed,…purchased,…and restored.…
The important one that we're going to be looking at…is purchased,…however, another important one is deferred,…which is triggered when the ask to buy feature…is implemented on an iTunes family account.…This is the case where parental controls are in place…and a user is awaiting approval…before a purchase can be completed.…More on how to handle this later on.…SKPaymentQueueDelegate also has some additional callbacks…that you're going to need to take note of…such as paymentQueue:restoreCompletedTransactions,…
First, learn what you can legitimately offer for sale in the App Store. Apple's guidelines restrict the sale of certain products, including real-world goods. Next, learn how to configure new products for sale with iTunes Connect and retrieve the product information in your app. Ron then shows how to request and process payments, and deliver the user's purchases to their iOS device. Plus, learn about selling subscriptions and restoring purchased content—a smart strategy for keeping your app rating high.
- What you can and can't sell in the App Store
- Looking at StoreKit
- Creating products in iTunes Connect
- Presenting products in your storefront
- Requesting payments in your app
- Processing transactions
- Delivering products
- Persisting purchases and auto-renewed subscriptions
- Restoring purchased content