Join Ron Buencamino for an in-depth discussion in this video Validate an App Store receipt, part of Implementing In-App Purchases in iOS 10 with Swift 3.
- [Narrator] To validate a receipt data locally,…I'm going to make use of RMStore,…the open source package that I bundled with our project.…In particular, we're going to make use of RMStore…app receipt verifier.…And as a reminder,…if you're following along with your own project file…and not using the bundled exercise files,…if you're going to use RMStore,…you need to statically link the open SSL libraries…or else your app won't properly build.…Also, since RMStore is an Objective-C project,…you should have recreated a bridging header…upon importing this code.…
Now, let's go over here in IAP manager…and scroll down to the bottom of the class.…Here, I want to create a function called validate receipt.…In this function,…the first thing that I want to do is initialize my RMStore…app receipt verifier.…Our verifier has a method called verify app receipt…which returns a Boolean.…This method will grab our app receipt,…decrypt it and validate as to whether or not…our receipt is good.…
So let's go ahead and check that.…So handling our if clause,…
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