Latest 0.2.0
Homepage https://github.com/Vitaa/IAPurchaseManager
License MIT
Platforms ios 8.0
Authors

Swift In-App Purchase Manager for iOS

Easy-to-use a singleton class that supports non-renewable in-app purchases.
It’s super cool because

1) it’s written in Swift 3

2) it uses blocks!

Making a purchase

If you want to make a purchase, all you need to do is to call a method:

  IAPManager.shared.purchaseProduct(productId: productId) { (error) -> Void in 
    if error == nil {
      // successful purchase!
    } else {
      // something wrong.. 
    }
}

You can call purchaseProductWithId without first loading products info because inside purchaseProductWithId it’ll load it if needed. So just call purchaseProductWithId whenever you want to make a purchase.

But if you need to get all products info, you can load it by calling:

  IAPManager.shared.loadProducts(productIds: []) { (products, error) in }

Check product was purchased

To check if a product was purchased, call (it returns Bool):

  IAPManager.shared.isProductPurchased(productId)

Restore transactions

To restore transactions call:

  IAPManager.shared.restoreCompletedTransactions { (error) in }

Details

All completed transactions are saved to a file:

data.write(to: purchasedItemsURL(), options: [.atomicWrite, .completeFileProtection])

Setup

Just drag IAPManager.swift to your project.

or using CocoaPods

pod 'IAPurchaseManager'

If you are using Swift 2.x, then

pod 'IAPurchaseManager', '~> 0.0.2'

Carthage compatible

github "Vitaa/IAPurchaseManager"





If you want to add validation, keychain support or some other features, feel free to send me pull requests!

Latest podspec

{
    "name": "IAPurchaseManager",
    "version": "0.2.0",
    "summary": "Swift In-App Purchase Manager for iOS",
    "homepage": "https://github.com/Vitaa/IAPurchaseManager",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Vitaliya Solomina": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Vitaa/IAPurchaseManager.git",
        "tag": "0.2.0"
    },
    "source_files": "IAPManager.swift",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This