{"id":24335877,"url":"https://github.com/russell-archer/helloiapworld","last_synced_at":"2025-09-12T05:42:14.915Z","repository":{"id":133329135,"uuid":"313401768","full_name":"russell-archer/HelloIAPWorld","owner":"russell-archer","description":"Minimal In-App Purchase example for iOS 14 and Xcode 12","archived":false,"fork":false,"pushed_at":"2024-04-23T16:00:04.000Z","size":5426,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T17:56:21.175Z","etag":null,"topics":["in-app-purchases","ios14","storekit","swift5","xcode12"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/russell-archer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-16T19:09:53.000Z","updated_at":"2024-11-17T18:02:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2c6b08a-eb0d-4743-81f4-921a7ab4cddf","html_url":"https://github.com/russell-archer/HelloIAPWorld","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/russell-archer/HelloIAPWorld","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russell-archer%2FHelloIAPWorld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russell-archer%2FHelloIAPWorld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russell-archer%2FHelloIAPWorld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russell-archer%2FHelloIAPWorld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/russell-archer","download_url":"https://codeload.github.com/russell-archer/HelloIAPWorld/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russell-archer%2FHelloIAPWorld/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274759131,"owners_count":25343875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["in-app-purchases","ios14","storekit","swift5","xcode12"],"created_at":"2025-01-18T05:36:00.943Z","updated_at":"2025-09-12T05:42:14.875Z","avatar_url":"https://github.com/russell-archer.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hello IAP World Example\nA very minimal app to demo IAP testing in Xcode 12 and iOS14\n\nThis iOS 14/Xcode 12 app presents a minimal exploration of what's required to support in-app purchases. \nFor a more detailed treatment of in-app purchases, including how to carry out receipt validation \nsee [https://github.com/russell-archer/IAPDemo](https://github.com/russell-archer/IAPDemo).\n\n**Disclaimer**. The source code presented here is for educational purposes. You may freely reuse and amend this code for use in your own apps. \nHowever, you do so entirely at your own risk.\n\n---\n\n# Contents\n* [Overview](#Overview)\n* [Receipt validation options](#Receipt-validation-options)\n    * [Server-side validation](#Server-side-validation)\n    * [On-device validation](#On-device-validation)\n    * [Third-party receipt validation service](#Third-party-receipt-validation-service) \n    * [No receipt validation](#No-receipt-validation)\n* [Sandbox accounts](#Sandbox-accounts)\n* [Basic Steps](#Basic-Steps)\n    * [Create an IAP helper class](#Create-an-IAP-helper-class)\n    * [Define your ProductIds](#Define-your-ProductIds)\n    * [Add your IAPHelper to the Payment Queue](#Add-your-IAPHelper-to-the-Payment-Queue)\n    * [Request localized product information from the App Store](#Request-localized-product-information-from-the-App-Store)\n    * [Present the localized product list to the user and handle purchases](#Present-the-localized-product-list-to-the-user-and-handle-purchases) \n    * [Process the App Store Receipt](#Process-the-App-Store-Receipt)\n    * [Xcode 12 Improvements](#Xcode-12-Improvements)\n* [HelloIAPWorld Example](#HelloIAPWorld-Example)\n    * [Create the App](#Create-the-App)\n    * [Add the StoreKit Framework](#Add-the-StoreKit-Framework)\n    * [Create the StoreKit configuration file](#Create-the-StoreKit-configuration-file) \n    * [Add the in-app purchase capability](#Add-the-in-app-purchase-capability)\n    * [Enable StoreKit Testing via the Project Scheme](#Enable-StoreKit-Testing-via-the-Project-Scheme) \n    * [Add the StoreKit public certificate](#Add-the-StoreKit-public-certificate)\n    * [Minimal IAPHelper Code](#Minimal-IAPHelper-Code)\n    * [Running the app](#Running-the-app)\n\n---\n\n# Overview\nThe code we write to manage in-app purchases is critically important to the success of our apps. However, if you’ve not tackled it before, implementing and \ntesting in-app purchases is daunting, complex and seems *way* more involved than you’d expect!\n\nAnybody wanting to support in-app purchases faces a similar set of challenges:\n\n- How do you define the set of products that can be purchased in your app?\n- Defining your in-app purchases in App Store Connect\n- Working with `StoreKit` to request *localized* product data from the App Store and initiate purchases\n- Implementing `StoreKit` delegate methods to process async notifications for purchase success, failure, restoring purchases, etc.\n- Handling edge-cases, like when a purchase is deferred because it requires parental permissions, or when entitlements for a user have changed and access to the specified IAPs has been revoked\n- Should you handle App Store receipt validation on-device or server-side?\n- Should you write your own receipt validation code or use a service like [RevenueCat](https://www.revenuecat.com/)?\n- Working with **OpenSSL** and the arcane **PKCS #7** and **ASN.1** data structures found in receipts\n- Writing code to validate the receipt and read in-app purchase data\n- Creating and managing sandbox accounts used for testing\n\nWhen I first implemented in-app purchases in one of my iOS apps in 2016 the two main pain-points were:\n\n- [Receipt validation options](#Receipt-validation-options)\n- [Sandbox accounts](#Sandbox-accounts)\n\n# Receipt validation options\n\nThe App Store issues an encrypted receipt when in-app purchases are made or restored (when an app’s first installed, no receipt is present). \nThis receipt contains a complete list of all in-app purchases made in the app. \n\nThere are four receipt validation approaches available:\n\n1. Server-side receipt validation\n2. On-device receipt validation\n3. Third-party receipt validation service\n4. No receipt validation\n\n## Server-side validation\nThis is probably the easiest option, but you need an app server to send requests to the App Store server. Apple specifically says you **should not** create direct \nconnections to the App Store server from your app because you can’t guard against man-in-the-middle attacks. \n\nDespite this clear warning, the web has many examples (including commercial offerings) of using direct app-to-App Store connections. The advantage of using \nserver-side validation is that you can retrieve easily decoded JSON payloads that include all the in-app purchase data you need. We don’t cover server-side \nvalidation in this example.\n\n## On-device validation\nOn-device validation is somewhat tricky and requires use of the C-based [OpenSSL](https://www.openssl.org/) library to decrypt and read the receipt data. \nNote that including the required two OpenSSL libraries adds nearly 50MB to your app.\n\nI first started supporting in-app purchases in 2016. I fully expected **StoreKit** or some other Apple framework to provide ready-to-use abstractions allowing \nfor easy access to the low-level cryptographic data structures in the receipt. However, as I looked deeper into the “where’s the receipt processing framework?” \nconundrum the more the answer became clear: having a ready-to-use framework creates a security risk because “hackers” wishing to access your in-app \npurchases for-free know in advance where and how to concentrate their attacks. Apple’s answer was (*and still is*): create your own custom receipt validation \nsolution because a unique solution will be harder to hack.\n\nClearly a custom solution (if done correctly) will be more secure. But, as all developers know that have attempted it, writing security-critical cryptographic-related \ncode is **hard** and if you get it wrong disasters will happen! In my opinion, surely it would be better for Apple to provide something that enables correct and \n*reasonably secure* receipt validation for the general app developer?\n\nHowever, at present (November 2020) you have no choice if you want to validate and read receipt data on-device: you must develop your own OpenSSL-based \nsolution. If you don’t feel confident doing this feel free to adapt (or use as-is) the code presented herein.\n\n## Third-party receipt validation service\nA number of third parties provide receipt validation services, normally as part of a larger in-app purchase, subscription and analytics service. I've not used any \nof them in my apps so can't comment on their suitability. However, [RevenueCat](https://www.revenuecat.com/) seems like a good option judging by their \ndocumentation and sample code. \n\n## No receipt validation\nIt’s perfectly possible to do no receipt validation at all, if you think that’s appropriate for your app’s business model. All you need to do is handle transactions \nfrom the App Store using the following method:\n\n```swift\npaymentQueue(_:updatedTransactions:)\n```\n\nWhen you get a `.purchased` or `.restored` transaction simply add the product identifier for the product to a list of purchased products that your app maintains. \nThe list should be persisted in a database, or even `UserDefaults`. Clearly, this is a far less secure approach than doing receipt validation. However, you may \ndecide that a particular app doesn’t warrant the greater protection and associated complexity provided by receipt validation. See the \n[HelloIAPWorld](#HelloIAPWorld-Example) example below for a discussion of this approach.\n\n# Sandbox accounts\nPrior to Xcode 12, in order to test in-app purchases you needed to create multiple sandbox test accounts in App Store Connect. Each sandbox account has to have \na unique email address and be validated as an AppleID. In addition, tests must be on a real device, not the simulator.\n\nOn the test device you need to sign out of your normal AppleID and sign-in using the sandbox account. This really means you need a spare device to do testing on. \nTo make things more painful, each time you make a purchase using a sandbox account that account becomes “used up” and can’t be used to re-purchase the \nsame product. There’s no way to clear purchases, so you need to use a fresh sandbox account for each set of product purchases.\n\n# Basic Steps\nThere are a lot of pieces that fit together to enable you to support in-app purchases in your app:\n\n![](./readme-assets/img1.png)\n\nThe basic steps you need to take to support in-app purchases (IAP hereafter) in your app are as follows:\n\n![](./readme-assets/img2.png)\n\n## Create an IAP helper class\nCreate a class or struct that will contain all your IAP-related code. For the sake of example we’ll refer to this as the `IAPHelper` code.\n\n## Define your ProductIds\nDefine a set of Strings that hold **ProductIds** for the products you want to sell. ProductIds are generally in reverse domain form (“com.your-company.your-product”). \nFor example, `com.rarcher.flowers-large`. These ids will match the product ids you define in App Store Connect.\n\n## Add your `IAPHelper` to the Payment Queue\nTo receive notifications from the App Store (when payments are successful, fail, are restored, etc.) add your IAPHelper to the StoreKit payment queue. \nThis should be done as soon as possible in the app’s lifecycle. \n\nFor example in `application(_:didFinishLaunchingWithOptions:)`, so that notifications from the App Store are not missed:\n\n```swift\nSKPaymentQueue.default().add(iapHelper)\n```\n\n## Request localized product information from the App Store\nThe `SKProductsRequestDelegate` method `productsRequest(_:didReceive:)` will be called asynchronously with a list of `SKProduct` objects. \nNote that you can’t simply use predefined product data because you need to display prices, etc. that are *localized* for each user.\n\n## Present the localized product list to the user and handle purchases\nWhen the user taps on “buy product” you should wrap the selected `SKProduct` in an `SKPayment` object, then add it to the `SKPaymentQueue`. \nThe App Store will then send notifications to the `SKPaymentTransactionObserver` method `paymentQueue(_:updatedTransactions)` as the \npurchase progresses. Note that the App Store presents the user with all the required purchase prompts and confirmations.\n\n## Process the App Store Receipt\nThe App Store will create a new **receipt** when a purchase has been made or restored. The receipt is available when the `paymentQueue(_:updatedTransactions)` \nmethod is called. This receipt, which is cryptographically signed and encrypted, contains a complete record of all the IAPs made by the user of your app.\n\nThe code discussed in the [HelloIAPWorld](#HelloIAPWorld-Example) example below provides a practical example of the above points (receipt validation is covered later).\n\n## Xcode 12 Improvements\n![](./readme-assets/wwdc-2020-100835422-large.jpg)\n\nImmediately before Apple’s WWDC 2020 keynote event I tweeted that I was hoping for something “magical and unexpected”. I followed this up with \n“How about an update to StoreKit that makes it really easy to do on-device validation of App Store receipts”. \n\nWell, I didn’t get my wish with regard to receipt validation, but I certainly got something magical and unexpected related to StoreKit and in-app purchases!\n\nStarting with Xcode 12, there’s a new local `StoreKit` test environment that allows you to do early testing of IAPs in the simulator and without having to set \nanything up in App Store Connect. You can define your products locally in a `StoreKit` Configuration file. Furthermore, you can view and delete transactions, \nissue refunds, and a whole lot more. There’s also a new `StoreKitTest` framework that enables you to do automated testing of IAPs. \nThe [HelloIAPWorld](#HelloIAPWorld-Example) project below includes details on how to create and use a StoreKit configuration file.\n\n![](./readme-assets/img3.jpg)\n\nThese new features are a huge leap forward in terms of making testing substantially easier, quicker to setup, more flexible and less frustrating!\n\n# HelloIAPWorld Example\nThe following example shows how to create a **very minimal IAP example** (the IAP equivalent of “Hello World”) that makes use of the new StoreKit testing \nfeatures in Xcode 12.\n\nNote that StoreKit testing requires **Xcode 12** and **iOS 14**.\n\nAlthough this is a bare-bones example, the project does demonstrate most of the essential requirements for handling in-app purchases in an iOS app.\n\nYou can find the code for **HelloIAPWorld** [on GitHub](https://github.com/russell-archer/HelloIAPWorld).\n\n![](./readme-assets/img4.png)\n\nNote that this example project is missing some features a real-world app would be expected to support:\n\n- The App Store receipt is not validated, nor is IAP data read from the receipt\n- Purchases are not persisted. So, if the app’s closed and restarted no purchases are remembered\n- There’s no way to restore previous purchases\n- Deferred purchases aren’t supported\n- Edge cases are not supported (refunds, entitlements being revoked, store front changes, purchasing IAPs directly from the app store, etc.)\n\nFor this example we’ll assume you’re going to create a demo app from scratch using iOS 14 and Xcode 12. Here are the steps we'll go through:\n\n- [Create the App](#Create-the-App)\n- [Add the StoreKit Framework](#Add-the-StoreKit-Framework)\n- [Create the StoreKit configuration file](#Create-the-StoreKit-configuration-file)\n- [Add the in-app purchase capability](#Add-the-in-app-purchase-capability)\n- [Enable StoreKit Testing via the Project Scheme](#Enable-StoreKit-Testing-via-the-Project-Scheme)\n- [Add the StoreKit public certificate](#Add-the-StoreKit-public-certificate)\n- [Minimal IAPHelper Code](#Minimal-IAPHelper-Code)\n- [Running the app](#Running-the-app)\n\n## Create the App\nCreate a new iOS app in Xcode named \"HelloIAPWorld\":\n\n![](./readme-assets/img5.png)\n\nAs we'll be creating the UI programmatically we need to remove the Storyboard.\n\nRemove the name (“Main”) of the storyboard in **Targets \u003e General \u003e Deployment Info**:\n\n![](./readme-assets/img6.png)\n\nDelete **Main.storyboard** and move it to the trash:\n\n![](./readme-assets/img7.png)\n\nOpen **Info.plist**, search for **Main** and then remove the **Storyboard Name** entry entirely:\n\n![](./readme-assets/img8.png)\n\nOpen **SceneDelegate.swift** and modify the `scene(_:willConnectTo:options:)` method as follows:\n\n```swift\nclass SceneDelegate: UIResponder, UIWindowSceneDelegate {\n    \n    var window: UIWindow?\n\n    func scene( _ scene: UIScene, \n                willConnectTo session: UISceneSession, \n                options connectionOptions: UIScene.ConnectionOptions) {\n                \n        // Use this method to optionally configure and attach the UIWindow `window` to the \n        // provided UIWindowScene `scene`. If using a storyboard, the `window` property will \n        // automatically be initialized and attached to the scene.\n\n        // Get the window scene\n        guard let windowScene = (scene as? UIWindowScene) else { return }  \n        \n        // Create a window\n        window = UIWindow(frame: windowScene.coordinateSpace.bounds)  \n       \n        if let w = window {\n            // Assign the window scene to the window's window scene\n            w.windowScene = windowScene  \n            \n            // Set the root view controller (to the default view controller)\n            w.rootViewController = ViewController() \n            \n            // Make the window visible\n            w.makeKeyAndVisible()  \n        }\n    }\n    :\n    :\n}\n```\n\n## Add the StoreKit Framework\nThe first thing you need to do after creating your new app is to add the **StoreKit** framework. Select your app **Target** and the **General** tab, then \nadd the `StoreKit` framework:\n\n![](./readme-assets/img9.png)\n\n## Create the StoreKit configuration file\nNow create a StoreKit configuration file. Select **File \u003e New \u003e File** and choose the **StoreKit Configuration File** template:\n\n![](./readme-assets/img10.jpg)\n\nChoose a location in your project to save the file.\n\nOpen the StoreKit configuration file and click **+** to add an in-app purchase. For this example select the **Add Non-Consumable in-App Purchase** option:\n\n![](./readme-assets/img11.jpg)\n\nYou can now define your products in the StoreKit configuration file:\n\n![](./readme-assets/img11b.png)\n\nIn this example I set the following fields:\n\n- **Reference Name**\u003cbr/\u003e\nA descriptive name for the product\n\n- **Product ID**\u003cbr/\u003e\nThis the unique code used to identify an IAP product. This same ID will be used in App Store Connect when setting up in-app purchases for production. \nNote that Product ID is a string that, by convention, uses the format “com.developer.product”, although it can be anything you like\n\n- **Price**\u003cbr/\u003e\nA hard-coded price for the product. In production your app will request localized price (and other) information from the App Store\n\nBy default, the first localization is for the US store. However, you can add as many localizations as required.\n\nNote that none of the data defined in the .storekit file is ever uploaded to App Store Connect. It’s only used when testing in-app purchases locally in Xcode.\n\n## Add the in-app purchase capability\nIt’s easy to forget to do this! And you can successfully test in-app purchases *without* adding the IAP capability. However, you will receive the following \nerror when attempting to archive a project in preparation for uploading it to the App Store:\n\n![](./readme-assets/img13.jpg)\n\nAdd the in-app purchase capability by selecting the app target and **Signing \u0026 Capabilities**, then click **+** **Capability** to add a capability:\n\n![](./readme-assets/img14.png)\n![](./readme-assets/img15.jpg)\n\n## Enable StoreKit Testing via the Project Scheme\nYou now need to enable StoreKit testing in Xcode (it’s disabled by default).\n\nSelect **Product \u003e Scheme \u003e Edit Scheme**. Now select **Run** and the **Options** tab. You can now select your configuration file from \nthe **StoreKit Configuration** list:\n\n![](./readme-assets/img16.jpg)\n\nShould you wish to disable StoreKit testing then repeat the above steps and remove the StoreKit configuration file from the **StoreKit Configuration** list.\n\n## Add the StoreKit public certificate\nYou need to add the StoreKit public test certificate to your project. This isn’t strictly necessary if you’re not going to be doing any receipt validation. \nHowever, we’ll include the details here for completeness.\n\nStoreKit testing in Xcode generates *locally signed* receipts that your app must validate locally against the StoreKit test certificate. In production your \napp will include the **Apple Root Certificate** and use that when validating the App Store receipt.\n\nIn Xcode project navigator, select the StoreKit configuration file. Now select **Editor \u003e Save Public Certificate**.\n\nChoose a location in your project to save the file.\n\nYou now need to ensure your app uses the correct certificate in all environments. The easiest way to do this is to create a simple helper which returns the \ncorrect certificate name for the runtime environment:\n\n```swift\n/// Constants used in support of IAP operations.\npublic struct IAPConstants {\n\n    /// The appropriate certificate to use for DEBUG and RELEASE builds.\n    /// - Returns: Returns the appropriate certificate to use for \n    /// DEBUG and RELEASE builds.\n    public static func Certificate() -\u003e String {\n        #if DEBUG\n        // This is issued by StoreKit for local testing\n        return \"StoreKitTestCertificate\"  \n        #else\n        // For release with the real App Store\n        return \"AppleIncRootCertificate\"  \n        #endif\n    }\n}\n```\n\n## Minimal IAPHelper Code\nIn this example we’ll put all IAP related code into a single `IAPHelper` class. We set this up as a singleton, ensuring there’s only ever a single instance \nof the class:\n\n```swift\npublic class IAPHelper: NSObject  {\n    \n    /// Singleton access. Use IAPHelper.shared to access all IAPHelper \n    /// properties and methods.\n    public static let shared: IAPHelper = IAPHelper()\n   \n    /// Private initializer prevents more than a single instance of this class \n    /// being created. See the public static 'shared' property. This helper \n    /// must be initialized as soon as possible in the app's lifecycle. \n    /// See application(_:didFinishLaunchingWithOptions:).\n    private override init() {\n        super.init()\n        \n        // Add ourselves to the payment queue so we get App Store \n        // notifications        \n        SKPaymentQueue.default().add(self)  \n    }\n    :\n    :\n}\n```\n\nIn `AppDelegate` we initialize `IAPHelper`:\n\n```swift\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    public var iapHelper: IAPHelper?\n    \n    func application(_\n                application: UIApplication, \n                didFinishLaunchingWithOptions launchOptions: \n                [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n\n        // Make sure the IAPHelper is initialized early in the app's lifecycle \n        // to ensure we don't miss any App Store notifications\n        iapHelper = IAPHelper.shared\n        return true\n    }\n```\n\nThen in the initial `ViewController` we request a list of localized product information:\n\n```swift\nclass ViewController: UIViewController {\n\n    private let iap = IAPHelper.shared\n    \n    override func viewDidLoad() {\n        :\n        configureProducts()\n    }\n    \n    private func configureProducts() {\n        // Ask the App Store for a list of localized products\n        iap.requestProductsFromAppStore { notification in\n            \n            print(notification)\n            if notification == .requestProductsDidFinish { self.tableView.reloadData() }\n        }\n    }\n}\n```\n\nWhen the user wants to purchase a product we call `IAPHelper.buyProduct(_:completion:)` and handle the result in a closure:\n\n```swift\nextension ViewController: ProductCellDelegate {\n    \n    internal func requestBuyProduct(productId: ProductId) {\n        guard let product = iap.getStoreProductFrom(id: productId) else { return }\n        \n        // Start the process to purchase the product\n        iap.buyProduct(product) { notification in\n            switch notification {\n            case .purchaseAbortPurchaseInProgress: \n                print(\"Purchase aborted because another purchase is being processed\")\n                \n            case .purchaseCompleted(productId: let pid): \n                print(\"Purchase completed for product \\(pid)\")\n                \n            case .purchaseCancelled(productId: let pid): \n                print(\"Purchase cancelled for product \\(pid)\")\n                \n            case .purchaseFailed(productId: let pid): \n                print(\"Purchase failed for product \\(pid)\")\n                \n            default: break\n            }\n            \n            self.tableView.reloadData()\n        }\n    }\n}\n```\n\n## Running the app\nIf you run the app you'll be able to tap on \"buy\" button and step through the purchase procedure:\n\n![](./readme-assets/demo.gif)\n\nWhile the app's running, click on the **Manage StoreKit Transactions** button in Xcode's console toolbar:\n\n![](./readme-assets/img17.png)\n\nYou'll see transactions for purchases you've made:\n\n![](./readme-assets/img18.png)\n\nFrom the **Manage StoreKit Transaction** view you can select a transaction and then:\n\n- **Approve** a transaction (if it's pending parental approval)\n- **Decline** a transaction (if it's pending parental approval)\n- Issue a **refund**\n- **Resolve** transaction issues\n- **Delete** a transaction\n\nThe ability to **delete** transactions is a huge boast to productivity! Previously, when working with App Store Connect sandbox accounts you could \ntest purchase a product once. If you wanted to test purchasing the same product again you'd have to create a new sandbox account, complete with \nApple ID, email, etc.\n\nFor a more detailed treatment of in-app purchases, including how to carry out receipt validation \nsee [https://github.com/russell-archer/IAPDemo](https://github.com/russell-archer/IAPDemo).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussell-archer%2Fhelloiapworld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frussell-archer%2Fhelloiapworld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussell-archer%2Fhelloiapworld/lists"}