Join Ron Buencamino for an in-depth discussion in this video Observe the default SKPaymentQueue, part of Implementing In-App Purchases in iOS 10 with Swift 3.
- [Instructor] So I want to set up my…SK payment Q observer and to do that…first I want to adhere to the SK payment…transaction observer protocol.…So I'm going to come over here and do just that.…Now that we've adhered to this protocol…I want to make sure that we're setting…the observer right when the app loads…and if we remember in our app delegate…we're calling a function called setup purchases.…So let's jump over to setup purchases.…In here we're checking to see if we can make payments…and if true this is where we want to add our observer.…
So let's go ahead and do that.…So I'm simply calling the default payment queue…and I'm adding our observer of self.…Now what I want to do is I want to set up…the payment transaction observer callback functions.…So I'm going to come over here and we're…going to add the function in.…The function that we want to call…is paymentQueueUpdatedTransactions.…This is the function that's called back whenever…an update to the transaction status occurs.…
Now what happens with this function…
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